From 805c3147676990a0e3dd272a91f13301296f8b45 Mon Sep 17 00:00:00 2001 From: Ville Ranki Date: Mon, 25 Nov 2019 00:25:04 +0200 Subject: [PATCH] Various enhancements --- qmlui/main.qml | 5 +++++ qmlui/panelitems/needle/AirspeedIndicator.qml | 19 ++++++++-------- qmlui/panelitems/needle/Altimeter.qml | 22 ++++++++++++++++--- qmlui/panelitems/needle/CircularGaugeBars.qml | 10 ++++++--- qmlui/panelitems/needle/Variometer.qml | 2 ++ 5 files changed, 43 insertions(+), 15 deletions(-) diff --git a/qmlui/main.qml b/qmlui/main.qml index 1598071..3259c77 100644 --- a/qmlui/main.qml +++ b/qmlui/main.qml @@ -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 { diff --git a/qmlui/panelitems/needle/AirspeedIndicator.qml b/qmlui/panelitems/needle/AirspeedIndicator.qml index e52028b..467c10e 100644 --- a/qmlui/panelitems/needle/AirspeedIndicator.qml +++ b/qmlui/panelitems/needle/AirspeedIndicator.qml @@ -50,18 +50,26 @@ 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 @@ -69,7 +77,6 @@ PanelItems.PanelItem { GaugeArc { // Yellow arc anchors.fill: parent arcColor: "yellow" - z: -20 startAngle: valueBars.value2Angle(vnoRef.value) arcAngle: valueBars.value2Angle(vneRef.value) - startAngle arcWidth: arcWidth @@ -77,7 +84,6 @@ PanelItems.PanelItem { GaugeArc { // Vno arc anchors.fill: parent arcColor: "green" - z: -20 startAngle: valueBars.value2Angle(vsRef.value) arcAngle: valueBars.value2Angle(vnoRef.value) -startAngle arcWidth: arcWidth @@ -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" diff --git a/qmlui/panelitems/needle/Altimeter.qml b/qmlui/panelitems/needle/Altimeter.qml index 344cb9f..46680e0 100644 --- a/qmlui/panelitems/needle/Altimeter.qml +++ b/qmlui/panelitems/needle/Altimeter.qml @@ -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 diff --git a/qmlui/panelitems/needle/CircularGaugeBars.qml b/qmlui/panelitems/needle/CircularGaugeBars.qml index 17b6eea..a464302 100644 --- a/qmlui/panelitems/needle/CircularGaugeBars.qml +++ b/qmlui/panelitems/needle/CircularGaugeBars.qml @@ -2,8 +2,10 @@ 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 @@ -11,6 +13,7 @@ Item { // Gets parent size 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 @@ -37,7 +40,7 @@ Item { // Gets parent size transformOrigin: Item.Center Rectangle { color: "white" - width: thickBars ? 50 : 25 + width: longBars ? 50 : 25 height: thickBars ? 15 : 5 antialiasing: true } @@ -45,10 +48,11 @@ Item { // Gets parent size 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) } } } diff --git a/qmlui/panelitems/needle/Variometer.qml b/qmlui/panelitems/needle/Variometer.qml index 66398e7..74f6e7d 100644 --- a/qmlui/panelitems/needle/Variometer.qml +++ b/qmlui/panelitems/needle/Variometer.qml @@ -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