summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Ivchenko <[email protected]>2015-07-23 19:59:21 +0400
committerMikhail Ivchenko <[email protected]>2015-07-24 14:01:19 +0400
commit01d268f46bb5d43c22579ee67bda8a54d23cbfec (patch)
tree3561b8d77eea86a06272d9b47dd55302574fb3f8
parentea928feef0298bd872c541c5ebfe0240deae8646 (diff)
Move Marble Maps to QQmlApplicationEngine and QtQuick components.
Add basic menubar and toolbar. REVIEW: 124441
-rw-r--r--src/apps/marble_maps/CMakeLists.txt2
-rw-r--r--src/apps/marble_maps/MainScreen.qml33
-rw-r--r--src/apps/marble_maps/QmlView.cpp37
-rw-r--r--src/apps/marble_maps/QmlView.h31
-rw-r--r--src/apps/marble_maps/main.cpp8
-rw-r--r--src/apps/marble_maps/package/AndroidManifest.xml2
6 files changed, 34 insertions, 79 deletions
diff --git a/src/apps/marble_maps/CMakeLists.txt b/src/apps/marble_maps/CMakeLists.txt
index a259af7..3260a69 100644
--- a/src/apps/marble_maps/CMakeLists.txt
+++ b/src/apps/marble_maps/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(marble_SRCS main.cpp QmlView.cpp)
+set(marble_SRCS main.cpp)
qt5_add_resources(marble_QRCS MarbleMaps.qrc)
add_library (Marble SHARED ${marble_SRCS} ${marble_QRCS})
diff --git a/src/apps/marble_maps/MainScreen.qml b/src/apps/marble_maps/MainScreen.qml
index 2904755..db90849 100644
--- a/src/apps/marble_maps/MainScreen.qml
+++ b/src/apps/marble_maps/MainScreen.qml
@@ -1,14 +1,37 @@
import QtQuick 2.3
+import QtQuick.Controls 1.4
+import QtQuick.Window 2.2
+
import MarbleItem 1.0
-Rectangle {
- id: mainRect
- anchors.fill: parent
- color: "black"
+ApplicationWindow {
+ id: root
+ title: qsTr("Marble Maps")
+ visible: true
+
+ menuBar: MenuBar {
+ id: menuBar
+ Menu {
+ MenuItem{
+ text: qsTr("Search")
+ }
+ }
+ }
+
+ toolBar: ToolBar {
+ id: toolBar
+ }
+
+ Rectangle {
+ id: background
+ anchors.fill: parent
+ color: "black"
+ }
PinchArea {
anchors.fill: parent
enabled: true
+
onPinchStarted: marbleMaps.handlePinchStarted(pinch.center)
onPinchFinished: marbleMaps.handlePinchFinished(pinch.center)
onPinchUpdated: marbleMaps.handlePinchUpdated(pinch.center, pinch.scale)
@@ -37,4 +60,4 @@ Rectangle {
showBackground: false
}
}
-}
+} \ No newline at end of file
diff --git a/src/apps/marble_maps/QmlView.cpp b/src/apps/marble_maps/QmlView.cpp
deleted file mode 100644
index 6c4fc70..0000000
--- a/src/apps/marble_maps/QmlView.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// This file is part of the Marble Virtual Globe.
-//
-// This program is free software licensed under the GNU LGPL. You can
-// find a copy of this license in LICENSE.txt in the top directory of
-// the source code.
-//
-// Copyright 2015 Gábor Péterffy <[email protected]>
-//
-
-#include "QmlView.h"
-#include "MarbleQuickItem.h"
-
-using namespace Marble;
-
-QmlView::QmlView():
- QQuickView()
-{
-}
-
-void QmlView::start()
-{
- qmlRegisterType<MarbleQuickItem>("MarbleItem", 1, 0, "MarbleItem");
- setSource(QUrl("qrc:/MainScreen.qml"));
-
- if( status() != QQuickView::Ready )
- {
- qDebug() << "QmlView initialisation has failed";
- }
-
- setColor(QColor(Qt::black));
- setTitle("Marble Maps");
-
- showFullScreen();
-}
-
-#include "QmlView.h"
diff --git a/src/apps/marble_maps/QmlView.h b/src/apps/marble_maps/QmlView.h
deleted file mode 100644
index b312d9a..0000000
--- a/src/apps/marble_maps/QmlView.h
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// This file is part of the Marble Virtual Globe.
-//
-// This program is free software licensed under the GNU LGPL. You can
-// find a copy of this license in LICENSE.txt in the top directory of
-// the source code.
-//
-// Copyright 2015 Gábor Péterffy <[email protected]>
-//
-
-#ifndef MARBLE_QMLVIEW_H
-#define MARBLE_QMLVIEW_H
-
-#include <QQuickView>
-
-namespace Marble
-{
-
-class QmlView : public QQuickView
-{
-public:
- QmlView();
-
- /**
- * @brief It loads the main qml file, and it inits the qml application.
- */
- void start();
-};
-
-}
-#endif
diff --git a/src/apps/marble_maps/main.cpp b/src/apps/marble_maps/main.cpp
index 473ff44..08f4be5 100644
--- a/src/apps/marble_maps/main.cpp
+++ b/src/apps/marble_maps/main.cpp
@@ -9,17 +9,17 @@
//
#include <QApplication>
+#include <QQmlApplicationEngine>
-#include "QmlView.h"
+#include "MarbleQuickItem.h"
using namespace Marble;
int main(int argc, char ** argv)
{
QApplication app(argc, argv);
-
- QmlView marbleMaps;
- marbleMaps.start();
+ qmlRegisterType<MarbleQuickItem>("MarbleItem", 1, 0, "MarbleItem");
+ QQmlApplicationEngine engine(QUrl("qrc:/MainScreen.qml"));
return app.exec();
}
diff --git a/src/apps/marble_maps/package/AndroidManifest.xml b/src/apps/marble_maps/package/AndroidManifest.xml
index 9125e5d..4ea604b 100644
--- a/src/apps/marble_maps/package/AndroidManifest.xml
+++ b/src/apps/marble_maps/package/AndroidManifest.xml
@@ -2,7 +2,7 @@
<manifest android:versionName="0.0.1" package="org.kde.marble.maps" android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- <application android:label="Marble Maps" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:icon="@drawable/marblelogo">
+ <application android:label="Marble Maps" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:icon="@drawable/marblelogo" android:theme="@android:style/Theme.Holo">
<activity android:label="Marble Maps" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:screenOrientation="unspecified" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>