diff -r 315810614048 -r 839377eedc2b 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 Tue Aug 31 15:15:55 2010 +0300 @@ -0,0 +1,114 @@ +/* +* 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 +* +*/ + +// Version : %version: % + +#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() +// ------------------------------------------------------------------------------------------------- +// +XQPluginLoader::XQPluginLoader( int uid, QObject* parent ) +{ + MPX_DEBUG(_L("XQPluginLoader::XQPluginLoader()")); + + Q_UNUSED( parent ); + + mUid = uid; +} + +// ------------------------------------------------------------------------------------------------- +// XQPluginLoader::~XQPluginLoader() +// ------------------------------------------------------------------------------------------------- +// +XQPluginLoader::~XQPluginLoader() +{ + MPX_DEBUG(_L("XQPluginLoader::~XQPluginLoader()")); +} + +// ------------------------------------------------------------------------------------------------- +// XQPluginLoader::listImplementations() +// ------------------------------------------------------------------------------------------------- +// +bool XQPluginLoader::listImplementations( const QString &interfaceName, + QList &impls ) +{ + MPX_DEBUG(_L("XQPluginLoader::listImplementations()")); + + Q_UNUSED( interfaceName ); + Q_UNUSED( impls ); + + return true; +} + +// ------------------------------------------------------------------------------------------------- +// XQPluginLoader::instance() +// ------------------------------------------------------------------------------------------------- +// +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]; +} + +// ------------------------------------------------------------------------------------------------- +// XQPluginLoader::cleanup() +// ------------------------------------------------------------------------------------------------- +// +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; + } +} + +// ------------------------------------------------------------------------------------------------- +// XQPluginLoader::setPluginLoadFailure() +// ------------------------------------------------------------------------------------------------- +// +void XQPluginLoader::setPluginLoadFailure( int uid ) +{ + MPX_DEBUG(_L("XQPluginLoader::setPluginLoadFailure()")); + + mFailToLoadPluginUid = uid; +}