Skip to content

Commit

Permalink
Remove enum to support older Qt versions, fix debian package dependen…
Browse files Browse the repository at this point in the history
…cies
  • Loading branch information
vranki committed Nov 24, 2019
1 parent 2ee2879 commit 0b92220
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 19 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
extplane-panel (2.0.1) UNRELEASED; urgency=low

* 2.0.1, Fixed dependencies

-- Ville Ranki <[email protected]> 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.
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 17 additions & 5 deletions qmlui/UnitConverter.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}
}
4 changes: 2 additions & 2 deletions qmlui/panelitems/needle/AirspeedIndicator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions qmlui/panelitems/needle/Altimeter.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions qmlui/panelitems/needle/EngineRpm.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ PanelItems.PanelItem {
}
Panel.UnitConverter {
id: radianConverter
inUnit: Panel.UnitConverter.TurnRateRadiansPerSecond
outUnit: Panel.UnitConverter.TurnRateRPM
inUnit: uTurnRateRadiansPerSecond
outUnit: uTurnRateRPM
}

CircularGauge {
Expand Down
8 changes: 4 additions & 4 deletions qmlui/panelitems/needle/Variometer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion qmlui/qmlui.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0b92220

Please sign in to comment.