Skip to content
Snippets Groups Projects
Commit d04518d5 authored by Don Gagne's avatar Don Gagne
Browse files

Altitude properties are visually distinct

parent a6cffd54
No related branches found
No related tags found
No related merge requests found
...@@ -56,6 +56,15 @@ QGCFlickable { ...@@ -56,6 +56,15 @@ QGCFlickable {
qgcView.showDialog(propertyPicker, "Value Widget Setup", qgcView.showDialogDefaultWidth, StandardButton.Ok) qgcView.showDialog(propertyPicker, "Value Widget Setup", qgcView.showDialogDefaultWidth, StandardButton.Ok)
} }
function listContains(list, value) {
for (var i=0; i<list.length; i++) {
if (list[i] === value) {
return true
}
}
return false
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: showPicker() onClicked: showPicker()
...@@ -74,6 +83,7 @@ QGCFlickable { ...@@ -74,6 +83,7 @@ QGCFlickable {
width: _largeColumn.width width: _largeColumn.width
property Fact fact: _activeVehicle.getFact(modelData.replace("Vehicle.", "")) property Fact fact: _activeVehicle.getFact(modelData.replace("Vehicle.", ""))
property bool largeValue: _root.listContains(controller.altitudeProperties, fact.name)
QGCLabel { QGCLabel {
width: parent.width width: parent.width
...@@ -84,8 +94,8 @@ QGCFlickable { ...@@ -84,8 +94,8 @@ QGCFlickable {
QGCLabel { QGCLabel {
width: parent.width width: parent.width
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font.pixelSize: ScreenTools.largeFontPixelSize font.pixelSize: ScreenTools.largeFontPixelSize * (largeValue ? 1.3 : 1.0)
font.weight: Font.DemiBold font.weight: largeValue ? Font.ExtraBold : Font.Normal
color: textColor color: textColor
text: fact.valueString text: fact.valueString
} }
...@@ -185,15 +195,6 @@ QGCFlickable { ...@@ -185,15 +195,6 @@ QGCFlickable {
property string propertyName: factGroupName + "." + modelData property string propertyName: factGroupName + "." + modelData
function contains(list, value) {
for (var i=0; i<list.length; i++) {
if (list[i] === value) {
return true
}
}
return false
}
function removeFromList(list, value) { function removeFromList(list, value) {
var newList = [] var newList = []
for (var i=0; i<list.length; i++) { for (var i=0; i<list.length; i++) {
...@@ -236,14 +237,14 @@ QGCFlickable { ...@@ -236,14 +237,14 @@ QGCFlickable {
QGCCheckBox { QGCCheckBox {
id: _addCheckBox id: _addCheckBox
text: factGroup.getFact(modelData).shortDescription text: factGroup.getFact(modelData).shortDescription
checked: _largeCheckBox.checked || parent.contains(controller.smallValues, propertyName) checked: _largeCheckBox.checked || listContains(controller.smallValues, propertyName)
onClicked: updateValues() onClicked: updateValues()
} }
QGCCheckBox { QGCCheckBox {
id: _largeCheckBox id: _largeCheckBox
text: "large" text: "large"
checked: parent.contains(controller.largeValues, propertyName) checked: listContains(controller.largeValues, propertyName)
enabled: _addCheckBox.checked enabled: _addCheckBox.checked
onClicked: updateValues() onClicked: updateValues()
} }
......
...@@ -40,6 +40,8 @@ ValuesWidgetController::ValuesWidgetController(void) ...@@ -40,6 +40,8 @@ ValuesWidgetController::ValuesWidgetController(void)
_largeValues = settings.value(_largeValuesKey, largeDefaults).toStringList(); _largeValues = settings.value(_largeValuesKey, largeDefaults).toStringList();
_smallValues = settings.value(_smallValuesKey, QStringList()).toStringList(); _smallValues = settings.value(_smallValuesKey, QStringList()).toStringList();
_altitudeProperties << "altitudeRelative" << "altitudeAMSL";
// Keep back compat for removed WGS84 value // Keep back compat for removed WGS84 value
if (_largeValues.contains ("Vehicle.altitudeWGS84")) { if (_largeValues.contains ("Vehicle.altitudeWGS84")) {
setLargeValues(_largeValues.replaceInStrings("Vehicle.altitudeWGS84", "Vehicle.altitudeRelative")); setLargeValues(_largeValues.replaceInStrings("Vehicle.altitudeWGS84", "Vehicle.altitudeRelative"));
......
...@@ -36,10 +36,13 @@ public: ...@@ -36,10 +36,13 @@ public:
Q_PROPERTY(QStringList largeValues READ largeValues WRITE setLargeValues NOTIFY largeValuesChanged) Q_PROPERTY(QStringList largeValues READ largeValues WRITE setLargeValues NOTIFY largeValuesChanged)
Q_PROPERTY(QStringList smallValues READ smallValues WRITE setSmallValues NOTIFY smallValuesChanged) Q_PROPERTY(QStringList smallValues READ smallValues WRITE setSmallValues NOTIFY smallValuesChanged)
Q_PROPERTY(QStringList altitudeProperties READ altitudeProperties CONSTANT)
QStringList largeValues(void) const { return _largeValues; } QStringList largeValues(void) const { return _largeValues; }
QStringList smallValues(void) const { return _smallValues; } QStringList smallValues(void) const { return _smallValues; }
void setLargeValues(const QStringList& values); void setLargeValues(const QStringList& values);
void setSmallValues(const QStringList& values); void setSmallValues(const QStringList& values);
QStringList altitudeProperties(void) const { return _altitudeProperties; }
signals: signals:
void largeValuesChanged(QStringList values); void largeValuesChanged(QStringList values);
...@@ -48,6 +51,7 @@ signals: ...@@ -48,6 +51,7 @@ signals:
private: private:
QStringList _largeValues; QStringList _largeValues;
QStringList _smallValues; QStringList _smallValues;
QStringList _altitudeProperties;
static const char* _groupKey; static const char* _groupKey;
static const char* _largeValuesKey; static const char* _largeValuesKey;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment