1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * |
|
20 */ |
|
21 |
|
22 #include <QtGui> |
|
23 |
|
24 #include <QObject> |
|
25 #include <QString> |
|
26 #include <QList> |
|
27 |
|
28 #include <xqplugin.h> |
|
29 #include <xqpluginloader.h> |
|
30 #include <xqplugininfo.h> |
|
31 |
|
32 #include <stdio.h> |
|
33 |
|
34 #include <testplugininterface.h> |
|
35 |
|
36 void log(const QString& aString) |
|
37 { |
|
38 FILE* poFile = fopen( "c:/trace.log", "a" ); |
|
39 if( !poFile ) |
|
40 return; |
|
41 fprintf( poFile, "%s\n", aString.toAscii().constData() ); |
|
42 fclose( poFile ); |
|
43 } |
|
44 |
|
45 int main(int argc, char *argv[]) |
|
46 { |
|
47 QApplication app(argc, argv); |
|
48 log("--- Start ---"); |
|
49 QList<XQPluginInfo> impls; |
|
50 |
|
51 XQPluginLoader::listImplementations("org.nokia.mmdt.TestPlugin/1.0", impls); |
|
52 |
|
53 log("list plugins:"); |
|
54 |
|
55 for (int i=0; i<impls.size(); i++) { |
|
56 log("plugin found..."); |
|
57 QString fmtStr("%1: %2"); |
|
58 log(fmtStr.arg("dll: ").arg(impls[i].dllName())); |
|
59 log(fmtStr.arg("opaque data: ").arg(impls[i].opaqueData())); |
|
60 log(fmtStr.arg("uid: ").arg(impls[i].uid())); |
|
61 log("---"); |
|
62 } |
|
63 |
|
64 XQPluginLoader pluginLoader; |
|
65 pluginLoader.setUid(0xE1253163); |
|
66 |
|
67 QObject *plugin = pluginLoader.instance(); |
|
68 |
|
69 QString pluginFmt("Plugin instance: %1"); |
|
70 log(pluginFmt.arg(reinterpret_cast<int>(plugin))); |
|
71 |
|
72 TestPluginInterface *pluginCast = qobject_cast<TestPluginInterface*>(plugin); |
|
73 log(pluginFmt.arg(reinterpret_cast<int>(pluginCast))); |
|
74 |
|
75 |
|
76 if (pluginCast!=0) |
|
77 log(pluginFmt.arg(pluginCast->test())); |
|
78 |
|
79 log("--- Stop ---"); |
|
80 // return app.exec(); |
|
81 } |
|
82 |
|