|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: XQPluginLoader stub |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: % |
|
19 |
|
20 #include "stub/inc/xqpluginloader.h" |
|
21 #include "stub/inc/xqplugininfo.h" |
|
22 #include "testviewplugin.h" |
|
23 #include "mpxvideo_debug.h" |
|
24 |
|
25 QHash<int, MpxViewPlugin*> XQPluginLoader::mPluginList; |
|
26 int XQPluginLoader::mFailToLoadPluginUid = -1; |
|
27 |
|
28 // ------------------------------------------------------------------------------------------------- |
|
29 // XQPluginLoader::XQPluginLoader() |
|
30 // ------------------------------------------------------------------------------------------------- |
|
31 // |
|
32 XQPluginLoader::XQPluginLoader( int uid, QObject* parent ) |
|
33 { |
|
34 MPX_DEBUG(_L("XQPluginLoader::XQPluginLoader()")); |
|
35 |
|
36 Q_UNUSED( parent ); |
|
37 |
|
38 mUid = uid; |
|
39 } |
|
40 |
|
41 // ------------------------------------------------------------------------------------------------- |
|
42 // XQPluginLoader::~XQPluginLoader() |
|
43 // ------------------------------------------------------------------------------------------------- |
|
44 // |
|
45 XQPluginLoader::~XQPluginLoader() |
|
46 { |
|
47 MPX_DEBUG(_L("XQPluginLoader::~XQPluginLoader()")); |
|
48 } |
|
49 |
|
50 // ------------------------------------------------------------------------------------------------- |
|
51 // XQPluginLoader::listImplementations() |
|
52 // ------------------------------------------------------------------------------------------------- |
|
53 // |
|
54 bool XQPluginLoader::listImplementations( const QString &interfaceName, |
|
55 QList<XQPluginInfo > &impls ) |
|
56 { |
|
57 MPX_DEBUG(_L("XQPluginLoader::listImplementations()")); |
|
58 |
|
59 Q_UNUSED( interfaceName ); |
|
60 Q_UNUSED( impls ); |
|
61 |
|
62 return true; |
|
63 } |
|
64 |
|
65 // ------------------------------------------------------------------------------------------------- |
|
66 // XQPluginLoader::instance() |
|
67 // ------------------------------------------------------------------------------------------------- |
|
68 // |
|
69 QObject* XQPluginLoader::instance() |
|
70 { |
|
71 MPX_ENTER_EXIT(_L("XQPluginLoader::instance()")); |
|
72 |
|
73 if ( mUid == mFailToLoadPluginUid ) |
|
74 { |
|
75 return 0; |
|
76 } |
|
77 |
|
78 if ( ! mPluginList.contains( mUid ) ) |
|
79 { |
|
80 mPluginList[mUid] = new TestViewPlugin(); |
|
81 } |
|
82 |
|
83 return mPluginList[mUid]; |
|
84 } |
|
85 |
|
86 // ------------------------------------------------------------------------------------------------- |
|
87 // XQPluginLoader::cleanup() |
|
88 // ------------------------------------------------------------------------------------------------- |
|
89 // |
|
90 void XQPluginLoader::cleanup() |
|
91 { |
|
92 MPX_ENTER_EXIT(_L("XQPluginLoader::cleanup()")); |
|
93 |
|
94 QHash<int, MpxViewPlugin*>::const_iterator i = mPluginList.constBegin(); |
|
95 while(i != mPluginList.constEnd()) |
|
96 { |
|
97 TestViewPlugin *view = dynamic_cast<TestViewPlugin*>(i.value()); |
|
98 if(view) |
|
99 view->destroyView(); |
|
100 delete i.value(); |
|
101 ++i; |
|
102 } |
|
103 } |
|
104 |
|
105 // ------------------------------------------------------------------------------------------------- |
|
106 // XQPluginLoader::setPluginLoadFailure() |
|
107 // ------------------------------------------------------------------------------------------------- |
|
108 // |
|
109 void XQPluginLoader::setPluginLoadFailure( int uid ) |
|
110 { |
|
111 MPX_DEBUG(_L("XQPluginLoader::setPluginLoadFailure()")); |
|
112 |
|
113 mFailToLoadPluginUid = uid; |
|
114 } |