Commit 11474181 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #5568 from DonLakeFlyer/PageView

New PageView control in instrument panel
parents 11371d99 ea06f65e
......@@ -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)
......
......@@ -75,6 +75,7 @@
<file alias="QGroundControl/Controls/MultiRotorMotorDisplay.qml">src/QmlControls/MultiRotorMotorDisplay.qml</file>
<file alias="QGroundControl/Controls/NoMouseThroughRectangle.qml">src/QmlControls/NoMouseThroughRectangle.qml</file>
<file alias="QGroundControl/Controls/OfflineMapButton.qml">src/QmlControls/OfflineMapButton.qml</file>
<file alias="QGroundControl/Controls/PageView.qml">src/QmlControls/PageView.qml</file>
<file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file>
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file>
<file alias="QGroundControl/Controls/PlanToolBar.qml">src/PlanView/PlanToolBar.qml</file>
......@@ -163,11 +164,7 @@
<file alias="QGroundControl/FlightMap/QGCPitchIndicator.qml">src/FlightMap/Widgets/QGCPitchIndicator.qml</file>
<file alias="QGroundControl/FlightMap/QGCVideoBackground.qml">src/FlightMap/QGCVideoBackground.qml</file>
<file alias="QGroundControl/FlightMap/qmldir">src/FlightMap/qmldir</file>
<file alias="QGroundControl/FlightMap/CameraWidget.qml">src/FlightMap/Widgets/CameraWidget.qml</file>
<file alias="QGroundControl/FlightMap/ValuesWidget.qml">src/FlightMap/Widgets/ValuesWidget.qml</file>
<file alias="QGroundControl/FlightMap/VehicleHealthWidget.qml">src/FlightMap/Widgets/VehicleHealthWidget.qml</file>
<file alias="QGroundControl/FlightMap/VehicleMapItem.qml">src/FlightMap/MapItems/VehicleMapItem.qml</file>
<file alias="QGroundControl/FlightMap/VibrationWidget.qml">src/FlightMap/Widgets/VibrationWidget.qml</file>
<file alias="QGroundControl/ScreenTools/qmldir">src/QmlControls/QGroundControl.ScreenTools.qmldir</file>
<file alias="QGroundControl/ScreenTools/ScreenTools.qml">src/QmlControls/ScreenTools.qml</file>
<file alias="QmlTest.qml">src/QmlControls/QmlTest.qml</file>
......@@ -189,6 +186,10 @@
<file alias="UdpSettings.qml">src/ui/preferences/UdpSettings.qml</file>
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file>
<file alias="VirtualJoystick.qml">src/FlightDisplay/VirtualJoystick.qml</file>
<file alias="CameraPageWidget.qml">src/FlightMap/Widgets/CameraPageWidget.qml</file>
<file alias="ValuePageWidget.qml">src/FlightMap/Widgets/ValuePageWidget.qml</file>
<file alias="HealthPageWidget.qml">src/FlightMap/Widgets/HealthPageWidget.qml</file>
<file alias="VibrationPageWidget.qml">src/FlightMap/Widgets/VibrationPageWidget.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="MavCmdInfoCommon.json">src/MissionManager/MavCmdInfoCommon.json</file>
......
......@@ -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"
......
......@@ -14,41 +14,19 @@ 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
/// Camera page for Instrument Panel PageView
Column {
width: pageWidth
spacing: ScreenTools.defaultFontPixelHeight
property var qgcView
property color textColor
property var maxHeight
property bool showSettingsIcon: false
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
}
QGCButton {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Trigger Camera")
onClicked: _activeVehicle.triggerCamera()
enabled: _activeVehicle
}
}
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* 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
}
}
}
}
......@@ -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
}
}
}
......@@ -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
}
}
......
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* 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
}
}
}
}
}
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* 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
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* 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
......@@ -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
......
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
}
}
}
......@@ -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
}
}
}
......
......@@ -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
......
......@@ -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;
......
......@@ -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);
......
......@@ -7,15 +7,13 @@
*
****************************************************************************/
#include "QGCSettings.h"
#include "QmlPageInfo.h"
/// @file
/// @brief Core Plugin Interface for QGroundControl. Settings element.
/// @author Gus Grubba <mavlink@grubba.com>
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)
{
}
......@@ -12,23 +12,21 @@
#include <QObject>
#include <QUrl>
/// @file
/// @brief Core Plugin Interface for QGroundControl. Settings element.
/// @author Gus Grubba <mavlink@grubba.com>
class QGCSettings : public QObject
/// Represents a
class QmlPageInfo : public QObject
{
Q_OBJECT
public:
QGCSettings(QString title, QUrl url, QUrl icon = QUrl());
QmlPageInfo(QString title, QUrl url, QUrl icon = QUrl(), QObject* parent = NULL);
Q_PROPERTY(QString title READ title CONSTANT)
Q_PROPERTY(QUrl url READ url CONSTANT)
Q_PROPERTY(QUrl icon READ icon CONSTANT)
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; }
virtual QString title () { return _title; }
virtual QUrl url () { return _url; }
virtual QUrl icon () { return _icon; }
protected:
QString _title;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment