diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro
index 9010834163ed2f9492d7c0140e3e7697d3f9d577..7d2199c61640dc0b3dabb29e11acd7f48bd774d7 100644
--- a/qgroundcontrol.pro
+++ b/qgroundcontrol.pro
@@ -186,6 +186,7 @@ INCLUDEPATH += \
src/comm \
src/FlightDisplay \
src/FlightMap \
+ src/FlightMap/Widgets \
src/input \
src/Joystick \
src/lib/qmapcontrol \
@@ -245,6 +246,7 @@ HEADERS += \
src/comm/UDPLink.h \
src/FlightDisplay/FlightDisplayViewController.h \
src/FlightMap/FlightMapSettings.h \
+ src/FlightMap/Widgets/ValuesWidgetController.h \
src/GAudioOutput.h \
src/HomePositionManager.h \
src/Joystick/Joystick.h \
@@ -370,6 +372,7 @@ SOURCES += \
src/comm/UDPLink.cc \
src/FlightDisplay/FlightDisplayViewController.cc \
src/FlightMap/FlightMapSettings.cc \
+ src/FlightMap/Widgets/ValuesWidgetController.cc \
src/GAudioOutput.cc \
src/HomePositionManager.cc \
src/Joystick/Joystick.cc \
diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index 021575ad7792fe6cc4be272e592a89673b86caf9..1264e3e68149ce6b15eaf82e5f25c4b2aa027c60 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -92,6 +92,8 @@
src/FlightDisplay/FlightDisplayViewVideo.qml
src/FlightDisplay/FlightDisplayViewWidgets.qml
src/FlightDisplay/qmldir
+
+ src/FlightMap/qmldir
src/FlightMap/FlightMap.qml
src/FlightMap/MapItems/MissionItemIndicator.qml
src/FlightMap/MapItems/MissionItemView.qml
@@ -104,8 +106,9 @@
src/FlightMap/Widgets/QGCPitchIndicator.qml
src/FlightMap/Widgets/QGCSlider.qml
src/FlightMap/QGCVideoBackground.qml
- src/FlightMap/qmldir
+ src/FlightMap/Widgets/ValuesWidget.qml
src/FlightMap/MapItems/VehicleMapItem.qml
+
src/QmlControls/QGroundControl.ScreenTools.qmldir
src/QmlControls/ScreenTools.qml
src/QmlControls/QmlTest.qml
diff --git a/src/FactSystem/Fact.cc b/src/FactSystem/Fact.cc
index bda502d4e7afabf17077fd0871e393818172b0cb..0216cd2daab34be79e06792cca7786f6c6edd927 100644
--- a/src/FactSystem/Fact.cc
+++ b/src/FactSystem/Fact.cc
@@ -524,3 +524,17 @@ void Fact::sendDeferredValueChangedSignal(void)
emit valueChanged(cookedValue());
}
}
+
+QString Fact::enumOrValueString(void)
+{
+ if (_metaData) {
+ if (_metaData->enumStrings().count()) {
+ return enumStringValue();
+ } else {
+ return cookedValueString();
+ }
+ } else {
+ qWarning() << "Meta data pointer missing";
+ }
+ return QString();
+}
diff --git a/src/FactSystem/Fact.h b/src/FactSystem/Fact.h
index 93a6330a33facebf0fafe5a5681ef5ea5fee6c74..67e8a4a5b24b5d254f80895f9e402a7fd5f44305 100644
--- a/src/FactSystem/Fact.h
+++ b/src/FactSystem/Fact.h
@@ -72,7 +72,8 @@ public:
Q_PROPERTY(QString units READ cookedUnits CONSTANT)
Q_PROPERTY(QVariant value READ cookedValue WRITE setCookedValue NOTIFY valueChanged)
Q_PROPERTY(bool valueEqualsDefault READ valueEqualsDefault NOTIFY valueChanged)
- Q_PROPERTY(QVariant valueString READ cookedValueString NOTIFY valueChanged)
+ Q_PROPERTY(QString valueString READ cookedValueString NOTIFY valueChanged)
+ Q_PROPERTY(QString enumOrValueString READ enumOrValueString NOTIFY valueChanged)
/// Convert and validate value
/// @param convertOnly true: validate type conversion only, false: validate against meta data as well
@@ -111,6 +112,7 @@ public:
QString cookedValueString (void) const;
bool valueEqualsDefault (void) const;
bool rebootRequired (void) const;
+ QString enumOrValueString (void); // This is not const, since an unknown value can modify the enum lists
void setRawValue (const QVariant& value);
void setCookedValue (const QVariant& value);
diff --git a/src/FactSystem/FactGroup.cc b/src/FactSystem/FactGroup.cc
index 9407a0f9877fc5c2f5c6182450864805fa239c54..4ff0fa628fa7270d8348ca1ce13d98a8c1d5b745 100644
--- a/src/FactSystem/FactGroup.cc
+++ b/src/FactSystem/FactGroup.cc
@@ -29,6 +29,7 @@
#include
#include
#include
+#include
QGC_LOGGING_CATEGORY(FactGroupLog, "FactGroupLog")
@@ -55,25 +56,46 @@ FactGroup::FactGroup(int updateRateMsecs, const QString& metaDataFile, QObject*
Fact* FactGroup::getFact(const QString& name)
{
+ Fact* fact = NULL;
+
+ if (name.contains(".")) {
+ QStringList parts = name.split(".");
+ if (parts.count() != 2) {
+ qWarning() << "Only single level of hierarchy supported";
+ return NULL;
+ }
+
+ FactGroup * factGroup = getFactGroup(parts[0]);
+ if (!factGroup) {
+ qWarning() << "Unknown FactGroup" << parts[0];
+ return NULL;
+ }
+
+ return factGroup->getFact(parts[1]);
+ }
+
if (_nameToFactMap.contains(name)) {
- return _nameToFactMap[name];
+ fact = _nameToFactMap[name];
+ QQmlEngine::setObjectOwnership(fact, QQmlEngine::CppOwnership);
} else {
qWarning() << "Unknown Fact" << name;
}
- return NULL;
+ return fact;
}
FactGroup* FactGroup::getFactGroup(const QString& name)
{
+ FactGroup* factGroup = NULL;
+
if (_nameToFactGroupMap.contains(name)) {
- return _nameToFactGroupMap[name];
+ factGroup = _nameToFactGroupMap[name];
+ QQmlEngine::setObjectOwnership(factGroup, QQmlEngine::CppOwnership);
} else {
qWarning() << "Unknown FactGroup" << name;
}
- // FIXME: Return bogus fact
- return NULL;
+ return factGroup;
}
void FactGroup::_addFact(Fact* fact, const QString& name)
diff --git a/src/FactSystem/FactSystem.cc b/src/FactSystem/FactSystem.cc
index dea179ab9d6edfaa2467ac17f6d77523f9e20cab..0e0b9542e6f33bd470560624c094ba8b3ad4cb42 100644
--- a/src/FactSystem/FactSystem.cc
+++ b/src/FactSystem/FactSystem.cc
@@ -43,6 +43,7 @@ void FactSystem::setToolbox(QGCToolbox *toolbox)
QGCTool::setToolbox(toolbox);
qmlRegisterType (_factSystemQmlUri, 1, 0, "Fact");
- qmlRegisterType (_factSystemQmlUri, 1, 0, "FactGroup");
qmlRegisterType(_factSystemQmlUri, 1, 0, "FactPanelController");
+
+ qmlRegisterUncreatableType(_factSystemQmlUri, 1, 0, "FactGroup", "ReferenceOnly");
}
diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml
index 6c0d84569399aa8edd3432fdaf49ef74b03755f4..d991677027d372266aa2e1d68bb908557cc6d235 100644
--- a/src/FlightDisplay/FlightDisplayView.qml
+++ b/src/FlightDisplay/FlightDisplayView.qml
@@ -39,8 +39,10 @@ import QGroundControl.Controllers 1.0
import QGroundControl.FactSystem 1.0
/// Flight Display View
-Item {
- id: root
+QGCView {
+ id: root
+ viewPanel: _panel
+ topDialogMargin: height - availableHeight
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
@@ -139,143 +141,149 @@ Item {
px4JoystickCheck()
}
- //-- Map View
- // For whatever reason, if FlightDisplayViewMap is the root item, changing
- // width/height has no effect.
- Item {
- id: _flightMapContainer
- z: _mainIsMap ? root.z + 1 : root.z + 2
- anchors.left: root.left
- anchors.bottom: root.bottom
- visible: _mainIsMap || _isPipVisible
- width: _mainIsMap ? root.width : pipSize
- height: _mainIsMap ? root.height : pipSize * (9/16)
- states: [
- State {
- name: "pipMode"
- PropertyChanges {
- target: _flightMapContainer
- anchors.margins: ScreenTools.defaultFontPixelHeight
- }
- },
- State {
- name: "fullMode"
- PropertyChanges {
- target: _flightMapContainer
- anchors.margins: 0
+ QGCViewPanel {
+ id: _panel
+ anchors.fill: parent
+
+ //-- Map View
+ // For whatever reason, if FlightDisplayViewMap is the _panel item, changing
+ // width/height has no effect.
+ Item {
+ id: _flightMapContainer
+ z: _mainIsMap ? _panel.z + 1 : _panel.z + 2
+ anchors.left: _panel.left
+ anchors.bottom: _panel.bottom
+ visible: _mainIsMap || _isPipVisible
+ width: _mainIsMap ? _panel.width : pipSize
+ height: _mainIsMap ? _panel.height : pipSize * (9/16)
+ states: [
+ State {
+ name: "pipMode"
+ PropertyChanges {
+ target: _flightMapContainer
+ anchors.margins: ScreenTools.defaultFontPixelHeight
+ }
+ },
+ State {
+ name: "fullMode"
+ PropertyChanges {
+ target: _flightMapContainer
+ anchors.margins: 0
+ }
}
+ ]
+ FlightDisplayViewMap {
+ id: _flightMap
+ anchors.fill: parent
}
- ]
- FlightDisplayViewMap {
- id: _flightMap
- anchors.fill: parent
}
- }
- //-- Video View
- FlightDisplayViewVideo {
- id: _flightVideo
- z: _mainIsMap ? root.z + 2 : root.z + 1
- width: !_mainIsMap ? root.width : pipSize
- height: !_mainIsMap ? root.height : pipSize * (9/16)
- anchors.left: root.left
- anchors.bottom: root.bottom
- visible: _controller.hasVideo && (!_mainIsMap || _isPipVisible)
- states: [
- State {
- name: "pipMode"
- PropertyChanges {
- target: _flightVideo
- anchors.margins: ScreenTools.defaultFontPixelHeight
+ //-- Video View
+ FlightDisplayViewVideo {
+ id: _flightVideo
+ z: _mainIsMap ? _panel.z + 2 : _panel.z + 1
+ width: !_mainIsMap ? _panel.width : pipSize
+ height: !_mainIsMap ? _panel.height : pipSize * (9/16)
+ anchors.left: _panel.left
+ anchors.bottom: _panel.bottom
+ visible: _controller.hasVideo && (!_mainIsMap || _isPipVisible)
+ states: [
+ State {
+ name: "pipMode"
+ PropertyChanges {
+ target: _flightVideo
+ anchors.margins: ScreenTools.defaultFontPixelHeight
+ }
+ },
+ State {
+ name: "fullMode"
+ PropertyChanges {
+ target: _flightVideo
+ anchors.margins: 0
+ }
}
- },
- State {
- name: "fullMode"
- PropertyChanges {
- target: _flightVideo
- anchors.margins: 0
- }
- }
- ]
- }
-
- QGCPipable {
- id: _flightVideoPipControl
- z: _flightVideo.z + 3
- width: pipSize
- height: pipSize * (9/16)
- anchors.left: root.left
- anchors.bottom: root.bottom
- anchors.margins: ScreenTools.defaultFontPixelHeight
- isHidden: !_isPipVisible
- isDark: isBackgroundDark
- onActivated: {
- _mainIsMap = !_mainIsMap
- setStates()
+ ]
}
- onHideIt: {
- setPipVisibility(!state)
+
+ QGCPipable {
+ id: _flightVideoPipControl
+ z: _flightVideo.z + 3
+ width: pipSize
+ height: pipSize * (9/16)
+ anchors.left: _panel.left
+ anchors.bottom: _panel.bottom
+ anchors.margins: ScreenTools.defaultFontPixelHeight
+ isHidden: !_isPipVisible
+ isDark: isBackgroundDark
+ onActivated: {
+ _mainIsMap = !_mainIsMap
+ setStates()
+ }
+ onHideIt: {
+ setPipVisibility(!state)
+ }
}
- }
- //-- Widgets
- Loader {
- id: widgetsLoader
- z: root.z + 4
- anchors.right: parent.right
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- height: availableHeight
- property bool isBackgroundDark: root.isBackgroundDark
- }
+ //-- Widgets
+ Loader {
+ id: widgetsLoader
+ z: _panel.z + 4
+ anchors.right: parent.right
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ height: availableHeight
+ property bool isBackgroundDark: root.isBackgroundDark
+ property var qgcView: root
+ }
- //-- Virtual Joystick
- Item {
- id: multiTouchItem
- z: root.z + 5
- width: parent.width - (_flightVideoPipControl.width / 2)
- height: thumbAreaHeight
- visible: QGroundControl.virtualTabletJoystick
- anchors.bottom: _flightVideoPipControl.top
- anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * 2
- anchors.horizontalCenter: parent.horizontalCenter
-
- readonly property real thumbAreaHeight: Math.min(parent.height * 0.25, ScreenTools.defaultFontPixelWidth * 16)
-
- QGCMapPalette { id: mapPal; lightColors: !isBackgroundDark }
-
- Timer {
- interval: 40 // 25Hz, same as real joystick rate
- running: QGroundControl.virtualTabletJoystick && _activeVehicle
- repeat: true
- onTriggered: {
- if (_activeVehicle) {
- _activeVehicle.virtualTabletJoystickValue(rightStick.xAxis, rightStick.yAxis, leftStick.xAxis, leftStick.yAxis)
+ //-- Virtual Joystick
+ Item {
+ id: multiTouchItem
+ z: _panel.z + 5
+ width: parent.width - (_flightVideoPipControl.width / 2)
+ height: thumbAreaHeight
+ visible: QGroundControl.virtualTabletJoystick
+ anchors.bottom: _flightVideoPipControl.top
+ anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * 2
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ readonly property real thumbAreaHeight: Math.min(parent.height * 0.25, ScreenTools.defaultFontPixelWidth * 16)
+
+ QGCMapPalette { id: mapPal; lightColors: !isBackgroundDark }
+
+ Timer {
+ interval: 40 // 25Hz, same as real joystick rate
+ running: QGroundControl.virtualTabletJoystick && _activeVehicle
+ repeat: true
+ onTriggered: {
+ if (_activeVehicle) {
+ _activeVehicle.virtualTabletJoystickValue(rightStick.xAxis, rightStick.yAxis, leftStick.xAxis, leftStick.yAxis)
+ }
}
}
- }
- JoystickThumbPad {
- id: leftStick
- anchors.leftMargin: xPositionDelta
- anchors.bottomMargin: -yPositionDelta
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- width: parent.thumbAreaHeight
- height: parent.thumbAreaHeight
- yAxisThrottle: true
- lightColors: !isBackgroundDark
- }
+ JoystickThumbPad {
+ id: leftStick
+ anchors.leftMargin: xPositionDelta
+ anchors.bottomMargin: -yPositionDelta
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ width: parent.thumbAreaHeight
+ height: parent.thumbAreaHeight
+ yAxisThrottle: true
+ lightColors: !isBackgroundDark
+ }
- JoystickThumbPad {
- id: rightStick
- anchors.rightMargin: -xPositionDelta
- anchors.bottomMargin: -yPositionDelta
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- width: parent.thumbAreaHeight
- height: parent.thumbAreaHeight
- lightColors: !isBackgroundDark
+ JoystickThumbPad {
+ id: rightStick
+ anchors.rightMargin: -xPositionDelta
+ anchors.bottomMargin: -yPositionDelta
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ width: parent.thumbAreaHeight
+ height: parent.thumbAreaHeight
+ lightColors: !isBackgroundDark
+ }
}
}
}
diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml
index 0a2d0171d6ddb218348a41cc8094c47d23a301cf..7ed7c0a2b17fb10f7ded8e26a1036b3aea499adb 100644
--- a/src/FlightDisplay/FlightDisplayViewWidgets.qml
+++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml
@@ -36,11 +36,9 @@ import QGroundControl.Vehicle 1.0
import QGroundControl.FlightMap 1.0
Item {
+ id: _root
- readonly property string _InstrumentVisibleKey: "IsInstrumentPanelVisible"
-
- property bool _isInstrumentVisible: QGroundControl.loadBoolGlobalSetting(_InstrumentVisibleKey, true)
- property var _activeVehicle: multiVehicleManager.activeVehicle
+ property var _activeVehicle: multiVehicleManager.activeVehicle
QGCMapPalette { id: mapPal; lightColors: !isBackgroundDark }
@@ -96,7 +94,7 @@ Item {
anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
- visible: _isInstrumentVisible && !QGroundControl.virtualTabletJoystick
+ visible: !QGroundControl.virtualTabletJoystick
size: getGadgetWidth()
active: _activeVehicle != null
heading: _heading
@@ -107,10 +105,8 @@ Item {
airSpeedFact: _airSpeedFact
isSatellite: _mainIsMap ? _flightMap ? _flightMap.isSatelliteMap : true : true
z: QGroundControl.zOrderWidgets
- onClicked: {
- _isInstrumentVisible = false
- QGroundControl.saveBoolGlobalSetting(_InstrumentVisibleKey, false)
- }
+ qgcView: parent.parent.qgcView
+ maxHeight: parent.height - (ScreenTools.defaultFontPixelHeight * 2)
}
//-- Alternate Instrument Panel
@@ -162,35 +158,6 @@ Item {
}
}
- //-- Show (Hidden) Instrument Panel
- Rectangle {
- id: openButton
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- anchors.margins: ScreenTools.defaultFontPixelHeight
- height: ScreenTools.defaultFontPixelSize * 2
- width: ScreenTools.defaultFontPixelSize * 2
- radius: ScreenTools.defaultFontPixelSize / 3
- visible: !_isInstrumentVisible && !QGroundControl.virtualTabletJoystick
- color: isBackgroundDark ? Qt.rgba(0,0,0,0.75) : Qt.rgba(0,0,0,0.5)
- Image {
- width: parent.width * 0.75
- height: parent.height * 0.75
- source: "/res/buttonLeft.svg"
- mipmap: true
- fillMode: Image.PreserveAspectFit
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- _isInstrumentVisible = true
- QGroundControl.saveBoolGlobalSetting(_InstrumentVisibleKey, true)
- }
- }
- }
-
//-- Vertical Tool Buttons
Column {
id: toolColumn
diff --git a/src/FlightMap/Widgets/QGCInstrumentWidget.qml b/src/FlightMap/Widgets/QGCInstrumentWidget.qml
index 636a743257dfcc0972717a24b3421b5ad34b43bb..c0dd98dded2cf9c39a7166d763cfde59ecd02be4 100644
--- a/src/FlightMap/Widgets/QGCInstrumentWidget.qml
+++ b/src/FlightMap/Widgets/QGCInstrumentWidget.qml
@@ -32,12 +32,14 @@ import QtQuick 2.4
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.FactSystem 1.0
+import QGroundControl.FlightMap 1.0
-Item {
- id: root
- height: size
-
- signal clicked
+Rectangle {
+ id: instrumentPanel
+ height: compass.y + compass.height + _topBottomMargin
+ width: size
+ radius: size / 2
+ color: isSatellite ? Qt.rgba(1,1,1,0.75) : Qt.rgba(0,0,0,0.75)
property alias heading: compass.heading
property alias rollAngle: attitude.rollAngle
@@ -45,6 +47,8 @@ Item {
property real size: _defaultSize
property bool isSatellite: false
property bool active: false
+ property var qgcView
+ property real maxHeight
property Fact _emptyFact: Fact { }
property Fact groundSpeedFact: _emptyFact
@@ -57,122 +61,59 @@ Item {
property real _bigFontSize: ScreenTools.defaultFontPixelSize * 2.5 * _sizeRatio
property real _normalFontSize:ScreenTools.defaultFontPixelSize * 1.5 * _sizeRatio
property real _labelFontSize: ScreenTools.defaultFontPixelSize * 0.75 * _sizeRatio
+ property real _spacing: ScreenTools.defaultFontPixelSize * 0.33
+ property real _topBottomMargin: (size * 0.05) / 2
+ property real _availableValueHeight: maxHeight - (attitude.height + _spacer1.height + _spacer2.height + compass.height + (_spacing * 4))
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: _valuesWidget.showPicker()
+ }
+
+ QGCAttitudeWidget {
+ id: attitude
+ y: _topBottomMargin
+ size: parent.width * 0.95
+ active: active
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ Rectangle {
+ id: _spacer1
+ anchors.topMargin: _spacing
+ anchors.top: attitude.bottom
+ height: 1
+ width: parent.width * 0.9
+ color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25)
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ ValuesWidget {
+ id: _valuesWidget
+ anchors.topMargin: _spacing
+ anchors.top: _spacer1.bottom
+ width: parent.width
+ qgcView: instrumentPanel.qgcView
+ textColor: isSatellite ? "black" : "white"
+ maxHeight: _availableValueHeight
+ }
- //-- Instrument Panel
Rectangle {
- id: instrumentPanel
- height: instruments.height + (size * 0.05)
- width: root.size
- radius: root.size / 2
- color: isSatellite ? Qt.rgba(1,1,1,0.75) : Qt.rgba(0,0,0,0.75)
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
- Column {
- id: instruments
- width: parent.width
- spacing: ScreenTools.defaultFontPixelSize * 0.33
- anchors.verticalCenter: parent.verticalCenter
- //-- Attitude Indicator
- QGCAttitudeWidget {
- id: attitude
- size: parent.width * 0.95
- active: root.active
- anchors.horizontalCenter: parent.horizontalCenter
- }
- //-- Altitude
- Rectangle {
- height: 1
- width: parent.width * 0.9
- color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25)
- anchors.horizontalCenter: parent.horizontalCenter
- }
- QGCLabel {
- text: altitudeFact.shortDescription + " (" + altitudeFact.units + ")"
- font.pixelSize: _labelFontSize
- width: parent.width
- height: _labelFontSize
- color: isSatellite ? "black" : "white"
- horizontalAlignment: TextEdit.AlignHCenter
- }
- QGCLabel {
- text: altitudeFact.valueString
- font.pixelSize: _bigFontSize
- font.weight: Font.DemiBold
- width: parent.width
- color: isSatellite ? "black" : "white"
- horizontalAlignment: TextEdit.AlignHCenter
- }
- //-- Ground Speed
- Rectangle {
- height: 1
- width: parent.width * 0.9
- color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25)
- anchors.horizontalCenter: parent.horizontalCenter
- visible: airSpeedFact.value <= 0 && !ScreenTools.isTinyScreen
- }
- QGCLabel {
- text: groundSpeedFact.shortDescription + " (" + groundSpeedFact.units + ")"
- font.pixelSize: _labelFontSize
- width: parent.width
- height: _labelFontSize
- color: isSatellite ? "black" : "white"
- horizontalAlignment: TextEdit.AlignHCenter
- visible: airSpeedFact.value <= 0 && !ScreenTools.isTinyScreen
- }
- QGCLabel {
- text: groundSpeedFact.valueString
- font.pixelSize: _normalFontSize
- font.weight: Font.DemiBold
- width: parent.width
- color: isSatellite ? "black" : "white"
- horizontalAlignment: TextEdit.AlignHCenter
- visible: airSpeedFact.value <= 0 && !ScreenTools.isTinyScreen
- }
- //-- Air Speed
- Rectangle {
- height: 1
- width: parent.width * 0.9
- color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25)
- anchors.horizontalCenter: parent.horizontalCenter
- visible: airSpeedFact.value > 0 && !ScreenTools.isTinyScreen
- }
- QGCLabel {
- text: airSpeedFact.shortDescription + " (" + airSpeedFact.units + ")"
- font.pixelSize: _labelFontSize
- width: parent.width
- height: _labelFontSize
- color: isSatellite ? "black" : "white"
- visible: airSpeedFact.value > 0 && !ScreenTools.isTinyScreen
- horizontalAlignment: TextEdit.AlignHCenter
- }
- QGCLabel {
- text: airSpeedFact.valueString
- font.pixelSize: _normalFontSize
- font.weight: Font.DemiBold
- width: parent.width
- color: isSatellite ? "black" : "white"
- visible: airSpeedFact.value > 0 && !ScreenTools.isTinyScreen
- horizontalAlignment: TextEdit.AlignHCenter
- }
- //-- Compass
- Rectangle {
- height: 1
- width: parent.width * 0.9
- color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25)
- anchors.horizontalCenter: parent.horizontalCenter
- }
- QGCCompassWidget {
- id: compass
- size: parent.width * 0.95
- active: root.active
- anchors.horizontalCenter: parent.horizontalCenter
- }
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- onClicked: root.clicked()
- }
- }
+ id: _spacer2
+ anchors.topMargin: _spacing
+ anchors.top: _valuesWidget.bottom
+ height: 1
+ width: parent.width * 0.9
+ color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25)
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ QGCCompassWidget {
+ id: compass
+ anchors.topMargin: _spacing
+ anchors.top: _spacer2.bottom
+ size: parent.width * 0.95
+ active: active
+ anchors.horizontalCenter: parent.horizontalCenter
}
}
diff --git a/src/FlightMap/Widgets/ValuesWidget.qml b/src/FlightMap/Widgets/ValuesWidget.qml
new file mode 100644
index 0000000000000000000000000000000000000000..c903f6e60043a14586b85bdfb8722e3596fe28d8
--- /dev/null
+++ b/src/FlightMap/Widgets/ValuesWidget.qml
@@ -0,0 +1,267 @@
+/*=====================================================================
+
+QGroundControl Open Source Ground Control Station
+
+(c) 2009, 2015 QGROUNDCONTROL PROJECT
+
+This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+======================================================================*/
+
+import QtQuick 2.4
+import QtQuick.Dialogs 1.2
+
+import QGroundControl.Controls 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.FactSystem 1.0
+import QGroundControl.Controllers 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl 1.0
+
+QGCFlickable {
+ id: _root
+ visible: _activeVehicle
+ height: Math.min(maxHeight, _smallFlow.y + _smallFlow.height)
+ contentHeight: _smallFlow.y + _smallFlow.height
+ flickableDirection: Flickable.VerticalFlick
+ clip: true
+
+ property var qgcView
+ property color textColor
+ property var maxHeight
+
+ property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
+ property real _margins: ScreenTools.defaultFontPixelWidth / 2
+
+ QGCPalette { id:qgcPal; colorGroupEnabled: true }
+
+ ValuesWidgetController {
+ id: controller
+ }
+
+ function showPicker() {
+ qgcView.showDialog(propertyPicker, "Value Widget Setup", qgcView.showDialogDefaultWidth, StandardButton.Ok)
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: showPicker()
+ }
+
+ Column {
+ id: _largeColumn
+ width: parent.width
+ spacing: _margins
+
+ Repeater {
+ model: _activeVehicle ? controller.largeValues : 0
+
+ Column {
+ id: valueColumn
+ width: _largeColumn.width
+
+ property Fact fact: _activeVehicle.getFact(modelData.replace("Vehicle.", ""))
+
+ QGCLabel {
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ color: textColor
+ text: fact.shortDescription + (fact.units ? " (" + fact.units + ")" : "")
+ }
+ QGCLabel {
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: ScreenTools.largeFontPixelSize
+ font.weight: Font.DemiBold
+ color: textColor
+ text: fact.valueString
+ }
+ }
+ } // Repeater - Large
+ } // Column - Large
+
+ Flow {
+ id: _smallFlow
+ width: parent.width
+ anchors.topMargin: _margins
+ anchors.top: _largeColumn.bottom
+ layoutDirection: Qt.LeftToRight
+ spacing: _margins
+
+ Repeater {
+ model: _activeVehicle ? controller.smallValues : 0
+
+ Column {
+ id: valueColumn
+ width: (_root.width / 2) - (_margins / 2) - 0.1
+ clip: true
+
+ property Fact fact: _activeVehicle.getFact(modelData.replace("Vehicle.", ""))
+
+ QGCLabel {
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: ScreenTools.smallFontPixelSize
+ color: textColor
+ text: fact.shortDescription
+ }
+ QGCLabel {
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ color: textColor
+ text: fact.enumOrValueString
+ }
+ QGCLabel {
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: ScreenTools.smallFontPixelSize
+ color: textColor
+ text: fact.units
+ }
+ }
+ } // Repeater - Small
+ } // Flow
+
+ Component {
+ id: propertyPicker
+
+ QGCViewDialog {
+ id: _propertyPickerDialog
+
+ QGCLabel {
+ id: _label
+ text: "Select the values you want to display:"
+ }
+
+ Loader {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.topMargin: _margins
+ anchors.top: _label.bottom
+ anchors.bottom: parent.bottom
+ sourceComponent: factGroupList
+
+ property var factGroup: _activeVehicle
+ property var factGroupName: "Vehicle"
+ }
+ }
+ }
+
+ Component {
+ id: factGroupList
+
+ // You must push in the following properties from the Loader
+ // property var factGroup
+ // property string factGroupName
+
+ Column {
+ id: _root
+ spacing: _margins
+
+ QGCLabel {
+ width: parent.width
+ wrapMode: Text.WordWrap
+ text: factGroup ? factGroupName : "Vehicle must be connected to assign values."
+ }
+
+ Repeater {
+ model: factGroup ? factGroup.factNames : 0
+
+ Row {
+ spacing: _margins
+
+ property string propertyName: factGroupName + "." + modelData
+
+ function contains(list, value) {
+ for (var i=0; i
+
+ This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+ ======================================================================*/
+
+#include "ValuesWidgetController.h"
+
+#include
+
+const char* ValuesWidgetController::_groupKey = "ValuesWidget";
+const char* ValuesWidgetController::_largeValuesKey = "large";
+const char* ValuesWidgetController::_smallValuesKey = "small";
+
+ValuesWidgetController::ValuesWidgetController(void)
+{
+ QSettings settings;
+ QStringList largeDefaults;
+
+ settings.beginGroup(_groupKey);
+
+ largeDefaults << "Vehicle.altitudeWGS84" << "Vehicle.groundSpeed";
+ _largeValues = settings.value(_largeValuesKey, largeDefaults).toStringList();
+ _smallValues = settings.value(_smallValuesKey, QStringList()).toStringList();
+}
+
+void ValuesWidgetController::setLargeValues(const QStringList& values)
+{
+ QSettings settings;
+
+ settings.beginGroup(_groupKey);
+ settings.setValue(_largeValuesKey, values);
+
+ _largeValues = values;
+ emit largeValuesChanged(values);
+}
+
+void ValuesWidgetController::setSmallValues(const QStringList& values)
+{
+ QSettings settings;
+
+ settings.beginGroup(_groupKey);
+ settings.setValue(_smallValuesKey, values);
+
+ _smallValues = values;
+ emit smallValuesChanged(values);
+}
diff --git a/src/FlightMap/Widgets/ValuesWidgetController.h b/src/FlightMap/Widgets/ValuesWidgetController.h
new file mode 100644
index 0000000000000000000000000000000000000000..418d66b79e9aeeb4b9b4e56552f5f15d095aa444
--- /dev/null
+++ b/src/FlightMap/Widgets/ValuesWidgetController.h
@@ -0,0 +1,57 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009, 2015 QGROUNDCONTROL PROJECT
+
+ This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+ ======================================================================*/
+
+#ifndef ValuesWidgetController_H
+#define ValuesWidgetController_H
+
+#include
+
+class ValuesWidgetController : public QObject
+{
+ Q_OBJECT
+
+public:
+ ValuesWidgetController(void);
+
+ Q_PROPERTY(QStringList largeValues READ largeValues WRITE setLargeValues NOTIFY largeValuesChanged)
+ Q_PROPERTY(QStringList smallValues READ smallValues WRITE setSmallValues NOTIFY smallValuesChanged)
+
+ QStringList largeValues(void) const { return _largeValues; }
+ QStringList smallValues(void) const { return _smallValues; }
+ void setLargeValues(const QStringList& values);
+ void setSmallValues(const QStringList& values);
+
+signals:
+ void largeValuesChanged(QStringList values);
+ void smallValuesChanged(QStringList values);
+
+private:
+ QStringList _largeValues;
+ QStringList _smallValues;
+
+ static const char* _groupKey;
+ static const char* _largeValuesKey;
+ static const char* _smallValuesKey;
+};
+
+#endif
diff --git a/src/FlightMap/qmldir b/src/FlightMap/qmldir
index db985b1d37da44be97a61c1d484e7ae29bbeb56c..cd915c52abe6693561bac9b2b4c2a03a3ec5ec98 100644
--- a/src/FlightMap/qmldir
+++ b/src/FlightMap/qmldir
@@ -12,6 +12,7 @@ QGCCompassWidget 1.0 QGCCompassWidget.qml
QGCInstrumentWidget 1.0 QGCInstrumentWidget.qml
QGCPitchIndicator 1.0 QGCPitchIndicator.qml
QGCSlider 1.0 QGCSlider.qml
+ValuesWidget 1.0 ValuesWidget.qml
# Map items
MissionItemIndicator 1.0 MissionItemIndicator.qml
diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc
index bf701bbd261dbdaa012ea6a21519e80beaba79f2..72bf6b06c8b1c89951fd0d1ecf6249fc5a6cbdb7 100644
--- a/src/QGCApplication.cc
+++ b/src/QGCApplication.cc
@@ -98,6 +98,7 @@
#include "VideoReceiver.h"
#include "LogDownloadController.h"
#include "PX4AirframeLoader.h"
+#include "ValuesWidgetController.h"
#ifndef __ios__
#include "SerialLink.h"
@@ -445,6 +446,7 @@ void QGCApplication::_initCommon(void)
qmlRegisterType ("QGroundControl.Controllers", 1, 0, "MainToolBarController");
qmlRegisterType ("QGroundControl.Controllers", 1, 0, "MissionController");
qmlRegisterType ("QGroundControl.Controllers", 1, 0, "FlightDisplayViewController");
+ qmlRegisterType ("QGroundControl.Controllers", 1, 0, "ValuesWidgetController");
#ifndef __mobile__
qmlRegisterType ("QGroundControl.Controllers", 1, 0, "ViewWidgetController");