Fix include guard
[quandoparte] / application / view.cpp
index d922d68..03ef9f0 100644 (file)
@@ -22,17 +22,18 @@ Boston, MA 02110-1301, USA.
 #include "view.h"
 #include "settings.h"
 #include "dataprovider.h"
-#include "stationlistmodel.h"
-#include "stationlistproxymodel.h"
 #include "stationschedulemodel.h"
+#include "stationlistproxymodel.h"
+#include "stationlistmodel.h"
 
+#include <QtGlobal>
+#include <QtConcurrentRun>
 #include <QDebug>
 #include <QDir>
 #include <QFile>
 #include <QModelIndex>
-#include <QtConcurrentRun>
-#ifdef TARGET_PLATFORM_SAILFISH
-#include <QtQuick>
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
+#include <QtQuick/QtQuick>
 #else
 #include <QtDeclarative>
 #endif
@@ -64,7 +65,12 @@ static QString trueFilePath(const QString &path)
 #endif
 }
 
-#ifdef TARGET_PLATFORM_SAILFISH
+Q_DECLARE_METATYPE(QList< QPersistentModelIndex >)
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
+Q_DECLARE_METATYPE(QAbstractItemModel::LayoutChangeHint)
+#endif
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
 View::View(QWindow *parent) :
     QQuickView(parent),
 #else
@@ -81,14 +87,17 @@ View::View(QWidget *parent) :
     stationListProxyModel->setSourceModel(stationListModel);
 
     /* Types to be made accessible to QML */
-    qRegisterMetaType<QModelIndex>("QModelIndex");
-    qmlRegisterType<Settings>("net.cirulla.quandoparte", 1, 0, "Settings");
-    qmlRegisterType<StationListProxyModel>(
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
+    qRegisterMetaType< QModelIndex >();
+    qRegisterMetaType< QList< QPersistentModelIndex > >();
+    qRegisterMetaType< QAbstractItemModel::LayoutChangeHint>();
+#endif
+    qmlRegisterType< StationListProxyModel >(
                 "net.cirulla.quandoparte", 1, 0, "StationListProxyModel");
-    qmlRegisterType<StationScheduleModel>(
+    qmlRegisterType< StationScheduleModel >(
                 "net.cirulla.quandoparte", 1, 0, "StationScheduleModel");
 
-#ifdef TARGET_PLATFORM_SAILFISH
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
     QQmlContext *context = this->rootContext();
 #else
     QDeclarativeContext *context = this->rootContext();