diff options
-rw-r--r-- | app/BtnArrow.qml | 94 | ||||
-rw-r--r-- | app/BtnEnlarge.qml | 48 | ||||
-rw-r--r-- | app/BtnGuidance.qml | 258 | ||||
-rw-r--r-- | app/BtnMapDirection.qml | 90 | ||||
-rw-r--r-- | app/BtnPresentPosition.qml | 78 | ||||
-rw-r--r-- | app/BtnShrink.qml | 50 | ||||
-rw-r--r-- | app/ImgDestinationDirection.qml | 188 | ||||
-rw-r--r-- | app/ProgressNextCross.qml | 90 | ||||
-rw-r--r-- | app/main.cpp | 318 | ||||
-rw-r--r-- | app/navigation.qrc | 24 |
10 files changed, 619 insertions, 619 deletions
diff --git a/app/BtnArrow.qml b/app/BtnArrow.qml index da5f8f4..2039865 100644 --- a/app/BtnArrow.qml +++ b/app/BtnArrow.qml @@ -1,47 +1,47 @@ -import QtQuick 2.0
-import QtQuick.Controls 1.5
-
-Item {
- Button {
- id: btn_arrow
- width: 100
- height: 100
-
- function settleState() {
- if(btn_arrow.state == "1"){
- btn_arrow.state = "2";
- } else if(btn_arrow.state == "2"){
- btn_arrow.state = "3";
- } else {
- btn_arrow.state = "1";
- }
- }
-
- onClicked: { settleState() }
-
- Image {
- id: image
- width: 92
- height: 92
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
- source: "images/SW_Patern_1.bmp"
- }
-
- states: [
- State {
- name: "1"
- PropertyChanges { target: image; source: "images/SW_Patern_1.bmp" }
- },
- State {
- name: "2"
- PropertyChanges { target: image; source: "images/SW_Patern_2.bmp" }
- },
- State {
- name: "3"
- PropertyChanges { target: image; source: "images/SW_Patern_3.bmp" }
- }
- ]
-
- }
-}
+import QtQuick 2.0 +import QtQuick.Controls 1.5 + +Item { + Button { + id: btn_arrow + width: 100 + height: 100 + + function settleState() { + if(btn_arrow.state == "1"){ + btn_arrow.state = "2"; + } else if(btn_arrow.state == "2"){ + btn_arrow.state = "3"; + } else { + btn_arrow.state = "1"; + } + } + + onClicked: { settleState() } + + Image { + id: image + width: 92 + height: 92 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + source: "images/SW_Patern_1.bmp" + } + + states: [ + State { + name: "1" + PropertyChanges { target: image; source: "images/SW_Patern_1.bmp" } + }, + State { + name: "2" + PropertyChanges { target: image; source: "images/SW_Patern_2.bmp" } + }, + State { + name: "3" + PropertyChanges { target: image; source: "images/SW_Patern_3.bmp" } + } + ] + + } +} diff --git a/app/BtnEnlarge.qml b/app/BtnEnlarge.qml index 229b5f1..1a261d6 100644 --- a/app/BtnEnlarge.qml +++ b/app/BtnEnlarge.qml @@ -1,24 +1,24 @@ -import QtQuick 2.0
-import QtQuick.Controls 1.5
-
-Item {
- Button {
- width: 100
- height: 100
-
- function zoomUp() {
- map.zoomLevel += 1
- }
-
- onClicked: { zoomUp() }
-
- Image {
- id: image
- width: 92
- height: 92
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
- source: "images/240px-Antu_kdenlive-zoom-large.svg.png"
- }
- }
-}
+import QtQuick 2.0 +import QtQuick.Controls 1.5 + +Item { + Button { + width: 100 + height: 100 + + function zoomUp() { + map.zoomLevel += 1 + } + + onClicked: { zoomUp() } + + Image { + id: image + width: 92 + height: 92 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + source: "images/240px-Antu_kdenlive-zoom-large.svg.png" + } + } +} diff --git a/app/BtnGuidance.qml b/app/BtnGuidance.qml index 37f3598..2744019 100644 --- a/app/BtnGuidance.qml +++ b/app/BtnGuidance.qml @@ -1,129 +1,129 @@ -import QtQuick 2.0
-import QtQuick.Controls 1.5
-import QtLocation 5.9
-import QtPositioning 5.6
-
-Item {
- id: btn_guidance
-
- // 0: idle
- // 1: routing
- // 2: on guide
- property int sts_guide: 0
-
- onSts_guideChanged: {
- console.log("onSts_guideChanged")
- switch(btn_guidance.sts_guide){
- case 0:
- positionTimer.stop();
- break
- case 1:
- break
- case 2:
- positionTimer.start();
- break
- default:
- break
- }
- }
-
- function startGuidance() {
- btn_present_position.state = "Flowing"
- btn_guidance.sts_guide = 2
- btn_guidance.state = "onGuide"
- }
-
- function discardWaypoints(startFromCurrentPosition) {
- if (startFromCurrentPosition === undefined) startFromCurrentPosition = false
- map.initDestination(startFromCurrentPosition)
-
- if(btn_guidance.sts_guide != 0){
- map.qmlSignalStopDemo()
- }
-
- if(map.center !== map.currentpostion){
- btn_present_position.state = "Optional"
- }
-
- btn_guidance.sts_guide = 0
- btn_guidance.state = "Idle"
- }
-
- Timer {
- id: positionTimer
- interval: fileOperation.getUpdateInterval();
- running: false;
- repeat: true
- onTriggered: map.updatePositon()
- }
-
- Button {
- id: discard
- width: 100
- height: 100
-
- visible: false
-
- onClicked: discardWaypoints()
-
- Image {
- id: discard_image
- width: 92
- height: 92
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
- source: "images/200px-Black_close_x.svg.png"
- }
- }
-
- Button {
- id: guidance
- width: 100
- height: 100
-
- visible: false
-
- onClicked: { startGuidance() }
-
- Image {
- id: guidance_image
- width: 92
- height: 92
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
- source: "images/MUTCD_RS-113.svg"
- }
-
- }
- states: [
- State {
- name: "Idle"
- PropertyChanges { target: discard; visible: false }
- PropertyChanges { target: guidance; visible: false }
- PropertyChanges { target: guidance; x: 0 }
- PropertyChanges { target: progress_next_cross; state: "invisible" }
- PropertyChanges { target: img_destination_direction; state: "invisible" }
- },
- State {
- name: "Routing"
- PropertyChanges { target: discard; visible: true }
- PropertyChanges { target: guidance; visible: true }
- PropertyChanges { target: guidance; x: -150 }
- PropertyChanges { target: progress_next_cross; state: "invisible" }
- PropertyChanges { target: img_destination_direction; state: "invisible" }
- },
- State {
- name: "onGuide"
- PropertyChanges { target: discard; visible: true }
- PropertyChanges { target: guidance; visible: false }
- PropertyChanges { target: guidance; x: 0 }
- PropertyChanges { target: progress_next_cross; state: "visible" }
- PropertyChanges { target: img_destination_direction; state: "0" }
- }
- ]
-
- transitions: Transition {
- NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad }
- NumberAnimation { properties: "visible"; easing.type: Easing.InOutQuad }
- }
-}
+import QtQuick 2.0 +import QtQuick.Controls 1.5 +import QtLocation 5.9 +import QtPositioning 5.6 + +Item { + id: btn_guidance + + // 0: idle + // 1: routing + // 2: on guide + property int sts_guide: 0 + + onSts_guideChanged: { + console.log("onSts_guideChanged") + switch(btn_guidance.sts_guide){ + case 0: + positionTimer.stop(); + break + case 1: + break + case 2: + positionTimer.start(); + break + default: + break + } + } + + function startGuidance() { + btn_present_position.state = "Flowing" + btn_guidance.sts_guide = 2 + btn_guidance.state = "onGuide" + } + + function discardWaypoints(startFromCurrentPosition) { + if (startFromCurrentPosition === undefined) startFromCurrentPosition = false + map.initDestination(startFromCurrentPosition) + + if(btn_guidance.sts_guide != 0){ + map.qmlSignalStopDemo() + } + + if(map.center !== map.currentpostion){ + btn_present_position.state = "Optional" + } + + btn_guidance.sts_guide = 0 + btn_guidance.state = "Idle" + } + + Timer { + id: positionTimer + interval: fileOperation.getUpdateInterval(); + running: false; + repeat: true + onTriggered: map.updatePositon() + } + + Button { + id: discard + width: 100 + height: 100 + + visible: false + + onClicked: discardWaypoints() + + Image { + id: discard_image + width: 92 + height: 92 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + source: "images/200px-Black_close_x.svg.png" + } + } + + Button { + id: guidance + width: 100 + height: 100 + + visible: false + + onClicked: { startGuidance() } + + Image { + id: guidance_image + width: 92 + height: 92 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + source: "images/MUTCD_RS-113.svg" + } + + } + states: [ + State { + name: "Idle" + PropertyChanges { target: discard; visible: false } + PropertyChanges { target: guidance; visible: false } + PropertyChanges { target: guidance; x: 0 } + PropertyChanges { target: progress_next_cross; state: "invisible" } + PropertyChanges { target: img_destination_direction; state: "invisible" } + }, + State { + name: "Routing" + PropertyChanges { target: discard; visible: true } + PropertyChanges { target: guidance; visible: true } + PropertyChanges { target: guidance; x: -150 } + PropertyChanges { target: progress_next_cross; state: "invisible" } + PropertyChanges { target: img_destination_direction; state: "invisible" } + }, + State { + name: "onGuide" + PropertyChanges { target: discard; visible: true } + PropertyChanges { target: guidance; visible: false } + PropertyChanges { target: guidance; x: 0 } + PropertyChanges { target: progress_next_cross; state: "visible" } + PropertyChanges { target: img_destination_direction; state: "0" } + } + ] + + transitions: Transition { + NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad } + NumberAnimation { properties: "visible"; easing.type: Easing.InOutQuad } + } +} diff --git a/app/BtnMapDirection.qml b/app/BtnMapDirection.qml index 8f6074d..80f16ce 100644 --- a/app/BtnMapDirection.qml +++ b/app/BtnMapDirection.qml @@ -1,45 +1,45 @@ -import QtQuick 2.0
-import QtQuick.Controls 1.5
-
-Item {
- Button {
- id: btn_map_direction
- width: 100
- height: 100
-
- function settleState() {
- if(root.st_heading_up){
- btn_map_direction.state = "NorthUp"
- car_position_mapitem.state = "NorthUp"
- root.st_heading_up = false
- } else {
- btn_map_direction.state = "HeadingUp"
- car_position_mapitem.state = "HeadingUp"
- root.st_heading_up = true
- }
- map.rotateMapSmooth()
- }
-
- onClicked: { settleState() }
-
- Image {
- id: image
- width: 92
- height: 92
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
- source: "images/202px-Compass-icon_bb_N.svg.png"
- }
-
- states: [
- State {
- name: "HeadingUp"
- PropertyChanges { target: image; source: "images/240px-Compass_icon_NE.svg.png" }
- },
- State {
- name: "NorthUp"
- PropertyChanges { target: image; source: "images/202px-Compass-icon_bb_N.svg.png" }
- }
- ]
- }
-}
+import QtQuick 2.0 +import QtQuick.Controls 1.5 + +Item { + Button { + id: btn_map_direction + width: 100 + height: 100 + + function settleState() { + if(root.st_heading_up){ + btn_map_direction.state = "NorthUp" + car_position_mapitem.state = "NorthUp" + root.st_heading_up = false + } else { + btn_map_direction.state = "HeadingUp" + car_position_mapitem.state = "HeadingUp" + root.st_heading_up = true + } + map.rotateMapSmooth() + } + + onClicked: { settleState() } + + Image { + id: image + width: 92 + height: 92 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + source: "images/202px-Compass-icon_bb_N.svg.png" + } + + states: [ + State { + name: "HeadingUp" + PropertyChanges { target: image; source: "images/240px-Compass_icon_NE.svg.png" } + }, + State { + name: "NorthUp" + PropertyChanges { target: image; source: "images/202px-Compass-icon_bb_N.svg.png" } + } + ] + } +} diff --git a/app/BtnPresentPosition.qml b/app/BtnPresentPosition.qml index 0a735f5..496847e 100644 --- a/app/BtnPresentPosition.qml +++ b/app/BtnPresentPosition.qml @@ -1,39 +1,39 @@ -import QtQuick 2.0
-import QtQuick.Controls 1.5
-
-Item {
- id: btn_present_position
-
- Button {
- id: btn_present_position_
- width: 100
- height: 100
- visible: false
-
- function present_position_clicked() {
- map.center = map.currentpostion
- btn_present_position.state = "Flowing"
- }
- onClicked: { present_position_clicked() }
-
- Image {
- id: image_present_position
- width: 48
- height: 92
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
- source: "images/207px-Car_icon_top.svg.png"
- }
- }
- states: [
- State{
- name: "Flowing"
- PropertyChanges { target: btn_present_position_; visible: false }
- },
- State{
- name: "Optional"
- PropertyChanges { target: btn_present_position_; visible: true }
- }
- ]
-
-}
+import QtQuick 2.0 +import QtQuick.Controls 1.5 + +Item { + id: btn_present_position + + Button { + id: btn_present_position_ + width: 100 + height: 100 + visible: false + + function present_position_clicked() { + map.center = map.currentpostion + btn_present_position.state = "Flowing" + } + onClicked: { present_position_clicked() } + + Image { + id: image_present_position + width: 48 + height: 92 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + source: "images/207px-Car_icon_top.svg.png" + } + } + states: [ + State{ + name: "Flowing" + PropertyChanges { target: btn_present_position_; visible: false } + }, + State{ + name: "Optional" + PropertyChanges { target: btn_present_position_; visible: true } + } + ] + +} diff --git a/app/BtnShrink.qml b/app/BtnShrink.qml index 1387557..a028bce 100644 --- a/app/BtnShrink.qml +++ b/app/BtnShrink.qml @@ -1,25 +1,25 @@ -import QtQuick 2.0
-import QtQuick.Controls 1.5
-
-Item {
- Button {
- id: btn_shrink
- width: 100
- height: 100
-
- function zoomDown() {
- map.zoomLevel -= 1
- }
-
- onClicked: { zoomDown() }
-
- Image {
- id: image
- width: 92
- height: 92
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
- source: "images/240px-Antu_file-zoom-out.svg.png"
- }
- }
-}
+import QtQuick 2.0 +import QtQuick.Controls 1.5 + +Item { + Button { + id: btn_shrink + width: 100 + height: 100 + + function zoomDown() { + map.zoomLevel -= 1 + } + + onClicked: { zoomDown() } + + Image { + id: image + width: 92 + height: 92 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + source: "images/240px-Antu_file-zoom-out.svg.png" + } + } +} diff --git a/app/ImgDestinationDirection.qml b/app/ImgDestinationDirection.qml index 76155c9..b652cdc 100644 --- a/app/ImgDestinationDirection.qml +++ b/app/ImgDestinationDirection.qml @@ -1,94 +1,94 @@ -import QtQuick 2.0
-
-Item {
- id: img_destination_direction
- width: 100
- height: 100
- visible: false
-
- Rectangle {
- width: parent.width
- height: parent.height
- color: "#a0a0a0"
-
- Image {
- id: direction
- anchors.fill: parent
- anchors.margins: 1
- source: "images/SW_Patern_3.bmp"
- }
- }
-
- states: [
- State {
- name: "0" // NoDirection
- PropertyChanges { target: img_destination_direction; visible: false }
- },
- State {
- name: "1" // DirectionForward
- PropertyChanges { target: img_destination_direction; visible: true }
- PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_N.png" }
- },
- State {
- name: "2" // DirectionBearRight
- PropertyChanges { target: img_destination_direction; visible: true }
- PropertyChanges { target: direction; source: "images/11_2_bear_right_112px-Signal_C117a.svg.png" }
- },
- State {
- name: "3" // DirectionLightRight
- PropertyChanges { target: img_destination_direction; visible: true }
- PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_NE.png" }
- },
- State {
- name: "4" // DirectionRight
- PropertyChanges { target: img_destination_direction; visible: true }
- PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_E.png" }
- },
- State {
- name: "5" // DirectionHardRight
- PropertyChanges { target: img_destination_direction; visible: true }
- PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_SE.png" }
- },
- State {
- name: "6" // DirectionUTurnRight
- PropertyChanges { target: img_destination_direction; visible: true }
-// PropertyChanges { target: direction; source: "images/146px-Israely_road_sign_211.svg.png" }
- PropertyChanges { target: direction; source: "images/146px-Israely_road_sign_212.svg.png" } // No u-turn right in CES2019
- },
- State {
- name: "7" // DirectionUTurnLeft
- PropertyChanges { target: img_destination_direction; visible: true }
- PropertyChanges { target: direction; source: "images/146px-Israely_road_sign_212.svg.png" }
- },
- State {
- name: "8" // DirectionHardLeft
- PropertyChanges { target: img_destination_direction; visible: true }
- PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_SW.png" }
- },
- State {
- name: "9" // DirectionLeft
- PropertyChanges { target: img_destination_direction; visible: true }
- PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_W.png" }
- },
- State {
- name: "10" // DirectionLightLeft
- PropertyChanges { target: img_destination_direction; visible: true }
- PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_NW.png" }
- },
- State {
- name: "11" // DirectionBearLeft
- PropertyChanges { target: img_destination_direction; visible: true }
- PropertyChanges { target: direction; source: "images/10_11_bear_left_112px-Signal_C117a.svg.png" }
- },
- State {
- name: "12" // arrived at your destination
- PropertyChanges { target: img_destination_direction; visible: true }
- PropertyChanges { target: direction; source: "images/Emoji_u1f3c1.svg" }
- },
- State {
- name: "invisible"
- PropertyChanges { target: img_destination_direction; visible: false }
- }
-
- ]
-}
+import QtQuick 2.0 + +Item { + id: img_destination_direction + width: 100 + height: 100 + visible: false + + Rectangle { + width: parent.width + height: parent.height + color: "#a0a0a0" + + Image { + id: direction + anchors.fill: parent + anchors.margins: 1 + source: "images/SW_Patern_3.bmp" + } + } + + states: [ + State { + name: "0" // NoDirection + PropertyChanges { target: img_destination_direction; visible: false } + }, + State { + name: "1" // DirectionForward + PropertyChanges { target: img_destination_direction; visible: true } + PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_N.png" } + }, + State { + name: "2" // DirectionBearRight + PropertyChanges { target: img_destination_direction; visible: true } + PropertyChanges { target: direction; source: "images/11_2_bear_right_112px-Signal_C117a.svg.png" } + }, + State { + name: "3" // DirectionLightRight + PropertyChanges { target: img_destination_direction; visible: true } + PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_NE.png" } + }, + State { + name: "4" // DirectionRight + PropertyChanges { target: img_destination_direction; visible: true } + PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_E.png" } + }, + State { + name: "5" // DirectionHardRight + PropertyChanges { target: img_destination_direction; visible: true } + PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_SE.png" } + }, + State { + name: "6" // DirectionUTurnRight + PropertyChanges { target: img_destination_direction; visible: true } +// PropertyChanges { target: direction; source: "images/146px-Israely_road_sign_211.svg.png" } + PropertyChanges { target: direction; source: "images/146px-Israely_road_sign_212.svg.png" } // No u-turn right in CES2019 + }, + State { + name: "7" // DirectionUTurnLeft + PropertyChanges { target: img_destination_direction; visible: true } + PropertyChanges { target: direction; source: "images/146px-Israely_road_sign_212.svg.png" } + }, + State { + name: "8" // DirectionHardLeft + PropertyChanges { target: img_destination_direction; visible: true } + PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_SW.png" } + }, + State { + name: "9" // DirectionLeft + PropertyChanges { target: img_destination_direction; visible: true } + PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_W.png" } + }, + State { + name: "10" // DirectionLightLeft + PropertyChanges { target: img_destination_direction; visible: true } + PropertyChanges { target: direction; source: "images/145px-16_cardinal_points_NW.png" } + }, + State { + name: "11" // DirectionBearLeft + PropertyChanges { target: img_destination_direction; visible: true } + PropertyChanges { target: direction; source: "images/10_11_bear_left_112px-Signal_C117a.svg.png" } + }, + State { + name: "12" // arrived at your destination + PropertyChanges { target: img_destination_direction; visible: true } + PropertyChanges { target: direction; source: "images/Emoji_u1f3c1.svg" } + }, + State { + name: "invisible" + PropertyChanges { target: img_destination_direction; visible: false } + } + + ] +} diff --git a/app/ProgressNextCross.qml b/app/ProgressNextCross.qml index d9e04a5..31e552c 100644 --- a/app/ProgressNextCross.qml +++ b/app/ProgressNextCross.qml @@ -1,45 +1,45 @@ -import QtQuick 2.0
-import QtQuick.Controls 1.5
-import QtQuick.Controls.Styles 1.4
-
-Item {
- id: progress_next_cross
-
- visible: false
-
- // val [Input]
- // distance to next cross. (unit = meter)
- // when over the ProgressBar.maximumValue/m, progress bar indicates max (same as ProgressBar.maximumValue/m)
- function setProgress(val) {
- if ( (0 < val) && (val < bar.maximumValue ) ) {
- bar.value = val
- }else if ( bar.maximumValue < val ){
- bar.value = bar.maximumValue
- }else{
- bar.value = 0
- }
- }
-
- ProgressBar {
- id: bar
- width: 25
- height: 100
- orientation: Qt.Vertical
- value: 0
- minimumValue: 0
- maximumValue: 300
-
- style: ProgressBarStyle {
- progress: Rectangle {
- color: "green"
- }
- }
- }
- states: [
- State {
- name: "visible"; PropertyChanges { target: progress_next_cross; visible: true }},
- State {
- name: "invisible"; PropertyChanges { target: progress_next_cross; visible: false }}
- ]
-
-}
+import QtQuick 2.0 +import QtQuick.Controls 1.5 +import QtQuick.Controls.Styles 1.4 + +Item { + id: progress_next_cross + + visible: false + + // val [Input] + // distance to next cross. (unit = meter) + // when over the ProgressBar.maximumValue/m, progress bar indicates max (same as ProgressBar.maximumValue/m) + function setProgress(val) { + if ( (0 < val) && (val < bar.maximumValue ) ) { + bar.value = val + }else if ( bar.maximumValue < val ){ + bar.value = bar.maximumValue + }else{ + bar.value = 0 + } + } + + ProgressBar { + id: bar + width: 25 + height: 100 + orientation: Qt.Vertical + value: 0 + minimumValue: 0 + maximumValue: 300 + + style: ProgressBarStyle { + progress: Rectangle { + color: "green" + } + } + } + states: [ + State { + name: "visible"; PropertyChanges { target: progress_next_cross; visible: true }}, + State { + name: "invisible"; PropertyChanges { target: progress_next_cross; visible: false }} + ] + +} diff --git a/app/main.cpp b/app/main.cpp index 22872bb..0c10209 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -1,159 +1,159 @@ -/*
- * Copyright (C) 2016 The Qt Company Ltd.
- * Copyright (C) 2019 Konsulko Group
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef DESKTOP
-#define USE_QTAGLEXTRAS 0
-#define USE_QLIBWINDOWMANAGER 0
-#else
-#define USE_QTAGLEXTRAS 0
-#define USE_QLIBWINDOWMANAGER 1
-#endif
-
-#if USE_QTAGLEXTRAS
-#include <QtAGLExtras/AGLApplication>
-#elif USE_QLIBWINDOWMANAGER
-#include <qlibwindowmanager.h>
-#include <qlibhomescreen.h>
-#include <string>
-#endif
-#include <QtCore/QDebug>
-#include <QtCore/QCommandLineParser>
-#include <QtCore/QUrlQuery>
-#include <QtCore/QSettings>
-#include <QtGui/QGuiApplication>
-#include <QtQml/QQmlApplicationEngine>
-#include <QtQml/QQmlContext>
-#include <QtQuickControls2/QQuickStyle>
-#include <QQuickWindow>
-#include <QtDBus/QDBusConnection>
-#include "markermodel.h"
-#include "dbus_server.h"
-#include "dbus_server_navigationcore.h"
-#include "guidance_module.h"
-#include "file_operation.h"
-
-int main(int argc, char *argv[])
-{
-
- // for dbusIF
- if (!QDBusConnection::sessionBus().isConnected()) {
- qWarning("Cannot connect to the D-Bus session bus.\n"
- "Please check your system settings and try again.\n");
- return 1;
- }
-
-#if USE_QTAGLEXTRAS
- AGLApplication app(argc, argv);
- app.setApplicationName("navigation");
- app.setupApplicationRole("navigation");
- app.load(QUrl(QStringLiteral("qrc:/navigation.qml")));
-
-#elif USE_QLIBWINDOWMANAGER
- QGuiApplication app(argc, argv);
- QString graphic_role = QString("navigation");
- int port = 1700;
- QString token = "hello";
- QCoreApplication::setOrganizationDomain("LinuxFoundation");
- QCoreApplication::setOrganizationName("AutomotiveGradeLinux");
- QCoreApplication::setApplicationName(graphic_role);
- QCoreApplication::setApplicationVersion("0.1.0");
- QCommandLineParser parser;
- parser.addPositionalArgument("port", app.translate("main", "port for binding"));
- parser.addPositionalArgument("secret", app.translate("main", "secret for binding"));
- parser.addHelpOption();
- parser.addVersionOption();
- parser.process(app);
- QStringList positionalArguments = parser.positionalArguments();
- if (positionalArguments.length() == 2) {
- port = positionalArguments.takeFirst().toInt();
- token = positionalArguments.takeFirst();
- }
- fprintf(stderr, "[navigation] app_name: %s, port: %d, token: %s.\n",
- graphic_role.toStdString().c_str(),
- port,
- token.toStdString().c_str());
-
- // QLibWM
- QLibWindowmanager* qwmHandler = new QLibWindowmanager();
- int res;
- if((res = qwmHandler->init(port,token)) != 0){
- fprintf(stderr, "[navigation] init qlibwm err(%d)\n", res);
- return -1;
- }
- if((res = qwmHandler->requestSurface(graphic_role)) != 0) {
- fprintf(stderr, "[navigation] request surface err(%d)\n", res);
- return -1;
- }
- qwmHandler->set_event_handler(QLibWindowmanager::Event_SyncDraw,
- [qwmHandler, &graphic_role](json_object *object) {
- qwmHandler->endDraw(graphic_role);
- });
-
- // QLibHS
- QLibHomeScreen* qhsHandler = new QLibHomeScreen();
- qhsHandler->init(port, token.toStdString().c_str());
- qhsHandler->set_event_handler(QLibHomeScreen::Event_ShowWindow,
- [qwmHandler, &graphic_role](json_object *object){
- qDebug("Surface %s got showWindow\n", graphic_role.toStdString().c_str());
- qwmHandler->activateWindow(graphic_role);
- });
- // Load qml
- QQmlApplicationEngine engine;
-
- MarkerModel model;
- engine.rootContext()->setContextProperty("markerModel", &model);
-
- Guidance_Module guidance;
- engine.rootContext()->setContextProperty("guidanceModule", &guidance);
-
- File_Operation file;
- engine.rootContext()->setContextProperty("fileOperation", &file);
-
- engine.load(QUrl(QStringLiteral("qrc:/navigation.qml")));
- QObject *root = engine.rootObjects().first();
- QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
- QObject::connect(window, SIGNAL(frameSwapped()), qwmHandler, SLOT(slotActivateSurface()));
- QObject *map = engine.rootObjects().first()->findChild<QObject*>("map");
- DBus_Server dbus(map);
- dbus_server_navigationcore dbus_navigationcore(map);
-
-#else // for only libwindowmanager
- QGuiApplication app(argc, argv);
- app.setApplicationName("navigation");
-
- // Load qml
- QQmlApplicationEngine engine;
-
- MarkerModel model;
- engine.rootContext()->setContextProperty("markerModel", &model);
-
- Guidance_Module guidance;
- engine.rootContext()->setContextProperty("guidanceModule", &guidance);
-
- File_Operation file;
- engine.rootContext()->setContextProperty("fileOperation", &file);
-
- engine.load(QUrl(QStringLiteral("qrc:/navigation.qml")));
- QObject *map = engine.rootObjects().first()->findChild<QObject*>("map");
- DBus_Server dbus(map);
- dbus_server_navigationcore dbus_navigationcore(map);
-
-#endif
-
- return app.exec();
-}
-
+/* + * Copyright (C) 2016 The Qt Company Ltd. + * Copyright (C) 2019 Konsulko Group + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifdef DESKTOP +#define USE_QTAGLEXTRAS 0 +#define USE_QLIBWINDOWMANAGER 0 +#else +#define USE_QTAGLEXTRAS 0 +#define USE_QLIBWINDOWMANAGER 1 +#endif + +#if USE_QTAGLEXTRAS +#include <QtAGLExtras/AGLApplication> +#elif USE_QLIBWINDOWMANAGER +#include <qlibwindowmanager.h> +#include <qlibhomescreen.h> +#include <string> +#endif +#include <QtCore/QDebug> +#include <QtCore/QCommandLineParser> +#include <QtCore/QUrlQuery> +#include <QtCore/QSettings> +#include <QtGui/QGuiApplication> +#include <QtQml/QQmlApplicationEngine> +#include <QtQml/QQmlContext> +#include <QtQuickControls2/QQuickStyle> +#include <QQuickWindow> +#include <QtDBus/QDBusConnection> +#include "markermodel.h" +#include "dbus_server.h" +#include "dbus_server_navigationcore.h" +#include "guidance_module.h" +#include "file_operation.h" + +int main(int argc, char *argv[]) +{ + + // for dbusIF + if (!QDBusConnection::sessionBus().isConnected()) { + qWarning("Cannot connect to the D-Bus session bus.\n" + "Please check your system settings and try again.\n"); + return 1; + } + +#if USE_QTAGLEXTRAS + AGLApplication app(argc, argv); + app.setApplicationName("navigation"); + app.setupApplicationRole("navigation"); + app.load(QUrl(QStringLiteral("qrc:/navigation.qml"))); + +#elif USE_QLIBWINDOWMANAGER + QGuiApplication app(argc, argv); + QString graphic_role = QString("navigation"); + int port = 1700; + QString token = "hello"; + QCoreApplication::setOrganizationDomain("LinuxFoundation"); + QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); + QCoreApplication::setApplicationName(graphic_role); + QCoreApplication::setApplicationVersion("0.1.0"); + QCommandLineParser parser; + parser.addPositionalArgument("port", app.translate("main", "port for binding")); + parser.addPositionalArgument("secret", app.translate("main", "secret for binding")); + parser.addHelpOption(); + parser.addVersionOption(); + parser.process(app); + QStringList positionalArguments = parser.positionalArguments(); + if (positionalArguments.length() == 2) { + port = positionalArguments.takeFirst().toInt(); + token = positionalArguments.takeFirst(); + } + fprintf(stderr, "[navigation] app_name: %s, port: %d, token: %s.\n", + graphic_role.toStdString().c_str(), + port, + token.toStdString().c_str()); + + // QLibWM + QLibWindowmanager* qwmHandler = new QLibWindowmanager(); + int res; + if((res = qwmHandler->init(port,token)) != 0){ + fprintf(stderr, "[navigation] init qlibwm err(%d)\n", res); + return -1; + } + if((res = qwmHandler->requestSurface(graphic_role)) != 0) { + fprintf(stderr, "[navigation] request surface err(%d)\n", res); + return -1; + } + qwmHandler->set_event_handler(QLibWindowmanager::Event_SyncDraw, + [qwmHandler, &graphic_role](json_object *object) { + qwmHandler->endDraw(graphic_role); + }); + + // QLibHS + QLibHomeScreen* qhsHandler = new QLibHomeScreen(); + qhsHandler->init(port, token.toStdString().c_str()); + qhsHandler->set_event_handler(QLibHomeScreen::Event_ShowWindow, + [qwmHandler, &graphic_role](json_object *object){ + qDebug("Surface %s got showWindow\n", graphic_role.toStdString().c_str()); + qwmHandler->activateWindow(graphic_role); + }); + // Load qml + QQmlApplicationEngine engine; + + MarkerModel model; + engine.rootContext()->setContextProperty("markerModel", &model); + + Guidance_Module guidance; + engine.rootContext()->setContextProperty("guidanceModule", &guidance); + + File_Operation file; + engine.rootContext()->setContextProperty("fileOperation", &file); + + engine.load(QUrl(QStringLiteral("qrc:/navigation.qml"))); + QObject *root = engine.rootObjects().first(); + QQuickWindow *window = qobject_cast<QQuickWindow *>(root); + QObject::connect(window, SIGNAL(frameSwapped()), qwmHandler, SLOT(slotActivateSurface())); + QObject *map = engine.rootObjects().first()->findChild<QObject*>("map"); + DBus_Server dbus(map); + dbus_server_navigationcore dbus_navigationcore(map); + +#else // for only libwindowmanager + QGuiApplication app(argc, argv); + app.setApplicationName("navigation"); + + // Load qml + QQmlApplicationEngine engine; + + MarkerModel model; + engine.rootContext()->setContextProperty("markerModel", &model); + + Guidance_Module guidance; + engine.rootContext()->setContextProperty("guidanceModule", &guidance); + + File_Operation file; + engine.rootContext()->setContextProperty("fileOperation", &file); + + engine.load(QUrl(QStringLiteral("qrc:/navigation.qml"))); + QObject *map = engine.rootObjects().first()->findChild<QObject*>("map"); + DBus_Server dbus(map); + dbus_server_navigationcore dbus_navigationcore(map); + +#endif + + return app.exec(); +} + diff --git a/app/navigation.qrc b/app/navigation.qrc index b0c2023..51f7b7b 100644 --- a/app/navigation.qrc +++ b/app/navigation.qrc @@ -1,12 +1,12 @@ -<RCC>
- <qresource prefix="/">
- <file>navigation.qml</file>
- <file>BtnMapDirection.qml</file>
- <file>BtnShrink.qml</file>
- <file>BtnEnlarge.qml</file>
- <file>ImgDestinationDirection.qml</file>
- <file>ProgressNextCross.qml</file>
- <file>BtnGuidance.qml</file>
- <file>BtnPresentPosition.qml</file>
- </qresource>
-</RCC>
+<RCC> + <qresource prefix="/"> + <file>navigation.qml</file> + <file>BtnMapDirection.qml</file> + <file>BtnShrink.qml</file> + <file>BtnEnlarge.qml</file> + <file>ImgDestinationDirection.qml</file> + <file>ProgressNextCross.qml</file> + <file>BtnGuidance.qml</file> + <file>BtnPresentPosition.qml</file> + </qresource> +</RCC> |