videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/xqpluginloader.cpp
changeset 17 69946d1824c4
parent 15 cf5481c2bc0b
child 52 e3cecb93e76a
equal deleted inserted replaced
15:cf5481c2bc0b 17:69946d1824c4
    16 */
    16 */
    17 
    17 
    18 #include "stub/inc/xqpluginloader.h"
    18 #include "stub/inc/xqpluginloader.h"
    19 #include "stub/inc/xqplugininfo.h"
    19 #include "stub/inc/xqplugininfo.h"
    20 #include "testviewplugin.h"
    20 #include "testviewplugin.h"
       
    21 #include "mpxvideo_debug.h"
    21 
    22 
    22 QHash<int, MpxViewPlugin*> XQPluginLoader::mPluginList;
    23 QHash<int, MpxViewPlugin*> XQPluginLoader::mPluginList;
    23 int XQPluginLoader::mFailToLoadPluginUid = -1;
    24 int XQPluginLoader::mFailToLoadPluginUid = -1;
    24 
    25 
    25 XQPluginLoader::XQPluginLoader(int uid, QObject* parent)
    26 XQPluginLoader::XQPluginLoader( int uid, QObject* parent )
    26 {
    27 {
       
    28     MPX_DEBUG(_L("XQPluginLoader::XQPluginLoader()"));  
       
    29     
       
    30     Q_UNUSED( parent );    
    27     mUid = uid;
    31     mUid = uid;
    28 }
    32 }
    29 
    33 
    30 XQPluginLoader::~XQPluginLoader()
    34 XQPluginLoader::~XQPluginLoader()
    31 {
    35 {
    32     
    36     MPX_DEBUG(_L("XQPluginLoader::~XQPluginLoader()"));      
    33 }
    37 }
    34 
    38 
    35 bool XQPluginLoader::listImplementations(const QString &interfaceName, 
    39 bool XQPluginLoader::listImplementations( const QString &interfaceName, 
    36                          QList<XQPluginInfo > &impls)
    40                                           QList<XQPluginInfo > &impls )
    37 {
    41 {
       
    42     MPX_DEBUG(_L("XQPluginLoader::listImplementations()"));  
    38     return true;
    43     return true;
    39 }
    44 }
    40 
    45 
    41 QObject* XQPluginLoader::instance()
    46 QObject* XQPluginLoader::instance()
    42 {
    47 {
    43     if(mUid == mFailToLoadPluginUid)
    48     MPX_ENTER_EXIT(_L("XQPluginLoader::instance()"));
       
    49     
       
    50     if ( mUid == mFailToLoadPluginUid )
    44     {
    51     {
    45         return 0;
    52         return 0;
    46     }
    53     }
    47     
    54     
    48     if(!mPluginList.contains(mUid))
    55     if ( ! mPluginList.contains( mUid ) )
    49     {
    56     {
    50         mPluginList[mUid] = new TestViewPlugin();
    57         mPluginList[mUid] = new TestViewPlugin();
    51     }
    58     }
    52 
    59 
    53     return mPluginList[mUid];
    60     return mPluginList[mUid];
    54 }
    61 }
    55 
    62 
    56 void XQPluginLoader::cleanup()
    63 void XQPluginLoader::cleanup()
    57 {
    64 {
       
    65     MPX_ENTER_EXIT(_L("XQPluginLoader::cleanup()"));
       
    66     
    58     QHash<int, MpxViewPlugin*>::const_iterator i = mPluginList.constBegin();
    67     QHash<int, MpxViewPlugin*>::const_iterator i = mPluginList.constBegin();
    59     while(i != mPluginList.constEnd()) 
    68     while(i != mPluginList.constEnd()) 
    60     {
    69     {
    61         TestViewPlugin *view = dynamic_cast<TestViewPlugin*>(i.value());
    70         TestViewPlugin *view = dynamic_cast<TestViewPlugin*>(i.value());
    62         if(view)
    71         if(view)
    67 }
    76 }
    68 
    77 
    69 /**
    78 /**
    70  * Sets plugin load to fail.
    79  * Sets plugin load to fail.
    71  */
    80  */
    72 void XQPluginLoader::setPluginLoadFailure(int uid)
    81 void XQPluginLoader::setPluginLoadFailure( int uid )
    73 {
    82 {
       
    83     MPX_DEBUG(_L("XQPluginLoader::setPluginLoadFailure()"));
    74     mFailToLoadPluginUid = uid;
    84     mFailToLoadPluginUid = uid;
    75 }
    85 }