Skip to content

Commit

Permalink
Various enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
vranki committed Nov 24, 2019
1 parent 582b8b8 commit 805c314
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 15 deletions.
5 changes: 5 additions & 0 deletions qmlui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ Window {
Text {
color: extplaneClient.extplaneConnection.connected ? "white" : "red"
text: extplaneClient.connectionMessage + " " + extplaneClient.extplaneConnection.networkError
onTextChanged: {
opacity = 1
opacityAnimation.start()
}
NumberAnimation on opacity { id: opacityAnimation; to: 0; duration: 10*1000}
}

Item {
Expand Down
19 changes: 10 additions & 9 deletions qmlui/panelitems/needle/AirspeedIndicator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,40 @@ PanelItems.PanelItem {
scaleFactor: unitConverter.scaleFactor
}

CircularGaugeBars {
id: thinValueBars
barValue: settings.thinBarValue
valueMax: valueBars.valueMax
showLastValue: true
}

CircularGaugeBars {
id: valueBars

thickBars: true
showValue: true
fontSizeMultiplier: 0.7
barValue: settings.thickBarValue
valueMax: vneRef.value || 100
valueMax: Math.round(vneRef.value) || 200
Component.onCompleted: console.log("Thick bars", barCount, barAngle, "values", valueMax, barValue)

GaugeArc { // Vne bar
anchors.fill: parent
arcColor: "red"
z: -10
startAngle: valueBars.value2Angle(vneRef.value)
arcAngle: 0.3
arcWidth: width * 0.06
}
GaugeArc { // Yellow arc
anchors.fill: parent
arcColor: "yellow"
z: -20
startAngle: valueBars.value2Angle(vnoRef.value)
arcAngle: valueBars.value2Angle(vneRef.value) - startAngle
arcWidth: arcWidth
}
GaugeArc { // Vno arc
anchors.fill: parent
arcColor: "green"
z: -20
startAngle: valueBars.value2Angle(vsRef.value)
arcAngle: valueBars.value2Angle(vnoRef.value) -startAngle
arcWidth: arcWidth
Expand All @@ -88,15 +94,10 @@ PanelItems.PanelItem {
anchors.fill: parent
radius: width / 2 - 2*arcWidth
arcColor: "white"
z: -30
startAngle: valueBars.value2Angle(vsoRef.value)
arcAngle: valueBars.value2Angle(vfeRef.value) - startAngle
arcWidth: arcWidth
}
CircularGaugeBars {
barValue: settings.thinBarValue
valueMax: valueBars.valueMax
}
Text {
text: unitConverter.outUnitName
color: "white"
Expand Down
22 changes: 19 additions & 3 deletions qmlui/panelitems/needle/Altimeter.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,30 @@ PanelItems.PanelItem {
name: "sim/cockpit/misc/barometer_setting"
scaleFactor: pressureConverter.scaleFactor
}

CircularGaugeBars {
barValue: 100
valueMax: 10000
valueMultiplier: 1000
barsAngleMin: 90
barsAngle: 359
showLastValue: false
}
CircularGaugeBars {
longBars: true
barValue: 500
valueMax: 10000
valueMultiplier: 1000
barsAngleMin: 90
barsAngle: 359
showLastValue: false
}
CircularGaugeBars {
id: valueBars

thickBars: true
showValue: true
barValue: settings.isMs ? 1000 : 1000
valueMax: settings.isMs ? 10000 : 10000
barValue: 1000
valueMax: 10000
valueMultiplier: 1000
barsAngleMin: 90
barsAngle: 359
Expand Down
10 changes: 7 additions & 3 deletions qmlui/panelitems/needle/CircularGaugeBars.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ import QtQuick 2.0

Item { // Gets parent size
property bool thickBars: false // Thick or thin bars
property bool longBars: thickBars // Long bars
property bool showValue: false // Show values as numbers
property bool showLastValue: true // Can be used to hide last value (for 360 degree gauges)
property bool absValue: false // Don't show negative numbers with -
property bool limitAngle: false // Limit value2angle between min & max values
property real valueMin: 0 // Minimum value to show
property real valueMax: 100 // Maximum value to show
property real barValue: 10 // Value of one bar
property int barsAngleMin: -90 // Angle of minimum value, 0=west
property int barsAngle: 270 // Total angle of values
property real valueMultiplier: 1 // Multiplier of value labels
property real fontSizeMultiplier: 1

readonly property int barCount: valueRange / barValue + 1
readonly property real valueRange: valueMax - valueMin
Expand All @@ -37,18 +40,19 @@ Item { // Gets parent size
transformOrigin: Item.Center
Rectangle {
color: "white"
width: thickBars ? 50 : 25
width: longBars ? 50 : 25
height: thickBars ? 15 : 5
antialiasing: true
}
Text {
x: 70
visible: showValue && (showLastValue || index < barCount - 1)
color: "white"
font.pixelSize: Math.min((barsItem.width / barCount) * 1.1, 100)
font.pixelSize: 100 * fontSizeMultiplier
rotation: -barItem.rotation
anchors.verticalCenter: parent.verticalCenter
text: Math.round((index * barValue + valueMin) / valueMultiplier)
text: absValue ? Math.abs(value) : value
property int value: Math.round((index * barValue + valueMin) / valueMultiplier)
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions qmlui/panelitems/needle/Variometer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ PanelItems.PanelItem {

thickBars: true
showValue: true
absValue: true
fontSizeMultiplier: 1.3
barValue: settings.isMs ? 1 : 200
valueMax: settings.isMs ? 5 : 1000
valueMin: -valueMax
Expand Down

0 comments on commit 805c314

Please sign in to comment.