Port View class to Qt5
authorLuciano Montanaro <mikelima@cirulla.net>
Sat, 26 Oct 2013 15:31:28 +0000 (17:31 +0200)
committerLuciano Montanaro <mikelima@cirulla.net>
Sat, 26 Oct 2013 15:31:28 +0000 (17:31 +0200)
application/view.cpp
application/view.h
application/view_qt4.h [new file with mode: 0644]
application/view_qt5.h [new file with mode: 0644]

index 61c9171..1236dcc 100644 (file)
@@ -27,11 +27,11 @@ Boston, MA 02110-1301, USA.
 #include "stationschedulemodel.h"
 
 #include <QtGlobal>
+#include <QtConcurrentRun>
 #include <QDebug>
 #include <QDir>
 #include <QFile>
 #include <QModelIndex>
-#include <QtConcurrent/QtConcurrentRun>
 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
 #include <QtQuick/QtQuick>
 #else
index 0fff3aa..daac6dc 100644 (file)
@@ -23,41 +23,11 @@ Boston, MA 02110-1301, USA.
 */
 
 #include <QtGlobal>
-#include <QFuture>
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
-#include <QtQuick/QQuickView>
-#else
-#include <QDeclarativeView>
-#endif
-
-class StationListModel;
-class StationListProxyModel;
 
-class View :
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
-        public QQuickView
-#else
-        public QDeclarativeView
-#endif
-{
-    Q_OBJECT
-public:
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
-    explicit View(QWindow *parent = 0);
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
+#include "view_qt4.h"
 #else
-    explicit View(QWidget *parent = 0);
+#include "view_qt5.h"
 #endif
 
-    ~View();
-
-signals:
-
-public slots:
-
-private:
-    QFuture<void> future;
-    StationListModel *stationListModel;
-    StationListProxyModel *stationListProxyModel;
-};
-
 #endif // QP_VIEW_H
diff --git a/application/view_qt4.h b/application/view_qt4.h
new file mode 100644 (file)
index 0000000..ae6783b
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef QP_VIEW_QT4_H
+#define QP_VIEW_QT5_H
+
+/*
+
+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 <QtGlobal>
+#include <QFuture>
+#include <QDeclarativeView>
+
+class StationListModel;
+class StationListProxyModel;
+
+class View :
+        public QDeclarativeView
+{
+    Q_OBJECT
+public:
+    explicit View(QWidget *parent = 0);
+
+    ~View();
+
+signals:
+
+public slots:
+
+private:
+    QFuture<void> future;
+    StationListModel *stationListModel;
+    StationListProxyModel *stationListProxyModel;
+};
+
+#endif // QP_VIEW_QT4_H
diff --git a/application/view_qt5.h b/application/view_qt5.h
new file mode 100644 (file)
index 0000000..b65bdec
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef QP_VIEW_QT5_H
+#define QP_VIEW_QT5_H
+
+/*
+
+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 <QtGlobal>
+#include <QFuture>
+#include <QtQuick/QQuickView>
+
+class StationListModel;
+class StationListProxyModel;
+
+class View :
+        public QQuickView
+{
+    Q_OBJECT
+public:
+    explicit View(QWindow *parent = 0);
+
+    ~View();
+
+signals:
+
+public slots:
+
+private:
+    QFuture<void> future;
+    StationListModel *stationListModel;
+    StationListProxyModel *stationListProxyModel;
+};
+
+#endif // QP_VIEW_QT5_H