X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fqml-client%2Fmain.cpp;fp=src%2Fqml-client%2Fmain.cpp;h=674eb3e745767362bf5d420a3a326a3211c4d46c;hb=a4530ce6a29ea37465dd6acc9a359c6be5061e1d;hp=9d992b8acf6fe74d4c50f5f055d4238dcefdbbd3;hpb=fb1b5e73f9767fecad734f260b1c5397709f0f70;p=qtrapids diff --git a/src/qml-client/main.cpp b/src/qml-client/main.cpp index 9d992b8..674eb3e 100644 --- a/src/qml-client/main.cpp +++ b/src/qml-client/main.cpp @@ -15,26 +15,22 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include #include #include #include #include -//#include -//#include "DownloadView.h" #include -#include "models/QDeclarativeDownloadListModel.h" +#include +#include -#include "MainWindow.h" +#include "models/QDeclarativeDownloadListModel.h" +#include "MainPageHandler.h" #include "../include/qtrapids/dbus.hpp" -using qtrapids::MainWindow; - int main(int argc, char *argv[]) { - - + // TODO: Check: could we use MApplication:: instead? QCoreApplication::setOrganizationName("Ixonos"); QCoreApplication::setOrganizationDomain("ixonos.com"); QCoreApplication::setApplicationName("QtRapids"); @@ -43,24 +39,30 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); //MainWindow mainWindow; app.setProperty("NoMStyle", true); - - // Register our types: + + // Register our types (e.g. models and stuff): qmlRegisterType("QtRapids", 1, 0, "DownloadListModel"); QDir::setCurrent(app.applicationDirPath()); QDeclarativeView window; - //QDeclarativeEngine engine; + // Setting the root context properties. Create an QObject-derived + // object: qtrapids::QDeclarativeDownloadListModel downloadModel; + qtrapids::MainPageHandler mainPageHandler; + // ... and add to QML context. This can then be used in QML context. QDeclarativeContext *context = window.rootContext(); context->setContextProperty("downloadModel", &downloadModel); + context->setContextProperty("mainPageHandler", &mainPageHandler); + + // Initial QML file/resource: window.setSource(QUrl("qrc:/main.qml")); window.showFullScreen(); -// window.show(); - + /* TODO: Enable this once we have the views up & running + * TODO: We can add this to mainPageHandler now... QDBusConnection dbus = QDBusConnection::sessionBus(); dbus.registerObject("/qtrapids_gui", &mainWindow); dbus.registerService("com.ixonos.qtrapids_gui");