diff --git a/qmlui/AddItemDialog.qml b/qmlui/AddItemDialog.qml
index 22de38c..f2e27d0 100644
--- a/qmlui/AddItemDialog.qml
+++ b/qmlui/AddItemDialog.qml
@@ -232,5 +232,20 @@ Dialog {
itemName: "decoration/ImageItem"
description: "Can show an image file."
}
+ ListElement {
+ name: "Needle only gauge"
+ itemName: "needle/GaugeLess"
+ description: "Shows an arbitrary gauge."
+ }
+ ListElement {
+ name: "B738 generic cap switch"
+ itemName: "switches/B738GenericCap"
+ description: "Caps that are not backed by an spcecific dataref."
+ }
+ ListElement {
+ name: "Dual Annunciator"
+ itemName: "annunciators/DualAnnunciator"
+ description: "It has three states off, dim and bright"
+ }
}
}
diff --git a/qmlui/PanelItemArea.qml b/qmlui/PanelItemArea.qml
index 0411755..a34888f 100644
--- a/qmlui/PanelItemArea.qml
+++ b/qmlui/PanelItemArea.qml
@@ -195,6 +195,7 @@ MouseArea {
Settings {
id: settings
category: "panelitems"
+ fileName: "panel.ini"
property alias datastore: dragArea.datastore
property int largestId: 0
onDatastoreChanged: {
diff --git a/qmlui/main.qml b/qmlui/main.qml
index 323f1f2..ec79fe5 100644
--- a/qmlui/main.qml
+++ b/qmlui/main.qml
@@ -68,10 +68,12 @@ Window {
property int height: 768
property bool fullscreen: false
property string backgroundImage: ""
+ fileName: "panel.ini"
}
Settings {
category: "panel/" + panelId
property int itemCount: 0
+ fileName: "panel.ini"
}
Settings {
id: applicationSettings
@@ -80,6 +82,7 @@ Window {
property alias panelId: panelItemArea.panelId
property alias snapToGrid: panelItemArea.snapToGrid
property alias extplaneHost: window.extplaneHost
+ fileName: "panel.ini"
}
ExtplaneUtilities { id: extplaneUtilities }
diff --git a/qmlui/panelitems/PanelItem.qml b/qmlui/panelitems/PanelItem.qml
index daf5b6f..4b959d5 100644
--- a/qmlui/panelitems/PanelItem.qml
+++ b/qmlui/panelitems/PanelItem.qml
@@ -68,6 +68,7 @@ Item {
property alias z: panelItem.z
property alias width: panelItem.width
property alias height: panelItem.height
+ fileName: "panel.ini"
}
// Default properties dialog
diff --git a/qmlui/panelitems/PanelItemSettings.qml b/qmlui/panelitems/PanelItemSettings.qml
index 456f5a7..e3db61e 100644
--- a/qmlui/panelitems/PanelItemSettings.qml
+++ b/qmlui/panelitems/PanelItemSettings.qml
@@ -3,5 +3,6 @@ import Qt.labs.settings 1.0
Settings {
id: settings
+ fileName: "panel.ini"
category: "panelitem-" + panelId + "/" + itemId
}
diff --git a/qmlui/panelitems/annunciators/Annunciator.qml b/qmlui/panelitems/annunciators/Annunciator.qml
index 405a3b6..be95cf6 100644
--- a/qmlui/panelitems/annunciators/Annunciator.qml
+++ b/qmlui/panelitems/annunciators/Annunciator.qml
@@ -7,9 +7,9 @@ import "../settingsui" as SettingsUi
PanelItems.PanelItem {
id: annunciator
- property var colors: ['red', 'yellow', 'green', 'blue']
+ property var colors: ['red', 'yellow', 'green', 'blue','orange']
property color textColor: settings.backgroundLights ? (active ? "black" : "#494949") : (active ? lightColor : "black")
- property color lightColor: colors[settings.annunciatorColor]
+ property color lightColor: settings.overrideColor=="" ? colors[settings.annunciatorColor] : settings.overrideColor
property bool active: annunciatorRef.value !== "0"
property alias settings: settings
readonly property bool twoLines: settings.bottomText.length
@@ -21,7 +21,7 @@ PanelItems.PanelItem {
Rectangle {
anchors.fill: parent
radius: 2
- color: settings.backgroundLights ? (active ? colors[settings.annunciatorColor] : "black") : lightColor
+ color: settings.backgroundLights ? (active ? lightColor : "black") : lightColor
opacity: settings.backgroundLights ? 1 : 0.1
border.color: "#494949"
border.width: 2
@@ -29,7 +29,7 @@ PanelItems.PanelItem {
Rectangle {
anchors.fill: parent
radius: 2
- color: colors[settings.annunciatorColor]
+ color: lightColor
opacity: 0.02
}
Text { // One line version
@@ -75,7 +75,9 @@ PanelItems.PanelItem {
Text { text: "Whole annunciator lights up (not just text)" },
CheckBox { checked: settings.backgroundLights ; onCheckedChanged: settings.backgroundLights = checked },
Text { text: "Dataref" },
- TextField { text: settings.dataref; onTextChanged: settings.dataref = text }
+ TextField { text: settings.dataref; onTextChanged: settings.dataref = text },
+ Text { text: "Override Color" },
+ TextField { text: settings.overrideColor; onTextChanged: settings.overrideColor = text }
]
PanelItems.PanelItemSettings {
@@ -85,6 +87,7 @@ PanelItems.PanelItem {
property int annunciatorColor: 0
property string dataref: ""
property bool backgroundLights: false
+ property string overrideColor: ""
}
function copySettings(other) {
@@ -94,5 +97,6 @@ PanelItems.PanelItem {
settings.annunciatorColor = other.settings.annunciatorColor
settings.dataref = other.settings.dataref
settings.backgroundLights = other.settings.backgroundLights
+ settings.overrideColor = other.settings.overrideColor
}
}
diff --git a/qmlui/panelitems/annunciators/DualAnnunciator.qml b/qmlui/panelitems/annunciators/DualAnnunciator.qml
new file mode 100644
index 0000000..d279f9f
--- /dev/null
+++ b/qmlui/panelitems/annunciators/DualAnnunciator.qml
@@ -0,0 +1,99 @@
+import QtQuick 2.0
+import QtQuick.Controls 2.2
+import org.vranki.extplane 1.0
+import ".." as PanelItems
+import "../.." as Panel
+import "../settingsui" as SettingsUi
+
+PanelItems.PanelItem {
+ id: annunciator
+ property var colors: ['red', 'yellow', 'green', 'blue','orange']
+ property color textColor: dimmed ? "lightgrey" : active ? "white" : "black"
+ property color lightColor: settings.overrideColor=="" ? colors[settings.annunciatorColor] : settings.overrideColor
+ property bool active: annunciatorRef.value !== "0"
+ property bool dimmed: annunciatorRef.value == "0.5"
+ property alias settings: settings
+ readonly property bool twoLines: settings.bottomText.length
+
+ DataRef {
+ id: annunciatorRef
+ name: settings.dataref
+ }
+ Rectangle {
+ anchors.fill: parent
+ radius: 2
+ color: lightColor
+ opacity: dimmed ? 0.2 : active ? 0.7 : 0
+ border.color: "#494949"
+ border.width: 2
+ }
+ Rectangle {
+ anchors.fill: parent
+ radius: 2
+ color: lightColor
+ opacity: 0.02
+ }
+ Text { // One line version
+ text: settings.topText.length ? settings.topText : "ANN TEXT"
+ color: textColor
+ font.pixelSize: parent.height * 0.3
+ font.family: b612.name
+ anchors.centerIn: parent
+ visible: !twoLines
+ }
+ Text { // Two line version
+ text: settings.topText.length ? settings.topText : "ANN TEXT"
+ color: textColor
+ font.pixelSize: parent.height * 0.3
+ font.family: b612.name
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ anchors.topMargin: parent.height * 0.1
+ visible: twoLines
+ }
+ Text { // Two line version, bottom
+ text: settings.bottomText
+ color: textColor
+ font.pixelSize: parent.height * 0.3
+ font.family: b612.name
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: parent.height * 0.1
+ visible: twoLines
+ }
+ propertiesDialog.helpText: 'Dual state annunciator light with text. Set bottom text for 2 rows.'
+ propertiesDialog.propertyItems: [
+ Text { text: "Text (top)" },
+ TextField { text: settings.topText; onTextChanged: settings.topText = text },
+ Text { text: "Text (bottom)" },
+ TextField { text: settings.bottomText; onTextChanged: settings.bottomText = text },
+ Text { text: "Color" },
+ SettingsUi.ColorSelector {
+ colors: annunciator.colors
+ value: settings.annunciatorColor
+ onValueChanged: settings.annunciatorColor = value
+ },
+ Text { text: "Dataref" },
+ TextField { text: settings.dataref; onTextChanged: settings.dataref = text },
+ Text { text: "Override Color" },
+ TextField { text: settings.overrideColor; onTextChanged: settings.overrideColor = text }
+ ]
+
+ PanelItems.PanelItemSettings {
+ id: settings
+ property string topText: ""
+ property string bottomText: ""
+ property int annunciatorColor: 0
+ property string dataref: ""
+ property string overrideColor: ""
+ }
+
+ function copySettings(other) {
+ console.log(other.settings)
+ settings.topText = other.settings.topText
+ settings.bottomText = other.settings.bottomText
+ settings.annunciatorColor = other.settings.annunciatorColor
+ settings.dataref = other.settings.dataref
+ settings.overrideColor = other.settings.overrideColor
+ }
+}
diff --git a/qmlui/panelitems/decoration/Label.qml b/qmlui/panelitems/decoration/Label.qml
index ec12be1..401b6ee 100644
--- a/qmlui/panelitems/decoration/Label.qml
+++ b/qmlui/panelitems/decoration/Label.qml
@@ -3,16 +3,22 @@ import QtQuick.Controls 2.2
import org.vranki.extplane 1.0
import ".." as PanelItems
import "../.." as Panel
+import "../settingsui" as SettingsUi
PanelItems.PanelItem {
+ id: label
+ property var colors: ['black','white','red', 'yellow', 'green', 'deepskyblue','orange']
+ property real rounder: Math.pow(10,settings.decimals)
+
DataRef {
id: labelRef
name: settings.dataref
+ accuracy: settings.accuracy
}
Text {
- text: settings.labelText + labelRef.value
- color: "white"
+ text: settings.labelText + (settings.round ? (Math.round(labelRef.value * rounder)/rounder) : labelRef.value)
+ color: colors[settings.annunciatorColor]
font.pixelSize: parent.height * 0.75
font.family: b612.name
anchors.centerIn: parent
@@ -23,12 +29,27 @@ PanelItems.PanelItem {
Text { text: "Label text" },
TextField { text: settings.labelText; onTextChanged: settings.labelText = text },
Text { text: "Dataref" },
- TextField { text: settings.dataref; onTextChanged: settings.dataref = text }
+ TextField { text: settings.dataref; onTextChanged: settings.dataref = text },
+ Text { text: "Color" },
+ SettingsUi.ColorSelector {
+ colors: label.colors
+ value: settings.annunciatorColor
+ onValueChanged: settings.annunciatorColor = value},
+ Text { text: "Accuracy" },
+ TextField { text: settings.accuracy; onTextChanged: settings.accuracy = parseFloat(text) || 0 },
+ Text { text: "Round" },
+ CheckBox { checked: settings.round ; onCheckedChanged: settings.round = checked },
+ Text { text: "Decimals" },
+ SettingsUi.IntField { text: settings.decimals; onValueChanged: settings.decimals = value }
]
PanelItems.PanelItemSettings {
id: settings
- property string labelText: ""
+ property string labelText: "LABEL"
property string dataref: ""
+ property int annunciatorColor: 0
+ property real accuracy: 0.5
+ property bool round: true
+ property int decimals: 0
}
}
diff --git a/qmlui/panelitems/needle/CircularGauge.qml b/qmlui/panelitems/needle/CircularGauge.qml
index 5161b56..6d99422 100644
--- a/qmlui/panelitems/needle/CircularGauge.qml
+++ b/qmlui/panelitems/needle/CircularGauge.qml
@@ -13,6 +13,7 @@ PanelItems.PanelItem {
property string bottomLabel: ""
property real valueMultiplier: 1
property int needleType: 0
+ property bool showGauge: true
readonly property real barAngle: valueBars.barAngle
// Keep rectangular
@@ -30,6 +31,7 @@ PanelItems.PanelItem {
valueMin: parent.valueMin
valueMax: parent.valueMax
valueMultiplier: parent.valueMultiplier
+ showGauge: parent.showGauge
Needle {
needleType: parent.parent.needleType
rotation: valueBars.value2Angle(gaugeValue)
@@ -42,6 +44,7 @@ PanelItems.PanelItem {
barsAngleMin: parent.barsAngleMin
valueMin: parent.valueMin
valueMax: parent.valueMax
+ showGauge: parent.showGauge
z: -10
}
Text {
diff --git a/qmlui/panelitems/needle/CircularGaugeBars.qml b/qmlui/panelitems/needle/CircularGaugeBars.qml
index a464302..a1d09bf 100644
--- a/qmlui/panelitems/needle/CircularGaugeBars.qml
+++ b/qmlui/panelitems/needle/CircularGaugeBars.qml
@@ -14,6 +14,7 @@ Item { // Gets parent size
property int barsAngle: 270 // Total angle of values
property real valueMultiplier: 1 // Multiplier of value labels
property real fontSizeMultiplier: 1
+ property bool showGauge: true
readonly property int barCount: valueRange / barValue + 1
readonly property real valueRange: valueMax - valueMin
@@ -30,7 +31,7 @@ Item { // Gets parent size
transformOrigin: Item.TopLeft
Repeater {
id: thickBarsRepeater
- model: barCount
+ model: showGauge ? barCount : 0
Item {
id: barItem
width: barsItem.width
diff --git a/qmlui/panelitems/needle/GaugeLess.qml b/qmlui/panelitems/needle/GaugeLess.qml
new file mode 100644
index 0000000..b09d51d
--- /dev/null
+++ b/qmlui/panelitems/needle/GaugeLess.qml
@@ -0,0 +1,55 @@
+import QtQuick 2.0
+import QtQuick.Controls 2.2
+import org.vranki.extplane 1.0
+import QtQuick.Layouts 1.3
+
+import "../.." as Panel
+import ".." as PanelItems
+
+PanelItems.PanelItem {
+ DataRef {
+ id: gaugeLessRef
+ name: settings.dataref
+ accuracy: settings.accuracy
+ }
+
+ CircularGauge {
+ id: gauge
+ anchors.fill: parent
+ gaugeValue: parseFloat(gaugeLessRef.value) || 0
+ barValue: 20
+ thinBarValue: 5
+ barsAngle: settings.barsAngle
+ barsAngleMin: settings.barsAngleMin
+ valueMin: settings.valueMin
+ valueMax: settings.valueMax
+ topLabel: ""
+ bottomLabel: ""
+ showGauge: parent.editMode
+ }
+
+ propertiesDialog.propertyItems: [
+ Text { text: "Dataref" },
+ TextField { text: settings.dataref; onTextChanged: settings.dataref = text },
+ Text { text: "Lower angle" },
+ TextField { text: settings.barsAngleMin; onTextChanged: settings.barsAngleMin = parseFloat(text) || 0 },
+ Text { text: "Gauge angle" },
+ TextField { text: settings.barsAngle; onTextChanged: settings.barsAngle = parseFloat(text) || 0 },
+ Text { text: "Min. Value" },
+ TextField { text: settings.valueMin; onTextChanged: settings.valueMin = parseFloat(text) || 0 },
+ Text { text: "Max. Value" },
+ TextField { text: settings.valueMax; onTextChanged: settings.valueMax = parseFloat(text) || 0 },
+ Text { text: "Accuracy" },
+ TextField { text: settings.accuracy; onTextChanged: settings.accuracy = parseFloat(text) || 0 }
+ ]
+
+ PanelItems.PanelItemSettings {
+ id: settings
+ property string dataref: ""
+ property real barsAngle: 90
+ property real barsAngleMin: -30
+ property real valueMin: 0
+ property real valueMax: 100
+ property real accuracy: 0.5
+ }
+}
diff --git a/qmlui/panelitems/switches/B738GenericCap.qml b/qmlui/panelitems/switches/B738GenericCap.qml
new file mode 100644
index 0000000..b00881e
--- /dev/null
+++ b/qmlui/panelitems/switches/B738GenericCap.qml
@@ -0,0 +1,55 @@
+import QtQuick 2.0
+import QtQuick.Controls 2.2
+import org.vranki.extplane 1.0
+import ".." as PanelItems
+import "../.." as Panel
+import "../settingsui" as SettingsUi
+
+PanelItems.PanelItem {
+ clip: false
+ property bool isOn: settings.dataref === "" ? switchRef.values[settings.index] === "1" : switchRef.value === "1"
+
+ Image {
+ id: switchImage
+ source: settings.red ? isOn ? "rcap-open.svg" : "rcap_closed.svg" :
+ isOn ? "bcap-open.svg" : "bcap-closed.svg"
+ anchors.fill: parent
+ fillMode: Image.PreserveAspectFit
+ rotation: settings.rotation
+ }
+
+ MouseArea {
+ id: buttonMouseArea
+ acceptedButtons: Qt.RightButton
+ propagateComposedEvents: true
+ enabled: !editMode
+ anchors.fill: switchImage
+ onClicked: extplaneClient.extplaneConnection.commandOnce(settings.command)
+ }
+ DataRef {
+ id: switchRef
+ name: settings.dataref== "" ? "laminar/B738/button_switch/cover_position" : settings.dataref
+ }
+ propertiesDialog.helpText: 'A B738 generic cap switch, controlled by an array or a concrete dataref ';
+ propertiesDialog.propertyItems: [
+ Text { text: "Index" },
+ SettingsUi.IntField { text: settings.index; onValueChanged: settings.index = limitValue(value, 0, 10) },
+ Text { text: "Dataref for non generic caps" },
+ TextField { text: settings.dataref; onTextChanged: settings.dataref = text },
+ Text { text: "Toggle Cap Command" },
+ TextField { text: settings.command; onTextChanged: settings.command = text },
+ Text { text: "Angle" },
+ TextField { text: settings.rotation; onTextChanged: settings.rotation = parseFloat(text) | 0 },
+ Text { text: "Red Cap" },
+ CheckBox { checked: settings.red ; onCheckedChanged: settings.red = checked }
+ ]
+
+ PanelItems.PanelItemSettings {
+ id: settings
+ property string command: "laminar/B738/button_switch_cover00"
+ property string dataref: ""
+ property int index: 0
+ property real rotation: 0
+ property bool red: false
+ }
+}
diff --git a/qmlui/panelitems/switches/Dial.qml b/qmlui/panelitems/switches/Dial.qml
index f49bc36..6e51667 100644
--- a/qmlui/panelitems/switches/Dial.qml
+++ b/qmlui/panelitems/switches/Dial.qml
@@ -8,13 +8,12 @@ import "../settingsui" as SettingsUi
PanelItems.PanelItem {
clip: false
- property int position: parseInt(dialRef.value) || 0
property int positionCount: settings.positionCount
property var positionName: [ settings.name0, settings.name1, settings.name2, settings.name3, settings.name4, settings.name5, settings.name6, settings.name7 ]
property var positionValue: [ settings.value0, settings.value1, settings.value2, settings.value3, settings.value4, settings.value5, settings.value6, settings.value7 ]
-
- property real positionAngle: 30
- property real positionAngleZero: -((positionCount - 1) / 2) * positionAngle
+ property real positionAngle: settings.positionAngle
+ property real positionAngleZero: settings.positionAngleZero
+ property int position: value2Position(parseFloat(dialRef.value))
readonly property real knobRadius: width * 0.3
property int lineLength: height * 0.1
@@ -23,7 +22,7 @@ PanelItems.PanelItem {
name: settings.dataRef
}
Repeater {
- model: positionCount
+ model: settings.showLabels ? positionCount : 0
Rectangle {
id: positionRect
property real lineRotation: positionAngleZero + index * positionAngle
@@ -61,20 +60,67 @@ PanelItems.PanelItem {
}
Image {
- source: "dialknob.svg"
+ source: settings.style == 0 ? "dialknob.svg" : settings.style == 1 ? "knob1.svg" : "knob2.svg"
anchors.centerIn: parent
width: knobRadius
height: knobRadius
rotation: positionAngleZero + position * positionAngle
MouseArea {
+ id: wholeArea
anchors.fill: parent
- enabled: !editMode
+ enabled: !editMode & !settings.enableMouseAreas
acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed: {
- if(pressedButtons & Qt.LeftButton) position = Math.max(position - 1, 0)
- if(pressedButtons & Qt.RightButton) position = Math.min(position + 1, positionCount - 1)
- if(positionValue[position] !== undefined) {
- dialRef.value = positionValue[position]
+ if(settings.leftCommand == "" & settings.leftCommand == "")
+ {
+ if(pressedButtons & Qt.LeftButton) position = Math.max(position - 1, 0)
+ if(pressedButtons & Qt.RightButton) position = Math.min(position + 1, positionCount - 1)
+
+ if(positionValue[position] !== undefined)
+ dialRef.value = positionValue[position]
+ }
+ else
+ {
+ if(pressedButtons & Qt.LeftButton) extplaneClient.extplaneConnection.commandOnce(settings.leftCommand)
+ if(pressedButtons & Qt.RightButton) extplaneClient.extplaneConnection.commandOnce(settings.rightCommand)
+ }
+ }
+ }
+ MouseArea {
+ id: leftMouseArea
+ enabled: !editMode & settings.enableMouseAreas
+ width: parent.width/2
+ height: parent.height
+ anchors.left: parent.left
+ onPressed: {
+ if(settings.leftCommand == "" & settings.leftCommand == "")
+ {
+ position = Math.max(position - 1, 0)
+ if(positionValue[position] !== undefined)
+ dialRef.value = positionValue[position]
+ }
+ else
+ {
+ extplaneClient.extplaneConnection.commandOnce(settings.leftCommand)
+ }
+ }
+ }
+ MouseArea {
+ id: reightMouseArea
+ enabled: !editMode & settings.enableMouseAreas
+ width: parent.width/2
+ height: parent.height
+ anchors.right: parent.right
+ onPressed: {
+ if(settings.leftCommand == "" & settings.leftCommand == "")
+ {
+ position = Math.min(position + 1, positionCount - 1)
+ if(positionValue[position] !== undefined)
+ dialRef.value = positionValue[position]
+ }
+ else
+ {
+ extplaneClient.extplaneConnection.commandOnce(settings.rightCommand)
}
}
}
@@ -84,6 +130,10 @@ PanelItems.PanelItem {
propertiesDialog.propertyItems: [
Text { text: "Dataref" },
TextField { text: settings.dataRef; onTextChanged: settings.dataRef = text },
+ Text { text: "Move Right Command" },
+ TextField { text: settings.rightCommand; onTextChanged: settings.rightCommand = text },
+ Text { text: "Move Left Command" },
+ TextField { text: settings.leftCommand; onTextChanged: settings.leftCommand = text },
Text { text: "Number of positions" },
SettingsUi.IntField { text: settings.positionCount; onValueChanged: settings.positionCount = limitValue(value, 2, 8) },
Text { text: "Label 1" },
@@ -103,11 +153,11 @@ PanelItems.PanelItem {
Text { text: "Label 8" },
TextField { text: settings.name7; onTextChanged: settings.name7 = text },
Text { text: "Value 1" },
- SettingsUi.IntField { text: settings.value0; onValueChanged: settings.value0 = value },
+ TextField { text: settings.value0; onTextChanged: settings.value0 = parseFloat(text) | 0 },
Text { text: "Value 2" },
- SettingsUi.IntField { text: settings.value1; onValueChanged: settings.value1 = value },
+ TextField { text: settings.value1; onTextChanged: settings.value1 = parseFloat(text) | 0 },
Text { text: "Value 3" },
- SettingsUi.IntField { text: settings.value2; onValueChanged: settings.value2 = value },
+ TextField { text: settings.value2; onTextChanged: settings.value2 = parseFloat(text) | 0 },
Text { text: "Value 4" },
SettingsUi.IntField { text: settings.value3; onValueChanged: settings.value3 = value },
Text { text: "Value 5" },
@@ -117,13 +167,25 @@ PanelItems.PanelItem {
Text { text: "Value 7" },
SettingsUi.IntField { text: settings.value6; onValueChanged: settings.value6 = value },
Text { text: "Value 8" },
- SettingsUi.IntField { text: settings.value7; onValueChanged: settings.value7 = value }
+ SettingsUi.IntField { text: settings.value7; onValueChanged: settings.value7 = value },
+ Text { text: "Knob rotation" },
+ SettingsUi.IntField { text: settings.positionAngle; onValueChanged: settings.positionAngle = value },
+ Text { text: "Initial Angle" },
+ TextField {text: settings.positionAngleZero; onTextChanged: settings.positionAngleZero = parseFloat(text) || 0 },
+ Text { text: "Show Labels" },
+ CheckBox { checked: settings.showLabels ; onCheckedChanged: settings.showLabels = checked },
+ Text { text: "Style 0 1 2" },
+ SettingsUi.IntField { text: settings.style; onValueChanged: settings.style = value },
+ Text { text: "Enable mouse areas to use left mouse button" },
+ CheckBox { checked: settings.enableMouseAreas ; onCheckedChanged: settings.enableMouseAreas = checked }
]
PanelItems.PanelItemSettings {
id: settings
property int positionCount: 3
property string dataRef: ""
+ property string leftCommand: ""
+ property string rightCommand: ""
property string name0: "OFF"
property string name1: "AUTO"
property string name2: "ON"
@@ -132,13 +194,25 @@ PanelItems.PanelItem {
property string name5: ""
property string name6: ""
property string name7: ""
- property int value0: 0
- property int value1: 1
- property int value2: 2
+ property real value0: 0
+ property real value1: 1
+ property real value2: 2
property int value3: 3
property int value4: 4
property int value5: 5
property int value6: 6
property int value7: 7
+ property real positionAngle: 30
+ property real positionAngleZero: -30
+ property bool showLabels: true
+ property int style: 0
+ property bool enableMouseAreas: false
+ }
+ function value2Position(value)
+ {
+ for (var i = 0; i < positionValue.length; i++)
+ if (positionValue[i] === value) return i
+
+ return 0
}
}
diff --git a/qmlui/panelitems/switches/RotaryKnob.qml b/qmlui/panelitems/switches/RotaryKnob.qml
index d5c2297..287437e 100644
--- a/qmlui/panelitems/switches/RotaryKnob.qml
+++ b/qmlui/panelitems/switches/RotaryKnob.qml
@@ -6,7 +6,8 @@ import "../.." as Panel
PanelItems.PanelItem {
clip: false
-
+ property bool timerActive: false
+ property bool rightDirection: false
property real rotationAngle: (parseFloat(rotaryRef.value) || 0) * settings.rotationScale
Rectangle {
@@ -46,9 +47,38 @@ PanelItems.PanelItem {
anchors.fill: knob
onWheel: {
var rotationChange = settings.changeValue * (wheel.angleDelta.y / 120)
- rotaryRef.value = parseFloat(rotaryRef.value) + rotationChange
+ if (settings.leftCommand=="")
+ rotaryRef.value = parseFloat(rotaryRef.value) + rotationChange
+ else
+ rotationChange >= 0 ? extplaneClient.extplaneConnection.commandOnce(settings.rightCommand) :
+ extplaneClient.extplaneConnection.commandOnce(settings.leftCommand)
+ }
+ }
+ MouseArea {
+ id: leftMouseArea
+ enabled: !editMode
+ width: parent.width/2
+ height: parent.height
+ anchors.left: parent.left
+ onPressed: pressOnce(false)
+ onPressAndHold: { rightDirection = false
+ timerActive = true
}
+ onReleased: timerActive = false
}
+ MouseArea {
+ id: rightMouseArea
+ enabled: !editMode
+ width: parent.width/2
+ height: parent.height
+ anchors.right: parent.right
+ onPressed: pressOnce(true)
+ onPressAndHold: { rightDirection = true
+ timerActive = true
+ }
+ onReleased: timerActive = false
+ }
+
DataRef {
id: rotaryRef
name: settings.dataref
@@ -60,14 +90,45 @@ PanelItems.PanelItem {
Text { text: "Scale between dial angle and dataref value" },
TextField { text: settings.rotationScale; onTextChanged: settings.rotationScale = parseFloat(text) || 1 },
Text { text: "Dataref" },
- TextField { text: settings.dataref; onTextChanged: settings.dataref = text }
+ TextField { text: settings.dataref; onTextChanged: settings.dataref = text },
+ Text { text: "Move Right Command" },
+ TextField { text: settings.rightCommand; onTextChanged: settings.rightCommand = text },
+ Text { text: "Move Left Command" },
+ TextField { text: settings.leftCommand; onTextChanged: settings.leftCommand = text }
]
-
PanelItems.PanelItemSettings {
id: settings
property string dataref: ""
+ property string leftCommand: ""
+ property string rightCommand: ""
property real changeValue: 1
property real rotationScale: 1
}
+ function pressOnce(right)
+ {
+ if (settings.leftCommand=="")
+ {
+ if (right)
+ rotaryRef.value = parseFloat(rotaryRef.value) + settings.changeValue
+ else
+ rotaryRef.value = parseFloat(rotaryRef.value) - settings.changeValue
+ }
+ else
+ {
+ if (right)
+ extplaneClient.extplaneConnection.commandOnce(settings.rightCommand)
+ else
+ extplaneClient.extplaneConnection.commandOnce(settings.leftCommand)
+ }
+ }
+ Timer
+ {
+ id: timer
+ interval: 100
+ repeat: true
+ triggeredOnStart: true
+ running: timerActive
+ onTriggered: pressOnce(rightDirection)
+ }
}
diff --git a/qmlui/panelitems/switches/ThreeWaySwitch.qml b/qmlui/panelitems/switches/ThreeWaySwitch.qml
index 6c2e103..626d86c 100644
--- a/qmlui/panelitems/switches/ThreeWaySwitch.qml
+++ b/qmlui/panelitems/switches/ThreeWaySwitch.qml
@@ -8,7 +8,7 @@ PanelItems.PanelItem {
clip: false
property color frontColor: "white"
property color backColor: "black"
- property int position: parseInt(switchRef.value) || 0
+ property int position: switchRef.value == settings.upValue ? 0 : switchRef.value == settings.centerValue ? 1 : 2
Image {
property var positionImages: ["switch-up.svg", "switch-center.svg", "switch-down.svg"]
@@ -17,13 +17,19 @@ PanelItems.PanelItem {
source: positionImages[positionImageIndex]
anchors.fill: parent
fillMode: Image.PreserveAspectFit
+ rotation: parseInt(settings.rotation)
MouseArea {
id: topMouseArea
enabled: !editMode
width: parent.width
height: parent.height/3
- onPressed: switchRef.setValue("0")
- onReleased: if(settings.upReturns) switchRef.setValue("1")
+ onPressed: settings.upCommand == "" ? switchRef.setValue(settings.upValue) : extplaneClient.extplaneConnection.commandBegin(settings.upCommand)
+ onReleased: if (settings.upCommand == "")
+ {
+ if(settings.upReturns) switchRef.setValue(settings.centerValue)
+ }
+ else
+ extplaneClient.extplaneConnection.commandEnd(settings.upCommand)
}
MouseArea {
id: centerMouseArea
@@ -31,7 +37,8 @@ PanelItems.PanelItem {
width: parent.width
height: parent.height/3
anchors.centerIn: parent
- onPressed: switchRef.setValue("1")
+ onPressed: settings.downCommand == "" ? switchRef.setValue(settings.centerValue) : position == 0 ?
+ extplaneClient.extplaneConnection.commandOnce(settings.downCommand) : extplaneClient.extplaneConnection.commandOnce(settings.upCommand)
}
MouseArea {
id: bottomMouseArea
@@ -39,8 +46,13 @@ PanelItems.PanelItem {
width: parent.width
height: parent.height/3
anchors.bottom: parent.bottom
- onPressed: switchRef.setValue("2")
- onReleased: if(settings.downReturns) switchRef.setValue("1")
+ onPressed: settings.downCommand == "" ? switchRef.setValue(settings.downValue) : extplaneClient.extplaneConnection.commandBegin(settings.downCommand)
+ onReleased: if (settings.downCommand == "")
+ {
+ if(settings.downReturns) switchRef.setValue(settings.centerValue)
+ }
+ else
+ extplaneClient.extplaneConnection.commandEnd(settings.downCommand)
}
}
Text {
@@ -80,7 +92,7 @@ PanelItems.PanelItem {
id: switchRef
name: settings.dataref
}
- propertiesDialog.helpText: 'A generic 3-way switch, can set a dataref 0, 1 or 2. \
+ propertiesDialog.helpText: 'A generic 3-way switch, can set a dataref arbitrary values (defaults are 0, 1 or 2). \
You can set up/down positions to return to center when released.'
propertiesDialog.propertyItems: [
Text { text: "Label text" },
@@ -93,13 +105,24 @@ You can set up/down positions to return to center when released.'
TextField { text: settings.downText; onTextChanged: settings.downText = text },
Text { text: "Dataref" },
TextField { text: settings.dataref; onTextChanged: settings.dataref = text },
+ Text { text: "Move Up Command" },
+ TextField { text: settings.upCommand; onTextChanged: settings.upCommand = text },
+ Text { text: "Move Down Command" },
+ TextField { text: settings.downCommand; onTextChanged: settings.downCommand = text },
Text { text: "Up returns" },
CheckBox { checked: settings.upReturns ; onCheckedChanged: settings.upReturns = checked },
Text { text: "Down returns" },
- CheckBox { checked: settings.downReturns ; onCheckedChanged: settings.downReturns = checked }
+ CheckBox { checked: settings.downReturns ; onCheckedChanged: settings.downReturns = checked },
+ Text { text: "Angle" },
+ TextField { text: settings.rotation; onTextChanged: settings.rotation = text },
+ Text { text: "Up value" },
+ TextField { text: settings.upValue ; onTextChanged: settings.upValue = text },
+ Text { text: "Center value" },
+ TextField { text: settings.centerValue ; onTextChanged: settings.centerValue = text },
+ Text { text: "Down value" },
+ TextField { text: settings.downValue ; onTextChanged: settings.downValue = text }
]
-
PanelItems.PanelItemSettings {
id: settings
property string labelText: ""
@@ -109,5 +132,11 @@ You can set up/down positions to return to center when released.'
property string dataref: ""
property bool upReturns: false
property bool downReturns: false
+ property string rotation: "0"
+ property string upValue: "0"
+ property string centerValue: "1"
+ property string downValue: "2"
+ property string upCommand: ""
+ property string downCommand: ""
}
}
diff --git a/qmlui/panelitems/switches/ToggleSwitch.qml b/qmlui/panelitems/switches/ToggleSwitch.qml
index e89b36e..be6925f 100644
--- a/qmlui/panelitems/switches/ToggleSwitch.qml
+++ b/qmlui/panelitems/switches/ToggleSwitch.qml
@@ -3,18 +3,20 @@ import QtQuick.Controls 2.2
import org.vranki.extplane 1.0
import ".." as PanelItems
import "../.." as Panel
+import "../settingsui" as SettingsUi
PanelItems.PanelItem {
clip: false
property color frontColor: "white"
property color backColor: "black"
- property bool isOn: switchRef.value == "1"
+ property bool isOn: switchRef.value == settings.onValue
Image {
id: switchImage
source: (settings.invert ? !isOn : isOn) ? "switch-up.svg" : "switch-down.svg"
anchors.fill: parent
fillMode: Image.PreserveAspectFit
+ rotation: settings.rotation
}
Text {
text: settings.labelText
@@ -46,7 +48,10 @@ PanelItems.PanelItem {
id: buttonMouseArea
enabled: !editMode
anchors.fill: switchImage
- onClicked: switchRef.setValue(isOn ? "0" : "1")
+ onClicked: settings.command=="" ? switchRef.setValue(isOn ? "0" : settings.onValue) : (settings.commandDown=="" ?
+ extplaneClient.extplaneConnection.commandOnce(settings.command) :
+ (settings.invert ? !isOn : isOn) ?
+ extplaneClient.extplaneConnection.commandOnce(settings.commandDown) : extplaneClient.extplaneConnection.commandOnce(settings.command))
}
DataRef {
id: switchRef
@@ -63,11 +68,18 @@ Check invert if you want to have 1 down and 0 up';
TextField { text: settings.downText; onTextChanged: settings.downText = text },
Text { text: "Dataref" },
TextField { text: settings.dataref; onTextChanged: settings.dataref = text },
+ Text { text: "Command toggle/up for readonly datarefs" },
+ TextField { text: settings.command; onTextChanged: settings.command = text },
+ Text { text: "Command down for readonly datarefs" },
+ TextField { text: settings.commandDown; onTextChanged: settings.commandDown = text },
Text { text: "Invert" },
- CheckBox { checked: settings.invert ; onCheckedChanged: settings.invert = checked }
+ CheckBox { checked: settings.invert ; onCheckedChanged: settings.invert = checked },
+ Text { text: "Angle" },
+ TextField { text: settings.rotation; onTextChanged: settings.rotation = parseFloat(text) | 0 },
+ Text { text: "On Value" },
+ TextField { text: settings.onValue; onTextChanged: settings.onValue = text }
]
-
PanelItems.PanelItemSettings {
id: settings
property string labelText: ""
@@ -75,5 +87,9 @@ Check invert if you want to have 1 down and 0 up';
property string downText: ""
property string dataref: ""
property bool invert: false
+ property real rotation: 0
+ property string command: ""
+ property string commandDown: ""
+ property string onValue: "1"
}
}
diff --git a/qmlui/panelitems/switches/bcap-closed.svg b/qmlui/panelitems/switches/bcap-closed.svg
new file mode 100644
index 0000000..720907e
--- /dev/null
+++ b/qmlui/panelitems/switches/bcap-closed.svg
@@ -0,0 +1,47 @@
+
+
+
+
diff --git a/qmlui/panelitems/switches/bcap-open.svg b/qmlui/panelitems/switches/bcap-open.svg
new file mode 100644
index 0000000..138c7d9
--- /dev/null
+++ b/qmlui/panelitems/switches/bcap-open.svg
@@ -0,0 +1,49 @@
+
+
+
+
diff --git a/qmlui/panelitems/switches/knob1.svg b/qmlui/panelitems/switches/knob1.svg
new file mode 100644
index 0000000..73e9643
--- /dev/null
+++ b/qmlui/panelitems/switches/knob1.svg
@@ -0,0 +1,295 @@
+
+
+
+
diff --git a/qmlui/panelitems/switches/knob2.svg b/qmlui/panelitems/switches/knob2.svg
new file mode 100644
index 0000000..4075991
--- /dev/null
+++ b/qmlui/panelitems/switches/knob2.svg
@@ -0,0 +1,475 @@
+
+
+
+
diff --git a/qmlui/panelitems/switches/rcap-open.svg b/qmlui/panelitems/switches/rcap-open.svg
new file mode 100644
index 0000000..ae30f2b
--- /dev/null
+++ b/qmlui/panelitems/switches/rcap-open.svg
@@ -0,0 +1,49 @@
+
+
+
+
diff --git a/qmlui/panelitems/switches/rcap_closed.svg b/qmlui/panelitems/switches/rcap_closed.svg
new file mode 100644
index 0000000..59ced13
--- /dev/null
+++ b/qmlui/panelitems/switches/rcap_closed.svg
@@ -0,0 +1,52 @@
+
+
+
+
diff --git a/qmlui/qml.qrc b/qmlui/qml.qrc
index d782d31..b9ae492 100644
--- a/qmlui/qml.qrc
+++ b/qmlui/qml.qrc
@@ -60,5 +60,14 @@
panelitems/settingsui/FileSelector.qml
panelitems/settingsui/ColorSelector.qml
panelitems/CompassWhisky.qml
+ panelitems/switches/bcap-closed.svg
+ panelitems/switches/bcap-open.svg
+ panelitems/switches/rcap_closed.svg
+ panelitems/switches/rcap-open.svg
+ panelitems/switches/knob1.svg
+ panelitems/switches/knob2.svg
+ panelitems/needle/GaugeLess.qml
+ panelitems/switches/B738GenericCap.qml
+ panelitems/annunciators/DualAnnunciator.qml