diff options
Diffstat (limited to 'basicsuite/ebike-ui')
44 files changed, 768 insertions, 106 deletions
diff --git a/basicsuite/ebike-ui/ClockView.qml b/basicsuite/ebike-ui/ClockView.qml index 55ada41..70101e1 100644 --- a/basicsuite/ebike-ui/ClockView.qml +++ b/basicsuite/ebike-ui/ClockView.qml @@ -38,8 +38,8 @@ import QtQuick 2.7 import "./BikeStyle" // Permanent placeholder for time display Item { - width: backgroundImage.width - height: backgroundImage.height + width: parent.width * 0.225 + height: parent.height * 0.075 z: 1 // Timer that will show the current time at the top of the screen @@ -53,12 +53,11 @@ Item { source: "images/top_curtain_drag.png" anchors.centerIn: parent fillMode: Image.PreserveAspectFit - width: root.width * 0.225 - height: root.height * 0.075 } Text { id: timeLabel + clip: clipDynamicText anchors { horizontalCenter: parent.horizontalCenter baseline: parent.top diff --git a/basicsuite/ebike-ui/ConfigurationDrawer.qml b/basicsuite/ebike-ui/ConfigurationDrawer.qml index f6f6094..05b1e0a 100644 --- a/basicsuite/ebike-ui/ConfigurationDrawer.qml +++ b/basicsuite/ebike-ui/ConfigurationDrawer.qml @@ -43,6 +43,7 @@ Drawer { property alias bikeInfoTab: bikeInfoTab property alias generalTab: generalTab property alias viewTab: viewTab + dim: false background: Rectangle { color: Colors.curtainBackground @@ -55,12 +56,12 @@ Drawer { anchors { left: parent.left right: parent.right - leftMargin: root.width * 0.025 - rightMargin: root.width * 0.025 + leftMargin: parent.width * 0.025 + rightMargin: parent.width * 0.025 } contentHeight: parent.height * 0.175 background: Rectangle { - color: Colors.curtainBackground + color: "transparent" } IconifiedTabButton { @@ -134,8 +135,8 @@ Drawer { source: "images/curtain_shadow_handle.png" anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top - width: root.width * 0.2 - height: root.height * 0.07 + width: parent.width * 0.2 + height: parent.height * 0.07 fillMode: Image.PreserveAspectFit } diff --git a/basicsuite/ebike-ui/FpsItem.qml b/basicsuite/ebike-ui/FpsItem.qml index 0ab183d..71d2af5 100644 --- a/basicsuite/ebike-ui/FpsItem.qml +++ b/basicsuite/ebike-ui/FpsItem.qml @@ -59,6 +59,7 @@ Item { Text { id: fpsText + clip: clipDynamicText anchors.right: parent.right anchors.verticalCenter: spinnerImage.verticalCenter color: "red" diff --git a/basicsuite/ebike-ui/IconifiedTabButton.qml b/basicsuite/ebike-ui/IconifiedTabButton.qml index 4762d94..1095625 100644 --- a/basicsuite/ebike-ui/IconifiedTabButton.qml +++ b/basicsuite/ebike-ui/IconifiedTabButton.qml @@ -44,7 +44,7 @@ TabButton { property var bar background: Rectangle { - color: Colors.tabBackground + color: "transparent" Image { height: parent.height diff --git a/basicsuite/ebike-ui/LightsBox.qml b/basicsuite/ebike-ui/LightsBox.qml index b920864..33ff043 100644 --- a/basicsuite/ebike-ui/LightsBox.qml +++ b/basicsuite/ebike-ui/LightsBox.qml @@ -41,8 +41,8 @@ import "./BikeStyle" // Bottom-left corner, controls Item { - width: root.width * 0.425 - height: root.height * 0.45 + width: parent.width * 0.425 + height: parent.height * 0.45 property real imageMargin: Math.min(width, height) * 0.35 Image { diff --git a/basicsuite/ebike-ui/MainPage.qml b/basicsuite/ebike-ui/MainPage.qml index e459789..9ca9edb 100644 --- a/basicsuite/ebike-ui/MainPage.qml +++ b/basicsuite/ebike-ui/MainPage.qml @@ -42,8 +42,9 @@ import "./BikeStyle" Page { background: Rectangle { - color: Colors.mainBackground + color: "transparent" } + property alias statsButton: statsButton property alias naviButton: naviButton property alias lightsButton: lightsButton @@ -61,7 +62,7 @@ Page { MouseArea { anchors.fill: parent onClicked: { - swipeView.currentIndex = 0 + swipeView.decrementCurrentIndex() } } } @@ -77,7 +78,7 @@ Page { MouseArea { anchors.fill: parent onClicked: { - swipeView.currentIndex = 2 + swipeView.incrementCurrentIndex() } } } diff --git a/basicsuite/ebike-ui/ModeBox.qml b/basicsuite/ebike-ui/ModeBox.qml index 490bc16..7250d30 100644 --- a/basicsuite/ebike-ui/ModeBox.qml +++ b/basicsuite/ebike-ui/ModeBox.qml @@ -42,11 +42,12 @@ import "./BikeStyle" // Bottom-right corner, mode Item { - width: root.width * 0.425 - height: root.height * 0.45 + width: parent.width * 0.425 + height: parent.height * 0.45 Text { id: sportModeText + clip: clipDynamicText anchors { bottom: parent.bottom bottomMargin: parent.height * 0.3 @@ -63,6 +64,7 @@ Item { Text { id: cruiseModeText + clip: clipDynamicText anchors { bottom: sportModeText.top bottomMargin: parent.height * 0.025 diff --git a/basicsuite/ebike-ui/NaviBox.qml b/basicsuite/ebike-ui/NaviBox.qml index 9a97cf8..f02ed95 100644 --- a/basicsuite/ebike-ui/NaviBox.qml +++ b/basicsuite/ebike-ui/NaviBox.qml @@ -42,8 +42,8 @@ import "./BikeStyle" // Top-right corner, navi Item { id: rootItem - width: root.width * 0.425 - height: root.height * 0.45 + width: parent.width * 0.425 + height: parent.height * 0.45 property string arrowSource: "images/nav_right.png" property string distance: "0" property string unit: "m" @@ -71,6 +71,7 @@ Item { Text { id: naviText + clip: clipDynamicText anchors.baseline: container.bottom color: Colors.distanceText font { diff --git a/basicsuite/ebike-ui/NaviGuide.qml b/basicsuite/ebike-ui/NaviGuide.qml index a3c011f..f6fdf25 100644 --- a/basicsuite/ebike-ui/NaviGuide.qml +++ b/basicsuite/ebike-ui/NaviGuide.qml @@ -44,7 +44,7 @@ Rectangle { property string distance: "0" property string unit: "m" - width: root.width * 0.14 + width: parent.width * 0.14 height: width radius: width color: Colors.naviPageGuideBackground diff --git a/basicsuite/ebike-ui/NaviPage.qml b/basicsuite/ebike-ui/NaviPage.qml index 0b6c3e3..217887c 100644 --- a/basicsuite/ebike-ui/NaviPage.qml +++ b/basicsuite/ebike-ui/NaviPage.qml @@ -44,6 +44,11 @@ import "./BikeStyle" Page { id: mapContainer + + background: Rectangle { + color: "transparent" + } + property var startCoordinate: QtPositioning.coordinate(36.131961, -115.153048) property var destinationCoordinate: QtPositioning.coordinate(90, 0) property var targetPlace @@ -183,7 +188,7 @@ Page { delegate: Component { Rectangle { - width: parent.width + width: targetList.width height: UILayout.naviPageSuggestionHeight color: "white" border.color: Colors.naviPageSuggestionsDivider @@ -290,7 +295,7 @@ Page { anchors { right: parent.right bottom: parent.bottom - rightMargin: root.width * 0.015 + rightMargin: parent.width * 0.015 bottomMargin: anchors.rightMargin } arrowSource: naviGuideArrowSource @@ -624,9 +629,15 @@ Page { } } + Binding { + target: mapboxgl + property: 'name' + value: "mapboxgl" + when: navigation.active + } + Plugin { id: mapboxgl - name: "mapboxgl" PluginParameter { name: "mapbox.access_token" value: "pk.eyJ1IjoibWFwYm94NHF0IiwiYSI6ImNpd3J3eDE0eDEzdm8ydHM3YzhzajlrN2oifQ.keEkjqm79SiFDFjnesTcgQ" @@ -635,10 +646,21 @@ Page { name: "mapboxgl.mapping.additional_style_urls" value: "mapbox://styles/mapbox/outdoors-v11" } + PluginParameter { + name: "mapboxgl.mapping.use_fbo" + value: "false" + } } + + Binding { + target: mapbox + property: 'name' + value: "mapbox" + when: navigation.active + } + Plugin { id: mapbox - name: "mapbox" PluginParameter { name: "mapbox.access_token" value: "pk.eyJ1IjoibWFwYm94NHF0IiwiYSI6ImNpd3J3eDE0eDEzdm8ydHM3YzhzajlrN2oifQ.keEkjqm79SiFDFjnesTcgQ" diff --git a/basicsuite/ebike-ui/SpeedView.qml b/basicsuite/ebike-ui/SpeedView.qml index 49be98a..af698df 100644 --- a/basicsuite/ebike-ui/SpeedView.qml +++ b/basicsuite/ebike-ui/SpeedView.qml @@ -41,11 +41,13 @@ import "./BikeStyle" Rectangle { id: speedViewItem objectName: "ebikeSpeedView" - width: root.width * 0.35 + width: parent.width * 0.35 height: width color: "transparent" radius: width z: 1 + layer.enabled: enableLayerForSpeedView + anchors{ verticalCenter: parent.verticalCenter horizontalCenter: parent.horizontalCenter @@ -71,6 +73,7 @@ Rectangle { // Speed info Text { id: speedText + clip: (clipDynamicText && !enableLayerForSpeedView) anchors { horizontalCenter: speedView.horizontalCenter baseline: speedView.bottom @@ -106,6 +109,7 @@ Rectangle { // Average speed info Text { id: averageSpeedText + clip: (clipDynamicText && !enableLayerForSpeedView) anchors { baseline: speedText.baseline baselineOffset: speedInfoTextsOffset @@ -158,6 +162,7 @@ Rectangle { // Assist info Text { id: assistDistanceText + clip: (clipDynamicText && !enableLayerForSpeedView) anchors { baseline: speedText.baseline baselineOffset: speedInfoTextsOffset @@ -419,7 +424,7 @@ Rectangle { anchors.leftMargin: parent.width * 0.075 anchors.bottom: parent.bottom anchors.bottomMargin: parent.height * 0.075 - visible: swipeView.currentIndex != 1 + visible: speedView.state == "CORNERED" } } @@ -521,7 +526,7 @@ Rectangle { onClicked: { if (enlarged) enlarged = false - else if (swipeView.currentIndex === 1) + else if (speedView.state !== "CORNERED") enlarged = true else speedView.showMain() diff --git a/basicsuite/ebike-ui/StandaloneMain.qml b/basicsuite/ebike-ui/StandaloneMain.qml new file mode 100644 index 0000000..ae83a75 --- /dev/null +++ b/basicsuite/ebike-ui/StandaloneMain.qml @@ -0,0 +1,331 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the E-Bike demo project. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import QtQuick.Window 2.10 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 +import QtQuick.VirtualKeyboard 2.1 +import QtQml 2.2 +import DataStore 1.0 + +import "./BikeStyle" + +Window { + id: window + visible: true + color: "#111520" + + /* Updating Text properties dynamically can cause rebuild of whole SceneGraph node tree which is expensive. + Enabling this might help in that case to prevent full rebuild from happening. + More info see https://www.qt.io/blog/2017/01/19/shoot-foot-using-scene-graph-neat-optimization-trick-inside + */ + readonly property bool clipDynamicText: false + + /* SpeedView uses Canvas so it might be optimization when enabling layer for rendering it */ + readonly property bool enableLayerForSpeedView: false + + readonly property int portraitRotation: 90 + property real rotation: Screen.orientation === Qt.PortraitOrientation ? portraitRotation : 0 + property bool rotate: Screen.orientation === Qt.PortraitOrientation ? true : false + contentOrientation: (Screen.orientation === Qt.PortraitOrientation) ? Qt.LandscapeOrientation : Qt.PrimaryOrientation + width: appConf.width + height: appConf.height + + Rectangle { + id: container + transform: Rotation { origin.x: (width/2); origin.y: (width/2); angle: window.rotation} + color: "transparent" + width: rotate ? parent.height : parent.width + height: rotate ? parent.width : parent.height + + // Permanent placeholder for time display + ClockView { + id: clockButton + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + + MouseArea { + anchors.rightMargin: -20 + anchors.leftMargin: -20 + anchors.bottomMargin: -20 + anchors.fill: parent + onClicked: { + drawer.open() + } + } + } + + FpsItem { + anchors.top: parent.top + anchors.left: parent.left + visible: fps.visible + } + + // The always-visible speed view + SpeedView { + id: speedView + onShowMain: swipeView.currentIndex = 1 + showZero: naviPage.targetEdit.activeFocus + property real enlargedMultiplier: 1.19 + property real corneredMultiplier: 0.25 + states: [ + State { + name: "CORNERED" + when: swipeView.currentIndex != 1 + PropertyChanges { + target: speedView + width: parent.width * 0.14 + height: width + anchors.leftMargin: parent.width * 0.015 + anchors.bottomMargin: anchors.leftMargin + color: Colors.speedViewBackgroundCornered + dotcount: UILayout.speedViewDotsMinified + speedTextSize: height * 0.475 + speedBaselineOffset: height * 0.4 + innerRadius: width * 0.45 * 0.875 + speedUnitBaselineOffset: height * 0.1 + speedUnitsSize: height * 0.09 + curvewidth: Math.min(width, height) * 0.055 + } + AnchorChanges { + target: speedView + anchors.horizontalCenter: undefined + anchors.top: undefined + anchors.verticalCenter: undefined + anchors.left: swipeView.left + anchors.bottom: swipeView.bottom + } + PropertyChanges { + target: speedView.cornerRectangle + color: Colors.speedViewBackgroundCornered + } + AnchorChanges { + target: speedView.cornerRectangle + anchors.horizontalCenter: undefined + anchors.verticalCenter: undefined + anchors.left: speedView.left + anchors.bottom: speedView.bottom + } + StateChangeScript { + script: { + musicPlayer.lastMusicPlayerState = musicPlayer.state; + musicPlayer.state = "hidden"; + } + } + }, + State { + name: "ENLARGED" + when: swipeView.currentIndex == 1 && speedView.enlarged + PropertyChanges { + target: speedView + width: parent.width * 0.35 * enlargedMultiplier + height: width + dotcount: UILayout.speedViewDotsEnlarged + speedTextSize: height * 0.4 * enlargedMultiplier + innerRadius: width * 0.45 + speedUnitsSize: height * 0.05 * 1.125 + speedUnitBaselineOffset: height * 0.075 * enlargedMultiplier + speedIconsOffset: width * 0.25 + speedInfoTextsOffset: 0 + speedInfoTextsSize: speedTextSize * 0.45 * enlargedMultiplier + speedInfoUnitsOffset: height * 0.075 * enlargedMultiplier + assistPowerIconOffset: height * 0.175 * enlargedMultiplier + } + PropertyChanges { + target: mainPage.statsButton + anchors.leftMargin: -mainPage.statsButton.width + anchors.topMargin: -mainPage.statsButton.height + } + PropertyChanges { + target: mainPage.naviButton + anchors.rightMargin: -mainPage.naviButton.width + anchors.topMargin: -mainPage.naviButton.height + } + PropertyChanges { + target: mainPage.lightsButton + anchors.leftMargin: -mainPage.statsButton.width + anchors.bottomMargin: -mainPage.statsButton.height + } + PropertyChanges { + target: mainPage.modeButton + anchors.rightMargin: -mainPage.statsButton.width + anchors.bottomMargin: -mainPage.statsButton.height + } + PropertyChanges { + target: clockButton + anchors.topMargin: -clockButton.height + } + AnchorChanges { + target: speedView + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + } + StateChangeScript { + script: { + musicPlayer.lastMusicPlayerState = musicPlayer.state; + musicPlayer.state = "hidden"; + } + } + } + ] + + transitions: [ + Transition { + from: ""; to: "ENLARGED" + NumberAnimation { + properties: "anchors.leftMargin,anchors.rightMargin,anchors.topMargin,anchors.bottomMargin" + duration: 250 + } + NumberAnimation { + properties: "width,height,dotcount,speedTextSize,speedBaselineOffset,innerRadius,speedUnitsSize,speedUnitBaselineOffset,speedIconsOffset,speedInfoTextsOffset,speedInfoTextsSize,speedInfoUnitsOffset,assistPowerIconOffset" + duration: 250 + } + AnchorAnimation { + duration: 250 + } + }, + Transition { + from: "ENLARGED"; to: "" + NumberAnimation { + properties: "anchors.leftMargin,anchors.rightMargin,anchors.topMargin,anchors.bottomMargin" + easing.type: Easing.OutBack + duration: 250 + } + NumberAnimation { + properties: "width,height,dotcount,speedTextSize,speedBaselineOffset,innerRadius,speedUnitsSize,speedUnitBaselineOffset,speedIconsOffset,speedInfoTextsOffset,speedInfoTextsSize,speedInfoUnitsOffset,assistPowerIconOffset" + duration: 250 + } + AnchorAnimation { + duration: 250 + } + }, + Transition { + NumberAnimation { + properties: "width,height,curvewidth,speedTextSize,speedBaselineOffset,innerRadius,speedUnitMargin" + easing.type: Easing.OutBack + duration: 250 + } + ColorAnimation { + duration: 250 + } + AnchorAnimation { + easing.type: Easing.OutBack + duration: 250 + } + } + ] + } + + // Configuration and settings drawer + ConfigurationDrawer { + id: drawer + height: parent.height * 0.475 + width: parent.width + edge: Qt.TopEdge + dragMargin: 20 + } + + // Inactive swipe view, for animations + SwipeView { + id: swipeView + anchors.fill: parent + currentIndex: 1 + interactive: false + + // List of pages + StatsPage { + visible: SwipeView.isCurrentItem + } + MainPage { + id: mainPage + visible: SwipeView.isCurrentItem + naviGuideArrowSource: naviPage.naviGuideArrowSource + naviGuideDistance: naviPage.naviGuideDistance + naviGuideAddress: naviPage.naviGuideAddress + } + NaviPage { + id: naviPage + visible: SwipeView.isCurrentItem + } + } + + // Music player + MusicPlayer { + id: musicPlayer + property string lastMusicPlayerState: "unknown" + visible: (musicPlayer.state == "hidden" ? false : true) + z: 1 + } + + Connections { + target: datastore + function onDemoReset() { drawer.close() } + } + } + + InputPanel { + id: inputPanel + active: !window.rotate + visible: false + z: 99 + y: container.height + anchors.left: container.left + anchors.right: container.right + + states: State { + name: "visible" + when: Qt.inputMethod.visible && !window.rotate + PropertyChanges { + target: inputPanel + y: container.height - inputPanel.height + visible: true + } + } + transitions: Transition { + from: "" + to: "visible" + reversible: true + ParallelAnimation { + NumberAnimation { + properties: "y" + duration: 250 + easing.type: Easing.InOutQuad + } + } + } + } +} diff --git a/basicsuite/ebike-ui/StatsBox.qml b/basicsuite/ebike-ui/StatsBox.qml index 76254db..62c48bd 100644 --- a/basicsuite/ebike-ui/StatsBox.qml +++ b/basicsuite/ebike-ui/StatsBox.qml @@ -42,8 +42,8 @@ import "./BikeStyle" // Top-left corner, stats Item { - width: root.width * 0.425 - height: root.height * 0.45 + width: parent.width * 0.425 + height: parent.height * 0.45 property real imageMargin: Math.min(width, height) * 0.3 Image { @@ -62,6 +62,7 @@ Item { Text { id: tripText + clip: clipDynamicText color: Colors.distanceText anchors { bottom: tripIcon.verticalCenter @@ -108,6 +109,7 @@ Item { Text { id: calText + clip: clipDynamicText color: Colors.distanceText anchors { bottom: calIcon.verticalCenter diff --git a/basicsuite/ebike-ui/StatsPage.qml b/basicsuite/ebike-ui/StatsPage.qml index 9b204f0..5d34c91 100644 --- a/basicsuite/ebike-ui/StatsPage.qml +++ b/basicsuite/ebike-ui/StatsPage.qml @@ -45,7 +45,7 @@ import "moment.js" as Moment Page { id: statsPage background: Rectangle { - color: Colors.mainBackground + color: "transparent" } // Function for pretty-printing duration @@ -104,6 +104,7 @@ Page { Text { id: tripDateText + clip: clipDynamicText anchors { horizontalCenter: parent.horizontalCenter verticalCenter: parent.top @@ -184,6 +185,7 @@ Page { color: "transparent" border.color: "red" width: odometerText.width + odometerUnit.width + odometerDescription.width + 2 * 4 + clip: clipDynamicText anchors { right: parent.right bottom: parent.top @@ -201,7 +203,7 @@ Page { font { family: "Montserrat, Light" weight: Font.Light - pixelSize: root.height * 0.035 + pixelSize: parent.height * 0.035 } } @@ -215,7 +217,7 @@ Page { font { family: "Montserrat, Bold" weight: Font.Bold - pixelSize: root.height * 0.035 + pixelSize: parent.height * 0.035 } } @@ -228,7 +230,7 @@ Page { font { family: "Montserrat, Light" weight: Font.Light - pixelSize: root.height * 0.035 + pixelSize: parent.height * 0.035 } } } @@ -239,13 +241,11 @@ Page { left: parent.left right: parent.right top: endTrip.bottom - leftMargin: root.width * 0.025 - rightMargin: root.width * 0.025 + leftMargin: parent.width * 0.025 + rightMargin: parent.width * 0.025 topMargin: UILayout.statsTopMargin } - height: root.height * 0.2 - // Hide any excess content, since we are using margins - clip: true + height: parent.height * 0.2 // Load data on first show Component.onCompleted: tripdata.refresh() @@ -256,8 +256,10 @@ Page { model: tripdata Column { + clip: clipDynamicText width: tripView.width height: tripView.height + visible: SwipeView.isCurrentItem ColumnSpacer { color: Colors.statsSeparator @@ -304,15 +306,14 @@ Page { anchors { bottom: parent.bottom right: parent.right - bottomMargin: root.height * 0.0125 - rightMargin: root.width * 0.02 + bottomMargin: parent.height * 0.0125 + rightMargin: parent.width * 0.02 top: tripView.bottom left: parent.left - leftMargin: root.width * 0.175 + leftMargin: parent.width * 0.175 } animationRunning: tripView.currentIndex === 0 tripDetails: tripdata.get(currentIndex) currentIndex: tripView.currentIndex - visible: swipeView.currentIndex === 0 } } diff --git a/basicsuite/ebike-ui/TripChart.qml b/basicsuite/ebike-ui/TripChart.qml index 0bc3a7d..01ba457 100644 --- a/basicsuite/ebike-ui/TripChart.qml +++ b/basicsuite/ebike-ui/TripChart.qml @@ -199,7 +199,7 @@ ChartView { [0, 0]] // Animate only if visible on screen - running: animationRunning && (swipeView.currentIndex === 0) + running: animationRunning && parent.visible repeat: true interval: 200 onTriggered: { diff --git a/basicsuite/ebike-ui/app.pro b/basicsuite/ebike-ui/app.pro index d7094dc..c3c0b41 100644 --- a/basicsuite/ebike-ui/app.pro +++ b/basicsuite/ebike-ui/app.pro @@ -1,4 +1,4 @@ -QT += quick +QT += quick widgets quickcontrols2 CONFIG += c++11 TARGET = ebike @@ -8,16 +8,39 @@ TARGET = ebike # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS +# Uncomment to build ebike demo as separate which does not rely on shared functionality of B2qt launcher +#DEFINES += STANDALONE + +# Uncomment to use only app provided fonts and not common shared fonts +# When providing own fonts use fonts.files and fonts.qrc file to provide those +DEFINES += USE_APP_FONTS + # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 +contains(DEFINES, STANDALONE) { + SOURCES += \ + main.cpp \ + applicationsettings.cpp + + HEADERS += \ + applicationsettings.h + + content.files = \ + StandaloneMain.qml + + RESOURCES += qc2conf.qrc +} else { + content.files += \ + qtquickcontrols2.conf +} + include(../shared/shared.pri) -b2qtdemo_deploy_defaults() -content.files = \ - qtquickcontrols2.conf \ + +content.files += \ main.qml \ NaviPage.qml \ StatsPage.qml \ @@ -39,21 +62,13 @@ content.files = \ NaviGuide.qml \ NaviTripInfo.qml \ ViewTab.qml \ - moment.js \ StatsRow.qml \ ConfigurationItem.qml \ NaviButton.qml \ ToggleSwitch.qml \ + moment.js \ mostrecent.bson -content.path = $$DESTPATH - -style.files = \ - BikeStyle/Colors.qml \ - BikeStyle/qmldir \ - BikeStyle/UILayout.qml - - images.files = \ images/lights_off.png \ images/lights_on.png \ @@ -120,21 +135,34 @@ images.files = \ images/bike-light.png \ images/blue_circle_gps_area.png -OTHER_FILES += $${images.files} -INSTALLS += images -images.path = $$DESTPATH/images -export(images.files) -export(images.path) +style.files = \ + BikeStyle/Colors.qml \ + BikeStyle/qmldir \ + BikeStyle/UILayout.qml -OTHER_FILES += $${style.files} -INSTALLS += style style.path = $$DESTPATH/BikeStyle -export(style.files) -export(style.path) -export(OTHER_FILES) -export(INSTALLS) - - -OTHER_FILES += $${content.files} -INSTALLS += target content +fonts.files = \ + fonts/Montserrat-BlackItalic.ttf \ + fonts/Montserrat-Bold.ttf \ + fonts/Montserrat-ExtraLightItalic.ttf \ + fonts/Montserrat-LightItalic.ttf \ + fonts/Montserrat-Medium.ttf \ + fonts/Montserrat-SemiBold.ttf \ + fonts/Montserrat-Black.ttf \ + fonts/Montserrat-ExtraBoldItalic.ttf \ + fonts/Montserrat-ExtraLight.ttf \ + fonts/Montserrat-Light.ttf \ + fonts/Montserrat-Regular.ttf \ + fonts/Montserrat-ThinItalic.ttf \ + fonts/Montserrat-BoldItalic.ttf \ + fonts/Montserrat-ExtraBold.ttf \ + fonts/Montserrat-Italic.ttf \ + fonts/Montserrat-MediumItalic.ttf \ + fonts/Montserrat-SemiBoldItalic.ttf \ + fonts/Montserrat-Thin.ttf \ + fonts/Teko-Bold.ttf \ + fonts/Teko-Regular.ttf \ + fonts/Teko-Medium.ttf \ + fonts/Teko-Light.ttf \ + fonts/Teko-SemiBold.ttf diff --git a/basicsuite/ebike-ui/applicationsettings.cpp b/basicsuite/ebike-ui/applicationsettings.cpp new file mode 100644 index 0000000..ad7af51 --- /dev/null +++ b/basicsuite/ebike-ui/applicationsettings.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Device Creation. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "applicationsettings.h" + +#ifdef QT_WIDGETS_LIB +#include <QApplication> +#elif QT_GUI_LIB +#include <QGuiApplication> +#endif +#include <QScreen> + +ApplicationSettings::ApplicationSettings(QObject *parent) + : QObject(parent) +{ +#ifdef QT_WIDGETS_LIB + m_screen = qApp->primaryScreen(); +#elif QT_GUI_LIB + m_screen = qGuiApp->primaryScreen(); +#endif + +#if QT_CONFIG(cross_compile) + if (m_screen->orientation() == Qt::PortraitOrientation) { + m_width = m_screen->availableGeometry().height(); + m_height = m_screen->availableGeometry().width(); + } else { + m_width = m_screen->availableGeometry().width(); + m_height = m_screen->availableGeometry().height(); + } +#endif +} + +bool ApplicationSettings::isDesktop() +{ +#if !QT_CONFIG(cross_compile) + m_isDesktop = true; +#endif + return m_isDesktop; +} + +bool ApplicationSettings::isHighDpi() +{ + return (m_screen->devicePixelRatio() >= 2.0); +} + +int ApplicationSettings::width() +{ + return m_width; +} + +int ApplicationSettings::height() +{ + return m_height; +} + diff --git a/basicsuite/ebike-ui/applicationsettings.h b/basicsuite/ebike-ui/applicationsettings.h new file mode 100644 index 0000000..baadf5d --- /dev/null +++ b/basicsuite/ebike-ui/applicationsettings.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Device Creation. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef APPLICATIONSETTINGS_H +#define APPLICATIONSETTINGS_H + +#include <QObject> + +class QScreen; +class ApplicationSettings : public QObject +{ + Q_OBJECT + Q_PROPERTY(int width READ width NOTIFY widthChanged) + Q_PROPERTY(int height READ height NOTIFY heightChanged) + Q_PROPERTY(bool isDesktop READ isDesktop NOTIFY isDesktopChanged) + Q_PROPERTY(bool isHighDpi READ isHighDpi NOTIFY isHighDpiChanged) +public: + explicit ApplicationSettings(QObject *parent = 0); + + int width(); + int height(); + bool isDesktop(); + bool isHighDpi(); + +signals: + void widthChanged(int width); + void heightChanged(bool height); + void isDesktopChanged(bool isDesktop); + void isHighDpiChanged(bool isHighDpi); + +private: + QScreen *m_screen = nullptr; + int m_width = 1280; + int m_height = 720; + bool m_isDesktop = false; + +}; + +#endif // APPLICATIONSETTINGS_H diff --git a/basicsuite/ebike-ui/brightnesscontroller.cpp b/basicsuite/ebike-ui/datamodelplugin/brightnesscontroller.cpp index a6e2e30..a6e2e30 100644 --- a/basicsuite/ebike-ui/brightnesscontroller.cpp +++ b/basicsuite/ebike-ui/datamodelplugin/brightnesscontroller.cpp diff --git a/basicsuite/ebike-ui/brightnesscontroller.h b/basicsuite/ebike-ui/datamodelplugin/brightnesscontroller.h index 7b85f58..7b85f58 100644 --- a/basicsuite/ebike-ui/brightnesscontroller.h +++ b/basicsuite/ebike-ui/datamodelplugin/brightnesscontroller.h diff --git a/basicsuite/ebike-ui/datamodelplugin/datamodelplugin.pro b/basicsuite/ebike-ui/datamodelplugin/datamodelplugin.pro index ce22eec..98515ef 100644 --- a/basicsuite/ebike-ui/datamodelplugin/datamodelplugin.pro +++ b/basicsuite/ebike-ui/datamodelplugin/datamodelplugin.pro @@ -1,39 +1,31 @@ TEMPLATE = lib CONFIG += plugin -QT += qml quick positioning charts +QT += quick positioning TARGET = ebikedatamodelplugin +QML_MODULENAME = DataStore SOURCES += plugin.cpp \ - $$PWD/../socketclient.cpp \ - $$PWD/../datastore.cpp \ - $$PWD/../navigation.cpp \ - $$PWD/../mapboxsuggestions.cpp \ - $$PWD/../suggestionsmodel.cpp \ - $$PWD/../mapbox.cpp \ - $$PWD/../brightnesscontroller.cpp \ - $$PWD/../fpscounter.cpp \ - $$PWD/../tripdatamodel.cpp + socketclient.cpp \ + datastore.cpp \ + navigation.cpp \ + mapboxsuggestions.cpp \ + suggestionsmodel.cpp \ + mapbox.cpp \ + brightnesscontroller.cpp \ + fpscounter.cpp \ + tripdatamodel.cpp HEADERS += \ - $$PWD/../socketclient.h \ - $$PWD/../datastore.h \ - $$PWD/../navigation.h \ - $$PWD/../mapboxsuggestions.h \ - $$PWD/../suggestionsmodel.h \ - $$PWD/../mapbox.h \ - $$PWD/../brightnesscontroller.h \ - $$PWD/../fpscounter.h \ - $$PWD/../tripdatamodel.h - -INCLUDEPATH += $$PWD/../ - -pluginfiles.files += \ - qmldir \ - -B2QT_DEPLOYPATH = /data/user/qt/qmlplugins/DataStore -target.path += $$B2QT_DEPLOYPATH -pluginfiles.path += $$B2QT_DEPLOYPATH - -INSTALLS += target pluginfiles - + socketclient.h \ + datastore.h \ + navigation.h \ + mapboxsuggestions.h \ + suggestionsmodel.h \ + mapbox.h \ + brightnesscontroller.h \ + fpscounter.h \ + tripdatamodel.h + +top_builddir=$$shadowed($$PWD/../) +include(../../shared/shared_plugin.pri) diff --git a/basicsuite/ebike-ui/datastore.cpp b/basicsuite/ebike-ui/datamodelplugin/datastore.cpp index 73567ac..73567ac 100644 --- a/basicsuite/ebike-ui/datastore.cpp +++ b/basicsuite/ebike-ui/datamodelplugin/datastore.cpp diff --git a/basicsuite/ebike-ui/datastore.h b/basicsuite/ebike-ui/datamodelplugin/datastore.h index 20fa388..20fa388 100644 --- a/basicsuite/ebike-ui/datastore.h +++ b/basicsuite/ebike-ui/datamodelplugin/datastore.h diff --git a/basicsuite/ebike-ui/fpscounter.cpp b/basicsuite/ebike-ui/datamodelplugin/fpscounter.cpp index 137dcb4..137dcb4 100644 --- a/basicsuite/ebike-ui/fpscounter.cpp +++ b/basicsuite/ebike-ui/datamodelplugin/fpscounter.cpp diff --git a/basicsuite/ebike-ui/fpscounter.h b/basicsuite/ebike-ui/datamodelplugin/fpscounter.h index 7828844..7828844 100644 --- a/basicsuite/ebike-ui/fpscounter.h +++ b/basicsuite/ebike-ui/datamodelplugin/fpscounter.h diff --git a/basicsuite/ebike-ui/mapbox.cpp b/basicsuite/ebike-ui/datamodelplugin/mapbox.cpp index 9d2303d..9d2303d 100644 --- a/basicsuite/ebike-ui/mapbox.cpp +++ b/basicsuite/ebike-ui/datamodelplugin/mapbox.cpp diff --git a/basicsuite/ebike-ui/mapbox.h b/basicsuite/ebike-ui/datamodelplugin/mapbox.h index 5bd295f..5bd295f 100644 --- a/basicsuite/ebike-ui/mapbox.h +++ b/basicsuite/ebike-ui/datamodelplugin/mapbox.h diff --git a/basicsuite/ebike-ui/mapboxsuggestions.cpp b/basicsuite/ebike-ui/datamodelplugin/mapboxsuggestions.cpp index 3f66766..3f66766 100644 --- a/basicsuite/ebike-ui/mapboxsuggestions.cpp +++ b/basicsuite/ebike-ui/datamodelplugin/mapboxsuggestions.cpp diff --git a/basicsuite/ebike-ui/mapboxsuggestions.h b/basicsuite/ebike-ui/datamodelplugin/mapboxsuggestions.h index 8dc1506..8dc1506 100644 --- a/basicsuite/ebike-ui/mapboxsuggestions.h +++ b/basicsuite/ebike-ui/datamodelplugin/mapboxsuggestions.h diff --git a/basicsuite/ebike-ui/navigation.cpp b/basicsuite/ebike-ui/datamodelplugin/navigation.cpp index 067636e..067636e 100644 --- a/basicsuite/ebike-ui/navigation.cpp +++ b/basicsuite/ebike-ui/datamodelplugin/navigation.cpp diff --git a/basicsuite/ebike-ui/navigation.h b/basicsuite/ebike-ui/datamodelplugin/navigation.h index 6c9533f..6c9533f 100644 --- a/basicsuite/ebike-ui/navigation.h +++ b/basicsuite/ebike-ui/datamodelplugin/navigation.h diff --git a/basicsuite/ebike-ui/datamodelplugin/plugin.cpp b/basicsuite/ebike-ui/datamodelplugin/plugin.cpp index 098a6a8..870d418 100644 --- a/basicsuite/ebike-ui/datamodelplugin/plugin.cpp +++ b/basicsuite/ebike-ui/datamodelplugin/plugin.cpp @@ -70,7 +70,7 @@ class QExampleQmlPlugin : public QQmlExtensionPlugin public: - void registerTypes(const char *uri) + void registerTypes(const char *uri) { Q_UNUSED(uri); qmlRegisterType<DataStore>("DataStore", 1, 0, "DataStore"); @@ -89,7 +89,7 @@ public: MapBoxSuggestions *suggest = new MapBoxSuggestions(mapbox, engine); // Setup navigation container - Navigation *navi = new Navigation(mapbox, engine); + Navigation *navi = new Navigation(nullptr, engine); // Brightness controller BrightnessController *brightness = new BrightnessController(engine); diff --git a/basicsuite/ebike-ui/socketclient.cpp b/basicsuite/ebike-ui/datamodelplugin/socketclient.cpp index d40d268..d40d268 100644 --- a/basicsuite/ebike-ui/socketclient.cpp +++ b/basicsuite/ebike-ui/datamodelplugin/socketclient.cpp diff --git a/basicsuite/ebike-ui/socketclient.h b/basicsuite/ebike-ui/datamodelplugin/socketclient.h index dc100a2..dc100a2 100644 --- a/basicsuite/ebike-ui/socketclient.h +++ b/basicsuite/ebike-ui/datamodelplugin/socketclient.h diff --git a/basicsuite/ebike-ui/suggestionsmodel.cpp b/basicsuite/ebike-ui/datamodelplugin/suggestionsmodel.cpp index fa028f0..fa028f0 100644 --- a/basicsuite/ebike-ui/suggestionsmodel.cpp +++ b/basicsuite/ebike-ui/datamodelplugin/suggestionsmodel.cpp diff --git a/basicsuite/ebike-ui/suggestionsmodel.h b/basicsuite/ebike-ui/datamodelplugin/suggestionsmodel.h index 5bf22b5..5bf22b5 100644 --- a/basicsuite/ebike-ui/suggestionsmodel.h +++ b/basicsuite/ebike-ui/datamodelplugin/suggestionsmodel.h diff --git a/basicsuite/ebike-ui/tripdatamodel.cpp b/basicsuite/ebike-ui/datamodelplugin/tripdatamodel.cpp index b74605f..b74605f 100644 --- a/basicsuite/ebike-ui/tripdatamodel.cpp +++ b/basicsuite/ebike-ui/datamodelplugin/tripdatamodel.cpp diff --git a/basicsuite/ebike-ui/tripdatamodel.h b/basicsuite/ebike-ui/datamodelplugin/tripdatamodel.h index 56be84e..56be84e 100644 --- a/basicsuite/ebike-ui/tripdatamodel.h +++ b/basicsuite/ebike-ui/datamodelplugin/tripdatamodel.h diff --git a/basicsuite/ebike-ui/ebike-ui.pro b/basicsuite/ebike-ui/ebike-ui.pro index 70443af..67af517 100644 --- a/basicsuite/ebike-ui/ebike-ui.pro +++ b/basicsuite/ebike-ui/ebike-ui.pro @@ -4,4 +4,3 @@ CONFIG += ordered SUBDIRS += \ datamodelplugin \ app.pro - diff --git a/basicsuite/ebike-ui/fonts.qrc b/basicsuite/ebike-ui/fonts.qrc new file mode 100644 index 0000000..cd178fb --- /dev/null +++ b/basicsuite/ebike-ui/fonts.qrc @@ -0,0 +1,12 @@ +<RCC> + <qresource prefix="/"> + <file>fonts/Montserrat-Bold.ttf</file> + <file>fonts/Montserrat-Light.ttf</file> + <file>fonts/Montserrat-Medium.ttf</file> + <file>fonts/Montserrat-Regular.ttf</file> + <file>fonts/Teko-Bold.ttf</file> + <file>fonts/Teko-Light.ttf</file> + <file>fonts/Teko-Medium.ttf</file> + <file>fonts/Teko-Regular.ttf</file> + </qresource> +</RCC> diff --git a/basicsuite/ebike-ui/fonts/fontawesome-webfont.ttf b/basicsuite/ebike-ui/fonts/fontawesome-webfont.ttf Binary files differdeleted file mode 100644 index 35acda2..0000000 --- a/basicsuite/ebike-ui/fonts/fontawesome-webfont.ttf +++ /dev/null diff --git a/basicsuite/ebike-ui/main.cpp b/basicsuite/ebike-ui/main.cpp new file mode 100644 index 0000000..e0cacb2 --- /dev/null +++ b/basicsuite/ebike-ui/main.cpp @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of Qt for Device Creation. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <QtWidgets/QApplication> +#include <QtQml/QQmlApplicationEngine> +#include <QQmlContext> +#include <QtGui/QFontDatabase> +#include <QDir> + +#include "applicationsettings.h" + +#if defined(USE_QTWEBENGINE) +#include <qtwebengineglobal.h> +#endif + +int main(int argc, char **argv) +{ +#if defined(USE_QTWEBENGINE) + // This is currently needed by all QtWebEngine applications using the HW accelerated QQuickWebView. + // It enables sharing the QOpenGLContext of all QQuickWindows of the application. + // We have to do so until we expose public API for it in Qt or choose to enable it by default. + QtWebEngine::initialize(); +#endif + + // VKB is active also for desktop + qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); + + // TODO: On high dpi displays this breaks the layout + //QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + QApplication app(argc, argv); + + ApplicationSettings applicationSettings; + + bool fontsAsResource = false; + QStringList fonts; + QDir fontsResource(QStringLiteral(":/fonts")); + if (fontsResource.exists()) { + fontsAsResource = true; + fonts = fontsResource.entryList(); + } else { + QDir fontsDirectory(QCoreApplication::applicationDirPath() + QStringLiteral("/fonts")); + fonts = fontsDirectory.entryList(); + } + + if (fonts.isEmpty()) + qWarning() << "No fonts provided, using system default!"; + + QString path = fontsAsResource ? QStringLiteral(":/fonts/") : QCoreApplication::applicationDirPath() + QStringLiteral("/fonts/"); + for (int i = 0; i < fonts.size(); ++i) + QFontDatabase::addApplicationFont(path + fonts.at(i)); + + QQmlApplicationEngine applicationengine; + +#if !QT_CONFIG(cross_compile) + applicationengine.addImportPath(QCoreApplication::applicationDirPath() + "/qmlplugins"); +#else + applicationengine.addImportPath("/data/user/qt/qmlplugins"); +#endif + applicationengine.rootContext()->setContextProperty("appConf", &applicationSettings); + applicationengine.load(QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + "/StandaloneMain.qml")); + + app.exec(); +} diff --git a/basicsuite/ebike-ui/main.qml b/basicsuite/ebike-ui/main.qml index 22396d1..bb2b403 100644 --- a/basicsuite/ebike-ui/main.qml +++ b/basicsuite/ebike-ui/main.qml @@ -243,15 +243,19 @@ Rectangle { interactive: false // List of pages - StatsPage {} + StatsPage { + visible: SwipeView.isCurrentItem + } MainPage { id: mainPage + visible: SwipeView.isCurrentItem naviGuideArrowSource: naviPage.naviGuideArrowSource naviGuideDistance: naviPage.naviGuideDistance naviGuideAddress: naviPage.naviGuideAddress } NaviPage { id: naviPage; + visible: SwipeView.isCurrentItem } } @@ -259,6 +263,7 @@ Rectangle { MusicPlayer { id: musicPlayer property string lastMusicPlayerState: "unknown" + visible: (musicPlayer.state == "hidden" ? false : true) z: 1 } diff --git a/basicsuite/ebike-ui/qc2conf.qrc b/basicsuite/ebike-ui/qc2conf.qrc new file mode 100644 index 0000000..4fbf17b --- /dev/null +++ b/basicsuite/ebike-ui/qc2conf.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>qtquickcontrols2.conf</file> + </qresource> +</RCC> |