summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--basicsuite/camera/app.pro10
-rw-r--r--basicsuite/camera/camera.pro2
-rw-r--r--basicsuite/camera/camerautils/camerautils.pro12
-rw-r--r--basicsuite/ebike-ui/ClockView.qml7
-rw-r--r--basicsuite/ebike-ui/ConfigurationDrawer.qml11
-rw-r--r--basicsuite/ebike-ui/FpsItem.qml1
-rw-r--r--basicsuite/ebike-ui/IconifiedTabButton.qml2
-rw-r--r--basicsuite/ebike-ui/LightsBox.qml4
-rw-r--r--basicsuite/ebike-ui/MainPage.qml7
-rw-r--r--basicsuite/ebike-ui/ModeBox.qml6
-rw-r--r--basicsuite/ebike-ui/NaviBox.qml5
-rw-r--r--basicsuite/ebike-ui/NaviGuide.qml2
-rw-r--r--basicsuite/ebike-ui/NaviPage.qml30
-rw-r--r--basicsuite/ebike-ui/SpeedView.qml11
-rw-r--r--basicsuite/ebike-ui/StandaloneMain.qml331
-rw-r--r--basicsuite/ebike-ui/StatsBox.qml6
-rw-r--r--basicsuite/ebike-ui/StatsPage.qml27
-rw-r--r--basicsuite/ebike-ui/TripChart.qml2
-rw-r--r--basicsuite/ebike-ui/app.pro84
-rw-r--r--basicsuite/ebike-ui/applicationsettings.cpp80
-rw-r--r--basicsuite/ebike-ui/applicationsettings.h65
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/brightnesscontroller.cpp (renamed from basicsuite/ebike-ui/brightnesscontroller.cpp)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/brightnesscontroller.h (renamed from basicsuite/ebike-ui/brightnesscontroller.h)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/datamodelplugin.pro54
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/datastore.cpp (renamed from basicsuite/ebike-ui/datastore.cpp)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/datastore.h (renamed from basicsuite/ebike-ui/datastore.h)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/fpscounter.cpp (renamed from basicsuite/ebike-ui/fpscounter.cpp)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/fpscounter.h (renamed from basicsuite/ebike-ui/fpscounter.h)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/mapbox.cpp (renamed from basicsuite/ebike-ui/mapbox.cpp)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/mapbox.h (renamed from basicsuite/ebike-ui/mapbox.h)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/mapboxsuggestions.cpp (renamed from basicsuite/ebike-ui/mapboxsuggestions.cpp)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/mapboxsuggestions.h (renamed from basicsuite/ebike-ui/mapboxsuggestions.h)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/navigation.cpp (renamed from basicsuite/ebike-ui/navigation.cpp)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/navigation.h (renamed from basicsuite/ebike-ui/navigation.h)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/plugin.cpp4
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/socketclient.cpp (renamed from basicsuite/ebike-ui/socketclient.cpp)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/socketclient.h (renamed from basicsuite/ebike-ui/socketclient.h)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/suggestionsmodel.cpp (renamed from basicsuite/ebike-ui/suggestionsmodel.cpp)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/suggestionsmodel.h (renamed from basicsuite/ebike-ui/suggestionsmodel.h)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/tripdatamodel.cpp (renamed from basicsuite/ebike-ui/tripdatamodel.cpp)0
-rw-r--r--basicsuite/ebike-ui/datamodelplugin/tripdatamodel.h (renamed from basicsuite/ebike-ui/tripdatamodel.h)0
-rw-r--r--basicsuite/ebike-ui/ebike-ui.pro1
-rw-r--r--basicsuite/ebike-ui/fonts.qrc12
-rw-r--r--basicsuite/ebike-ui/fonts/fontawesome-webfont.ttfbin165548 -> 0 bytes
-rw-r--r--basicsuite/ebike-ui/main.cpp110
-rw-r--r--basicsuite/ebike-ui/main.qml7
-rw-r--r--basicsuite/ebike-ui/qc2conf.qrc5
-rw-r--r--basicsuite/enterprise-charts/enterprise-charts.pro10
-rw-r--r--basicsuite/graphicaleffects/graphicaleffects.pro15
-rw-r--r--basicsuite/mediaplayer/mediaplayer.pro18
-rw-r--r--basicsuite/qtquickcontrols2/qtquickcontrols2.pro27
-rw-r--r--basicsuite/qtwebbrowser/app.pro12
-rw-r--r--basicsuite/qtwebbrowser/lib.pro15
-rw-r--r--basicsuite/shared/SharedMain.qml9
-rw-r--r--basicsuite/shared/fonts.qrc19
-rw-r--r--basicsuite/shared/main.cpp109
-rw-r--r--basicsuite/shared/shared.pri120
-rw-r--r--basicsuite/shared/shared_fonts.qrc10
-rw-r--r--basicsuite/shared/shared_plugin.pri17
-rw-r--r--basicsuite/textinput/textinput.pro7
-rw-r--r--startupscreen/UsbModeDialog.qml4
61 files changed, 989 insertions, 301 deletions
diff --git a/basicsuite/camera/app.pro b/basicsuite/camera/app.pro
index 96a02a4..f1aed68 100644
--- a/basicsuite/camera/app.pro
+++ b/basicsuite/camera/app.pro
@@ -1,23 +1,17 @@
+QT += quick quickcontrols2
TARGET = camera
include(../shared/shared.pri)
-b2qtdemo_deploy_defaults()
content.files = \
+ main.qml \
CameraControlButton.qml \
CameraSetting.qml \
CaptureControl.qml \
CapturePreview.qml \
Controls.qml \
FocusControl.qml \
- main.qml \
Picker.qml \
RecordingTime.qml \
Slider.qml \
ZoomControl.qml
-
-content.path = $$DESTPATH
-
-OTHER_FILES += $${content.files}
-
-INSTALLS += target content
diff --git a/basicsuite/camera/camera.pro b/basicsuite/camera/camera.pro
index 7d9c9f1..33bd951 100644
--- a/basicsuite/camera/camera.pro
+++ b/basicsuite/camera/camera.pro
@@ -1,7 +1,5 @@
TEMPLATE = subdirs
-CONFIG += ordered
SUBDIRS += \
camerautils \
app.pro
-
diff --git a/basicsuite/camera/camerautils/camerautils.pro b/basicsuite/camera/camerautils/camerautils.pro
index 7e5864e..a896f35 100644
--- a/basicsuite/camera/camerautils/camerautils.pro
+++ b/basicsuite/camera/camerautils/camerautils.pro
@@ -3,18 +3,12 @@ CONFIG += plugin
QT += qml multimedia
TARGET = camerautilsplugin
+QML_MODULENAME = CameraUtils
SOURCES += plugin.cpp \
camerautils.cpp
HEADERS += camerautils.h
-pluginfiles.files += \
- qmldir \
-
-B2QT_DEPLOYPATH = /data/user/qt/qmlplugins/CameraUtils
-target.path += $$B2QT_DEPLOYPATH
-pluginfiles.path += $$B2QT_DEPLOYPATH
-
-INSTALLS += target pluginfiles
-
+top_builddir=$$shadowed($$PWD/../)
+include(../../shared/shared_plugin.pri)
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..28d73fa 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
deleted file mode 100644
index 35acda2..0000000
--- a/basicsuite/ebike-ui/fonts/fontawesome-webfont.ttf
+++ /dev/null
Binary files differ
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>
diff --git a/basicsuite/enterprise-charts/enterprise-charts.pro b/basicsuite/enterprise-charts/enterprise-charts.pro
index b71e6eb..06ea11b 100644
--- a/basicsuite/enterprise-charts/enterprise-charts.pro
+++ b/basicsuite/enterprise-charts/enterprise-charts.pro
@@ -1,12 +1,12 @@
+QT += quick widgets
TARGET = enterprise-charts
include(../shared/shared.pri)
-b2qtdemo_deploy_defaults()
content.files = \
+ main.qml \
BaseChart.qml \
loader.qml \
- main.qml \
View1.qml \
View10.qml \
View11.qml \
@@ -19,9 +19,3 @@ content.files = \
View7.qml \
View8.qml \
View9.qml \
-
-content.path = $$DESTPATH
-
-OTHER_FILES += $${content.files}
-
-INSTALLS += target content
diff --git a/basicsuite/graphicaleffects/graphicaleffects.pro b/basicsuite/graphicaleffects/graphicaleffects.pro
index da9e8a3..508ede4 100644
--- a/basicsuite/graphicaleffects/graphicaleffects.pro
+++ b/basicsuite/graphicaleffects/graphicaleffects.pro
@@ -1,7 +1,6 @@
TARGET = graphicaleffects
include(../shared/shared.pri)
-b2qtdemo_deploy_defaults()
content.files = \
Checkers.qml \
@@ -16,11 +15,11 @@ content.files = \
effect_HueSaturation.qml \
effect_OpacityMask.qml \
effect_ThresholdMask.qml \
- main.qml \
- images \
+ main.qml
-content.path = $$DESTPATH
-
-OTHER_FILES += $${content.files}
-
-INSTALLS += target content
+!contains(DEFINES, DESKTOP_BUILD) {
+ content.files += \
+ images
+} else {
+ copyToDestDir($$PWD/images, $$OUT_PWD)
+}
diff --git a/basicsuite/mediaplayer/mediaplayer.pro b/basicsuite/mediaplayer/mediaplayer.pro
index c56ba88..1b8c52d 100644
--- a/basicsuite/mediaplayer/mediaplayer.pro
+++ b/basicsuite/mediaplayer/mediaplayer.pro
@@ -1,7 +1,6 @@
TARGET = mediaplayer
include(../shared/shared.pri)
-b2qtdemo_deploy_defaults()
content.files = \
Content.qml \
@@ -18,12 +17,13 @@ content.files = \
PlayerSlider.qml \
SeekControl.qml \
UrlBar.qml \
- VolumeControl.qml \
- Effects \
- images
+ VolumeControl.qml
-content.path = $$DESTPATH
-
-OTHER_FILES += $${content.files}
-
-INSTALLS += target content
+!contains(DEFINES, DESKTOP_BUILD) {
+ content.files += \
+ Effects \
+ images
+} else {
+ copyToDestDir($$PWD/Effects, $$OUT_PWD)
+ copyToDestDir($$PWD/images, $$OUT_PWD)
+}
diff --git a/basicsuite/qtquickcontrols2/qtquickcontrols2.pro b/basicsuite/qtquickcontrols2/qtquickcontrols2.pro
index a0ecaf5..52f7dd6 100644
--- a/basicsuite/qtquickcontrols2/qtquickcontrols2.pro
+++ b/basicsuite/qtquickcontrols2/qtquickcontrols2.pro
@@ -1,17 +1,18 @@
TARGET = qtquickcontrols2
include(../shared/shared.pri)
-b2qtdemo_deploy_defaults()
-content.files = \
- $$PWD/main.qml \
- $$PWD/qtquickcontrols2.conf \
- $$PWD/images \
- $$PWD/icons \
- $$PWD/pages
-
-content.path = $$DESTPATH
-
-OTHER_FILES += $${content.files}
-
-INSTALLS += target content
+!contains(DEFINES, DESKTOP_BUILD) {
+ content.files += \
+ qtquickcontrols2.conf \
+ images \
+ icons \
+ pages
+} else {
+ # shared.pri uses COPIES on desktop which cannot copy
+ # directories
+ copyToDestDir($$PWD/qtquickcontrols2.conf, $$OUT_PWD)
+ copyToDestDir($$PWD/images, $$OUT_PWD)
+ copyToDestDir($$PWD/icons, $$OUT_PWD)
+ copyToDestDir($$PWD/pages, $$OUT_PWD)
+}
diff --git a/basicsuite/qtwebbrowser/app.pro b/basicsuite/qtwebbrowser/app.pro
index a64f9f0..8bc4b9e 100644
--- a/basicsuite/qtwebbrowser/app.pro
+++ b/basicsuite/qtwebbrowser/app.pro
@@ -1,13 +1,11 @@
TARGET = qtwebbrowser
+qtHaveModule(webengine) {
+ DEFINES += USE_QTWEBENGINE
+ QT += webengine
+}
+
include(../shared/shared.pri)
-b2qtdemo_deploy_defaults()
content.files = \
main.qml
-
-content.path = $$DESTPATH
-
-OTHER_FILES += $${content.files}
-
-INSTALLS += target content
diff --git a/basicsuite/qtwebbrowser/lib.pro b/basicsuite/qtwebbrowser/lib.pro
index 16152f2..ac0f03e 100644
--- a/basicsuite/qtwebbrowser/lib.pro
+++ b/basicsuite/qtwebbrowser/lib.pro
@@ -1,8 +1,10 @@
TEMPLATE = lib
-TARGET = webbrowser
QT += qml quick
CONFIG += qt plugin
+TARGET = webbrowser
+QML_MODULENAME = WebBrowser
+
INCLUDEPATH += tqtc-qtwebbrowser/src
HEADERS += \
@@ -16,14 +18,7 @@ SOURCES += \
tqtc-qtwebbrowser/src/touchtracker.cpp \
tqtc-qtwebbrowser/src/navigationhistoryproxymodel.cpp
-pluginfiles.files += \
- qmldir
+top_builddir=$$shadowed($$PWD)
+include(../shared/shared_plugin.pri)
RESOURCES += tqtc-qtwebbrowser/src/resources.qrc
-
-B2QT_DEPLOYPATH = /data/user/qt/qmlplugins/WebBrowser
-
-target.path = $$B2QT_DEPLOYPATH
-pluginfiles.path = $$B2QT_DEPLOYPATH
-
-INSTALLS += target pluginfiles
diff --git a/basicsuite/shared/SharedMain.qml b/basicsuite/shared/SharedMain.qml
index ec6d13b..543355c 100644
--- a/basicsuite/shared/SharedMain.qml
+++ b/basicsuite/shared/SharedMain.qml
@@ -60,6 +60,15 @@ Window {
color: "black"
+ /* 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
+
Item {
id: root
anchors.centerIn: window.contentItem
diff --git a/basicsuite/shared/fonts.qrc b/basicsuite/shared/fonts.qrc
deleted file mode 100644
index ccc8864..0000000
--- a/basicsuite/shared/fonts.qrc
+++ /dev/null
@@ -1,19 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>fonts/TitilliumWeb-Black.ttf</file>
- <file>fonts/TitilliumWeb-Bold.ttf</file>
- <file>fonts/TitilliumWeb-ExtraLight.ttf</file>
- <file>fonts/TitilliumWeb-Light.ttf</file>
- <file>fonts/TitilliumWeb-Regular.ttf</file>
- <file>fonts/TitilliumWeb-SemiBold.ttf</file>
- <file>fonts/ebike-fonts/fontawesome-webfont.ttf</file>
- <file>fonts/ebike-fonts/Montserrat-Bold.ttf</file>
- <file>fonts/ebike-fonts/Montserrat-Light.ttf</file>
- <file>fonts/ebike-fonts/Montserrat-Medium.ttf</file>
- <file>fonts/ebike-fonts/Montserrat-Regular.ttf</file>
- <file>fonts/ebike-fonts/Teko-Bold.ttf</file>
- <file>fonts/ebike-fonts/Teko-Light.ttf</file>
- <file>fonts/ebike-fonts/Teko-Medium.ttf</file>
- <file>fonts/ebike-fonts/Teko-Regular.ttf</file>
- </qresource>
-</RCC>
diff --git a/basicsuite/shared/main.cpp b/basicsuite/shared/main.cpp
index 9e27596..b3e2253 100644
--- a/basicsuite/shared/main.cpp
+++ b/basicsuite/shared/main.cpp
@@ -48,24 +48,24 @@
**
****************************************************************************/
#include <QtCore/QDebug>
-// QtWidget (QApplication) dependecy is required by QtCharts demo,
-// when QtWidget dependecy is not required use QGuiApplication from QtGui module
-#include <QtWidgets/QApplication>
+#ifdef QT_WIDGETS_LIB
+#include <QApplication>
+#elif QT_GUI_LIB
+#include <QGuiApplication>
+#endif
#include <QtGui/QFont>
#include <QtGui/QFontDatabase>
#include <QtGui/QScreen>
#include <QtGui/QPalette>
-#include <QtCore/QRegExp>
-#include <QtCore/QFile>
#include <QtQml/QQmlApplicationEngine>
-
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlContext>
#include <QtQml/QQmlComponent>
#include <QSettings>
#include <QQuickStyle>
#include <QIcon>
+#include <QDir>
#include <QQuickWindow>
#if defined(USE_QTWEBENGINE)
@@ -90,75 +90,69 @@ int main(int argc, char **argv)
QtWebEngine::initialize();
#endif
- //qputenv("QT_IM_MODULE", QByteArray("qtvkb"));
- qputenv("QT_QUICK_CONTROLS_CONF", "/data/user/qt/qtquickcontrols2/qtquickcontrols2.conf");
- QIcon::setThemeName("gallery");
- QIcon::setThemeSearchPaths(QStringList() << "/data/user/qt/qtquickcontrols2/icons");
+ QString appPath = QString::fromLocal8Bit(argv[0]);
+ QByteArray appDir = appPath.left(appPath.lastIndexOf(QDir::separator())).toLocal8Bit();
+ QByteArray appName = appPath.split(QDir::separator().toLatin1()).last().toLocal8Bit();
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ // VKB is active also for desktop
+ qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
- QApplication app(argc, argv);
+#if QT_CONFIG(cross_compile)
+ qputenv("QT_QUICK_CONTROLS_CONF", "/data/user/qt/" + appName + "/qtquickcontrols2.conf");
+#endif
- QFontDatabase::addApplicationFont(":/fonts/TitilliumWeb-Regular.ttf");
- QFontDatabase::addApplicationFont(":/fonts/TitilliumWeb-SemiBold.ttf");
- QFontDatabase::addApplicationFont(":/fonts/TitilliumWeb-Bold.ttf");
- QFontDatabase::addApplicationFont(":/fonts/TitilliumWeb-Black.ttf");
-
- //For eBike demo
- QFontDatabase::addApplicationFont(":/fonts/ebike-fonts/Montserrat-Bold.ttf");
- QFontDatabase::addApplicationFont(":/fonts/ebike-fonts/Montserrat-Light.ttf");
- QFontDatabase::addApplicationFont(":/fonts/ebike-fonts/Montserrat-Medium.ttf");
- QFontDatabase::addApplicationFont(":/fonts/ebike-fonts/Montserrat-Regular.ttf");
- QFontDatabase::addApplicationFont(":/fonts/ebike-fonts/Teko-Bold.ttf");
- QFontDatabase::addApplicationFont(":/fonts/ebike-fonts/Teko-Light.ttf");
- QFontDatabase::addApplicationFont(":/fonts/ebike-fonts/Teko-Medium.ttf");
- QFontDatabase::addApplicationFont(":/fonts/ebike-fonts/Teko-Regular.ttf");
- QFontDatabase::addApplicationFont(":/fonts/ebike-fonts/fontawesome-webfont.ttf");
-
- QString path = app.applicationDirPath();
-
- QPalette pal;
- pal.setColor(QPalette::Text, Qt::black);
- pal.setColor(QPalette::WindowText, Qt::black);
- pal.setColor(QPalette::ButtonText, Qt::black);
- pal.setColor(QPalette::Base, Qt::white);
- QGuiApplication::setPalette(pal);
-
- QString target = qgetenv("B2QT_BASE") + "-" + qgetenv("B2QT_PLATFORM");
- QFile excludeFile(path + QStringLiteral("/exclude.txt"));
- if (excludeFile.open(QFile::ReadOnly)) {
- const QStringList excludeList = QString::fromUtf8(excludeFile.readAll()).split(QRegExp(":|\\s+"));
- if (excludeList.contains(target))
- qDebug("Warning: This example may not be fully functional on this platform");
- excludeFile.close();
+ if (appName.contains("qtquickcontrols2")) {
+ QIcon::setThemeName("gallery");
+ QIcon::setThemeSearchPaths(QStringList() << appDir + "/icons");
}
- QString fontName = QStringLiteral("/system/lib/fonts/DejaVuSans.ttf");
- if (QFile::exists(fontName)) {
- QFontDatabase::addApplicationFont(fontName);
- QFont font("DejaVu Sans");
- font.setPixelSize(12);
- QGuiApplication::setFont(font);
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+
+#ifdef QT_WIDGETS_LIB
+ QApplication app(argc, argv);
+#elif QT_GUI_LIB
+ QGuiApplication app(argc, argv);
+#endif
+
+ bool fontsAsResource = false;
+ QStringList fonts;
+ QDir fontsResource(QStringLiteral(":/fonts"));
+ if (fontsResource.exists()) {
+ fontsAsResource = true;
+ fonts = fontsResource.entryList();
} else {
- QFont font;
- font.setStyleHint(QFont::SansSerif);
- QGuiApplication::setFont(font);
+ QDir fontsDirectory(QCoreApplication::applicationDirPath() + QStringLiteral("/fonts"));
+ fonts = fontsDirectory.entryList();
}
- // Material style can be set only for devices supporting GL
+ 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));
+
+ // Material style can be set only for devices supporting OpenGL
QSettings styleSettings;
QString style = styleSettings.value("style").toString();
if (checkGlAvailability()) {
if (style.isEmpty() || style == "Default")
styleSettings.setValue("style", "Material");
} else {
- qDebug()<<"No GL available, skipping Material style";
+ qWarning() << "No OpenGL available, skipping Material style";
}
QQuickStyle::setStyle(styleSettings.value("style").toString());
DummyEngine engine;
QQmlApplicationEngine applicationengine;
+
+#if !QT_CONFIG(cross_compile)
+ applicationengine.addImportPath(QCoreApplication::applicationDirPath() + "/qmlplugins");
+#else
+ applicationengine.addImportPath("/data/user/qt/qmlplugins");
+#endif
+
QString appFont("TitilliumWeb");
applicationengine.rootContext()->setContextProperty("engine", &engine);
applicationengine.rootContext()->setContextProperty("appFont", appFont);
@@ -173,10 +167,7 @@ int main(int argc, char **argv)
applicationengine.rootContext()->setContextProperty("_primaryGrey", demoSettings.value("primaryGrey", "#9d9faa"));
applicationengine.rootContext()->setContextProperty("_secondaryGrey", demoSettings.value("secondaryGrey", "#3a4055"));
- applicationengine.rootContext()->setContextProperty("VideosLocation", demoSettings.value("videosLocation", "file:///data/videos"));
- applicationengine.rootContext()->setContextProperty("DefaultVideoUrl", demoSettings.value("defaultVideoUrl", "file:///data/videos/Qt+for+Designers+and+Developers.mp4"));
-
- applicationengine.load(QUrl::fromLocalFile(path + "/SharedMain.qml"));
+ applicationengine.load(QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + "/SharedMain.qml"));
app.exec();
}
diff --git a/basicsuite/shared/shared.pri b/basicsuite/shared/shared.pri
index 9277275..86bc7de 100644
--- a/basicsuite/shared/shared.pri
+++ b/basicsuite/shared/shared.pri
@@ -1,48 +1,100 @@
-# widget dependecy is required by QtCharts demo
-QT += quick widgets quickcontrols2
+QT += quickcontrols2
-qtHaveModule(webengine) {
- DEFINES += USE_QTWEBENGINE
- QT += webengine
+#Use only for desktop or if target Qt does not support fontconfg
+DEFINES += FONTS_AS_RESOURCES
+
+defineTest(b2qtdemo_deploy_defaults) {
+ # Just backward compatibility do nothing
}
-DESTPATH = /data/user/qt/$$TARGET
-target.path = $$DESTPATH
+# copies the given files to the destination directory
+defineTest(copyToDestDir) {
+ files = $$1
+ dir = $$2
-SOURCES += $$PWD/main.cpp \
- $$PWD/engine.cpp
+ for(file, files) {
+ QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$file) $$shell_quote($$dir) $$escape_expand(\\n\\t)
+ }
-HEADERS += $$PWD/engine.h
+ export(QMAKE_POST_LINK)
+}
+
+CONFIG(cross_compile) {
+ message("Building for target")
+ DESTPATH = /data/user/qt/$$TARGET
+ target.path = $$DESTPATH
+} else {
+ message("Building for Desktop")
+ DESTPATH = $$OUT_PWD
+ target.path = $$DESTPATH
+ COPIES += commonFiles content images style
+}
+
+# Common fonts if app does not explicitly add it's own
+fonts.files += \
+ $$PWD/fonts/TitilliumWeb-Black.ttf \
+ $$PWD/fonts/TitilliumWeb-Bold.ttf \
+ $$PWD/fonts/TitilliumWeb-ExtraLight.ttf \
+ $$PWD/fonts/TitilliumWeb-Light.ttf \
+ $$PWD/fonts/TitilliumWeb-Regular.ttf \
+ $$PWD/fonts/TitilliumWeb-SemiBold.ttf
+
+contains(DEFINES, FONTS_AS_RESOURCES) {
+ !contains(DEFINES, USE_APP_FONTS) {
+ # Common fonts
+ RESOURCES += $$PWD/shared_fonts.qrc
+ }
+
+ # Application defined fonts
+ APP_FONTS=$${_PRO_FILE_PWD_}/fonts.qrc
+ exists($${APP_FONTS}) {
+ RESOURCES += $${APP_FONTS}
+ }
+} else {
+ fonts.path = $$DESTPATH/fonts
+ INSTALLS += fonts
+
+ CONFIG(cross_compile) {
+ QT_FOR_CONFIG += gui-private
+
+ qtConfig(fontconfig) {
+ #use fontconfig to provide fonts on target
+ fonts.path = /usr/share/fonts/truetype
+ }
+ } else {
+ COPIES += fonts
+ }
+}
+
+contains(DEFINES, STANDALONE) {
+ message("Building as Standalone")
+} else {
+ message("Building for B2Qt Launcher")
+ SOURCES += $$PWD/main.cpp \
+ $$PWD/engine.cpp
+
+ HEADERS += $$PWD/engine.h
-defineTest(b2qtdemo_deploy_defaults) {
commonFiles.files = \
- ../shared/SharedMain.qml \
+ $$PWD/SharedMain.qml \
+ # Resides on each application own source directory
preview_l.jpg \
demo.xml
+
commonFiles.path = $$DESTPATH
OTHER_FILES += $${commonFiles.files}
INSTALLS += commonFiles
- export(commonFiles.files)
- export(commonFiles.path)
- export(OTHER_FILES)
- export(INSTALLS)
}
-DISTFILES += $$PWD/fonts/TitilliumWeb-Black.ttf \
- $$PWD/fonts/TitilliumWeb-Bold.ttf \
- $$PWD/fonts/TitilliumWeb-ExtraLight.ttf \
- $$PWD/fonts/TitilliumWeb-Light.ttf \
- $$PWD/fonts/TitilliumWeb-Regular.ttf \
- $$PWD/fonts/TitilliumWeb-SemiBold.ttf \
- $$PWD/fonts/ebike-fonts/fontawesome-webfont.ttf \
- $$PWD/fonts/ebike-fonts/Montserrat-Bold.ttf \
- $$PWD/fonts/ebike-fonts/Montserrat-Light.ttf \
- $$PWD/fonts/ebike-fonts/Montserrat-Medium.ttf \
- $$PWD/fonts/ebike-fonts/Montserrat-Regular.ttf \
- $$PWD/fonts/ebike-fonts/Teko-Bold.ttf \
- $$PWD/fonts/ebike-fonts/Teko-Light.ttf \
- $$PWD/fonts/ebike-fonts/Teko-Medium.ttf \
- $$PWD/fonts/ebike-fonts/Teko-Regular.ttf
-
-RESOURCES += \
- $$PWD/fonts.qrc
+# Common for all projects that include this file. Only redefine in your project file
+# if different destination folder that default is preferred
+content.path = $$DESTPATH
+OTHER_FILES += $${content.files}
+
+images.path = $$DESTPATH/images
+OTHER_FILES += $${images.files}
+
+style.path = $$DESTPATH/Style
+OTHER_FILES += $${style.files}
+
+INSTALLS += target content images style
diff --git a/basicsuite/shared/shared_fonts.qrc b/basicsuite/shared/shared_fonts.qrc
new file mode 100644
index 0000000..51851e6
--- /dev/null
+++ b/basicsuite/shared/shared_fonts.qrc
@@ -0,0 +1,10 @@
+<RCC>
+ <qresource prefix="/">
+ <file>fonts/TitilliumWeb-Black.ttf</file>
+ <file>fonts/TitilliumWeb-Bold.ttf</file>
+ <file>fonts/TitilliumWeb-ExtraLight.ttf</file>
+ <file>fonts/TitilliumWeb-Light.ttf</file>
+ <file>fonts/TitilliumWeb-Regular.ttf</file>
+ <file>fonts/TitilliumWeb-SemiBold.ttf</file>
+ </qresource>
+</RCC>
diff --git a/basicsuite/shared/shared_plugin.pri b/basicsuite/shared/shared_plugin.pri
new file mode 100644
index 0000000..8259200
--- /dev/null
+++ b/basicsuite/shared/shared_plugin.pri
@@ -0,0 +1,17 @@
+pluginfiles.files += qmldir
+
+CONFIG(cross_compile) {
+ message("Building for target")
+ B2QT_DEPLOYPATH = /data/user/qt/qmlplugins/$$QML_MODULENAME
+ target.path += $$B2QT_DEPLOYPATH
+ pluginfiles.path += $$B2QT_DEPLOYPATH
+} else {
+ message("Building for Desktop")
+ DESTDIR = $$top_builddir/qmlplugins/$$QML_MODULENAME
+ target.path += $$DESTDIR
+ pluginfiles.path += $$DESTDIR
+ DEFINES += DESKTOP_BUILD
+ COPIES += target pluginfiles
+}
+
+INSTALLS += target pluginfiles
diff --git a/basicsuite/textinput/textinput.pro b/basicsuite/textinput/textinput.pro
index ed99be0..4f5b6de 100644
--- a/basicsuite/textinput/textinput.pro
+++ b/basicsuite/textinput/textinput.pro
@@ -1,7 +1,6 @@
TARGET = textinput
include(../shared/shared.pri)
-b2qtdemo_deploy_defaults()
content.files = \
main.qml \
@@ -9,9 +8,3 @@ content.files = \
TextArea.qml \
TextBase.qml \
TextField.qml
-
-content.path = $$DESTPATH
-
-OTHER_FILES += $${content.files}
-
-INSTALLS += target content
diff --git a/startupscreen/UsbModeDialog.qml b/startupscreen/UsbModeDialog.qml
index e923ac9..de4c2f6 100644
--- a/startupscreen/UsbModeDialog.qml
+++ b/startupscreen/UsbModeDialog.qml
@@ -75,7 +75,7 @@ Dialog {
reboot.open()
}
onRejected: {
- combobox.currentIndex = SettingsManager.mode === "cdcecm" ? 0 : 1
+ combobox.currentIndex = combobox.indexOfValue(SettingsManager.usbMode)
}
ColumnLayout {
@@ -91,7 +91,7 @@ Dialog {
}
ComboBox {
id: combobox
- currentIndex: SettingsManager.mode === "cdcecm" ? 0 : 1
+ Component.onCompleted: currentIndex = indexOfValue(SettingsManager.usbMode)
model: ["cdcecm", "rndis"]
}
}