Index: rbutil/rbutilqt/plugins/testplugin.cpp =================================================================== --- rbutil/rbutilqt/plugins/testplugin.cpp (revision 0) +++ rbutil/rbutilqt/plugins/testplugin.cpp (revision 0) @@ -0,0 +1,62 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2007 by Dominik Wenger + * $Id: testplugin.cpp 17847 2008-06-28 18:10:04Z bagder $ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + + +#include "testplugin.h" +#include +#include +#include + +#include "rbsettingswrapper.h" + +Q_EXPORT_PLUGIN2(testplugin, TestPlugin); + +QString TestPlugin::getDescription() +{ + return "This is a very simple Testplugin"; +} + + +bool TestPlugin::init(RbSettings* settings) +{ + g_settings = settings; + + Py_Initialize(); + Py_InitModule("rbsettings", RbSettingsMethods); + return true; +} + +void TestPlugin::run() +{ + qDebug() << "Plugin run is called" ; + + QFile pythonfile("testplugin.py"); + if (!pythonfile.open(QIODevice::ReadOnly | QIODevice::Text)) + { + qDebug() << "could not open python file"; + return; + } + QString pythonCode = pythonfile.readAll(); + + PyRun_SimpleString( pythonCode.toLocal8Bit().data()); + +} + Index: rbutil/rbutilqt/plugins/testplugin.h =================================================================== --- rbutil/rbutilqt/plugins/testplugin.h (revision 0) +++ rbutil/rbutilqt/plugins/testplugin.h (revision 0) @@ -0,0 +1,43 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2007 by Dominik Wenger + * $Id: testplugin.h 18119 2008-07-25 22:29:59Z bertrik $ + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef TESTPLUGIN_H +#define TESTPLUGIN_H + +#include +#include "plugininterface.h" + + +class TestPlugin : public QObject, PluginInterface +{ + Q_OBJECT + Q_INTERFACES(PluginInterface) + +public: + + QString getDescription(); + + void run(); + bool init(RbSettings* settings); + +}; + + +#endif + Index: rbutil/rbutilqt/plugins/testplugin.py =================================================================== --- rbutil/rbutilqt/plugins/testplugin.py (revision 0) +++ rbutil/rbutilqt/plugins/testplugin.py (revision 0) @@ -0,0 +1,27 @@ +import rbsettings +from PyQt4 import QtCore, QtGui +import sys +print rbsettings.mountpoint() +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(400, 300) + self.label = QtGui.QLabel(Dialog) + self.label.setGeometry(QtCore.QRect(60, 60, 280, 180)) + self.label.setObjectName("label") + self.label.setText("mountpoint: " + rbsettings.mountpoint() + "\n" + "curplatform: "+ rbsettings.curplatform() + "\n" + "curplatformname: " +rbsettings.curplatformname() +"\n" + "curname: " +rbsettings.curname() + "\n" + "curbrand: "+rbsettings.curbrand() +"\n" + "curresoultion: "+rbsettings.curresolution()) + self.retranslateUi(Dialog) + QtCore.QMetaObject.connectSlotsByName(Dialog) + def retranslateUi(self, Dialog): + Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8)) +class Test(QtGui.QDialog, Ui_Dialog): + def __init__(self): + QtGui.QDialog.__init__(self) + self.setupUi(self) +dialog = Test() +dialog.exec_() \ No newline at end of file Index: rbutil/rbutilqt/plugins/rbsettingswrapper.cpp =================================================================== --- rbutil/rbutilqt/plugins/rbsettingswrapper.cpp (revision 0) +++ rbutil/rbutilqt/plugins/rbsettingswrapper.cpp (revision 0) @@ -0,0 +1,80 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2007 by Dominik Wenger + * $Id: testplugin.h 18119 2008-07-25 22:29:59Z bertrik $ + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "rbsettingswrapper.h" + +// der globale RB Settings pointer +RbSettings* g_settings; + +// mountpoint wrapper +PyObject* rbsettings_mountpoint(PyObject *self) +{ + return Py_BuildValue("s", g_settings->mountpoint().toLocal8Bit().data()); +} + +// cur plattform wrapper +PyObject* rbsettings_curplattform(PyObject *self) +{ + return Py_BuildValue("s", g_settings->curPlatform().toLocal8Bit().data()); +} + +// cur plattform Name wrapper +PyObject* rbsettings_curplattformname(PyObject *self) +{ + return Py_BuildValue("s", g_settings->curPlatformName().toLocal8Bit().data()); +} + +// cur Name wrapper +PyObject* rbsettings_curname(PyObject *self) +{ + return Py_BuildValue("s", g_settings->curName().toLocal8Bit().data()); +} + +// cur brand wrapper +PyObject* rbsettings_curbrand(PyObject *self) +{ + return Py_BuildValue("s", g_settings->curBrand().toLocal8Bit().data()); +} + +// cur resolution wrapper +PyObject* rbsettings_curresolution(PyObject *self) +{ + return Py_BuildValue("s", g_settings->curResolution().toLocal8Bit().data()); +} + + + +// function struct +PyMethodDef RbSettingsMethods[] = +{ + {"mountpoint",(PyCFunction) rbsettings_mountpoint, METH_NOARGS, + "Return the current mountpoint as string."}, + {"curplatform",(PyCFunction) rbsettings_curplattform, METH_NOARGS, + "Return the current plattform as string."}, + {"curplatformname",(PyCFunction) rbsettings_curplattformname, METH_NOARGS, + "Return the current plattformname as string."}, + {"curname",(PyCFunction) rbsettings_curname, METH_NOARGS, + "Return the current name as string."}, + {"curbrand",(PyCFunction) rbsettings_curbrand, METH_NOARGS, + "Return the current brand as string."}, + {"curresolution",(PyCFunction) rbsettings_curresolution, METH_NOARGS, + "Return the current resolution as string."}, + {NULL, NULL, 0, NULL} +}; + Index: rbutil/rbutilqt/plugins/rbsettingswrapper.h =================================================================== --- rbutil/rbutilqt/plugins/rbsettingswrapper.h (revision 0) +++ rbutil/rbutilqt/plugins/rbsettingswrapper.h (revision 0) @@ -0,0 +1,31 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2007 by Dominik Wenger + * $Id: testplugin.h 18119 2008-07-25 22:29:59Z bertrik $ + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef RBSETTINGSWRAPPER_H +#define RBSETTINGSWRAPPER_H + +#include "rbsettings.h" +#include +// global settings pointer +extern RbSettings* g_settings; + +extern PyMethodDef RbSettingsMethods[]; + +#endif + Index: rbutil/rbutilqt/plugins/testplugin.pro =================================================================== --- rbutil/rbutilqt/plugins/testplugin.pro (revision 0) +++ rbutil/rbutilqt/plugins/testplugin.pro (revision 0) @@ -0,0 +1,15 @@ +TEMPLATE = lib +CONFIG += plugin release +DEFINES -= QT_NO_DEBUG_OUTPUT +INCLUDEPATH += .. H:\Python25\include +LIBS += -LH:\Python25\libs -lpython25 +TARGET = $$qtLibraryTarget(testplugin) +DESTDIR = ../release/ + +HEADERS = testplugin.h \ + rbsettingswrapper.h \ + ../rbsettings.h + +SOURCES = testplugin.cpp \ + rbsettingswrapper.cpp \ + ../rbsettings.cpp Index: rbutil/rbutilqt/rbutilqtfrm.ui =================================================================== --- rbutil/rbutilqt/rbutilqtfrm.ui (revision 18370) +++ rbutil/rbutilqt/rbutilqtfrm.ui (working copy) @@ -13,33 +13,33 @@ Rockbox Utility - :/icons/rockbox-1.png + + :/icons/rockbox-1.png:/icons/rockbox-1.png + + + 0 + 21 + 650 + 510 + + 6 - + 0 - - 0 - - - 0 - - - 0 - Qt::Horizontal - + 40 20 @@ -62,7 +62,7 @@ Qt::Horizontal - + 40 20 @@ -103,7 +103,7 @@ Qt::Horizontal - + 40 20 @@ -117,7 +117,8 @@ &Change - :/icons/edit-find.png + + :/icons/edit-find.png:/icons/edit-find.png @@ -130,6 +131,14 @@ 0 + + + 0 + 0 + 626 + 270 + + &Quick Start @@ -143,7 +152,8 @@ Complete Installation - :/icons/bootloader_btn.png + + :/icons/bootloader_btn.png:/icons/bootloader_btn.png @@ -172,7 +182,8 @@ Small Installation - :/icons/rbinstall_btn.png + + :/icons/rbinstall_btn.png:/icons/rbinstall_btn.png @@ -200,7 +211,7 @@ Qt::Vertical - + 20 91 @@ -213,7 +224,7 @@ Qt::Vertical - + 20 81 @@ -224,6 +235,14 @@ + + + 0 + 0 + 626 + 270 + + &Installation @@ -237,7 +256,8 @@ Install Bootloader - :/icons/bootloader_btn.png + + :/icons/bootloader_btn.png:/icons/bootloader_btn.png @@ -266,7 +286,8 @@ Install Rockbox - :/icons/rbinstall_btn.png + + :/icons/rbinstall_btn.png:/icons/rbinstall_btn.png @@ -297,7 +318,7 @@ Qt::Vertical - + 20 91 @@ -310,7 +331,7 @@ Qt::Vertical - + 20 81 @@ -321,6 +342,14 @@ + + + 0 + 0 + 626 + 270 + + &Extras @@ -334,7 +363,8 @@ Install Fonts package - :/icons/font_btn.png + + :/icons/font_btn.png:/icons/font_btn.png @@ -360,7 +390,8 @@ Install themes - :/icons/themes_btn.png + + :/icons/themes_btn.png:/icons/themes_btn.png @@ -386,7 +417,8 @@ Install game files - :/icons/doom_btn.png + + :/icons/doom_btn.png:/icons/doom_btn.png @@ -411,7 +443,7 @@ Qt::Vertical - + 20 40 @@ -424,7 +456,7 @@ Qt::Vertical - + 20 40 @@ -435,6 +467,14 @@ + + + 0 + 0 + 626 + 270 + + &Accessibility @@ -448,7 +488,8 @@ Install Voice files - :/icons/talkfile_btn.png + + :/icons/talkfile_btn.png:/icons/talkfile_btn.png @@ -474,7 +515,8 @@ Install Talk files - :/icons/talkfile_btn.png + + :/icons/talkfile_btn.png:/icons/talkfile_btn.png @@ -496,7 +538,7 @@ Qt::Vertical - + 20 51 @@ -509,7 +551,7 @@ Qt::Vertical - + 20 51 @@ -523,7 +565,8 @@ Create Voice files - :/icons/talkfile_btn.png + + :/icons/talkfile_btn.png:/icons/talkfile_btn.png @@ -536,7 +579,7 @@ - <b>Create Voice file</b><br/>Voice files are needed to make Rockbox speak the user interface. Speaking is enabled by default, so + <b>Create Voice file</b><br/>Voice files are needed to make Rockbox speak the user interface. Speaking is enabled by default, so if you installed the voice file Rockbox will speak. @@ -547,6 +590,14 @@ + + + 0 + 0 + 626 + 270 + + &Uninstallation @@ -560,7 +611,8 @@ Uninstall Bootloader - :/icons/rembootloader_btn.png + + :/icons/rembootloader_btn.png:/icons/rembootloader_btn.png @@ -586,7 +638,8 @@ Uninstall Rockbox - :/icons/remrb_btn.png + + :/icons/remrb_btn.png:/icons/remrb_btn.png @@ -617,7 +670,7 @@ Qt::Vertical - + 20 40 @@ -630,7 +683,7 @@ Qt::Vertical - + 20 40 @@ -641,6 +694,14 @@ + + + 0 + 0 + 626 + 270 + + &Manual @@ -663,7 +724,7 @@ true - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::NoTextInteraction + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse @@ -676,7 +737,7 @@ true - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::NoTextInteraction + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse @@ -712,7 +773,7 @@ Qt::Horizontal - + 40 20 @@ -735,7 +796,7 @@ Qt::Vertical - + 20 40 @@ -746,6 +807,14 @@ + + + 0 + 0 + 626 + 270 + + Inf&o @@ -774,6 +843,40 @@ + + + Plugins + + + + + + Install Fonts package + + + + :/icons/font_btn.png:/icons/font_btn.png + + + + 56 + 46 + + + + + + + + + + + true + + + + + @@ -784,7 +887,7 @@ 0 0 650 - 28 + 21 @@ -857,7 +960,16 @@ - + + + + 0 + 531 + 650 + 19 + + + Empty local download cache @@ -903,7 +1015,8 @@ - :/icons/bootloader_btn.png + + :/icons/bootloader_btn.png:/icons/bootloader_btn.png &Complete Installation @@ -911,7 +1024,8 @@ - :/icons/rbinstall_btn.png + + :/icons/rbinstall_btn.png:/icons/rbinstall_btn.png &Small Installation @@ -919,7 +1033,8 @@ - :/icons/bootloader_btn.png + + :/icons/bootloader_btn.png:/icons/bootloader_btn.png Install &Bootloader @@ -927,7 +1042,8 @@ - :/icons/rbinstall_btn.png + + :/icons/rbinstall_btn.png:/icons/rbinstall_btn.png Install &Rockbox @@ -935,7 +1051,8 @@ - :/icons/font_btn.png + + :/icons/font_btn.png:/icons/font_btn.png Install &Fonts Package @@ -943,7 +1060,8 @@ - :/icons/themes_btn.png + + :/icons/themes_btn.png:/icons/themes_btn.png Install &Themes @@ -951,7 +1069,8 @@ - :/icons/doom_btn.png + + :/icons/doom_btn.png:/icons/doom_btn.png Install &Game Files @@ -959,7 +1078,8 @@ - :/icons/talkfile_btn.png + + :/icons/talkfile_btn.png:/icons/talkfile_btn.png &Install Voice File @@ -967,7 +1087,8 @@ - :/icons/talkfile_btn.png + + :/icons/talkfile_btn.png:/icons/talkfile_btn.png Create &Talk Files @@ -975,7 +1096,8 @@ - :/icons/rembootloader_btn.png + + :/icons/rembootloader_btn.png:/icons/rembootloader_btn.png Remove &bootloader @@ -983,7 +1105,8 @@ - :/icons/remrb_btn.png + + :/icons/remrb_btn.png:/icons/remrb_btn.png Uninstall &Rockbox @@ -1011,7 +1134,8 @@ - :/icons/talkfile_btn.png + + :/icons/talkfile_btn.png:/icons/talkfile_btn.png Create &Voice File Index: rbutil/rbutilqt/rbutilqt.cpp =================================================================== --- rbutil/rbutilqt/rbutilqt.cpp (revision 18370) +++ rbutil/rbutilqt/rbutilqt.cpp (working copy) @@ -49,6 +49,7 @@ #include #endif + RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) { absolutePath = qApp->applicationDirPath(); @@ -112,13 +113,57 @@ connect(ui.actionInstall_Rockbox_Utility_on_player, SIGNAL(triggered()), this, SLOT(installPortable())); #endif + myLoader = new QPluginLoader(); + if(loadPlugin()) + { + ui.pluginText->setText(pluginInterface->getDescription()); + connect(ui.buttonPlugin,SIGNAL(clicked()),this,SLOT(runPlugin())); + } + else + { + ui.buttonPlugin->setEnabled(false); + } + initIpodpatcher(); initSansapatcher(); downloadInfo(); } +void RbUtilQt::runPlugin() +{ + loadPlugin(); + pluginInterface->run(); +} +bool RbUtilQt::loadPlugin() +{ + myLoader->unload(); + QDir pluginsDir(qApp->applicationDirPath()); + + pluginsDir.cd("plugins"); + foreach(QString fileName, pluginsDir.entryList(QDir::Files)) + { + qDebug() << "file found: " << pluginsDir.absoluteFilePath(fileName); + myLoader->setFileName(pluginsDir.absoluteFilePath(fileName)); + //QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName)); + QObject *plugin = myLoader->instance(); + if (plugin) { + pluginInterface = qobject_cast(plugin); + if (pluginInterface) + { + pluginInterface->init(settings); + return true; + } + } + } + + return false; +} + + + + void RbUtilQt::sysinfo(void) { Sysinfo *info = new Sysinfo(this); @@ -1022,3 +1067,4 @@ return error; } + Index: rbutil/rbutilqt/rbutilqt.pro =================================================================== --- rbutil/rbutilqt/rbutilqt.pro (revision 18370) +++ rbutil/rbutilqt/rbutilqt.pro (working copy) @@ -128,7 +128,8 @@ rbunzip.h \ rbzip.h \ sysinfo.h \ - detect.h + detect.h \ + plugininterface.h # Needed by QT on Win INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex ../../tools @@ -142,8 +143,8 @@ message("debug") } !dbg { - CONFIG += release thread qt - DEFINES += QT_NO_DEBUG_OUTPUT + CONFIG += release thread qt console + DEFINES -= QT_NO_DEBUG_OUTPUT message("release") } @@ -233,3 +234,4 @@ INSTALLS += target } + Index: rbutil/rbutilqt/rbutilqt.h =================================================================== --- rbutil/rbutilqt/rbutilqt.h (revision 18370) +++ rbutil/rbutilqt/rbutilqt.h (working copy) @@ -33,6 +33,7 @@ #include "installbootloader.h" #include "rbsettings.h" +#include "plugininterface.h" class RbUtilQt : public QMainWindow { @@ -60,12 +61,16 @@ QUrl proxy(void); QMap versmap; bool chkConfig(bool); - + bool loadPlugin(); + PluginInterface* pluginInterface; + QPluginLoader* myLoader; + volatile bool m_installed; volatile bool m_error; bool m_gotInfo; private slots: + void runPlugin(void); void about(void); void help(void); void sysinfo(void); @@ -109,7 +114,9 @@ void installPortable(void); void updateInfo(void); void updateTabs(int); + }; #endif +