diff -r 3738fe97f027 -r 8aed59de29f9 videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/xqpluginloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/xqpluginloader.cpp Fri Apr 16 18:13:14 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: XQPluginLoader stub +* +*/ + +#include "stub/inc/xqpluginloader.h" +#include "stub/inc/xqplugininfo.h" +#include "testviewplugin.h" +#include "mpxvideo_debug.h" + +QHash XQPluginLoader::mPluginList; +int XQPluginLoader::mFailToLoadPluginUid = -1; + +XQPluginLoader::XQPluginLoader( int uid, QObject* parent ) +{ + MPX_DEBUG(_L("XQPluginLoader::XQPluginLoader()")); + + Q_UNUSED( parent ); + mUid = uid; +} + +XQPluginLoader::~XQPluginLoader() +{ + MPX_DEBUG(_L("XQPluginLoader::~XQPluginLoader()")); +} + +bool XQPluginLoader::listImplementations( const QString &interfaceName, + QList &impls ) +{ + MPX_DEBUG(_L("XQPluginLoader::listImplementations()")); + return true; +} + +QObject* XQPluginLoader::instance() +{ + MPX_ENTER_EXIT(_L("XQPluginLoader::instance()")); + + if ( mUid == mFailToLoadPluginUid ) + { + return 0; + } + + if ( ! mPluginList.contains( mUid ) ) + { + mPluginList[mUid] = new TestViewPlugin(); + } + + return mPluginList[mUid]; +} + +void XQPluginLoader::cleanup() +{ + MPX_ENTER_EXIT(_L("XQPluginLoader::cleanup()")); + + QHash::const_iterator i = mPluginList.constBegin(); + while(i != mPluginList.constEnd()) + { + TestViewPlugin *view = dynamic_cast(i.value()); + if(view) + view->destroyView(); + delete i.value(); + ++i; + } +} + +/** + * Sets plugin load to fail. + */ +void XQPluginLoader::setPluginLoadFailure( int uid ) +{ + MPX_DEBUG(_L("XQPluginLoader::setPluginLoadFailure()")); + mFailToLoadPluginUid = uid; +}