diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index cb5825b276a4041092cb0702efdec7fbf97baafc..77f6c15ab138e63d67e694b1593a3f5af8879819 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -390,12 +390,12 @@ FORMS += \ HEADERS += \ src/api/QGCCorePlugin.h \ src/api/QGCOptions.h \ - src/api/QGCSettings.h \ + src/api/QmlPageInfo.h \ SOURCES += \ src/api/QGCCorePlugin.cc \ src/api/QGCOptions.cc \ - src/api/QGCSettings.cc \ + src/api/QmlPageInfo.cc \ # # Unit Test specific configuration goes here (requires full debug build with all plugins) diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index b86b5d2bc4c6b1ae7c4f3ec42c4475cf1c15d9c6..a8306f2dddeced69445eff363e9eeb1f80f41a4f 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -75,6 +75,7 @@ src/QmlControls/MultiRotorMotorDisplay.qml src/QmlControls/NoMouseThroughRectangle.qml src/QmlControls/OfflineMapButton.qml + src/QmlControls/PageView.qml src/QmlControls/ParameterEditor.qml src/QmlControls/ParameterEditorDialog.qml src/PlanView/PlanToolBar.qml @@ -163,11 +164,7 @@ src/FlightMap/Widgets/QGCPitchIndicator.qml src/FlightMap/QGCVideoBackground.qml src/FlightMap/qmldir - src/FlightMap/Widgets/CameraWidget.qml - src/FlightMap/Widgets/ValuesWidget.qml - src/FlightMap/Widgets/VehicleHealthWidget.qml src/FlightMap/MapItems/VehicleMapItem.qml - src/FlightMap/Widgets/VibrationWidget.qml src/QmlControls/QGroundControl.ScreenTools.qmldir src/QmlControls/ScreenTools.qml src/QmlControls/QmlTest.qml @@ -189,6 +186,10 @@ src/ui/preferences/UdpSettings.qml src/VehicleSetup/VehicleSummary.qml src/FlightDisplay/VirtualJoystick.qml + src/FlightMap/Widgets/CameraPageWidget.qml + src/FlightMap/Widgets/ValuePageWidget.qml + src/FlightMap/Widgets/HealthPageWidget.qml + src/FlightMap/Widgets/VibrationPageWidget.qml src/MissionManager/MavCmdInfoCommon.json diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml index c0a8d6005bd6366101f61851276dcd5f2c94ce93..fcd04dfdf1306bc9b541d13466e046123384f378 100644 --- a/src/FlightDisplay/FlightDisplayViewWidgets.qml +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -63,7 +63,9 @@ Item { break; } } else { - var useAlternateInstruments = QGroundControl.settingsManager.appSettings.virtualJoystick.value || ScreenTools.isTinyScreen + // Note: We currently show alternate instruments all the time. This is a trial change for daily builds. + // Leaving non-alternate code in for now in case the trial fails. + var useAlternateInstruments = true//QGroundControl.settingsManager.appSettings.virtualJoystick.value || ScreenTools.isTinyScreen if(useAlternateInstruments) { instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml" instrumentsLoader.state = "topMode" diff --git a/src/FlightMap/Widgets/CameraPageWidget.qml b/src/FlightMap/Widgets/CameraPageWidget.qml new file mode 100644 index 0000000000000000000000000000000000000000..68e90505dfeae884e23304212dce2960714506ed --- /dev/null +++ b/src/FlightMap/Widgets/CameraPageWidget.qml @@ -0,0 +1,32 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +import QtQuick 2.3 +import QtQuick.Layouts 1.2 + +import QGroundControl 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.ScreenTools 1.0 + +/// Camera page for Instrument Panel PageView +Column { + width: pageWidth + spacing: ScreenTools.defaultFontPixelHeight + + property bool showSettingsIcon: false + + property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle + + QGCButton { + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Trigger Camera") + onClicked: _activeVehicle.triggerCamera() + enabled: _activeVehicle + } +} diff --git a/src/FlightMap/Widgets/CameraWidget.qml b/src/FlightMap/Widgets/CameraWidget.qml deleted file mode 100644 index 080bfd372d44fab41af788e97bc80de6f9574a3c..0000000000000000000000000000000000000000 --- a/src/FlightMap/Widgets/CameraWidget.qml +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -import QtQuick 2.3 -import QtQuick.Layouts 1.2 - -import QGroundControl 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.ScreenTools 1.0 - -/// Camera controls used in InstrumentSwipeView -QGCFlickable { - id: _root - height: Math.min(maxHeight, column.height) - contentHeight: column.height - flickableDirection: Flickable.VerticalFlick - clip: true - - property var qgcView - property color textColor - property var maxHeight - - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle - - MouseArea { - anchors.fill: parent - onClicked: showNextPage() - } - - Column { - id: column - width: parent.width - spacing: ScreenTools.defaultFontPixelHeight - - QGCLabel { - anchors.horizontalCenter: parent.horizontalCenter - color: textColor - text: qsTr("Camera Controls") - } - - QGCButton { - anchors.horizontalCenter: parent.horizontalCenter - text: qsTr("Trigger Camera") - onClicked: _activeVehicle.triggerCamera() - enabled: _activeVehicle - } - } -} diff --git a/src/FlightMap/Widgets/HealthPageWidget.qml b/src/FlightMap/Widgets/HealthPageWidget.qml new file mode 100644 index 0000000000000000000000000000000000000000..834106737949f3eded9f0e7d0d3135311ce6b56a --- /dev/null +++ b/src/FlightMap/Widgets/HealthPageWidget.qml @@ -0,0 +1,49 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +import QtQuick 2.3 +import QtQuick.Layouts 1.2 + +import QGroundControl 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.ScreenTools 1.0 + +/// Health page for Instrument Panel PageWidget +Column { + width: pageWidth + + property bool showSettingsIcon: false + + property var _unhealthySensors: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.unhealthySensors : [ ] + + QGCLabel { + width: parent.width + horizontalAlignment: Text.AlignHCenter + text: qsTr("All systems healthy") + visible: healthRepeater.count == 0 + } + + Repeater { + id: healthRepeater + model: _unhealthySensors + + Row { + Image { + source: "/qmlimages/Yield.svg" + height: ScreenTools.defaultFontPixelHeight + sourceSize.height: height + fillMode: Image.PreserveAspectFit + } + + QGCLabel { + text: modelData + } + } + } +} diff --git a/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml b/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml index a1b48d986e203da7d9e33c947a80fac1a3d971c3..4e2fe1dc7d3711e3b52a5ee00e4c89cd221691e4 100644 --- a/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml +++ b/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml @@ -60,24 +60,6 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter } - Image { - id: gearThingy - anchors.bottomMargin: _topBottomMargin - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - source: qgcPal.globalTheme == QGCPalette.Light ? "/res/gear-black.svg" : "/res/gear-white.svg" - mipmap: true - opacity: 0.5 - width: root.height * 0.15 - sourceSize.width: width - fillMode: Image.PreserveAspectFit - } - - MouseArea { - anchors.fill: parent - onClicked: _valuesWidget.showPicker() - } - Item { id: _valuesItem anchors.topMargin: ScreenTools.defaultFontPixelHeight / 4 @@ -90,17 +72,13 @@ Rectangle { color: qgcPal.window } - InstrumentSwipeView { + PageView { id: _valuesWidget anchors.margins: 1 anchors.left: parent.left anchors.right: parent.right qgcView: root._qgcView - textColor: qgcPal.text - backgroundColor: qgcPal.window maxHeight: _availableValueHeight } } - - } diff --git a/src/FlightMap/Widgets/ValuesWidget.qml b/src/FlightMap/Widgets/ValuePageWidget.qml similarity index 87% rename from src/FlightMap/Widgets/ValuesWidget.qml rename to src/FlightMap/Widgets/ValuePageWidget.qml index 1d8733363e57cef25646f424a6c94dfee06d73cb..8863bccb647f99941694bb7baf08420b510f1266 100644 --- a/src/FlightMap/Widgets/ValuesWidget.qml +++ b/src/FlightMap/Widgets/ValuePageWidget.qml @@ -7,7 +7,6 @@ * ****************************************************************************/ - import QtQuick 2.3 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.2 @@ -20,16 +19,13 @@ import QGroundControl.Controllers 1.0 import QGroundControl.Palette 1.0 import QGroundControl 1.0 -QGCFlickable { - id: _root - height: Math.min(maxHeight, _smallFlow.y + _smallFlow.height) - contentHeight: _smallFlow.y + _smallFlow.height - flickableDirection: Flickable.VerticalFlick - clip: true +/// Value page for InstrumentPanel PageView +Column { + id: _largeColumn + width: pageWidth + spacing: _margins - property var qgcView - property color textColor - property var maxHeight + property bool showSettingsIcon: true property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle property real _margins: ScreenTools.defaultFontPixelWidth / 2 @@ -40,7 +36,7 @@ QGCFlickable { id: controller } - function showPicker() { + function showSettings() { qgcView.showDialog(propertyPicker, qsTr("Value Widget Setup"), qgcView.showDialogDefaultWidth, StandardButton.Ok) } @@ -53,36 +49,39 @@ QGCFlickable { return false } - MouseArea { - anchors.fill: parent - onClicked: showNextPage() - } + Repeater { + model: _activeVehicle ? controller.largeValues : 0 + Loader { + sourceComponent: fact ? largeValue : undefined + property Fact fact: _activeVehicle.getFact(modelData.replace("Vehicle.", "")) + } + } // Repeater - Large - Column { - id: _largeColumn - width: parent.width - spacing: _margins + Flow { + id: _smallFlow + width: parent.width + layoutDirection: Qt.LeftToRight + spacing: _margins Repeater { - model: _activeVehicle ? controller.largeValues : 0 + model: _activeVehicle ? controller.smallValues : 0 Loader { - sourceComponent: fact ? largeValue : undefined + sourceComponent: fact ? smallValue : undefined property Fact fact: _activeVehicle.getFact(modelData.replace("Vehicle.", "")) } - } // Repeater - Large - } // Column - Large + } // Repeater - Small + } // Flow Component { id: largeValue Column { width: _largeColumn.width - property bool largeValue: _root.listContains(controller.altitudeProperties, fact.name) + property bool largeValue: listContains(controller.altitudeProperties, fact.name) QGCLabel { width: parent.width horizontalAlignment: Text.AlignHCenter - color: textColor fontSizeMode: Text.HorizontalFit text: fact.shortDescription + (fact.units ? " (" + fact.units + ")" : "") } @@ -92,34 +91,16 @@ QGCFlickable { font.pointSize: ScreenTools.mediumFontPointSize * (largeValue ? 1.3 : 1.0) font.family: largeValue ? ScreenTools.demiboldFontFamily : ScreenTools.normalFontFamily fontSizeMode: Text.HorizontalFit - color: textColor text: fact.valueString } } } - Flow { - id: _smallFlow - width: parent.width - anchors.topMargin: _margins - anchors.top: _largeColumn.bottom - layoutDirection: Qt.LeftToRight - spacing: _margins - - Repeater { - model: _activeVehicle ? controller.smallValues : 0 - Loader { - sourceComponent: fact ? smallValue : undefined - property Fact fact: _activeVehicle.getFact(modelData.replace("Vehicle.", "")) - } - } // Repeater - Small - } // Flow - Component { id: smallValue Column { - width: (_root.width / 2) - (_margins / 2) - 0.1 + width: (pageWidth / 2) - (_margins / 2) - 0.1 clip: true QGCLabel { @@ -127,13 +108,11 @@ QGCFlickable { horizontalAlignment: Text.AlignHCenter font.pointSize: ScreenTools.isTinyScreen ? ScreenTools.smallFontPointSize * 0.75 : ScreenTools.smallFontPointSize fontSizeMode: Text.HorizontalFit - color: textColor text: fact.shortDescription } QGCLabel { width: parent.width horizontalAlignment: Text.AlignHCenter - color: textColor fontSizeMode: Text.HorizontalFit text: fact.enumOrValueString } @@ -142,7 +121,6 @@ QGCFlickable { horizontalAlignment: Text.AlignHCenter font.pointSize: ScreenTools.isTinyScreen ? ScreenTools.smallFontPointSize * 0.75 : ScreenTools.smallFontPointSize fontSizeMode: Text.HorizontalFit - color: textColor text: fact.units } } diff --git a/src/FlightMap/Widgets/VehicleHealthWidget.qml b/src/FlightMap/Widgets/VehicleHealthWidget.qml deleted file mode 100644 index 60834cf49bedb050d73c948e829176d60a8e93f4..0000000000000000000000000000000000000000 --- a/src/FlightMap/Widgets/VehicleHealthWidget.qml +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -import QtQuick 2.3 -import QtQuick.Layouts 1.2 - -import QGroundControl 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.ScreenTools 1.0 - -QGCFlickable { - id: _root - height: Math.min(maxHeight, healthColumn.y + healthColumn.height) - contentHeight: healthColumn.y + healthColumn.height - flickableDirection: Flickable.VerticalFlick - clip: true - - property var qgcView - property color textColor - property var maxHeight - - property var unhealthySensors: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.unhealthySensors : [ ] - - MouseArea { - anchors.fill: parent - onClicked: showNextPage() - } - - Column { - id: healthColumn - width: parent.width - - QGCLabel { - width: parent.width - horizontalAlignment: Text.AlignHCenter - color: textColor - text: qsTr("Vehicle Health") - } - - QGCLabel { - width: parent.width - horizontalAlignment: Text.AlignHCenter - color: textColor - text: qsTr("All systems healthy") - visible: healthRepeater.count == 0 - } - - Repeater { - id: healthRepeater - model: unhealthySensors - - Row { - Image { - source: "/qmlimages/Yield.svg" - height: ScreenTools.defaultFontPixelHeight - sourceSize.height: height - fillMode: Image.PreserveAspectFit - } - - QGCLabel { - color: textColor - text: modelData - } - } - } - } -} diff --git a/src/FlightMap/Widgets/VibrationPageWidget.qml b/src/FlightMap/Widgets/VibrationPageWidget.qml new file mode 100644 index 0000000000000000000000000000000000000000..aedba7c08730233624c4d353a82633c98c9c28e4 --- /dev/null +++ b/src/FlightMap/Widgets/VibrationPageWidget.qml @@ -0,0 +1,153 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +import QtQuick 2.3 +import QtQuick.Controls 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 + +Rectangle { + height: barRow.y + barRow.height + width: pageWidth + color: qgcPal.window + + property bool showSettingsIcon: false + + property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle + property bool _available: _activeVehicle ? !isNaN(_activeVehicle.vibration.xAxis.value) : false + property real _margins: ScreenTools.defaultFontPixelWidth / 2 + property real _barWidth: Math.round(ScreenTools.defaultFontPixelWidth * 3) + + readonly property real _barMinimum: 0.0 + readonly property real _barMaximum: 90.0 + readonly property real _barBadValue: 60.0 + + QGCPalette { id:qgcPal; colorGroupEnabled: true } + + QGCLabel { + id: title + text: qsTr("Vibe") + anchors.horizontalCenter: barRow.horizontalCenter + } + + Row { + id: barRow + anchors.margins: _margins + anchors.top: title.bottom + anchors.left: parent.left + spacing: _margins + + Column { + ProgressBar { + id: xBar + height: 50 + orientation: Qt.Vertical + minimumValue: _barMinimum + maximumValue: _barMaximum + value: _activeVehicle ? _activeVehicle.vibration.xAxis.value : 0 + } + + QGCLabel { + id: xBarLabel + text: "X" + anchors.horizontalCenter: xBar.horizontalCenter + } + } + + Column { + ProgressBar { + id: yBar + height: 50 + orientation: Qt.Vertical + minimumValue: _barMinimum + maximumValue: _barMaximum + value: _activeVehicle ? _activeVehicle.vibration.yAxis.value : 0 + } + + QGCLabel { + anchors.horizontalCenter: yBar.horizontalCenter + text: "Y" + } + } + + Column { + ProgressBar { + id: zBar + height: 50 + orientation: Qt.Vertical + minimumValue: _barMinimum + maximumValue: _barMaximum + value: _activeVehicle ? _activeVehicle.vibration.zAxis.value : 0 + } + + QGCLabel { + anchors.horizontalCenter: zBar.horizontalCenter + text: "Z" + } + } + } // Row + + // Max vibe indication line at 60 + Rectangle { + anchors.topMargin: xBar.height * (1.0 - ((_barBadValue - _barMinimum) / (_barMaximum - _barMinimum))) + anchors.top: barRow.top + anchors.left: barRow.left + anchors.right: barRow.right + width: barRow.width + height: 1 + color: "red" + } + + QGCLabel { + id: clipLabel + anchors.margins: _margins + anchors.left: barRow.right + anchors.right: parent.right + text: qsTr("Clip count") + horizontalAlignment: Text.AlignHCenter + } + + Column { + id: clipColumn + anchors.top: barRow.top + anchors.horizontalCenter: clipLabel.horizontalCenter + + QGCLabel { + text: qsTr("Accel 1: ") + (_activeVehicle ? _activeVehicle.vibration.clipCount1.valueString : "") + } + + QGCLabel { + text: qsTr("Accel 2: ") + (_activeVehicle ? _activeVehicle.vibration.clipCount2.valueString : "") + } + + QGCLabel { + text: qsTr("Accel 3: ") + (_activeVehicle ? _activeVehicle.vibration.clipCount3.valueString : "") + } + } + + // Not available overlay + Rectangle { + anchors.fill: parent + color: qgcPal.window + opacity: 0.75 + visible: !_available + + QGCLabel { + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: qsTr("Not Available") + } + } +} // Item diff --git a/src/FlightMap/Widgets/VibrationWidget.qml b/src/FlightMap/Widgets/VibrationWidget.qml deleted file mode 100644 index 896d93a69efd963e5d280c2559d40c5ec2f0ce95..0000000000000000000000000000000000000000 --- a/src/FlightMap/Widgets/VibrationWidget.qml +++ /dev/null @@ -1,177 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -import QtQuick 2.3 -import QtQuick.Controls 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 - height: Math.min(maxHeight, innerItem.height) - contentHeight: innerItem.height - flickableDirection: Flickable.VerticalFlick - clip: true - - property color textColor - property color backgroundColor - property var maxHeight - - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle - property real _margins: ScreenTools.defaultFontPixelWidth / 2 - property real _barWidth: Math.round(ScreenTools.defaultFontPixelWidth * 3) - - readonly property real _barMinimum: 0.0 - readonly property real _barMaximum: 90.0 - readonly property real _barBadValue: 60.0 - - QGCPalette { id:qgcPal; colorGroupEnabled: true } - - MouseArea { - anchors.fill: parent - onClicked: showNextPage() - } - - Item { - id: innerItem - width: parent.width - height: barRow.y + barRow.height - - QGCLabel { - id: title - color: textColor - text: qsTr("Vibe") - anchors.horizontalCenter: barRow.horizontalCenter - } - - Row { - id: barRow - anchors.margins: _margins - anchors.top: title.bottom - anchors.left: parent.left - spacing: _margins - - Column { - ProgressBar { - id: xBar - height: 50 - orientation: Qt.Vertical - minimumValue: _barMinimum - maximumValue: _barMaximum - value: _activeVehicle ? _activeVehicle.vibration.xAxis.value : 0 - } - - QGCLabel { - id: xBarLabel - color: textColor - text: "X" - anchors.horizontalCenter: xBar.horizontalCenter - } - } - - Column { - ProgressBar { - id: yBar - height: 50 - orientation: Qt.Vertical - minimumValue: _barMinimum - maximumValue: _barMaximum - value: _activeVehicle ? _activeVehicle.vibration.yAxis.value : 0 - } - - QGCLabel { - anchors.horizontalCenter: yBar.horizontalCenter - color: textColor - text: "Y" - } - } - - Column { - ProgressBar { - id: zBar - height: 50 - orientation: Qt.Vertical - minimumValue: _barMinimum - maximumValue: _barMaximum - value: _activeVehicle ? _activeVehicle.vibration.zAxis.value : 0 - } - - QGCLabel { - anchors.horizontalCenter: zBar.horizontalCenter - color: textColor - text: "Z" - } - } - } // Row - - // Max vibe indication line at 60 - Rectangle { - anchors.topMargin: xBar.height * (1.0 - ((_barBadValue - _barMinimum) / (_barMaximum - _barMinimum))) - anchors.top: barRow.top - anchors.left: barRow.left - anchors.right: barRow.right - width: barRow.width - height: 1 - color: "red" - } - - QGCLabel { - id: clipLabel - anchors.margins: _margins - anchors.left: barRow.right - anchors.right: parent.right - color: textColor - text: qsTr("Clip count") - horizontalAlignment: Text.AlignHCenter - } - - Column { - id: clipColumn - anchors.top: barRow.top - anchors.horizontalCenter: clipLabel.horizontalCenter - - QGCLabel { - text: qsTr("Accel 1: ") + (_activeVehicle ? _activeVehicle.vibration.clipCount1.valueString : "") - color: textColor - } - - QGCLabel { - text: qsTr("Accel 2: ") + (_activeVehicle ? _activeVehicle.vibration.clipCount2.valueString : "") - color: textColor - } - - QGCLabel { - text: qsTr("Accel 3: ") + (_activeVehicle ? _activeVehicle.vibration.clipCount3.valueString : "") - color: textColor - } - } - - // Not available overlay - Rectangle { - anchors.fill: parent - color: backgroundColor - opacity: 0.75 - visible: _activeVehicle ? isNaN(_activeVehicle.vibration.xAxis.value) : false - - QGCLabel { - anchors.fill: parent - text: qsTr("Not Available") - color: textColor - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - } // Item -} // QGCFLickable diff --git a/src/FlightMap/qmldir b/src/FlightMap/qmldir index c0c4f24b2a5195e186f1eb5aba323b0eef61501f..02dcde2206cf804bd831acdb26b57352a8c3706c 100644 --- a/src/FlightMap/qmldir +++ b/src/FlightMap/qmldir @@ -5,7 +5,6 @@ FlightMap 1.0 FlightMap.qml QGCVideoBackground 1.0 QGCVideoBackground.qml # Widgets -CameraWidget 1.0 CameraWidget.qml CenterMapDropButton 1.0 CenterMapDropButton.qml CenterMapDropPanel 1.0 CenterMapDropPanel.qml CompassRing 1.0 CompassRing.qml @@ -17,9 +16,6 @@ QGCAttitudeHUD 1.0 QGCAttitudeHUD.qml QGCAttitudeWidget 1.0 QGCAttitudeWidget.qml QGCCompassWidget 1.0 QGCCompassWidget.qml QGCPitchIndicator 1.0 QGCPitchIndicator.qml -ValuesWidget 1.0 ValuesWidget.qml -VehicleHealthWidget 1.0 VehicleHealthWidget.qml -VibrationWidget 1.0 VibrationWidget.qml # Map items CameraTriggerIndicator 1.0 CameraTriggerIndicator.qml diff --git a/src/QmlControls/PageView.qml b/src/QmlControls/PageView.qml new file mode 100644 index 0000000000000000000000000000000000000000..80196383c57ca0623df00631fa437cdf9047fc53 --- /dev/null +++ b/src/QmlControls/PageView.qml @@ -0,0 +1,71 @@ +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.2 + +import QGroundControl 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.ScreenTools 1.0 + +Rectangle { + id: _root + height: pageFlickable.y + pageFlickable.height + _margins + color: qgcPal.window + + property var qgcView ///< QGCView to use for showing dialogs + property real maxHeight ///< Maximum height that should be taken, smaller than this is ok + + property real _margins: ScreenTools.defaultFontPixelWidth / 2 + property real _pageWidth: _root.width + property var _instrumentPages: QGroundControl.corePlugin.instrumentPages + + QGCPalette { id:qgcPal; colorGroupEnabled: parent.enabled } + + QGCComboBox { + id: pageCombo + anchors.left: parent.left + anchors.right: parent.right + model: _instrumentPages + textRole: "title" + centeredLabel: true + pointSize: ScreenTools.smallFontPointSize + + Image { + anchors.leftMargin: _margins + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + source: qgcPal.globalTheme == QGCPalette.Light ? "/res/gear-black.svg" : "/res/gear-white.svg" + mipmap: true + width: parent.height -(_margins * 2) + sourceSize.width: width + fillMode: Image.PreserveAspectFit + visible: pageWidgetLoader.item.showSettingsIcon + + QGCMouseArea { + fillItem: parent + onClicked: pageWidgetLoader.item.showSettings() + } + } + } + + QGCFlickable { + id: pageFlickable + anchors.margins: _margins + anchors.top: pageCombo.bottom + anchors.left: parent.left + anchors.right: parent.right + height: Math.min(_maxHeight, pageWidgetLoader.height) + contentHeight: pageWidgetLoader.height + flickableDirection: Flickable.VerticalFlick + clip: true + + property real _maxHeight: maxHeight - y - _margins + + Loader { + id: pageWidgetLoader + source: _instrumentPages[pageCombo.currentIndex].url + + property var qgcView: _root.qgcView + property real pageWidth: parent.width + } + } +} diff --git a/src/QmlControls/QGCComboBox.qml b/src/QmlControls/QGCComboBox.qml index 62bc3d3f54aa4c580c98eb15719ec6ed02089859..73ed7a27ebde47e708e0ecb108be2f69db50f19d 100644 --- a/src/QmlControls/QGCComboBox.qml +++ b/src/QmlControls/QGCComboBox.qml @@ -9,6 +9,7 @@ Button { id: combo property real pointSize: ScreenTools.defaultFontPointSize ///< Point size for button text + property bool centeredLabel: false property alias model: popupItems.model property alias textRole: popup.textRole property alias currentIndex: popup.__selectedIndex @@ -60,10 +61,12 @@ Button { baselineOffset: text.y + text.baselineOffset QGCLabel { - id: text - anchors.verticalCenter: parent.verticalCenter - text: control.currentText - color: control._qgcPal.buttonText + id: text + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: centeredLabel ? parent.horizontalCenter : undefined + text: control.currentText + color: control._qgcPal.buttonText + font.pointSize: pointSize } } } diff --git a/src/QmlControls/QGroundControl.Controls.qmldir b/src/QmlControls/QGroundControl.Controls.qmldir index 6bff369b7595ca1779ca8ccc269c87a357d5bf2c..ee2a59064d9a97fe243c4fade18a27996c91c2a4 100644 --- a/src/QmlControls/QGroundControl.Controls.qmldir +++ b/src/QmlControls/QGroundControl.Controls.qmldir @@ -26,6 +26,7 @@ MissionItemStatus 1.0 MissionItemStatus.qml ModeSwitchDisplay 1.0 ModeSwitchDisplay.qml MultiRotorMotorDisplay 1.0 MultiRotorMotorDisplay.qml NoMouseThroughRectangle 1.0 NoMouseThroughRectangle.qml +PageView 1.0 PageView.qml ParameterEditor 1.0 ParameterEditor.qml ParameterEditorDialog 1.0 ParameterEditorDialog.qml PlanToolBar 1.0 PlanToolBar.qml diff --git a/src/api/QGCCorePlugin.cc b/src/api/QGCCorePlugin.cc index 1152b18fe163628ddd0c8b633cefbe76a6c4699a..88f6e8940e9c50adbe4e8cd6d4a6130b9810e9fc 100644 --- a/src/api/QGCCorePlugin.cc +++ b/src/api/QGCCorePlugin.cc @@ -10,7 +10,7 @@ #include "QGCApplication.h" #include "QGCCorePlugin.h" #include "QGCOptions.h" -#include "QGCSettings.h" +#include "QmlPageInfo.h" #include "FactMetaData.h" #include "SettingsManager.h" #include "AppMessages.h" @@ -26,16 +26,20 @@ class QGCCorePlugin_p { public: QGCCorePlugin_p() - : pGeneral(NULL) - , pCommLinks(NULL) - , pOfflineMaps(NULL) - , pMAVLink(NULL) - , pConsole(NULL) + : pGeneral (NULL) + , pCommLinks (NULL) + , pOfflineMaps (NULL) + , pMAVLink (NULL) + , pConsole (NULL) #if defined(QT_DEBUG) - , pMockLink(NULL) - , pDebug(NULL) + , pMockLink (NULL) + , pDebug (NULL) #endif - , defaultOptions(NULL) + , defaultOptions (NULL) + , valuesPageWidgetInfo (NULL) + , cameraPageWidgetInfo (NULL) + , healthPageWidgetInfo (NULL) + , vibrationPageWidgetInfo (NULL) { } @@ -61,17 +65,23 @@ public: delete defaultOptions; } - QGCSettings* pGeneral; - QGCSettings* pCommLinks; - QGCSettings* pOfflineMaps; - QGCSettings* pMAVLink; - QGCSettings* pConsole; + QmlPageInfo* pGeneral; + QmlPageInfo* pCommLinks; + QmlPageInfo* pOfflineMaps; + QmlPageInfo* pMAVLink; + QmlPageInfo* pConsole; #if defined(QT_DEBUG) - QGCSettings* pMockLink; - QGCSettings* pDebug; + QmlPageInfo* pMockLink; + QmlPageInfo* pDebug; #endif QVariantList settingsList; QGCOptions* defaultOptions; + + QmlPageInfo* valuesPageWidgetInfo; + QmlPageInfo* cameraPageWidgetInfo; + QmlPageInfo* healthPageWidgetInfo; + QmlPageInfo* vibrationPageWidgetInfo; + QVariantList instrumentPageWidgetList; }; QGCCorePlugin::~QGCCorePlugin() @@ -99,41 +109,55 @@ void QGCCorePlugin::setToolbox(QGCToolbox *toolbox) QVariantList &QGCCorePlugin::settingsPages() { - //-- If this hasn't been overridden, create default set of settings if(!_p->pGeneral) { - //-- Default Settings - _p->pGeneral = new QGCSettings(tr("General"), + _p->pGeneral = new QmlPageInfo(tr("General"), QUrl::fromUserInput("qrc:/qml/GeneralSettings.qml"), QUrl::fromUserInput("qrc:/res/gear-white.svg")); - _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pGeneral)); - _p->pCommLinks = new QGCSettings(tr("Comm Links"), + _p->settingsList.append(QVariant::fromValue((QmlPageInfo*)_p->pGeneral)); + _p->pCommLinks = new QmlPageInfo(tr("Comm Links"), QUrl::fromUserInput("qrc:/qml/LinkSettings.qml"), QUrl::fromUserInput("qrc:/res/waves.svg")); - _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pCommLinks)); - _p->pOfflineMaps = new QGCSettings(tr("Offline Maps"), + _p->settingsList.append(QVariant::fromValue((QmlPageInfo*)_p->pCommLinks)); + _p->pOfflineMaps = new QmlPageInfo(tr("Offline Maps"), QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"), QUrl::fromUserInput("qrc:/res/waves.svg")); - _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pOfflineMaps)); - _p->pMAVLink = new QGCSettings(tr("MAVLink"), + _p->settingsList.append(QVariant::fromValue((QmlPageInfo*)_p->pOfflineMaps)); + _p->pMAVLink = new QmlPageInfo(tr("MAVLink"), QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"), QUrl::fromUserInput("qrc:/res/waves.svg")); - _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pMAVLink)); - _p->pConsole = new QGCSettings(tr("Console"), + _p->settingsList.append(QVariant::fromValue((QmlPageInfo*)_p->pMAVLink)); + _p->pConsole = new QmlPageInfo(tr("Console"), QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/AppMessages.qml")); - _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pConsole)); + _p->settingsList.append(QVariant::fromValue((QmlPageInfo*)_p->pConsole)); #if defined(QT_DEBUG) //-- These are always present on Debug builds - _p->pMockLink = new QGCSettings(tr("Mock Link"), + _p->pMockLink = new QmlPageInfo(tr("Mock Link"), QUrl::fromUserInput("qrc:/qml/MockLink.qml")); - _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pMockLink)); - _p->pDebug = new QGCSettings(tr("Debug"), + _p->settingsList.append(QVariant::fromValue((QmlPageInfo*)_p->pMockLink)); + _p->pDebug = new QmlPageInfo(tr("Debug"), QUrl::fromUserInput("qrc:/qml/DebugWindow.qml")); - _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pDebug)); + _p->settingsList.append(QVariant::fromValue((QmlPageInfo*)_p->pDebug)); #endif } return _p->settingsList; } +QVariantList& QGCCorePlugin::instrumentPages(void) +{ + if (!_p->valuesPageWidgetInfo) { + _p->valuesPageWidgetInfo = new QmlPageInfo(tr("Values"), QUrl::fromUserInput("qrc:/qml/ValuePageWidget.qml")); + _p->cameraPageWidgetInfo = new QmlPageInfo(tr("Camera"), QUrl::fromUserInput("qrc:/qml/CameraPageWidget.qml")); + _p->healthPageWidgetInfo = new QmlPageInfo(tr("Health"), QUrl::fromUserInput("qrc:/qml/HealthPageWidget.qml")); + _p->vibrationPageWidgetInfo = new QmlPageInfo(tr("Vibration"), QUrl::fromUserInput("qrc:/qml/VibrationPageWidget.qml")); + + _p->instrumentPageWidgetList.append(QVariant::fromValue(_p->valuesPageWidgetInfo)); + _p->instrumentPageWidgetList.append(QVariant::fromValue(_p->cameraPageWidgetInfo)); + _p->instrumentPageWidgetList.append(QVariant::fromValue(_p->healthPageWidgetInfo)); + _p->instrumentPageWidgetList.append(QVariant::fromValue(_p->vibrationPageWidgetInfo)); + } + return _p->instrumentPageWidgetList; +} + int QGCCorePlugin::defaultSettings() { return 0; diff --git a/src/api/QGCCorePlugin.h b/src/api/QGCCorePlugin.h index bbd1057263a711bedb812cb01a23e117dfb07b0a..16e2c8d0003fb68229ef7bd54f45f83c21149c60 100644 --- a/src/api/QGCCorePlugin.h +++ b/src/api/QGCCorePlugin.h @@ -40,6 +40,7 @@ public: ~QGCCorePlugin(); Q_PROPERTY(QVariantList settingsPages READ settingsPages NOTIFY settingsPagesChanged) + Q_PROPERTY(QVariantList instrumentPages READ instrumentPages NOTIFY instrumentPagesChanged) Q_PROPERTY(int defaultSettings READ defaultSettings CONSTANT) Q_PROPERTY(QGCOptions* options READ options CONSTANT) @@ -54,6 +55,10 @@ public: /// @return A list of QGCSettings virtual QVariantList& settingsPages(void); + /// The list of PageWidget pages shown in the instrument panel + /// @return A list of QmlPageInfo + virtual QVariantList& instrumentPages(void); + /// The default settings panel to show /// @return The settings index virtual int defaultSettings(void); @@ -107,6 +112,7 @@ public: signals: void settingsPagesChanged (void); + void instrumentPagesChanged (void); void showTouchAreasChanged (bool showTouchAreas); void showAdvancedUIChanged (bool showAdvancedUI); diff --git a/src/api/QGCSettings.h b/src/api/QGCSettings.h deleted file mode 100644 index 682364cb20b796167f8a787e341001c26ebd6991..0000000000000000000000000000000000000000 --- a/src/api/QGCSettings.h +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -#pragma once - -#include -#include - -/// @file -/// @brief Core Plugin Interface for QGroundControl. Settings element. -/// @author Gus Grubba - -class QGCSettings : public QObject -{ - Q_OBJECT -public: - QGCSettings(QString title, QUrl url, QUrl icon = QUrl()); - - Q_PROPERTY(QString title READ title CONSTANT) - Q_PROPERTY(QUrl url READ url CONSTANT) - Q_PROPERTY(QUrl icon READ icon CONSTANT) - - virtual QString title () { return _title; } - virtual QUrl url () { return _url; } - virtual QUrl icon () { return _icon; } - -protected: - QString _title; - QUrl _url; - QUrl _icon; -}; diff --git a/src/api/QGCSettings.cc b/src/api/QmlPageInfo.cc similarity index 57% rename from src/api/QGCSettings.cc rename to src/api/QmlPageInfo.cc index 6fbe9dbe336b6bda84e2913a817ff6356382ba0c..645a27dc0dca1b4e2d54776db6a981980479e039 100644 --- a/src/api/QGCSettings.cc +++ b/src/api/QmlPageInfo.cc @@ -7,15 +7,13 @@ * ****************************************************************************/ -#include "QGCSettings.h" +#include "QmlPageInfo.h" -/// @file -/// @brief Core Plugin Interface for QGroundControl. Settings element. -/// @author Gus Grubba - -QGCSettings::QGCSettings(QString title, QUrl url, QUrl icon) - : _title(title) - , _url(url) - , _icon(icon) +QmlPageInfo::QmlPageInfo(QString title, QUrl url, QUrl icon, QObject* parent) + : QObject (parent) + , _title (title) + , _url (url) + , _icon (icon) { + } diff --git a/src/api/QmlPageInfo.h b/src/api/QmlPageInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..d206915988a4b30ae503f7a14d9567779d8bf0fc --- /dev/null +++ b/src/api/QmlPageInfo.h @@ -0,0 +1,35 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +#pragma once + +#include +#include + +/// Represents a +class QmlPageInfo : public QObject +{ + Q_OBJECT + +public: + QmlPageInfo(QString title, QUrl url, QUrl icon = QUrl(), QObject* parent = NULL); + + Q_PROPERTY(QString title READ title CONSTANT) ///< Title for page + Q_PROPERTY(QUrl url READ url CONSTANT) ///< Qml source code + Q_PROPERTY(QUrl icon READ icon CONSTANT) ///< Icon for page + + virtual QString title () { return _title; } + virtual QUrl url () { return _url; } + virtual QUrl icon () { return _icon; } + +protected: + QString _title; + QUrl _url; + QUrl _icon; +};