Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions qmlui/AddItemDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
1 change: 1 addition & 0 deletions qmlui/PanelItemArea.qml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ MouseArea {
Settings {
id: settings
category: "panelitems"
fileName: "panel.ini"
property alias datastore: dragArea.datastore
property int largestId: 0
onDatastoreChanged: {
Expand Down
3 changes: 3 additions & 0 deletions qmlui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }

Expand Down
1 change: 1 addition & 0 deletions qmlui/panelitems/PanelItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions qmlui/panelitems/PanelItemSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import Qt.labs.settings 1.0

Settings {
id: settings
fileName: "panel.ini"
category: "panelitem-" + panelId + "/" + itemId
}
14 changes: 9 additions & 5 deletions qmlui/panelitems/annunciators/Annunciator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,15 +21,15 @@ 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
}
Rectangle {
anchors.fill: parent
radius: 2
color: colors[settings.annunciatorColor]
color: lightColor
opacity: 0.02
}
Text { // One line version
Expand Down Expand Up @@ -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 {
Expand All @@ -85,6 +87,7 @@ PanelItems.PanelItem {
property int annunciatorColor: 0
property string dataref: ""
property bool backgroundLights: false
property string overrideColor: ""
}

function copySettings(other) {
Expand All @@ -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
}
}
99 changes: 99 additions & 0 deletions qmlui/panelitems/annunciators/DualAnnunciator.qml
Original file line number Diff line number Diff line change
@@ -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
}
}
29 changes: 25 additions & 4 deletions qmlui/panelitems/decoration/Label.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
3 changes: 3 additions & 0 deletions qmlui/panelitems/needle/CircularGauge.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -42,6 +44,7 @@ PanelItems.PanelItem {
barsAngleMin: parent.barsAngleMin
valueMin: parent.valueMin
valueMax: parent.valueMax
showGauge: parent.showGauge
z: -10
}
Text {
Expand Down
3 changes: 2 additions & 1 deletion qmlui/panelitems/needle/CircularGaugeBars.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
55 changes: 55 additions & 0 deletions qmlui/panelitems/needle/GaugeLess.qml
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading