From 0b92220bd226387764eff9fc93ad3a920cc1c4bc Mon Sep 17 00:00:00 2001 From: Ville Ranki Date: Sun, 24 Nov 2019 20:05:02 +0200 Subject: [PATCH] Remove enum to support older Qt versions, fix debian package dependencies --- debian/changelog | 6 +++++ debian/control | 2 +- qmlui/UnitConverter.qml | 22 ++++++++++++++----- qmlui/panelitems/needle/AirspeedIndicator.qml | 4 ++-- qmlui/panelitems/needle/Altimeter.qml | 8 +++---- qmlui/panelitems/needle/EngineRpm.qml | 4 ++-- qmlui/panelitems/needle/Variometer.qml | 8 +++---- qmlui/qmlui.pro | 1 - 8 files changed, 36 insertions(+), 19 deletions(-) diff --git a/debian/changelog b/debian/changelog index 445c50e..51aa793 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +extplane-panel (2.0.1) UNRELEASED; urgency=low + + * 2.0.1, Fixed dependencies + + -- Ville Ranki Thu, 19 Sep 2019 12:34:56 +0300 + extplane-panel (2.0.0) UNRELEASED; urgency=low * 2.0, QML based ui. Trying to return debian packaging. diff --git a/debian/control b/debian/control index 7028d97..9fefa77 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Homepage: https://github.com/vranki/ExtPlane-Panel Package: extplane-panel Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, +Depends: ${shlibs:Depends}, ${misc:Depends}, qml-module-qt-labs-settings, qml-module-qtquick-layouts, qml-module-qtquick-window2, qml-module-qtquick2, qml-module-qtquick-dialogs, qml-module-qtquick-controls Description: An external, networked cockpit panel for X-Plane flight simulator and a couple of others. It is possible to run this panel on the same computer or another computer on the network to display cockpit instruments from remote X-Plane. diff --git a/qmlui/UnitConverter.qml b/qmlui/UnitConverter.qml index 4462680..9b16e98 100644 --- a/qmlui/UnitConverter.qml +++ b/qmlui/UnitConverter.qml @@ -2,13 +2,15 @@ import QtQuick 2.0 Item { property real valueIn: 0 - property real valueOut: convertUnit(valueIn) + readonly property real valueOut: valueIn * scaleFactor property int inUnit: 0 property int outUnit: 0 readonly property real scaleFactor: unitTable[inUnit] * (1/unitTable[outUnit]) readonly property string inUnitName: unitNames[inUnit] readonly property string outUnitName: unitNames[outUnit] + /* + // Enums supprted in Qt >= 5.10 - enable when it time comes. enum Unit { NoUnit, VelocityKnots, @@ -23,12 +25,22 @@ Item { TurnRateRPM, TurnRateRadiansPerSecond } + */ + readonly property int uNoUnit: 0 + readonly property int uVelocityKnots: 1 + readonly property int uVelocityMS: 2 + readonly property int uVelocityKMH: 3 + readonly property int uVelocityFPM: 4 + readonly property int uDistanceMeters: 5 + readonly property int uDistanceFeet: 6 + readonly property int uPressurehPa: 7 + readonly property int uPressureInHG: 8 + readonly property int uPressureBar: 9 + readonly property int uTurnRateRPM: 10 + readonly property int uTurnRateRadiansPerSecond: 11 + // Conversion table from unit to SI standard unit readonly property var unitTable: [1, 0.514444, 1, 0.277778, 0.00508, 1, 0.3048, 1, 33.86, 1000, 1, 9.549296586] // Unit names readonly property var unitNames: ["No unit", "Knots", "m/s", "km/h", "fpm", "m", "ft", "hPa", "InHg", "Bar", "RPM", "Rad/s"] - - function convertUnit(value) { - return value * scaleFactor - } } diff --git a/qmlui/panelitems/needle/AirspeedIndicator.qml b/qmlui/panelitems/needle/AirspeedIndicator.qml index 90bb2bc..e52028b 100644 --- a/qmlui/panelitems/needle/AirspeedIndicator.qml +++ b/qmlui/panelitems/needle/AirspeedIndicator.qml @@ -13,8 +13,8 @@ PanelItems.PanelItem { Panel.UnitConverter { id: unitConverter - inUnit: Panel.UnitConverter.Unit.VelocityKnots - outUnit: settings.isKmh ? Panel.UnitConverter.Unit.VelocityKMH : Panel.UnitConverter.Unit.VelocityKnots + inUnit: uVelocityKnots + outUnit: settings.isKmh ? uVelocityKMH : uVelocityKnots } DataRef { diff --git a/qmlui/panelitems/needle/Altimeter.qml b/qmlui/panelitems/needle/Altimeter.qml index 87f692e..344cb9f 100644 --- a/qmlui/panelitems/needle/Altimeter.qml +++ b/qmlui/panelitems/needle/Altimeter.qml @@ -11,13 +11,13 @@ PanelItems.PanelItem { Panel.UnitConverter { id: altitudeConverter - inUnit: Panel.UnitConverter.Unit.DistanceFeet - outUnit: settings.isMs ? Panel.UnitConverter.Unit.DistanceMeters : Panel.UnitConverter.Unit.DistanceFeet + inUnit: uDistanceFeet + outUnit: settings.isMs ? uDistanceMeters : uDistanceFeet } Panel.UnitConverter { id: pressureConverter - inUnit: Panel.UnitConverter.Unit.PressureInHG - outUnit: settings.isMs ? Panel.UnitConverter.Unit.PressurehPa : Panel.UnitConverter.Unit.PressureInHG + inUnit: uPressureInHG + outUnit: settings.isMs ? uPressurehPa : uPressureInHG } DataRef { diff --git a/qmlui/panelitems/needle/EngineRpm.qml b/qmlui/panelitems/needle/EngineRpm.qml index d9aa556..78ac528 100644 --- a/qmlui/panelitems/needle/EngineRpm.qml +++ b/qmlui/panelitems/needle/EngineRpm.qml @@ -21,8 +21,8 @@ PanelItems.PanelItem { } Panel.UnitConverter { id: radianConverter - inUnit: Panel.UnitConverter.TurnRateRadiansPerSecond - outUnit: Panel.UnitConverter.TurnRateRPM + inUnit: uTurnRateRadiansPerSecond + outUnit: uTurnRateRPM } CircularGauge { diff --git a/qmlui/panelitems/needle/Variometer.qml b/qmlui/panelitems/needle/Variometer.qml index 40451d5..66398e7 100644 --- a/qmlui/panelitems/needle/Variometer.qml +++ b/qmlui/panelitems/needle/Variometer.qml @@ -11,13 +11,13 @@ PanelItems.PanelItem { Panel.UnitConverter { id: unitConverter - inUnit: Panel.UnitConverter.Unit.VelocityFPM - outUnit: settings.isMs ? Panel.UnitConverter.Unit.VelocityMS : Panel.UnitConverter.Unit.VelocityFPM + inUnit: uVelocityFPM + outUnit: settings.isMs ? uVelocityMS : uVelocityFPM } Panel.UnitConverter { id: laminarUnitConverter - inUnit: Panel.UnitConverter.Unit.VelocityMS - outUnit: settings.isMs ? Panel.UnitConverter.Unit.VelocityMS : Panel.UnitConverter.Unit.VelocityFPM + inUnit: uVelocityMS + outUnit: settings.isMs ? uVelocityMS : uVelocityFPM } DataRef { diff --git a/qmlui/qmlui.pro b/qmlui/qmlui.pro index f634ec7..de6558b 100644 --- a/qmlui/qmlui.pro +++ b/qmlui/qmlui.pro @@ -34,7 +34,6 @@ QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target target.path = /usr/bin