1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-01 18:29:16 +01:00

OP-1887 Gps display, 12bars - Add text

This commit is contained in:
Laurent Lalanne 2015-05-13 23:39:41 +02:00
parent f5160f64b0
commit 295e0870ef

View File

@ -76,24 +76,32 @@ Item {
sceneSize: info.sceneSize
elementName: "info-bg"
width: parent.width
opacity: qmlWidget.terrainEnabled ? 0.3 : 1
}
//
// GPS Info (Top)
//
property real bar_width: (info_bg.height + info_bg.width) / 110
Repeater {
id: satNumberBar
//smooth: true
// hack, qml/js treats qint8 as a char, necessary to convert it back to integer value
property int satNumber : String(GPSPositionSensor.Satellites).charCodeAt(0)
model: 10
SvgElementImage {
property int minSatNumber : index+1
elementName: "gps" + minSatNumber
sceneSize: info.sceneSize
visible: satNumberBar.satNumber >= minSatNumber
model: 13
Rectangle {
property int minSatNumber : index
width: Math.round(bar_width)
radius: width / 4
x: Math.round((bar_width*4.5) + (bar_width * 1.6 * index))
height: bar_width * index * 0.6
y: (bar_width*8) - height
color: "green"
opacity: satNumberBar.satNumber >= minSatNumber ? 1 : 0.4
}
}
@ -102,16 +110,25 @@ Item {
elementName: "gps-mode-text"
Text {
text: ["NO GPS", "NO FIX", "FIX 2D", "FIX 3D"][GPSPositionSensor.Status]
property int satNumber : String(GPSPositionSensor.Satellites).charCodeAt(0)
text: [satNumber > 5 ? " " + satNumber.toString() + " sats - " : ""] +
["NO GPS", "NO FIX", "2D", "3D"][GPSPositionSensor.Status]
anchors.centerIn: parent
font.pixelSize: Math.floor(parent.height*1.3)
font.pixelSize: parent.height*1.3
font.family: pt_bold.name
font.weight: Font.DemiBold
color: "white"
}
}
//
SvgElementImage {
sceneSize: info.sceneSize
elementName: "gps-icon"
width: scaledBounds.width * sceneItem.width
height: scaledBounds.height * sceneItem.height
}
// Waypoint Info (Top)
// Only visible when PathPlan is active (WP loaded)
@ -257,7 +274,6 @@ Item {
}
}
//
// Battery Info (Top)
// Only visible when PathPlan not active and Battery module enabled
@ -382,7 +398,6 @@ Item {
}
}
//
// Default counter
// Only visible when PathPlan not active
@ -423,13 +438,6 @@ Item {
}
}
SvgElementImage {
id: mask_SatBar
elementName: "satbar-mask"
sceneSize: info.sceneSize
}
//
// Home info (visible after arming)
//
@ -438,12 +446,15 @@ Item {
id: home_bg
elementName: "home-bg"
sceneSize: info.sceneSize
x: Math.floor(scaledBounds.x * sceneItem.width)
y: Math.floor(scaledBounds.y * sceneItem.height)
opacity: qmlWidget.terrainEnabled ? 0.6 : 1
states: State {
name: "fading"
when: TakeOffLocation.Status !== 0
PropertyChanges { target: home_bg; x: Math.floor(scaledBounds.x * sceneItem.width) + home_bg.width; }
when: TakeOffLocation.Status == 0
PropertyChanges { target: home_bg; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; }
}
transitions: Transition {
@ -463,8 +474,8 @@ Item {
states: State {
name: "fading_heading"
when: TakeOffLocation.Status !== 0
PropertyChanges { target: home_heading_text; x: Math.floor(scaledBounds.x * sceneItem.width) + home_bg.width; }
when: TakeOffLocation.Status == 0
PropertyChanges { target: home_heading_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; }
}
transitions: Transition {
@ -472,6 +483,7 @@ Item {
PropertyAnimation { property: "x"; duration: 800 }
}
}
Text {
text: " "+home_heading.toFixed(1)+"°"
anchors.centerIn: parent
@ -493,8 +505,8 @@ Item {
states: State {
name: "fading_distance"
when: TakeOffLocation.Status !== 0
PropertyChanges { target: home_distance_text; x: Math.floor(scaledBounds.x * sceneItem.width) + home_bg.width; }
when: TakeOffLocation.Status == 0
PropertyChanges { target: home_distance_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; }
}
transitions: Transition {
@ -524,8 +536,8 @@ Item {
states: State {
name: "fading_distance"
when: TakeOffLocation.Status !== 0
PropertyChanges { target: home_eta_text; x: Math.floor(scaledBounds.x * sceneItem.width) + home_bg.width; }
when: TakeOffLocation.Status == 0
PropertyChanges { target: home_eta_text; x: Math.floor(scaledBounds.x * sceneItem.width) - home_bg.width; }
}
transitions: Transition {