|
|
@ -27,169 +27,185 @@ QGCPopupDialog { |
|
|
|
|
|
|
|
|
|
|
|
property var instrumentValueData: dialogProperties.instrumentValueData |
|
|
|
property var instrumentValueData: dialogProperties.instrumentValueData |
|
|
|
|
|
|
|
|
|
|
|
QGCPalette { id: qgcPal; colorGroupEnabled: parent.enabled } |
|
|
|
QGCPalette { id: qgcPal; colorGroupEnabled: parent.enabled } |
|
|
|
QGCPalette { id: qgcPalDisabled; colorGroupEnabled: false } |
|
|
|
QGCPalette { id: qgcPalDisabled; colorGroupEnabled: false } |
|
|
|
|
|
|
|
|
|
|
|
GridLayout { |
|
|
|
Loader { |
|
|
|
rowSpacing: _margins |
|
|
|
sourceComponent: instrumentValueData.fact ? editorComponent : noFactComponent |
|
|
|
columnSpacing: _margins |
|
|
|
} |
|
|
|
columns: 2 |
|
|
|
|
|
|
|
|
|
|
|
Component { |
|
|
|
QGCComboBox { |
|
|
|
id: noFactComponent |
|
|
|
id: factGroupCombo |
|
|
|
|
|
|
|
Layout.fillWidth: true |
|
|
|
QGCLabel { |
|
|
|
model: instrumentValueData.factGroupNames |
|
|
|
text: qsTr("Valuec requires a connected vehicle for setup.") |
|
|
|
sizeToContents: true |
|
|
|
|
|
|
|
Component.onCompleted: currentIndex = find(instrumentValueData.factGroupName) |
|
|
|
|
|
|
|
onActivated: { |
|
|
|
|
|
|
|
instrumentValueData.setFact(currentText, "") |
|
|
|
|
|
|
|
instrumentValueData.icon = "" |
|
|
|
|
|
|
|
instrumentValueData.text = instrumentValueData.fact.shortDescription |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Connections { |
|
|
|
|
|
|
|
target: instrumentValueData |
|
|
|
|
|
|
|
onFactGroupNameChanged: factGroupCombo.currentIndex = factGroupCombo.find(instrumentValueData.factGroupName) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QGCComboBox { |
|
|
|
Component { |
|
|
|
id: factNamesCombo |
|
|
|
id: editorComponent |
|
|
|
Layout.fillWidth: true |
|
|
|
|
|
|
|
model: instrumentValueData.factValueNames |
|
|
|
GridLayout { |
|
|
|
sizeToContents: true |
|
|
|
rowSpacing: _margins |
|
|
|
Component.onCompleted: currentIndex = find(instrumentValueData.factName) |
|
|
|
columnSpacing: _margins |
|
|
|
onActivated: { |
|
|
|
columns: 2 |
|
|
|
instrumentValueData.setFact(instrumentValueData.factGroupName, currentText) |
|
|
|
|
|
|
|
instrumentValueData.icon = "" |
|
|
|
QGCComboBox { |
|
|
|
instrumentValueData.text = instrumentValueData.fact.shortDescription |
|
|
|
id: factGroupCombo |
|
|
|
} |
|
|
|
Layout.fillWidth: true |
|
|
|
Connections { |
|
|
|
model: instrumentValueData.factGroupNames |
|
|
|
target: instrumentValueData |
|
|
|
sizeToContents: true |
|
|
|
onFactNameChanged: factNamesCombo.currentIndex = factNamesCombo.find(instrumentValueData.factName) |
|
|
|
Component.onCompleted: currentIndex = find(instrumentValueData.factGroupName) |
|
|
|
|
|
|
|
onActivated: { |
|
|
|
|
|
|
|
instrumentValueData.setFact(currentText, "") |
|
|
|
|
|
|
|
instrumentValueData.icon = "" |
|
|
|
|
|
|
|
instrumentValueData.text = instrumentValueData.fact.shortDescription |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Connections { |
|
|
|
|
|
|
|
target: instrumentValueData |
|
|
|
|
|
|
|
onFactGroupNameChanged: factGroupCombo.currentIndex = factGroupCombo.find(instrumentValueData.factGroupName) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCRadioButton { |
|
|
|
QGCComboBox { |
|
|
|
id: iconRadio |
|
|
|
id: factNamesCombo |
|
|
|
text: qsTr("Icon") |
|
|
|
Layout.fillWidth: true |
|
|
|
Component.onCompleted: checked = instrumentValueData.icon != "" |
|
|
|
model: instrumentValueData.factValueNames |
|
|
|
onClicked: { |
|
|
|
sizeToContents: true |
|
|
|
instrumentValueData.text = "" |
|
|
|
Component.onCompleted: currentIndex = find(instrumentValueData.factName) |
|
|
|
instrumentValueData.icon = instrumentValueData.factValueGrid.iconNames[0] |
|
|
|
onActivated: { |
|
|
|
var updateFunction = function(icon){ instrumentValueData.icon = icon } |
|
|
|
instrumentValueData.setFact(instrumentValueData.factGroupName, currentText) |
|
|
|
mainWindow.showPopupDialogFromComponent(iconPickerDialog, { iconNames: instrumentValueData.factValueGrid.iconNames, icon: instrumentValueData.icon, updateIconFunction: updateFunction }) |
|
|
|
instrumentValueData.icon = "" |
|
|
|
|
|
|
|
instrumentValueData.text = instrumentValueData.fact.shortDescription |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Connections { |
|
|
|
|
|
|
|
target: instrumentValueData |
|
|
|
|
|
|
|
onFactNameChanged: factNamesCombo.currentIndex = factNamesCombo.find(instrumentValueData.factName) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCColoredImage { |
|
|
|
QGCRadioButton { |
|
|
|
id: valueIcon |
|
|
|
id: iconRadio |
|
|
|
Layout.alignment: Qt.AlignHCenter |
|
|
|
text: qsTr("Icon") |
|
|
|
height: ScreenTools.implicitComboBoxHeight |
|
|
|
Component.onCompleted: checked = instrumentValueData.icon != "" |
|
|
|
width: height |
|
|
|
|
|
|
|
source: "/InstrumentValueIcons/" + (instrumentValueData.icon ? instrumentValueData.icon : instrumentValueData.factValueGrid.iconNames[0]) |
|
|
|
|
|
|
|
sourceSize.height: height |
|
|
|
|
|
|
|
fillMode: Image.PreserveAspectFit |
|
|
|
|
|
|
|
mipmap: true |
|
|
|
|
|
|
|
smooth: true |
|
|
|
|
|
|
|
color: enabled ? qgcPal.text : qgcPalDisabled.text |
|
|
|
|
|
|
|
enabled: iconRadio.checked |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MouseArea { |
|
|
|
|
|
|
|
anchors.fill: parent |
|
|
|
|
|
|
|
onClicked: { |
|
|
|
onClicked: { |
|
|
|
|
|
|
|
instrumentValueData.text = "" |
|
|
|
|
|
|
|
instrumentValueData.icon = instrumentValueData.factValueGrid.iconNames[0] |
|
|
|
var updateFunction = function(icon){ instrumentValueData.icon = icon } |
|
|
|
var updateFunction = function(icon){ instrumentValueData.icon = icon } |
|
|
|
mainWindow.showPopupDialogFromComponent(iconPickerDialog, { iconNames: instrumentValueData.factValueGrid.iconNames, icon: instrumentValueData.icon, updateIconFunction: updateFunction }) |
|
|
|
mainWindow.showPopupDialogFromComponent(iconPickerDialog, { iconNames: instrumentValueData.factValueGrid.iconNames, icon: instrumentValueData.icon, updateIconFunction: updateFunction }) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Rectangle { |
|
|
|
QGCColoredImage { |
|
|
|
anchors.fill: valueIcon |
|
|
|
id: valueIcon |
|
|
|
color: qgcPal.text |
|
|
|
Layout.alignment: Qt.AlignHCenter |
|
|
|
visible: valueIcon.status === Image.Error |
|
|
|
height: ScreenTools.implicitComboBoxHeight |
|
|
|
|
|
|
|
width: height |
|
|
|
|
|
|
|
source: "/InstrumentValueIcons/" + (instrumentValueData.icon ? instrumentValueData.icon : instrumentValueData.factValueGrid.iconNames[0]) |
|
|
|
|
|
|
|
sourceSize.height: height |
|
|
|
|
|
|
|
fillMode: Image.PreserveAspectFit |
|
|
|
|
|
|
|
mipmap: true |
|
|
|
|
|
|
|
smooth: true |
|
|
|
|
|
|
|
color: enabled ? qgcPal.text : qgcPalDisabled.text |
|
|
|
|
|
|
|
enabled: iconRadio.checked |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MouseArea { |
|
|
|
|
|
|
|
anchors.fill: parent |
|
|
|
|
|
|
|
onClicked: { |
|
|
|
|
|
|
|
var updateFunction = function(icon){ instrumentValueData.icon = icon } |
|
|
|
|
|
|
|
mainWindow.showPopupDialogFromComponent(iconPickerDialog, { iconNames: instrumentValueData.factValueGrid.iconNames, icon: instrumentValueData.icon, updateIconFunction: updateFunction }) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle { |
|
|
|
|
|
|
|
anchors.fill: valueIcon |
|
|
|
|
|
|
|
color: qgcPal.text |
|
|
|
|
|
|
|
visible: valueIcon.status === Image.Error |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCRadioButton { |
|
|
|
QGCRadioButton { |
|
|
|
id: textRadio |
|
|
|
id: textRadio |
|
|
|
text: qsTr("Text") |
|
|
|
text: qsTr("Text") |
|
|
|
Component.onCompleted: checked = instrumentValueData.icon == "" |
|
|
|
Component.onCompleted: checked = instrumentValueData.icon == "" |
|
|
|
onClicked: { |
|
|
|
onClicked: { |
|
|
|
instrumentValueData.icon = "" |
|
|
|
instrumentValueData.icon = "" |
|
|
|
instrumentValueData.text = instrumentValueData.fact ? instrumentValueData.fact.shortDescription : qsTr("Label") |
|
|
|
instrumentValueData.text = instrumentValueData.fact ? instrumentValueData.fact.shortDescription : qsTr("Label") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCTextField { |
|
|
|
QGCTextField { |
|
|
|
id: labelTextField |
|
|
|
id: labelTextField |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 10 |
|
|
|
Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 10 |
|
|
|
text: instrumentValueData.text |
|
|
|
text: instrumentValueData.text |
|
|
|
enabled: textRadio.checked |
|
|
|
enabled: textRadio.checked |
|
|
|
onEditingFinished: instrumentValueData.text = text |
|
|
|
onEditingFinished: instrumentValueData.text = text |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QGCLabel { text: qsTr("Size") } |
|
|
|
QGCLabel { text: qsTr("Size") } |
|
|
|
|
|
|
|
|
|
|
|
QGCComboBox { |
|
|
|
QGCComboBox { |
|
|
|
id: fontSizeCombo |
|
|
|
id: fontSizeCombo |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
|
model: instrumentValueData.factValueGrid.fontSizeNames |
|
|
|
model: instrumentValueData.factValueGrid.fontSizeNames |
|
|
|
currentIndex: instrumentValueData.factValueGrid.fontSize |
|
|
|
currentIndex: instrumentValueData.factValueGrid.fontSize |
|
|
|
sizeToContents: true |
|
|
|
sizeToContents: true |
|
|
|
onActivated: instrumentValueData.factValueGrid.fontSize = index |
|
|
|
onActivated: instrumentValueData.factValueGrid.fontSize = index |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QGCCheckBox { |
|
|
|
QGCCheckBox { |
|
|
|
Layout.columnSpan: 2 |
|
|
|
Layout.columnSpan: 2 |
|
|
|
text: qsTr("Show Units") |
|
|
|
text: qsTr("Show Units") |
|
|
|
checked: instrumentValueData.showUnits |
|
|
|
checked: instrumentValueData.showUnits |
|
|
|
onClicked: instrumentValueData.showUnits = checked |
|
|
|
onClicked: instrumentValueData.showUnits = checked |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QGCLabel { text: qsTr("Range") } |
|
|
|
QGCLabel { text: qsTr("Range") } |
|
|
|
|
|
|
|
|
|
|
|
QGCComboBox { |
|
|
|
QGCComboBox { |
|
|
|
id: rangeTypeCombo |
|
|
|
id: rangeTypeCombo |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
|
model: instrumentValueData.rangeTypeNames |
|
|
|
model: instrumentValueData.rangeTypeNames |
|
|
|
currentIndex: instrumentValueData.rangeType |
|
|
|
currentIndex: instrumentValueData.rangeType |
|
|
|
sizeToContents: true |
|
|
|
sizeToContents: true |
|
|
|
onActivated: instrumentValueData.rangeType = index |
|
|
|
onActivated: instrumentValueData.rangeType = index |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Loader { |
|
|
|
Loader { |
|
|
|
id: rangeLoader |
|
|
|
id: rangeLoader |
|
|
|
Layout.columnSpan: 2 |
|
|
|
Layout.columnSpan: 2 |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.preferredWidth: item ? item.width : 0 |
|
|
|
Layout.preferredWidth: item ? item.width : 0 |
|
|
|
Layout.preferredHeight: item ? item.height : 0 |
|
|
|
Layout.preferredHeight: item ? item.height : 0 |
|
|
|
|
|
|
|
|
|
|
|
property var instrumentValueData: root.instrumentValueData |
|
|
|
property var instrumentValueData: root.instrumentValueData |
|
|
|
|
|
|
|
|
|
|
|
function updateSourceComponent() { |
|
|
|
function updateSourceComponent() { |
|
|
|
switch (instrumentValueData.rangeType) { |
|
|
|
switch (instrumentValueData.rangeType) { |
|
|
|
case InstrumentValueData.NoRangeInfo: |
|
|
|
case InstrumentValueData.NoRangeInfo: |
|
|
|
sourceComponent = undefined |
|
|
|
sourceComponent = undefined |
|
|
|
break |
|
|
|
break |
|
|
|
case InstrumentValueData.ColorRange: |
|
|
|
case InstrumentValueData.ColorRange: |
|
|
|
sourceComponent = colorRangeDialog |
|
|
|
sourceComponent = colorRangeDialog |
|
|
|
break |
|
|
|
break |
|
|
|
case InstrumentValueData.OpacityRange: |
|
|
|
case InstrumentValueData.OpacityRange: |
|
|
|
sourceComponent = opacityRangeDialog |
|
|
|
sourceComponent = opacityRangeDialog |
|
|
|
break |
|
|
|
break |
|
|
|
case InstrumentValueData.IconSelectRange: |
|
|
|
case InstrumentValueData.IconSelvalueedectRange: |
|
|
|
sourceComponent = iconRangeDialog |
|
|
|
sourceComponent = iconRangeDialog |
|
|
|
break |
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: updateSourceComponent() |
|
|
|
Component.onCompleted: updateSourceComponent() |
|
|
|
|
|
|
|
|
|
|
|
Connections { |
|
|
|
Connections { |
|
|
|
target: instrumentValueData |
|
|
|
target: instrumentValueData |
|
|
|
onRangeTypeChanged: rangeLoader.updateSourceComponent() |
|
|
|
onRangeTypeChanged: rangeLoader.updateSourceComponent() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -313,7 +329,7 @@ QGCPopupDialog { |
|
|
|
id: iconRangeDialog |
|
|
|
id: iconRangeDialog |
|
|
|
|
|
|
|
|
|
|
|
Item { |
|
|
|
Item { |
|
|
|
width: childrenRect.width |
|
|
|
width: childrenRect.widthvalueed |
|
|
|
height: childrenRect.height |
|
|
|
height: childrenRect.height |
|
|
|
|
|
|
|
|
|
|
|
function updateRangeValue(index, text) { |
|
|
|
function updateRangeValue(index, text) { |
|
|
@ -545,4 +561,3 @@ QGCPopupDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|