Added TorrentPickerPage.
[qtrapids] / src / qml-client / main.cpp
index 9d992b8..674eb3e 100644 (file)
  *   Free Software Foundation, Inc.,                                       *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
-#include <QApplication>
 #include <QtDeclarative>
 #include <QDeclarativeContext>
 #include <QTest>
 #include <QDebug>
-//#include <QDesktopWidget>
-//#include "DownloadView.h"
 #include <QtDeclarative/qdeclarative.h>
-#include "models/QDeclarativeDownloadListModel.h"
+#include <meegotouch/mapplicationpage.h>
+#include <meegotouch/mapplicationwindow.h>
 
-#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::QDeclarativeDownloadListModel>("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");