Created stub StationSchedule class
[quandoparte] / application / view.cpp
index 8162412..bfa8e74 100644 (file)
@@ -1,12 +1,34 @@
+/*
+
+Copyright (C) 2011 Luciano Montanaro <mikelima@cirulla.net>
+
+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 program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.
+
+*/
+
 #include "view.h"
+#include "settings.h"
+#include "dataprovider.h"
 #include "stationlistmodel.h"
 #include "stationlistproxymodel.h"
 
-#include <QDeclarativeContext>
-#include <QDeclarativeView>
 #include <QDebug>
 #include <QDir>
 #include <QFile>
+#include <QtDeclarative>
 
 // search Paths seem to be broken in Harmattan?
 
@@ -40,9 +62,17 @@ View::View(QWidget *parent) :
     stationListModel->load(trueFilePath("stations:stations.qpl"));
 
     stationListProxyModel->setSourceModel(stationListModel);
-    stationListProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
+
+    /* Types to be made accessible to QML */
+    qmlRegisterType<DataProvider>("net.cirulla.quandoparte", 1, 0, "DataProvider");
+    qmlRegisterType<Settings>("net.cirulla.quandoparte", 1, 0, "Settings");
+    qmlRegisterType<StationListProxyModel>(
+                "net.cirulla.quandoparte", 1, 0, "StationListProxyModel");
 
     QDeclarativeContext *context = this->rootContext();
+    /* objects to be made accessible to QML */
+    context->setContextProperty("settings", Settings::instance());
+    context->setContextProperty("stationList", stationListModel);
     context->setContextProperty("stationListProxyModel", stationListProxyModel);
 
     // This does not seem ot work in harmattan. As a workaround, change dir to