Commit e55deea4 authored by Gus Grubba's avatar Gus Grubba

Get rid of QGCView, QGCViewPanel and FactPanel. All messages and dialogs are...

Get rid of QGCView, QGCViewPanel and FactPanel. All messages and dialogs are now handled in the root window.
parent 1c4fdc2e
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
</qresource> </qresource>
<qresource prefix="/qml"> <qresource prefix="/qml">
<file alias="CorridorScanEditor.qml">src/PlanView/CorridorScanEditor.qml</file> <file alias="CorridorScanEditor.qml">src/PlanView/CorridorScanEditor.qml</file>
<file alias="QGCViewDialogContainer.qml">src/QmlControls/QGCViewDialogContainer.qml</file>
<file alias="QGroundControl/Controls/CameraCalc.qml">src/PlanView/CameraCalc.qml</file> <file alias="QGroundControl/Controls/CameraCalc.qml">src/PlanView/CameraCalc.qml</file>
<file alias="QGroundControl/Controls/CorridorScanMapVisual.qml">src/PlanView/CorridorScanMapVisual.qml</file> <file alias="QGroundControl/Controls/CorridorScanMapVisual.qml">src/PlanView/CorridorScanMapVisual.qml</file>
<file alias="QGroundControl/Controls/EditPositionDialog.qml">src/QmlControls/EditPositionDialog.qml</file> <file alias="QGroundControl/Controls/EditPositionDialog.qml">src/QmlControls/EditPositionDialog.qml</file>
...@@ -45,9 +46,7 @@ ...@@ -45,9 +46,7 @@
<file alias="LinkSettings.qml">src/ui/preferences/LinkSettings.qml</file> <file alias="LinkSettings.qml">src/ui/preferences/LinkSettings.qml</file>
<file alias="LogDownloadPage.qml">src/AnalyzeView/LogDownloadPage.qml</file> <file alias="LogDownloadPage.qml">src/AnalyzeView/LogDownloadPage.qml</file>
<file alias="LogReplaySettings.qml">src/ui/preferences/LogReplaySettings.qml</file> <file alias="LogReplaySettings.qml">src/ui/preferences/LogReplaySettings.qml</file>
<file alias="MainWindowHybrid.qml">src/ui/MainWindowHybrid.qml</file> <file alias="MainQmlWindow.qml">src/ui/MainQmlWindow.qml</file>
<file alias="MainWindowInner.qml">src/ui/MainWindowInner.qml</file>
<file alias="MainWindowNative.qml">src/ui/MainWindowNative.qml</file>
<file alias="MavlinkConsolePage.qml">src/AnalyzeView/MavlinkConsolePage.qml</file> <file alias="MavlinkConsolePage.qml">src/AnalyzeView/MavlinkConsolePage.qml</file>
<file alias="MavlinkSettings.qml">src/ui/preferences/MavlinkSettings.qml</file> <file alias="MavlinkSettings.qml">src/ui/preferences/MavlinkSettings.qml</file>
<file alias="MissionSettingsEditor.qml">src/PlanView/MissionSettingsEditor.qml</file> <file alias="MissionSettingsEditor.qml">src/PlanView/MissionSettingsEditor.qml</file>
...@@ -115,11 +114,8 @@ ...@@ -115,11 +114,8 @@
<file alias="QGroundControl/Controls/QGCSwitch.qml">src/QmlControls/QGCSwitch.qml</file> <file alias="QGroundControl/Controls/QGCSwitch.qml">src/QmlControls/QGCSwitch.qml</file>
<file alias="QGroundControl/Controls/QGCTextField.qml">src/QmlControls/QGCTextField.qml</file> <file alias="QGroundControl/Controls/QGCTextField.qml">src/QmlControls/QGCTextField.qml</file>
<file alias="QGroundControl/Controls/QGCToolBarButton.qml">src/QmlControls/QGCToolBarButton.qml</file> <file alias="QGroundControl/Controls/QGCToolBarButton.qml">src/QmlControls/QGCToolBarButton.qml</file>
<file alias="QGroundControl/Controls/QGCView.qml">src/QmlControls/QGCView.qml</file>
<file alias="QGroundControl/Controls/QGCViewDialog.qml">src/QmlControls/QGCViewDialog.qml</file> <file alias="QGroundControl/Controls/QGCViewDialog.qml">src/QmlControls/QGCViewDialog.qml</file>
<file alias="QGroundControl/Controls/QGCViewDialogContainer.qml">src/QmlControls/QGCViewDialogContainer.qml</file>
<file alias="QGroundControl/Controls/QGCViewMessage.qml">src/QmlControls/QGCViewMessage.qml</file> <file alias="QGroundControl/Controls/QGCViewMessage.qml">src/QmlControls/QGCViewMessage.qml</file>
<file alias="QGroundControl/Controls/QGCViewPanel.qml">src/QmlControls/QGCViewPanel.qml</file>
<file alias="QGroundControl/Controls/qmldir">src/QmlControls/QGroundControl.Controls.qmldir</file> <file alias="QGroundControl/Controls/qmldir">src/QmlControls/QGroundControl.Controls.qmldir</file>
<file alias="QGroundControl/Controls/RallyPointEditorHeader.qml">src/PlanView/RallyPointEditorHeader.qml</file> <file alias="QGroundControl/Controls/RallyPointEditorHeader.qml">src/PlanView/RallyPointEditorHeader.qml</file>
<file alias="QGroundControl/Controls/RallyPointItemEditor.qml">src/PlanView/RallyPointItemEditor.qml</file> <file alias="QGroundControl/Controls/RallyPointItemEditor.qml">src/PlanView/RallyPointItemEditor.qml</file>
...@@ -143,7 +139,6 @@ ...@@ -143,7 +139,6 @@
<file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file> <file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file>
<file alias="QGroundControl/FactControls/FactComboBox.qml">src/FactSystem/FactControls/FactComboBox.qml</file> <file alias="QGroundControl/FactControls/FactComboBox.qml">src/FactSystem/FactControls/FactComboBox.qml</file>
<file alias="QGroundControl/FactControls/FactLabel.qml">src/FactSystem/FactControls/FactLabel.qml</file> <file alias="QGroundControl/FactControls/FactLabel.qml">src/FactSystem/FactControls/FactLabel.qml</file>
<file alias="QGroundControl/FactControls/FactPanel.qml">src/FactSystem/FactControls/FactPanel.qml</file>
<file alias="QGroundControl/FactControls/FactTextField.qml">src/FactSystem/FactControls/FactTextField.qml</file> <file alias="QGroundControl/FactControls/FactTextField.qml">src/FactSystem/FactControls/FactTextField.qml</file>
<file alias="QGroundControl/FactControls/FactTextFieldGrid.qml">src/FactSystem/FactControls/FactTextFieldGrid.qml</file> <file alias="QGroundControl/FactControls/FactTextFieldGrid.qml">src/FactSystem/FactControls/FactTextFieldGrid.qml</file>
<file alias="QGroundControl/FactControls/FactTextFieldRow.qml">src/FactSystem/FactControls/FactTextFieldRow.qml</file> <file alias="QGroundControl/FactControls/FactTextFieldRow.qml">src/FactSystem/FactControls/FactTextFieldRow.qml</file>
......
This diff is collapsed.
...@@ -16,55 +16,40 @@ import QGroundControl.Controls 1.0 ...@@ -16,55 +16,40 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
/// Base view control for all Analyze pages /// Base view control for all Analyze pages
QGCView { Item {
id: analyePage anchors.fill: parent
viewPanel: analyzePanel
property alias pageComponent: pageLoader.sourceComponent property alias pageComponent: pageLoader.sourceComponent
property alias pageName: pageNameLabel.text property alias pageName: pageNameLabel.text
property alias pageDescription: pageDescriptionLabel.text property alias pageDescription: pageDescriptionLabel.text
property real availableWidth: width - pageLoader.x property real availableWidth: width - pageLoader.x
property real availableHeight: height - pageLoader.y property real availableHeight: height - pageLoader.y
property real _margins: ScreenTools.defaultFontPixelHeight * 0.5
property real _margins: ScreenTools.defaultFontPixelHeight / 2 QGCFlickable {
QGCPalette { id: qgcPal; colorGroupEnabled: analyzePanel.enabled }
QGCViewPanel {
id: analyzePanel
anchors.fill: parent anchors.fill: parent
contentWidth: pageLoader.x + pageLoader.item.width
QGCFlickable { contentHeight: pageLoader.y + pageLoader.item.height
anchors.fill: parent clip: true
contentWidth: pageLoader.x + pageLoader.item.width Column {
contentHeight: pageLoader.y + pageLoader.item.height id: headingColumn
clip: true width: parent.width
spacing: _margins
Column { QGCLabel {
id: headingColumn id: pageNameLabel
width: analyzePanel.width font.pointSize: ScreenTools.largeFontPointSize
spacing: _margins visible: !ScreenTools.isShortScreen
QGCLabel {
id: pageNameLabel
font.pointSize: ScreenTools.largeFontPointSize
visible: !ScreenTools.isShortScreen
}
QGCLabel {
id: pageDescriptionLabel
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
visible: !ScreenTools.isShortScreen
}
} }
QGCLabel {
Loader { id: pageDescriptionLabel
id: pageLoader anchors.left: parent.left
anchors.topMargin: _margins anchors.right: parent.right
anchors.top: headingColumn.bottom wrapMode: Text.WordWrap
visible: !ScreenTools.isShortScreen
} }
} }
Loader {
id: pageLoader
anchors.topMargin: _margins
anchors.top: headingColumn.bottom
}
} }
} }
...@@ -40,7 +40,7 @@ AnalyzePage { ...@@ -40,7 +40,7 @@ AnalyzePage {
ProgressBar { ProgressBar {
id: progressBar id: progressBar
width: qgcView.width -_margin * 5 width: geoTagPage.width -_margin * 5
maximumValue: 100 maximumValue: 100
value: geoController.progress value: geoController.progress
} }
...@@ -62,7 +62,7 @@ AnalyzePage { ...@@ -62,7 +62,7 @@ AnalyzePage {
// Horizontal spacer line // Horizontal spacer line
Rectangle { Rectangle {
height: 1 height: 1
width: qgcView.width * 1.0 width: geoTagPage.width * 1.0
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
...@@ -118,7 +118,7 @@ AnalyzePage { ...@@ -118,7 +118,7 @@ AnalyzePage {
// Horizontal spacer line // Horizontal spacer line
Rectangle { Rectangle {
height: 1 height: 1
width: qgcView.width * 1.0 width: geoTagPage.width * 1.0
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
......
...@@ -117,25 +117,21 @@ AnalyzePage { ...@@ -117,25 +117,21 @@ AnalyzePage {
} }
} }
} }
Column { Column {
spacing: _margin spacing: _margin
Layout.alignment: Qt.AlignTop | Qt.AlignLeft Layout.alignment: Qt.AlignTop | Qt.AlignLeft
QGCButton { QGCButton {
enabled: !logController.requestingList && !logController.downloadingLogs enabled: !logController.requestingList && !logController.downloadingLogs
text: qsTr("Refresh") text: qsTr("Refresh")
width: _butttonWidth width: _butttonWidth
onClicked: { onClicked: {
if (!QGroundControl.multiVehicleManager.activeVehicle || QGroundControl.multiVehicleManager.activeVehicle.isOfflineEditingVehicle) { if (!QGroundControl.multiVehicleManager.activeVehicle || QGroundControl.multiVehicleManager.activeVehicle.isOfflineEditingVehicle) {
logDownloadPage.showMessage(qsTr("Log Refresh"), qsTr("You must be connected to a vehicle in order to download logs."), StandardButton.Ok) mainWindow.showMessageDialog(qsTr("Log Refresh"), qsTr("You must be connected to a vehicle in order to download logs."))
} else { } else {
logController.refresh() logController.refresh()
} }
} }
} }
QGCButton { QGCButton {
enabled: !logController.requestingList && !logController.downloadingLogs && tableView.selection.count > 0 enabled: !logController.requestingList && !logController.downloadingLogs && tableView.selection.count > 0
text: qsTr("Download") text: qsTr("Download")
...@@ -151,54 +147,46 @@ AnalyzePage { ...@@ -151,54 +147,46 @@ AnalyzePage {
var o = logController.model.get(rowIndex) var o = logController.model.get(rowIndex)
if (o) o.selected = true if (o) o.selected = true
}) })
fileDialog.qgcView = logDownloadPage
fileDialog.title = qsTr("Select save directory") fileDialog.title = qsTr("Select save directory")
fileDialog.selectExisting = true fileDialog.selectExisting = true
fileDialog.folder = QGroundControl.settingsManager.appSettings.logSavePath fileDialog.folder = QGroundControl.settingsManager.appSettings.logSavePath
fileDialog.selectFolder = true fileDialog.selectFolder = true
fileDialog.openForLoad() fileDialog.openForLoad()
} }
QGCFileDialog { QGCFileDialog {
id: fileDialog id: fileDialog
onAcceptedForLoad: { onAcceptedForLoad: {
logController.download(file) logController.download(file)
close() close()
} }
} }
} }
QGCButton { QGCButton {
enabled: !logController.requestingList && !logController.downloadingLogs && logController.model.count > 0 enabled: !logController.requestingList && !logController.downloadingLogs && logController.model.count > 0
text: qsTr("Erase All") text: qsTr("Erase All")
width: _butttonWidth width: _butttonWidth
onClicked: logDownloadPage.showDialog(eraseAllMessage, onClicked: mainWindow.showDialog(
qsTr("Delete All Log Files"), eraseAllMessage,
logDownloadPage.showDialogDefaultWidth, qsTr("Delete All Log Files"),
StandardButton.Yes | StandardButton.No) mainWindow.showDialogDefaultWidth,
StandardButton.Yes | StandardButton.No)
Component { Component {
id: eraseAllMessage id: eraseAllMessage
QGCViewMessage { QGCViewMessage {
message: qsTr("All log files will be erased permanently. Is this really what you want?") message: qsTr("All log files will be erased permanently. Is this really what you want?")
function accept() { function accept() {
hideDialog()
logController.eraseAll() logController.eraseAll()
} }
} }
} }
} }
QGCButton { QGCButton {
text: qsTr("Cancel") text: qsTr("Cancel")
width: _butttonWidth width: _butttonWidth
enabled: logController.requestingList || logController.downloadingLogs enabled: logController.requestingList || logController.downloadingLogs
onClicked: logController.cancel() onClicked: logController.cancel()
} }
} // Column - Buttons }
} // RowLayout }
} // Component }
} // AnalyzePage }
...@@ -33,7 +33,6 @@ SetupPage { ...@@ -33,7 +33,6 @@ SetupPage {
APMAirframeComponentController { APMAirframeComponentController {
id: controller id: controller
factPanel: airframePage.viewPanel
} }
ExclusiveGroup { ExclusiveGroup {
......
...@@ -7,19 +7,16 @@ import QGroundControl.Controls 1.0 ...@@ -7,19 +7,16 @@ import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
APMAirframeComponentController { APMAirframeComponentController {
id: controller id: controller
factPanel: panel
} }
property bool _frameAvailable: controller.parameterExists(-1, "FRAME") property bool _frameAvailable: controller.parameterExists(-1, "FRAME")
property Fact _frame: controller.getParameterFact(-1, "FRAME", false) property Fact _frame: controller.getParameterFact(-1, "FRAME", false)
property Fact _frameClass: controller.getParameterFact(-1, "FRAME_CLASS", false) property Fact _frameClass: controller.getParameterFact(-1, "FRAME_CLASS", false)
property Fact _frameType: controller.getParameterFact(-1, "FRAME_TYPE", false) property Fact _frameType: controller.getParameterFact(-1, "FRAME_TYPE", false)
......
...@@ -28,7 +28,7 @@ SetupPage { ...@@ -28,7 +28,7 @@ SetupPage {
spacing: _margins spacing: _margins
width: availableWidth width: availableWidth
FactPanelController { id: controller; factPanel: cameraPage.viewPanel } FactPanelController { id: controller; }
QGCPalette { id: palette; colorGroupEnabled: true } QGCPalette { id: palette; colorGroupEnabled: true }
......
import QtQuick 2.3 import QtQuick 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QGroundControl.FactSystem 1.0 import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0 import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact _mountRCInTilt: controller.getParameterFact(-1, "MNT_RC_IN_TILT") property Fact _mountRCInTilt: controller.getParameterFact(-1, "MNT_RC_IN_TILT")
property Fact _mountRCInRoll: controller.getParameterFact(-1, "MNT_RC_IN_ROLL") property Fact _mountRCInRoll: controller.getParameterFact(-1, "MNT_RC_IN_ROLL")
......
...@@ -31,7 +31,7 @@ SetupPage { ...@@ -31,7 +31,7 @@ SetupPage {
spacing: _margins spacing: _margins
width: availableWidth width: availableWidth
FactPanelController { id: controller; factPanel: cameraPage.viewPanel } FactPanelController { id: controller; }
QGCPalette { id: palette; colorGroupEnabled: true } QGCPalette { id: palette; colorGroupEnabled: true }
......
...@@ -37,7 +37,6 @@ SetupPage { ...@@ -37,7 +37,6 @@ SetupPage {
APMFlightModesComponentController { APMFlightModesComponentController {
id: controller id: controller
factPanel: flightModePage.viewPanel
} }
Component { Component {
......
...@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0 ...@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property var _vehicle: controller.vehicle property var _vehicle: controller.vehicle
......
...@@ -30,7 +30,7 @@ SetupPage { ...@@ -30,7 +30,7 @@ SetupPage {
width: availableWidth width: availableWidth
spacing: _margins spacing: _margins
FactPanelController { id: controller; factPanel: safetyPage.viewPanel } FactPanelController { id: controller; }
QGCPalette { id: ggcPal; colorGroupEnabled: true } QGCPalette { id: ggcPal; colorGroupEnabled: true }
......
...@@ -29,7 +29,7 @@ SetupPage { ...@@ -29,7 +29,7 @@ SetupPage {
spacing: _margins spacing: _margins
width: availableWidth width: availableWidth
FactPanelController { id: controller; factPanel: lightsPage.viewPanel } FactPanelController { id: controller; }
QGCPalette { id: palette; colorGroupEnabled: true } QGCPalette { id: palette; colorGroupEnabled: true }
......
...@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0 ...@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact _rc5Function: controller.getParameterFact(-1, "r.SERVO5_FUNCTION") property Fact _rc5Function: controller.getParameterFact(-1, "r.SERVO5_FUNCTION")
property Fact _rc6Function: controller.getParameterFact(-1, "r.SERVO6_FUNCTION") property Fact _rc6Function: controller.getParameterFact(-1, "r.SERVO6_FUNCTION")
......
...@@ -25,7 +25,6 @@ SetupPage { ...@@ -25,7 +25,6 @@ SetupPage {
FactPanelController { FactPanelController {
id: controller id: controller
factPanel: powerPage.viewPanel
} }
Component { Component {
...@@ -388,7 +387,7 @@ SetupPage { ...@@ -388,7 +387,7 @@ SetupPage {
onClicked: { onClicked: {
_calcVoltageDlgVehicleVoltage = vehicleVoltage _calcVoltageDlgVehicleVoltage = vehicleVoltage
_calcVoltageDlgBattVoltMultParam = battVoltMult _calcVoltageDlgBattVoltMultParam = battVoltMult
showDialog(calcVoltageMultiplierDlgComponent, qsTr("Calculate Voltage Multiplier"), qgcView.showDialogDefaultWidth, StandardButton.Close) mainWindow.showDialog(calcVoltageMultiplierDlgComponent, qsTr("Calculate Voltage Multiplier"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
} }
} }
...@@ -420,7 +419,7 @@ SetupPage { ...@@ -420,7 +419,7 @@ SetupPage {
onClicked: { onClicked: {
_calcAmpsPerVoltDlgVehicleCurrent = vehicleCurrent _calcAmpsPerVoltDlgVehicleCurrent = vehicleCurrent
_calcAmpsPerVoltDlgBattAmpPerVoltParam = battAmpPerVolt _calcAmpsPerVoltDlgBattAmpPerVoltParam = battAmpPerVolt
showDialog(calcAmpsPerVoltDlgComponent, qsTr("Calculate Amps per Volt"), qgcView.showDialogDefaultWidth, StandardButton.Close) mainWindow.showDialog(calcAmpsPerVoltDlgComponent, qsTr("Calculate Amps per Volt"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
} }
} }
......
...@@ -15,20 +15,17 @@ import QGroundControl.FactControls 1.0 ...@@ -15,20 +15,17 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact _batt1Monitor: controller.getParameterFact(-1, "BATT_MONITOR") property Fact _batt1Monitor: controller.getParameterFact(-1, "BATT_MONITOR")
property Fact _batt2Monitor: controller.getParameterFact(-1, "BATT2_MONITOR", false /* reportMissing */) property Fact _batt2Monitor: controller.getParameterFact(-1, "BATT2_MONITOR", false /* reportMissing */)
property bool _batt2MonitorAvailable: controller.parameterExists(-1, "BATT2_MONITOR") property bool _batt2MonitorAvailable: controller.parameterExists(-1, "BATT2_MONITOR")
property bool _batt1MonitorEnabled: _batt1Monitor.rawValue !== 0 property bool _batt1MonitorEnabled: _batt1Monitor.rawValue !== 0
property bool _batt2MonitorEnabled: _batt2MonitorAvailable && _batt2Monitor.rawValue !== 0 property bool _batt2MonitorEnabled: _batt2MonitorAvailable && _batt2Monitor.rawValue !== 0
property Fact _battCapacity: controller.getParameterFact(-1, "BATT_CAPACITY", false /* reportMissing */) property Fact _battCapacity: controller.getParameterFact(-1, "BATT_CAPACITY", false /* reportMissing */)
property Fact _batt2Capacity: controller.getParameterFact(-1, "BATT2_CAPACITY", false /* reportMissing */) property Fact _batt2Capacity: controller.getParameterFact(-1, "BATT2_CAPACITY", false /* reportMissing */)
property bool _battCapacityAvailable: controller.parameterExists(-1, "BATT_CAPACITY") property bool _battCapacityAvailable: controller.parameterExists(-1, "BATT_CAPACITY")
......
...@@ -6,13 +6,12 @@ import QGroundControl.FactControls 1.0 ...@@ -6,13 +6,12 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel } FactPanelController { id: controller; }
property Fact mapRollFact: controller.getParameterFact(-1, "RCMAP_ROLL") property Fact mapRollFact: controller.getParameterFact(-1, "RCMAP_ROLL")
property Fact mapPitchFact: controller.getParameterFact(-1, "RCMAP_PITCH") property Fact mapPitchFact: controller.getParameterFact(-1, "RCMAP_PITCH")
......
...@@ -30,7 +30,7 @@ SetupPage { ...@@ -30,7 +30,7 @@ SetupPage {
width: availableWidth width: availableWidth
spacing: _margins spacing: _margins
FactPanelController { id: controller; factPanel: safetyPage.viewPanel } FactPanelController { id: controller; }
QGCPalette { id: ggcPal; colorGroupEnabled: true } QGCPalette { id: ggcPal; colorGroupEnabled: true }
......
...@@ -31,7 +31,7 @@ SetupPage { ...@@ -31,7 +31,7 @@ SetupPage {
width: availableWidth width: availableWidth
spacing: _margins spacing: _margins
FactPanelController { id: controller; factPanel: safetyPage.viewPanel } FactPanelController { id: controller; }
QGCPalette { id: ggcPal; colorGroupEnabled: true } QGCPalette { id: ggcPal; colorGroupEnabled: true }
......
...@@ -6,14 +6,11 @@ import QGroundControl.FactControls 1.0 ...@@ -6,14 +6,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact _copterFenceAction: controller.getParameterFact(-1, "FENCE_ACTION", false /* reportMissing */) property Fact _copterFenceAction: controller.getParameterFact(-1, "FENCE_ACTION", false /* reportMissing */)
property Fact _copterFenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE", false /* reportMissing */) property Fact _copterFenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE", false /* reportMissing */)
......
...@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0 ...@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact _failsafeThrEnable: controller.getParameterFact(-1, "FS_THR_ENABLE") property Fact _failsafeThrEnable: controller.getParameterFact(-1, "FS_THR_ENABLE")
......
...@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0 ...@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact _failsafeBattMah: controller.getParameterFact(-1, "FS_BATT_MAH") property Fact _failsafeBattMah: controller.getParameterFact(-1, "FS_BATT_MAH")
property Fact _failsafeBattVoltage: controller.getParameterFact(-1, "FS_BATT_VOLTAGE") property Fact _failsafeBattVoltage: controller.getParameterFact(-1, "FS_BATT_VOLTAGE")
......
...@@ -15,13 +15,11 @@ import QGroundControl.FactControls 1.0 ...@@ -15,13 +15,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact _failsafeThrEnable: controller.getParameterFact(-1, "FS_THR_ENABLE") property Fact _failsafeThrEnable: controller.getParameterFact(-1, "FS_THR_ENABLE")
property Fact _failsafeThrValue: controller.getParameterFact(-1, "FS_THR_VALUE") property Fact _failsafeThrValue: controller.getParameterFact(-1, "FS_THR_VALUE")
......
...@@ -7,16 +7,13 @@ import QGroundControl.FactControls 1.0 ...@@ -7,16 +7,13 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property bool _firmware34: activeVehicle.versionCompare(3, 5, 0) < 0
property bool _firmware34: _activeVehicle.versionCompare(3, 5, 0) < 0
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
// Enable/Action parameters // Enable/Action parameters
property Fact _failsafeBatteryEnable: controller.getParameterFact(-1, "r.BATT_FS_LOW_ACT") property Fact _failsafeBatteryEnable: controller.getParameterFact(-1, "r.BATT_FS_LOW_ACT")
......
...@@ -108,7 +108,7 @@ SetupPage { ...@@ -108,7 +108,7 @@ SetupPage {
break break
} }
showDialog(orientationsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, buttons) mainWindow.showDialog(orientationsDialogComponent, dialogTitle, mainWindow.showDialogDefaultWidth, buttons)
} }
APMSensorParams { APMSensorParams {
...@@ -118,7 +118,6 @@ SetupPage { ...@@ -118,7 +118,6 @@ SetupPage {
APMSensorsComponentController { APMSensorsComponentController {
id: controller id: controller
factPanel: sensorsPage.viewPanel
statusLog: statusTextArea statusLog: statusTextArea
progressBar: progressBar progressBar: progressBar
nextButton: nextButton nextButton: nextButton
...@@ -131,20 +130,20 @@ SetupPage { ...@@ -131,20 +130,20 @@ SetupPage {
onWaitingForCancelChanged: { onWaitingForCancelChanged: {
if (controller.waitingForCancel) { if (controller.waitingForCancel) {
showDialog(waitForCancelDialogComponent, qsTr("Calibration Cancel"), qgcView.showDialogDefaultWidth, 0) mainWindow.showDialog(waitForCancelDialogComponent, qsTr("Calibration Cancel"), mainWindow.showDialogDefaultWidth, 0)
} }
} }
onCalibrationComplete: { onCalibrationComplete: {
switch (calType) { switch (calType) {
case APMSensorsComponentController.CalTypeAccel: case APMSensorsComponentController.CalTypeAccel:
showDialog(postCalibrationComponent, qsTr("Accelerometer calibration complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok) mainWindow.showDialog(postCalibrationComponent, qsTr("Accelerometer calibration complete"), mainWindow.showDialogDefaultWidth, StandardButton.Ok)
break break
case APMSensorsComponentController.CalTypeOffboardCompass: case APMSensorsComponentController.CalTypeOffboardCompass:
showDialog(postCalibrationComponent, qsTr("Compass calibration complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok) mainWindow.showDialog(postCalibrationComponent, qsTr("Compass calibration complete"), mainWindow.showDialogDefaultWidth, StandardButton.Ok)
break break
case APMSensorsComponentController.CalTypeOnboardCompass: case APMSensorsComponentController.CalTypeOnboardCompass:
showDialog(postOnboardCompassCalibrationComponent, qsTr("Calibration complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok) mainWindow.showDialog(postOnboardCompassCalibrationComponent, qsTr("Calibration complete"), mainWindow.showDialogDefaultWidth, StandardButton.Ok)
break break
} }
} }
...@@ -158,7 +157,7 @@ SetupPage { ...@@ -158,7 +157,7 @@ SetupPage {
var usingUDP = controller.usingUDPLink() var usingUDP = controller.usingUDPLink()
var isSub = QGroundControl.multiVehicleManager.activeVehicle.sub; var isSub = QGroundControl.multiVehicleManager.activeVehicle.sub;
if (usingUDP && !isSub) { if (usingUDP && !isSub) {
showMessage(qsTr("Sensor Calibration"), qsTr("Performing sensor calibration over a WiFi connection can be unreliable. If you run into problems try using a direct USB connection instead."), StandardButton.Ok) mainWindow.showMessageDialog(qsTr("Sensor Calibration"), qsTr("Performing sensor calibration over a WiFi connection can be unreliable. If you run into problems try using a direct USB connection instead."))
} }
} }
...@@ -556,7 +555,7 @@ SetupPage { ...@@ -556,7 +555,7 @@ SetupPage {
onClicked: { onClicked: {
if (controller.accelSetupNeeded) { if (controller.accelSetupNeeded) {
showMessage(qsTr("Calibrate Compass"), qsTr("Accelerometer must be calibrated prior to Compass."), StandardButton.Ok) mainWindow.showMessageDialog(qsTr("Calibrate Compass"), qsTr("Accelerometer must be calibrated prior to Compass."))
} else { } else {
showOrientationsDialog(_calTypeCompass) showOrientationsDialog(_calTypeCompass)
} }
...@@ -571,9 +570,9 @@ SetupPage { ...@@ -571,9 +570,9 @@ SetupPage {
onClicked: { onClicked: {
if (controller.accelSetupNeeded) { if (controller.accelSetupNeeded) {
showMessage(_levelHorizonText, qsTr("Accelerometer must be calibrated prior to Level Horizon."), StandardButton.Ok) mainWindow.showMessageDialog(_levelHorizonText, qsTr("Accelerometer must be calibrated prior to Level Horizon."))
} else { } else {
showDialog(levelHorizonDialogComponent, _levelHorizonText, qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) mainWindow.showDialog(levelHorizonDialogComponent, _levelHorizonText, mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
} }
} }
} }
...@@ -581,7 +580,7 @@ SetupPage { ...@@ -581,7 +580,7 @@ SetupPage {
QGCButton { QGCButton {
width: _buttonWidth width: _buttonWidth
text: _calibratePressureText text: _calibratePressureText
onClicked: showDialog(calibratePressureDialogComponent, _calibratePressureText, qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) onClicked: mainWindow.showDialog(calibratePressureDialogComponent, _calibratePressureText, mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
readonly property string _calibratePressureText: _activeVehicle.fixedWing ? qsTr("Cal Baro/Airspeed") : qsTr("Calibrate Pressure") readonly property string _calibratePressureText: _activeVehicle.fixedWing ? qsTr("Cal Baro/Airspeed") : qsTr("Calibrate Pressure")
} }
...@@ -591,7 +590,7 @@ SetupPage { ...@@ -591,7 +590,7 @@ SetupPage {
text: qsTr("CompassMot") text: qsTr("CompassMot")
visible: _activeVehicle ? _activeVehicle.supportsMotorInterference : false visible: _activeVehicle ? _activeVehicle.supportsMotorInterference : false
onClicked: showDialog(compassMotDialogComponent, qsTr("CompassMot - Compass Motor Interference Calibration"), qgcView.showDialogFullWidth, StandardButton.Cancel | StandardButton.Ok) onClicked: mainWindow.showDialog(compassMotDialogComponent, qsTr("CompassMot - Compass Motor Interference Calibration"), mainWindow.showDialogFullWidth, StandardButton.Cancel | StandardButton.Ok)
} }
QGCButton { QGCButton {
......
...@@ -13,14 +13,11 @@ import QGroundControl.ArduPilot 1.0 ...@@ -13,14 +13,11 @@ import QGroundControl.ArduPilot 1.0
IMPORTANT NOTE: Any changes made here must also be made to SensorsComponentSummary.qml IMPORTANT NOTE: Any changes made here must also be made to SensorsComponentSummary.qml
*/ */
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } APMSensorsComponentController { id: controller; }
APMSensorsComponentController { id: controller; factPanel: panel }
APMSensorParams { APMSensorParams {
id: sensorParams id: sensorParams
......
...@@ -27,7 +27,7 @@ SetupPage { ...@@ -27,7 +27,7 @@ SetupPage {
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _oldFW: _activeVehicle.versionCompare(3 ,5 ,2) < 0 property bool _oldFW: _activeVehicle.versionCompare(3 ,5 ,2) < 0
APMAirframeComponentController { id: controller; factPanel: subFramePage.viewPanel } APMAirframeComponentController { id: controller; }
Component { Component {
id: subFramePageComponent id: subFramePageComponent
...@@ -115,7 +115,7 @@ SetupPage { ...@@ -115,7 +115,7 @@ SetupPage {
id: defaultsButton id: defaultsButton
anchors.left: parent.left anchors.left: parent.left
text: qsTr("Load Vehicle Default Parameters") text: qsTr("Load Vehicle Default Parameters")
onClicked: showDialog(selectParamFileDialogComponent, qsTr("Load Vehicle Default Parameters"), qgcView.showDialogDefaultWidth, StandardButton.Close) onClicked: mainWindow.showDialog(selectParamFileDialogComponent, qsTr("Load Vehicle Default Parameters"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
} }
} }
......
...@@ -7,14 +7,11 @@ import QGroundControl.Controls 1.0 ...@@ -7,14 +7,11 @@ import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact frameFact: controller.getParameterFact(-1, "FRAME_CONFIG") property Fact frameFact: controller.getParameterFact(-1, "FRAME_CONFIG")
......
...@@ -30,7 +30,6 @@ SetupPage { ...@@ -30,7 +30,6 @@ SetupPage {
FactPanelController { FactPanelController {
id: controller id: controller
factPanel: motorPage.viewPanel
} }
function setMotorDirection(num, reversed) { function setMotorDirection(num, reversed) {
......
...@@ -28,8 +28,6 @@ SetupPage { ...@@ -28,8 +28,6 @@ SetupPage {
width: availableWidth width: availableWidth
spacing: _margins spacing: _margins
FactPanelController { id: controller; factPanel: tuningPage.viewPanel }
QGCPalette { id: palette; colorGroupEnabled: true } QGCPalette { id: palette; colorGroupEnabled: true }
property bool _rcFeelAvailable: controller.parameterExists(-1, "RC_FEEL") property bool _rcFeelAvailable: controller.parameterExists(-1, "RC_FEEL")
......
...@@ -28,7 +28,7 @@ SetupPage { ...@@ -28,7 +28,7 @@ SetupPage {
width: availableWidth width: availableWidth
spacing: _margins spacing: _margins
FactPanelController { id: controller; factPanel: tuningPage.viewPanel } FactPanelController { id: controller; }
QGCPalette { id: palette; colorGroupEnabled: true } QGCPalette { id: palette; colorGroupEnabled: true }
......
...@@ -21,11 +21,7 @@ import QGroundControl.Controls 1.0 ...@@ -21,11 +21,7 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
QGCView { Item {
id: qgcView
viewPanel: panel
QGCPalette { id: palette; colorGroupEnabled: panel.enabled }
property real _margins: ScreenTools.defaultFontPixelHeight property real _margins: ScreenTools.defaultFontPixelHeight
property real _middleRowWidth: ScreenTools.defaultFontPixelWidth * 18 property real _middleRowWidth: ScreenTools.defaultFontPixelWidth * 18
...@@ -40,8 +36,7 @@ QGCView { ...@@ -40,8 +36,7 @@ QGCView {
property bool stResetCounters:false property bool stResetCounters:false
ESP8266ComponentController { ESP8266ComponentController {
id: controller id: controller
factPanel: panel
} }
Timer { Timer {
...@@ -103,7 +98,7 @@ QGCView { ...@@ -103,7 +98,7 @@ QGCView {
property Fact hostPort: controller.getParameterFact(controller.componentID, "WIFI_UDP_HPORT") property Fact hostPort: controller.getParameterFact(controller.componentID, "WIFI_UDP_HPORT")
property Fact clientPort: controller.getParameterFact(controller.componentID, "WIFI_UDP_CPORT") property Fact clientPort: controller.getParameterFact(controller.componentID, "WIFI_UDP_CPORT")
QGCViewPanel { Item {
id: panel id: panel
anchors.fill: parent anchors.fill: parent
...@@ -122,7 +117,7 @@ QGCView { ...@@ -122,7 +117,7 @@ QGCView {
font.family: ScreenTools.demiboldFontFamily font.family: ScreenTools.demiboldFontFamily
} }
Rectangle { Rectangle {
color: palette.windowShade color: qgcPal.windowShade
width: statusLayout.width + _margins * 4 width: statusLayout.width + _margins * 4
height: settingsRow.height + _margins * 2 height: settingsRow.height + _margins * 2
Row { Row {
...@@ -130,7 +125,7 @@ QGCView { ...@@ -130,7 +125,7 @@ QGCView {
spacing: _margins * 4 spacing: _margins * 4
anchors.centerIn: parent anchors.centerIn: parent
QGCColoredImage { QGCColoredImage {
color: palette.text color: qgcPal.text
width: ScreenTools.defaultFontPixelWidth * 12 width: ScreenTools.defaultFontPixelWidth * 12
height: width * 1.45 height: width * 1.45
sourceSize.height: width * 1.45 sourceSize.height: width * 1.45
...@@ -283,7 +278,7 @@ QGCView { ...@@ -283,7 +278,7 @@ QGCView {
font.family: ScreenTools.demiboldFontFamily font.family: ScreenTools.demiboldFontFamily
} }
Rectangle { Rectangle {
color: palette.windowShade color: qgcPal.windowShade
width: statusLayout.width + _margins * 4 width: statusLayout.width + _margins * 4
height: statusLayout.height + _margins * 2 height: statusLayout.height + _margins * 2
GridLayout { GridLayout {
......
...@@ -7,17 +7,14 @@ import QGroundControl.Controls 1.0 ...@@ -7,17 +7,14 @@ import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
ESP8266ComponentController { ESP8266ComponentController {
id: esp8266 id: esp8266
factPanel: panel
} }
property Fact debugEnabled: controller.getParameterFact(esp8266.componentID, "DEBUG_ENABLED") property Fact debugEnabled: controller.getParameterFact(esp8266.componentID, "DEBUG_ENABLED")
......
...@@ -26,7 +26,6 @@ SetupPage { ...@@ -26,7 +26,6 @@ SetupPage {
FactPanelController { FactPanelController {
id: controller id: controller
factPanel: motorPage.viewPanel
} }
Component { Component {
......
...@@ -31,8 +31,7 @@ SetupPage { ...@@ -31,8 +31,7 @@ SetupPage {
width: availableWidth width: availableWidth
height: Math.max(leftColumn.height, rightColumn.height) height: Math.max(leftColumn.height, rightColumn.height)
readonly property string dialogTitle: qsTr("Radio") readonly property string dialogTitle: qsTr("Radio")
readonly property real labelToMonitorMargin: defaultTextWidth * 3
property bool controllerCompleted: false property bool controllerCompleted: false
property bool controllerAndViewReady: false property bool controllerAndViewReady: false
...@@ -53,7 +52,6 @@ SetupPage { ...@@ -53,7 +52,6 @@ SetupPage {
RadioComponentController { RadioComponentController {
id: controller id: controller
factPanel: radioPage.viewPanel
statusText: statusText statusText: statusText
cancelButton: cancelButton cancelButton: cancelButton
nextButton: nextButton nextButton: nextButton
...@@ -61,16 +59,14 @@ SetupPage { ...@@ -61,16 +59,14 @@ SetupPage {
Component.onCompleted: { Component.onCompleted: {
controllerCompleted = true controllerCompleted = true
if (qgcView.completedSignalled) { controllerAndViewReady = true
controllerAndViewReady = true controller.start()
controller.start() updateChannelCount()
updateChannelCount()
}
} }
onChannelCountChanged: updateChannelCount() onChannelCountChanged: updateChannelCount()
onFunctionMappingChangedAPMReboot: showMessage(qsTr("Reboot required"), qsTr("Your stick mappings have changed, you must reboot the vehicle for correct operation."), StandardButton.Ok) onFunctionMappingChangedAPMReboot: mainWindow.showMessageDialog(qsTr("Reboot required"), qsTr("Your stick mappings have changed, you must reboot the vehicle for correct operation."))
onThrottleReversedCalFailure: showMessage(qsTr("Throttle channel reversed"), qsTr("Calibration failed. The throttle channel on your transmitter is reversed. You must correct this on your transmitter in order to complete calibration."), StandardButton.Ok) onThrottleReversedCalFailure: mainWindow.showMessageDialog(qsTr("Throttle channel reversed"), qsTr("Calibration failed. The throttle channel on your transmitter is reversed. You must correct this on your transmitter in order to complete calibration."))
} }
Component { Component {
...@@ -248,11 +244,11 @@ SetupPage { ...@@ -248,11 +244,11 @@ SetupPage {
id: rollLoader id: rollLoader
anchors.left: rollLabel.right anchors.left: rollLabel.right
anchors.right: parent.right anchors.right: parent.right
height: radioPage.defaultTextHeight height: defaultTextHeight
width: 100 width: 100
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: radioPage.defaultTextWidth property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.rollChannelMapped property bool mapped: controller.rollChannelMapped
property bool reversed: controller.rollChannelReversed property bool reversed: controller.rollChannelReversed
} }
...@@ -278,11 +274,11 @@ SetupPage { ...@@ -278,11 +274,11 @@ SetupPage {
id: pitchLoader id: pitchLoader
anchors.left: pitchLabel.right anchors.left: pitchLabel.right
anchors.right: parent.right anchors.right: parent.right
height: radioPage.defaultTextHeight height: defaultTextHeight
width: 100 width: 100
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: radioPage.defaultTextWidth property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.pitchChannelMapped property bool mapped: controller.pitchChannelMapped
property bool reversed: controller.pitchChannelReversed property bool reversed: controller.pitchChannelReversed
} }
...@@ -308,11 +304,11 @@ SetupPage { ...@@ -308,11 +304,11 @@ SetupPage {
id: yawLoader id: yawLoader
anchors.left: yawLabel.right anchors.left: yawLabel.right
anchors.right: parent.right anchors.right: parent.right
height: radioPage.defaultTextHeight height: defaultTextHeight
width: 100 width: 100
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: radioPage.defaultTextWidth property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.yawChannelMapped property bool mapped: controller.yawChannelMapped
property bool reversed: controller.yawChannelReversed property bool reversed: controller.yawChannelReversed
} }
...@@ -338,11 +334,11 @@ SetupPage { ...@@ -338,11 +334,11 @@ SetupPage {
id: throttleLoader id: throttleLoader
anchors.left: throttleLabel.right anchors.left: throttleLabel.right
anchors.right: parent.right anchors.right: parent.right
height: radioPage.defaultTextHeight height: defaultTextHeight
width: 100 width: 100
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: radioPage.defaultTextWidth property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.throttleChannelMapped property bool mapped: controller.throttleChannelMapped
property bool reversed: controller.throttleChannelReversed property bool reversed: controller.throttleChannelReversed
} }
...@@ -377,7 +373,7 @@ SetupPage { ...@@ -377,7 +373,7 @@ SetupPage {
onClicked: { onClicked: {
if (text === qsTr("Calibrate")) { if (text === qsTr("Calibrate")) {
showDialog(zeroTrimsDialogComponent, dialogTitle, radioPage.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) mainWindow.showDialog(zeroTrimsDialogComponent, dialogTitle, mainWindow.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
} else { } else {
controller.nextButtonClicked() controller.nextButtonClicked()
} }
...@@ -437,12 +433,12 @@ SetupPage { ...@@ -437,12 +433,12 @@ SetupPage {
QGCButton { QGCButton {
id: bindButton id: bindButton
text: qsTr("Spektrum Bind") text: qsTr("Spektrum Bind")
onClicked: showDialog(spektrumBindDialogComponent, dialogTitle, radioPage.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) onClicked: mainWindow.showDialog(spektrumBindDialogComponent, dialogTitle, mainWindow.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
} }
QGCButton { QGCButton {
text: qsTr("Copy Trims") text: qsTr("Copy Trims")
onClicked: showDialog(copyTrimsDialogComponent, dialogTitle, radioPage.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) onClicked: mainWindow.showDialog(copyTrimsDialogComponent, dialogTitle, mainWindow.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
} }
} }
} // Column - Left Column } // Column - Left Column
...@@ -495,6 +491,6 @@ SetupPage { ...@@ -495,6 +491,6 @@ SetupPage {
twoColumn: true twoColumn: true
} }
} // Column - Right Column } // Column - Right Column
} // Item } // Item
} // Component - pageComponent } // Component - pageComponent
} // SetupPage } // SetupPage
...@@ -21,9 +21,8 @@ import QGroundControl.ScreenTools 1.0 ...@@ -21,9 +21,8 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
/// Base view control for all Setup pages /// Base view control for all Setup pages
QGCView { Item {
id: setupView id: setupView
viewPanel: setupPanel
enabled: !_disableDueToArmed && !_disableDueToFlying enabled: !_disableDueToArmed && !_disableDueToFlying
property alias pageComponent: pageLoader.sourceComponent property alias pageComponent: pageLoader.sourceComponent
...@@ -42,69 +41,59 @@ QGCView { ...@@ -42,69 +41,59 @@ QGCView {
// FIXME: The _vehicleIsRover checkl is a hack to work around https://github.com/PX4/Firmware/issues/10969 // FIXME: The _vehicleIsRover checkl is a hack to work around https://github.com/PX4/Firmware/issues/10969
property bool _disableDueToFlying: vehicleComponent ? (!_vehicleIsRover && !vehicleComponent.allowSetupWhileFlying && _vehicleFlying) : false property bool _disableDueToFlying: vehicleComponent ? (!_vehicleIsRover && !vehicleComponent.allowSetupWhileFlying && _vehicleFlying) : false
property string _disableReason: _disableDueToArmed ? qsTr("armed") : qsTr("flying") property string _disableReason: _disableDueToArmed ? qsTr("armed") : qsTr("flying")
property real _margins: ScreenTools.defaultFontPixelHeight * 0.5
property string _pageTitle: qsTr("%1 Setup").arg(pageName)
property real _margins: ScreenTools.defaultFontPixelHeight * 0.5 QGCFlickable {
property string _pageTitle: qsTr("%1 Setup").arg(pageName)
QGCPalette { id: qgcPal; colorGroupEnabled: setupPanel.enabled }
QGCViewPanel {
id: setupPanel
anchors.fill: parent anchors.fill: parent
contentWidth: pageLoader.x + pageLoader.item.width
contentHeight: pageLoader.y + pageLoader.item.height
clip: true
RowLayout {
id: headingRow
anchors.left: parent.left
anchors.right: parent.right
spacing: _margins
layoutDirection: Qt.RightToLeft
QGCCheckBox {
id: advancedCheckBox
text: qsTr("Advanced")
visible: showAdvanced
}
QGCFlickable { Column {
anchors.fill: parent
contentWidth: pageLoader.x + pageLoader.item.width
contentHeight: pageLoader.y + pageLoader.item.height
clip: true
RowLayout {
id: headingRow
anchors.left: parent.left
anchors.right: parent.right
spacing: _margins spacing: _margins
layoutDirection: Qt.RightToLeft Layout.fillWidth: true
QGCCheckBox { QGCLabel {
id: advancedCheckBox font.pointSize: ScreenTools.largeFontPointSize
text: qsTr("Advanced") text: !setupView.enabled ? _pageTitle + "<font color=\"red\">" + qsTr(" (Disabled while the vehicle is %1)").arg(_disableReason) + "</font>" : _pageTitle
visible: showAdvanced visible: !ScreenTools.isShortScreen
} }
Column { QGCLabel {
spacing: _margins anchors.left: parent.left
Layout.fillWidth: true anchors.right: parent.right
wrapMode: Text.WordWrap
QGCLabel { text: pageDescription
font.pointSize: ScreenTools.largeFontPointSize visible: pageDescription !== "" && !ScreenTools.isShortScreen
text: !setupView.enabled ? _pageTitle + "<font color=\"red\">" + qsTr(" (Disabled while the vehicle is %1)").arg(_disableReason) + "</font>" : _pageTitle
visible: !ScreenTools.isShortScreen
}
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
text: pageDescription
visible: pageDescription !== "" && !ScreenTools.isShortScreen
}
} }
} }
}
Loader { Loader {
id: pageLoader id: pageLoader
anchors.topMargin: _margins anchors.topMargin: _margins
anchors.top: headingRow.bottom anchors.top: headingRow.bottom
} }
// Overlay to display when vehicle is armed and this setup page needs
// Overlay to display when vehicle is armed and this setup page needs // to be disabled
// to be disabled Rectangle {
Rectangle { visible: !setupView.enabled
visible: !setupView.enabled anchors.fill: pageLoader
anchors.fill: pageLoader color: "black"
color: "black" opacity: 0.5
opacity: 0.5
}
} }
} }
} }
...@@ -37,7 +37,6 @@ SetupPage { ...@@ -37,7 +37,6 @@ SetupPage {
SyslinkComponentController { SyslinkComponentController {
id: controller id: controller
factPanel: syslinkPage.viewPanel
} }
QGCLabel { QGCLabel {
......
...@@ -63,11 +63,9 @@ SetupPage { ...@@ -63,11 +63,9 @@ SetupPage {
AirframeComponentController { AirframeComponentController {
id: controller id: controller
factPanel: airframePage.viewPanel
Component.onCompleted: { Component.onCompleted: {
if (controller.showCustomConfigPanel) { if (controller.showCustomConfigPanel) {
showDialog(customConfigDialogComponent, qsTr("Custom Airframe Config"), qgcView.showDialogDefaultWidth, StandardButton.Reset) mainWindow.showDialog(customConfigDialogComponent, qsTr("Custom Airframe Config"), mainWindow.showDialogDefaultWidth, StandardButton.Reset)
} }
} }
} }
...@@ -133,7 +131,7 @@ Your vehicle will also be restarted in order to complete the process.") ...@@ -133,7 +131,7 @@ Your vehicle will also be restarted in order to complete the process.")
anchors.right: parent.right anchors.right: parent.right
text: qsTr("Apply and Restart") text: qsTr("Apply and Restart")
onClicked: showDialog(applyRestartDialogComponent, qsTr("Apply and Restart"), qgcView.showDialogDefaultWidth, StandardButton.Apply | StandardButton.Cancel) onClicked: mainWindow.showDialog(applyRestartDialogComponent, qsTr("Apply and Restart"), mainWindow.showDialogDefaultWidth, StandardButton.Apply | StandardButton.Cancel)
} }
} }
......
...@@ -7,13 +7,10 @@ import QGroundControl.Controls 1.0 ...@@ -7,13 +7,10 @@ import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } AirframeComponentController { id: controller; }
AirframeComponentController { id: controller; factPanel: panel }
property Fact sysIdFact: controller.getParameterFact(-1, "MAV_SYS_ID") property Fact sysIdFact: controller.getParameterFact(-1, "MAV_SYS_ID")
property Fact sysAutoStartFact: controller.getParameterFact(-1, "SYS_AUTOSTART") property Fact sysAutoStartFact: controller.getParameterFact(-1, "SYS_AUTOSTART")
......
...@@ -31,7 +31,7 @@ SetupPage { ...@@ -31,7 +31,7 @@ SetupPage {
width: Math.max(availableWidth, innerColumn.width) width: Math.max(availableWidth, innerColumn.width)
height: innerColumn.height height: innerColumn.height
FactPanelController { id: controller; factPanel: cameraPage.viewPanel } FactPanelController { id: controller; }
property real _margins: ScreenTools.defaultFontPixelHeight property real _margins: ScreenTools.defaultFontPixelHeight
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 25 property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 25
......
...@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0 ...@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact _camTriggerMode: controller.getParameterFact(-1, "TRIG_MODE", false) property Fact _camTriggerMode: controller.getParameterFact(-1, "TRIG_MODE", false)
property Fact _camTriggerInterface: controller.getParameterFact(-1, "TRIG_INTERFACE", false) property Fact _camTriggerInterface: controller.getParameterFact(-1, "TRIG_INTERFACE", false)
......
...@@ -7,13 +7,10 @@ import QGroundControl.Controls 1.0 ...@@ -7,13 +7,10 @@ import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact _nullFact property Fact _nullFact
property Fact _rcMapFltmode: controller.parameterExists(-1, "RC_MAP_FLTMODE") ? controller.getParameterFact(-1, "RC_MAP_FLTMODE") : _nullFact property Fact _rcMapFltmode: controller.parameterExists(-1, "RC_MAP_FLTMODE") ? controller.getParameterFact(-1, "RC_MAP_FLTMODE") : _nullFact
......
...@@ -25,10 +25,6 @@ import QGroundControl.ScreenTools 1.0 ...@@ -25,10 +25,6 @@ import QGroundControl.ScreenTools 1.0
Item { Item {
id: root id: root
// The following properties must be pushed in from the Loader
//property var qgcView - QGCView control
//property var qgcViewPanel - QGCViewPanel control
readonly property bool _shortText: ScreenTools.isTinyScreen readonly property bool _shortText: ScreenTools.isTinyScreen
// User visible strings // User visible strings
...@@ -93,8 +89,6 @@ Item { ...@@ -93,8 +89,6 @@ Item {
PX4AdvancedFlightModesController { PX4AdvancedFlightModesController {
id: controller id: controller
factPanel: qgcViewPanel
onModeRowsChanged: recalcModePositions() onModeRowsChanged: recalcModePositions()
} }
......
...@@ -24,12 +24,9 @@ import QGroundControl.ScreenTools 1.0 ...@@ -24,12 +24,9 @@ import QGroundControl.ScreenTools 1.0
/// PX4 Flight Mode configuration. This control will load either the Simple or Advanced Flight Mode config /// PX4 Flight Mode configuration. This control will load either the Simple or Advanced Flight Mode config
/// based on current parameter settings. /// based on current parameter settings.
SetupPage { SetupPage {
id: flightModesPage
pageComponent: pageComponent pageComponent: pageComponent
Component { Component {
id: pageComponent id: pageComponent
Loader { Loader {
width: availableWidth width: availableWidth
height: availableHeight height: availableHeight
...@@ -43,11 +40,7 @@ SetupPage { ...@@ -43,11 +40,7 @@ SetupPage {
FactPanelController { FactPanelController {
id: controller id: controller
factPanel: flightModesPage.viewPanel
} }
property var qgcView: flightModesPage
property var qgcViewPanel: flightModesPage.viewPanel
} }
} }
} }
...@@ -6,13 +6,10 @@ import QGroundControl.FactControls 1.0 ...@@ -6,13 +6,10 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact mapRollFact: controller.getParameterFact(-1, "RC_MAP_ROLL") property Fact mapRollFact: controller.getParameterFact(-1, "RC_MAP_ROLL")
property Fact mapPitchFact: controller.getParameterFact(-1, "RC_MAP_PITCH") property Fact mapPitchFact: controller.getParameterFact(-1, "RC_MAP_PITCH")
......
...@@ -21,10 +21,6 @@ import QGroundControl.ScreenTools 1.0 ...@@ -21,10 +21,6 @@ import QGroundControl.ScreenTools 1.0
Item { Item {
id: root id: root
// The following properties must be pushed in from the Loader
//property var qgcView - QGCView control
//property var qgcViewPanel - QGCViewPanel control
property real _margins: ScreenTools.defaultFontPixelHeight / 2 property real _margins: ScreenTools.defaultFontPixelHeight / 2
property var _switchNameList: [ "ACRO", "ARM", "GEAR", "KILL", "LOITER", "OFFB", "POSCTL", "RATT", "RETURN", "STAB" ] property var _switchNameList: [ "ACRO", "ARM", "GEAR", "KILL", "LOITER", "OFFB", "POSCTL", "RATT", "RETURN", "STAB" ]
property var _switchFactList: [ ] property var _switchFactList: [ ]
...@@ -53,7 +49,6 @@ Item { ...@@ -53,7 +49,6 @@ Item {
PX4SimpleFlightModesController { PX4SimpleFlightModesController {
id: controller id: controller
factPanel: qgcViewPanel
} }
QGCFlickable { QGCFlickable {
...@@ -207,6 +202,6 @@ Item { ...@@ -207,6 +202,6 @@ Item {
controller.getParameterFact(-1, "RC_MAP_FLTMODE").value = 0 controller.getParameterFact(-1, "RC_MAP_FLTMODE").value = 0
} }
} }
} // Column }
} // QGCFlickable }
} // QGCView }
...@@ -34,13 +34,11 @@ SetupPage { ...@@ -34,13 +34,11 @@ SetupPage {
FactPanelController { FactPanelController {
id: controller id: controller
factPanel: tuningPage.viewPanel
} }
// Standard tuning page // Standard tuning page
FactSliderPanel { FactSliderPanel {
width: availableWidth width: availableWidth
qgcViewPanel: tuningPage.viewPanel
visible: !advanced visible: !advanced
sliderModel: ListModel { sliderModel: ListModel {
......
...@@ -34,15 +34,12 @@ SetupPage { ...@@ -34,15 +34,12 @@ SetupPage {
FactPanelController { FactPanelController {
id: controller id: controller
factPanel: tuningPage.viewPanel
} }
// Standard tuning page // Standard tuning page
FactSliderPanel { FactSliderPanel {
width: availableWidth width: availableWidth
qgcViewPanel: tuningPage.viewPanel
visible: !advanced visible: !advanced
sliderModel: ListModel { sliderModel: ListModel {
ListElement { ListElement {
title: qsTr("Cruise throttle") title: qsTr("Cruise throttle")
...@@ -55,7 +52,6 @@ SetupPage { ...@@ -55,7 +52,6 @@ SetupPage {
} }
} }
Loader { Loader {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
......
...@@ -22,8 +22,6 @@ SetupPage { ...@@ -22,8 +22,6 @@ SetupPage {
FactSliderPanel { FactSliderPanel {
width: availableWidth width: availableWidth
qgcViewPanel: tuningPage.viewPanel
sliderModel: ListModel { sliderModel: ListModel {
ListElement { ListElement {
......
...@@ -88,15 +88,13 @@ SetupPage { ...@@ -88,15 +88,13 @@ SetupPage {
PowerComponentController { PowerComponentController {
id: controller id: controller
factPanel: powerPage.viewPanel onOldFirmware: mainWindow.showMessageDialog(qsTr("ESC Calibration"), qsTr("%1 cannot perform ESC Calibration with this version of firmware. You will need to upgrade to a newer firmware.").arg(QGroundControl.appName))
onNewerFirmware: mainWindow.showMessageDialog(qsTr("ESC Calibration"), qsTr("%1 cannot perform ESC Calibration with this version of firmware. You will need to upgrade %1.").arg(QGroundControl.appName))
onOldFirmware: showMessage(qsTr("ESC Calibration"), qsTr("%1 cannot perform ESC Calibration with this version of firmware. You will need to upgrade to a newer firmware.").arg(QGroundControl.appName), StandardButton.Ok) onBatteryConnected: mainWindow.showMessageDialog(qsTr("ESC Calibration"), qsTr("Performing calibration. This will take a few seconds.."))
onNewerFirmware: showMessage(qsTr("ESC Calibration"), qsTr("%1 cannot perform ESC Calibration with this version of firmware. You will need to upgrade %1.").arg(QGroundControl.appName), StandardButton.Ok) onCalibrationFailed: mainWindow.showMessageDialog(qsTr("ESC Calibration failed"), errorMessage)
onBatteryConnected: showMessage(qsTr("ESC Calibration"), qsTr("Performing calibration. This will take a few seconds.."), 0) onCalibrationSuccess: mainWindow.showMessageDialog(qsTr("ESC Calibration"), qsTr("Calibration complete. You can disconnect your battery now if you like."))
onCalibrationFailed: showMessage(qsTr("ESC Calibration failed"), errorMessage, StandardButton.Ok) onConnectBattery: mainWindow.showMessageDialog(qsTr("ESC Calibration"), highlightPrefix + qsTr("WARNING: Props must be removed from vehicle prior to performing ESC calibration.") + highlightSuffix + qsTr(" Connect the battery now and calibration will begin."))
onCalibrationSuccess: showMessage(qsTr("ESC Calibration"), qsTr("Calibration complete. You can disconnect your battery now if you like."), StandardButton.Ok) onDisconnectBattery: mainWindow.showMessageDialog(qsTr("ESC Calibration failed"), qsTr("You must disconnect the battery prior to performing ESC Calibration. Disconnect your battery and try again."))
onConnectBattery: showMessage(qsTr("ESC Calibration"), highlightPrefix + qsTr("WARNING: Props must be removed from vehicle prior to performing ESC calibration.") + highlightSuffix + qsTr(" Connect the battery now and calibration will begin."), 0)
onDisconnectBattery: showMessage(qsTr("ESC Calibration failed"), qsTr("You must disconnect the battery prior to performing ESC Calibration. Disconnect your battery and try again."), StandardButton.Ok)
} }
Component { Component {
...@@ -302,7 +300,7 @@ SetupPage { ...@@ -302,7 +300,7 @@ SetupPage {
QGCButton { QGCButton {
id: voltMultCalculateButton id: voltMultCalculateButton
text: qsTr("Calculate") text: qsTr("Calculate")
onClicked: showDialog(calcVoltageDividerDlgComponent, qsTr("Calculate Voltage Divider"), powerPage.showDialogDefaultWidth, StandardButton.Close) onClicked: mainWindow.showDialog(calcVoltageDividerDlgComponent, qsTr("Calculate Voltage Divider"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
} }
Item { width: 1; height: 1; Layout.columnSpan: 2 } Item { width: 1; height: 1; Layout.columnSpan: 2 }
...@@ -330,7 +328,7 @@ SetupPage { ...@@ -330,7 +328,7 @@ SetupPage {
QGCButton { QGCButton {
id: ampPerVoltCalculateButton id: ampPerVoltCalculateButton
text: qsTr("Calculate") text: qsTr("Calculate")
onClicked: showDialog(calcAmpsPerVoltDlgComponent, qsTr("Calculate Amps per Volt"), powerPage.showDialogDefaultWidth, StandardButton.Close) onClicked: mainWindow.showDialog(calcAmpsPerVoltDlgComponent, qsTr("Calculate Amps per Volt"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
} }
Item { width: 1; height: 1; Layout.columnSpan: 2 } Item { width: 1; height: 1; Layout.columnSpan: 2 }
......
...@@ -20,13 +20,11 @@ import QGroundControl.FactControls 1.0 ...@@ -20,13 +20,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel } FactPanelController { id: controller; }
property Fact batVChargedFact: controller.getParameterFact(-1, "BAT_V_CHARGED") property Fact batVChargedFact: controller.getParameterFact(-1, "BAT_V_CHARGED")
property Fact batVEmptyFact: controller.getParameterFact(-1, "BAT_V_EMPTY") property Fact batVEmptyFact: controller.getParameterFact(-1, "BAT_V_EMPTY")
......
...@@ -23,7 +23,6 @@ import QGroundControl.ScreenTools 1.0 ...@@ -23,7 +23,6 @@ import QGroundControl.ScreenTools 1.0
SetupPage { SetupPage {
id: safetyPage id: safetyPage
pageComponent: pageComponent pageComponent: pageComponent
Component { Component {
id: pageComponent id: pageComponent
...@@ -33,7 +32,6 @@ SetupPage { ...@@ -33,7 +32,6 @@ SetupPage {
FactPanelController { FactPanelController {
id: controller id: controller
factPanel: safetyPage.viewPanel
} }
readonly property string hitlParam: "SYS_HITL" readonly property string hitlParam: "SYS_HITL"
......
...@@ -6,13 +6,10 @@ import QGroundControl.FactControls 1.0 ...@@ -6,13 +6,10 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact returnAltFact: controller.getParameterFact(-1, "RTL_RETURN_ALT") property Fact returnAltFact: controller.getParameterFact(-1, "RTL_RETURN_ALT")
property Fact _descendAltFact: controller.getParameterFact(-1, "RTL_DESCEND_ALT") property Fact _descendAltFact: controller.getParameterFact(-1, "RTL_DESCEND_ALT")
......
...@@ -13,16 +13,12 @@ import QGroundControl.Controls 1.0 ...@@ -13,16 +13,12 @@ import QGroundControl.Controls 1.0
import QGroundControl.PX4 1.0 import QGroundControl.PX4 1.0
SetupPage { SetupPage {
id: sensorsPage
pageComponent: pageComponent pageComponent: pageComponent
Component { Component {
id: pageComponent id: pageComponent
SensorsSetup { SensorsSetup {
width: availableWidth width: availableWidth
height: availableHeight height: availableHeight
qgcView: sensorsPage
} }
} // Component }
} // SetupPage }
...@@ -11,13 +11,10 @@ import QGroundControl.Palette 1.0 ...@@ -11,13 +11,10 @@ import QGroundControl.Palette 1.0
IMPORTANT NOTE: Any changes made here must also be made to SensorsComponentSummary.qml IMPORTANT NOTE: Any changes made here must also be made to SensorsComponentSummary.qml
*/ */
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact mag0IdFact: controller.getParameterFact(-1, "CAL_MAG0_ID") property Fact mag0IdFact: controller.getParameterFact(-1, "CAL_MAG0_ID")
property Fact mag1IdFact: controller.getParameterFact(-1, "CAL_MAG1_ID") property Fact mag1IdFact: controller.getParameterFact(-1, "CAL_MAG1_ID")
......
...@@ -10,13 +10,11 @@ import QGroundControl.Palette 1.0 ...@@ -10,13 +10,11 @@ import QGroundControl.Palette 1.0
IMPORTANT NOTE: Any changes made here must also be made to SensorsComponentSummary.qml IMPORTANT NOTE: Any changes made here must also be made to SensorsComponentSummary.qml
*/ */
FactPanel { Item {
id: panel
anchors.fill: parent anchors.fill: parent
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } FactPanelController { id: controller; }
FactPanelController { id: controller; factPanel: panel }
property Fact mag0IdFact: controller.getParameterFact(-1, "CAL_MAG0_ID") property Fact mag0IdFact: controller.getParameterFact(-1, "CAL_MAG0_ID")
property Fact gyro0IdFact: controller.getParameterFact(-1, "CAL_GYRO0_ID") property Fact gyro0IdFact: controller.getParameterFact(-1, "CAL_GYRO0_ID")
......
...@@ -25,7 +25,6 @@ import QGroundControl.Controllers 1.0 ...@@ -25,7 +25,6 @@ import QGroundControl.Controllers 1.0
Item { Item {
id: _root id: _root
property var qgcView ///< QGCView must be passed in
property bool showSensorCalibrationCompass: true ///< true: Show this calibration button property bool showSensorCalibrationCompass: true ///< true: Show this calibration button
property bool showSensorCalibrationGyro: true ///< true: Show this calibration button property bool showSensorCalibrationGyro: true ///< true: Show this calibration button
property bool showSensorCalibrationAccel: true ///< true: Show this calibration button property bool showSensorCalibrationAccel: true ///< true: Show this calibration button
...@@ -117,7 +116,6 @@ Item { ...@@ -117,7 +116,6 @@ Item {
SensorsComponentController { SensorsComponentController {
id: controller id: controller
factPanel: _root.qgcView.viewPanel
statusLog: statusTextArea statusLog: statusTextArea
progressBar: progressBar progressBar: progressBar
compassButton: compassButton compassButton: compassButton
...@@ -133,12 +131,12 @@ Item { ...@@ -133,12 +131,12 @@ Item {
onMagCalComplete: { onMagCalComplete: {
setOrientationsDialogShowBoardOrientation = false setOrientationsDialogShowBoardOrientation = false
showDialog(setOrientationsDialogComponent, qsTr("Compass Calibration Complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok) mainWindow.showDialog(setOrientationsDialogComponent, qsTr("Compass Calibration Complete"), mainWindow.showDialogDefaultWidth, StandardButton.Ok)
} }
onWaitingForCancelChanged: { onWaitingForCancelChanged: {
if (controller.waitingForCancel) { if (controller.waitingForCancel) {
showDialog(waitForCancelDialogComponent, qsTr("Calibration Cancel"), qgcView.showDialogDefaultWidth, 0) mainWindow.showDialog(waitForCancelDialogComponent, qsTr("Calibration Cancel"), mainWindow.showDialogDefaultWidth, 0)
} }
} }
} }
...@@ -146,7 +144,7 @@ Item { ...@@ -146,7 +144,7 @@ Item {
Component.onCompleted: { Component.onCompleted: {
var usingUDP = controller.usingUDPLink() var usingUDP = controller.usingUDPLink()
if (usingUDP && !_wifiReliableForCalibration) { if (usingUDP && !_wifiReliableForCalibration) {
showMessage(qsTr("Sensor Calibration"), qsTr("Performing sensor calibration over a WiFi connection is known to be unreliable. You should disconnect and perform calibration using a direct USB connection instead."), StandardButton.Ok) mainWindow.showMessageDialog(qsTr("Sensor Calibration"), qsTr("Performing sensor calibration over a WiFi connection is known to be unreliable. You should disconnect and perform calibration using a direct USB connection instead."))
} }
} }
...@@ -395,7 +393,7 @@ Item { ...@@ -395,7 +393,7 @@ Item {
onClicked: { onClicked: {
preCalibrationDialogType = "compass" preCalibrationDialogType = "compass"
preCalibrationDialogHelp = compassHelp preCalibrationDialogHelp = compassHelp
showDialog(preCalibrationDialogComponent, qsTr("Calibrate Compass"), qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) mainWindow.showDialog(preCalibrationDialogComponent, qsTr("Calibrate Compass"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
} }
} }
...@@ -409,7 +407,7 @@ Item { ...@@ -409,7 +407,7 @@ Item {
onClicked: { onClicked: {
preCalibrationDialogType = "gyro" preCalibrationDialogType = "gyro"
preCalibrationDialogHelp = gyroHelp preCalibrationDialogHelp = gyroHelp
showDialog(preCalibrationDialogComponent, qsTr("Calibrate Gyro"), qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) mainWindow.showDialog(preCalibrationDialogComponent, qsTr("Calibrate Gyro"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
} }
} }
...@@ -423,7 +421,7 @@ Item { ...@@ -423,7 +421,7 @@ Item {
onClicked: { onClicked: {
preCalibrationDialogType = "accel" preCalibrationDialogType = "accel"
preCalibrationDialogHelp = accelHelp preCalibrationDialogHelp = accelHelp
showDialog(preCalibrationDialogComponent, qsTr("Calibrate Accelerometer"), qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) mainWindow.showDialog(preCalibrationDialogComponent, qsTr("Calibrate Accelerometer"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
} }
} }
...@@ -438,7 +436,7 @@ Item { ...@@ -438,7 +436,7 @@ Item {
onClicked: { onClicked: {
preCalibrationDialogType = "level" preCalibrationDialogType = "level"
preCalibrationDialogHelp = levelHelp preCalibrationDialogHelp = levelHelp
showDialog(preCalibrationDialogComponent, qsTr("Level Horizon"), qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) mainWindow.showDialog(preCalibrationDialogComponent, qsTr("Level Horizon"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
} }
} }
...@@ -456,7 +454,7 @@ Item { ...@@ -456,7 +454,7 @@ Item {
onClicked: { onClicked: {
preCalibrationDialogType = "airspeed" preCalibrationDialogType = "airspeed"
preCalibrationDialogHelp = airspeedHelp preCalibrationDialogHelp = airspeedHelp
showDialog(preCalibrationDialogComponent, qsTr("Calibrate Airspeed"), qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) mainWindow.showDialog(preCalibrationDialogComponent, qsTr("Calibrate Airspeed"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
} }
} }
...@@ -485,7 +483,7 @@ Item { ...@@ -485,7 +483,7 @@ Item {
onClicked: { onClicked: {
setOrientationsDialogShowBoardOrientation = true setOrientationsDialogShowBoardOrientation = true
showDialog(setOrientationsDialogComponent, qsTr("Set Orientations"), qgcView.showDialogDefaultWidth, StandardButton.Ok) mainWindow.showDialog(setOrientationsDialogComponent, qsTr("Set Orientations"), mainWindow.showDialogDefaultWidth, StandardButton.Ok)
} }
} }
} // Column - Buttons } // Column - Buttons
......
/****************************************************************************
*
* (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.
*
****************************************************************************/
/// @file
/// @author Don Gagne <don@thegagnes.com>
import QtQuick 2.3
import QtQuick.Controls 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FocusScope {
property alias color: rectangle.color
property string __missingParams: ""
property string __errorMsg: ""
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
function showMissingParameterOverlay(missingParamName) {
if (__missingParams.length != 0) {
__missingParams = __missingParams.concat(", ")
}
__missingParams = __missingParams.concat(missingParamName)
__missingParamsOverlay.visible = true
}
function showError(errorMsg) {
__errorMsg = errorMsg
__missingParamsOverlay.visible = true
}
Rectangle {
id: rectangle
color: qgcPal.window
Rectangle {
id: __missingParamsOverlay
anchors.fill: parent
z: 9999
visible: false
color: qgcPal.window
opacity: 0.85
QGCLabel {
anchors.fill: parent
wrapMode: Text.WordWrap
text: __errorMsg.length ? __errorMsg : qsTr("Parameters(s) missing: %1").arg(__missingParams)
}
}
}
}
...@@ -20,65 +20,38 @@ ...@@ -20,65 +20,38 @@
QGC_LOGGING_CATEGORY(FactPanelControllerLog, "FactPanelControllerLog") QGC_LOGGING_CATEGORY(FactPanelControllerLog, "FactPanelControllerLog")
FactPanelController::FactPanelController(bool standaloneUnitTesting) FactPanelController::FactPanelController()
: _vehicle(NULL)
, _uas(NULL)
, _autopilot(NULL)
, _factPanel(NULL)
{ {
_vehicle = qgcApp()->toolbox()->multiVehicleManager()->activeVehicle(); _vehicle = qgcApp()->toolbox()->multiVehicleManager()->activeVehicle();
if (_vehicle) { if (_vehicle) {
_uas = _vehicle->uas(); _uas = _vehicle->uas();
_autopilot = _vehicle->autopilotPlugin(); _autopilot = _vehicle->autopilotPlugin();
} else { } else {
_vehicle = qgcApp()->toolbox()->multiVehicleManager()->offlineEditingVehicle(); _vehicle = qgcApp()->toolbox()->multiVehicleManager()->offlineEditingVehicle();
} }
if (!standaloneUnitTesting) {
// Do a delayed check for the _factPanel finally being set correctly from Qml
QTimer::singleShot(1000, this, &FactPanelController::_checkForMissingFactPanel);
}
}
QQuickItem* FactPanelController::factPanel(void)
{
return _factPanel;
}
void FactPanelController::setFactPanel(QQuickItem* panel)
{
// Once we finally have the _factPanel member set, send any
// missing fact notices that were waiting to go out
_factPanel = panel;
foreach (const QString &missingParam, _delayedMissingParams) {
_notifyPanelMissingParameter(missingParam);
}
_delayedMissingParams.clear();
} }
void FactPanelController::_notifyPanelMissingParameter(const QString& missingParam) void FactPanelController::_notifyPanelMissingParameter(const QString& missingParam)
{ {
if (_factPanel) { if (qgcApp()->mainQmlWindow()) {
QVariant returnedValue; QVariant returnedValue;
QMetaObject::invokeMethod(
QMetaObject::invokeMethod(_factPanel, qgcApp()->mainQmlWindow(),
"showMissingParameterOverlay", "showMissingParameterOverlay",
Q_RETURN_ARG(QVariant, returnedValue), Q_RETURN_ARG(QVariant, returnedValue),
Q_ARG(QVariant, missingParam)); Q_ARG(QVariant, missingParam));
} }
} }
void FactPanelController::_notifyPanelErrorMsg(const QString& errorMsg) void FactPanelController::_notifyPanelErrorMsg(const QString& errorMsg)
{ {
if (_factPanel) { if(qgcApp()->mainQmlWindow()) {
QVariant returnedValue; QVariant returnedValue;
QMetaObject::invokeMethod(
QMetaObject::invokeMethod(_factPanel, qgcApp()->mainQmlWindow(),
"showError", "showFactError",
Q_RETURN_ARG(QVariant, returnedValue), Q_RETURN_ARG(QVariant, returnedValue),
Q_ARG(QVariant, errorMsg)); Q_ARG(QVariant, errorMsg));
} }
} }
...@@ -94,7 +67,7 @@ void FactPanelController::_reportMissingParameter(int componentId, const QString ...@@ -94,7 +67,7 @@ void FactPanelController::_reportMissingParameter(int componentId, const QString
// will not have access to _factPanel yet. Just record list of missing facts // will not have access to _factPanel yet. Just record list of missing facts
// in that case instead of notify. Once _factPanel is available they will be // in that case instead of notify. Once _factPanel is available they will be
// send out for real. // send out for real.
if (_factPanel) { if (qgcApp()->mainQmlWindow()) {
_notifyPanelMissingParameter(missingParam); _notifyPanelMissingParameter(missingParam);
} else { } else {
_delayedMissingParams += missingParam; _delayedMissingParams += missingParam;
...@@ -115,12 +88,6 @@ bool FactPanelController::_allParametersExists(int componentId, QStringList name ...@@ -115,12 +88,6 @@ bool FactPanelController::_allParametersExists(int componentId, QStringList name
return noMissingFacts; return noMissingFacts;
} }
void FactPanelController::_checkForMissingFactPanel(void)
{
if (!_factPanel) {
_showInternalError(tr("Incorrect FactPanel Qml implementation. FactPanelController used without passing in factPanel."));
}
}
Fact* FactPanelController::getParameterFact(int componentId, const QString& name, bool reportMissing) Fact* FactPanelController::getParameterFact(int componentId, const QString& name, bool reportMissing)
{ {
...@@ -132,7 +99,7 @@ Fact* FactPanelController::getParameterFact(int componentId, const QString& name ...@@ -132,7 +99,7 @@ Fact* FactPanelController::getParameterFact(int componentId, const QString& name
if (reportMissing) { if (reportMissing) {
_reportMissingParameter(componentId, name); _reportMissingParameter(componentId, name);
} }
return NULL; return nullptr;
} }
} }
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
****************************************************************************/ ****************************************************************************/
#ifndef FactPanelController_H #pragma once
#define FactPanelController_H
/// @file /// @file
/// @author Don Gagne <don@thegagnes.com> /// @author Don Gagne <don@thegagnes.com>
...@@ -23,47 +22,35 @@ ...@@ -23,47 +22,35 @@
Q_DECLARE_LOGGING_CATEGORY(FactPanelControllerLog) Q_DECLARE_LOGGING_CATEGORY(FactPanelControllerLog)
/// FactPanelController is used in combination with the FactPanel Qml control for handling /// FactPanelController is used for handling missing Facts from C++ code.
/// missing Facts from C++ code.
class FactPanelController : public QObject class FactPanelController : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
/// @param standaloneUnitTesting true: being run without factPanel, false: normal operation, factPanel is required FactPanelController();
FactPanelController(bool standaloneUnitTesting = false);
Q_PROPERTY(QQuickItem* factPanel READ factPanel WRITE setFactPanel)
Q_PROPERTY(Vehicle* vehicle MEMBER _vehicle CONSTANT) Q_PROPERTY(Vehicle* vehicle MEMBER _vehicle CONSTANT)
Q_INVOKABLE Fact* getParameterFact (int componentId, const QString& name, bool reportMissing = true); Q_INVOKABLE Fact* getParameterFact (int componentId, const QString& name, bool reportMissing = true);
Q_INVOKABLE bool parameterExists (int componentId, const QString& name); Q_INVOKABLE bool parameterExists (int componentId, const QString& name);
QQuickItem* factPanel(void);
void setFactPanel(QQuickItem* panel);
protected: protected:
/// Checks for existence of the specified parameters /// Checks for existence of the specified parameters
/// @return true: all parameters exists, false: parameters missing and reported /// @return true: all parameters exists, false: parameters missing and reported
bool _allParametersExists(int componentId, QStringList names); bool _allParametersExists(int componentId, QStringList names);
/// Report a missing parameter to the FactPanel Qml element /// Report a missing parameter
void _reportMissingParameter(int componentId, const QString& name); void _reportMissingParameter(int componentId, const QString& name);
Vehicle* _vehicle; Vehicle* _vehicle = nullptr;
UASInterface* _uas; UASInterface* _uas = nullptr;
AutoPilotPlugin* _autopilot; AutoPilotPlugin* _autopilot = nullptr;
private slots:
void _checkForMissingFactPanel(void);
private: private:
void _notifyPanelMissingParameter(const QString& missingParam); void _notifyPanelMissingParameter(const QString& missingParam);
void _notifyPanelErrorMsg(const QString& errorMsg); void _notifyPanelErrorMsg(const QString& errorMsg);
void _showInternalError(const QString& errorMsg); void _showInternalError(const QString& errorMsg);
QQuickItem* _factPanel; QStringList _delayedMissingParams;
QStringList _delayedMissingParams;
}; };
#endif
...@@ -27,28 +27,20 @@ QGCTextField { ...@@ -27,28 +27,20 @@ QGCTextField {
Qt.ImhFormattedNumbersOnly // Forces use of virtual numeric keyboard Qt.ImhFormattedNumbersOnly // Forces use of virtual numeric keyboard
onEditingFinished: { onEditingFinished: {
if (typeof qgcView !== 'undefined' && qgcView) { var errorString = fact.validate(text, false /* convertOnly */)
var errorString = fact.validate(text, false /* convertOnly */) if (errorString === "") {
if (errorString === "") {
fact.value = text
_textField.updated()
} else {
_validateString = text
qgcView.showDialog(validationErrorDialogComponent, qsTr("Invalid Value"), qgcView.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
}
} else {
fact.value = text fact.value = text
fact.valueChanged(fact.value)
_textField.updated() _textField.updated()
} else {
_validateString = text
mainWindow.showDialog(validationErrorDialogComponent, qsTr("Invalid Value"), mainWindow.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
} }
} }
onHelpClicked: qgcView.showDialog(helpDialogComponent, qsTr("Value Details"), qgcView.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel) onHelpClicked: mainWindow.showDialog(helpDialogComponent, qsTr("Value Details"), mainWindow.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
Component { Component {
id: validationErrorDialogComponent id: validationErrorDialogComponent
ParameterEditorDialog { ParameterEditorDialog {
validate: true validate: true
validateValue: _validateString validateValue: _validateString
...@@ -58,7 +50,6 @@ QGCTextField { ...@@ -58,7 +50,6 @@ QGCTextField {
Component { Component {
id: helpDialogComponent id: helpDialogComponent
ParameterEditorDialog { ParameterEditorDialog {
fact: _textField.fact fact: _textField.fact
} }
......
...@@ -97,7 +97,7 @@ Rectangle { ...@@ -97,7 +97,7 @@ Rectangle {
onClicked: { onClicked: {
valueListView.focus = true valueListView.focus = true
if (_currentIndex === index) { if (_currentIndex === index) {
qgcView.showDialog(editDialogComponent, qsTr("Value Details"), qgcView.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel) mainWindow.showDialog(editDialogComponent, qsTr("Value Details"), mainWindow.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
} else { } else {
_currentIndex = index _currentIndex = index
valueListView.positionViewAtIndex(_currentIndex, ListView.Center) valueListView.positionViewAtIndex(_currentIndex, ListView.Center)
......
...@@ -5,7 +5,6 @@ FactBitmask 1.0 FactBitmask.qml ...@@ -5,7 +5,6 @@ FactBitmask 1.0 FactBitmask.qml
FactCheckBox 1.0 FactCheckBox.qml FactCheckBox 1.0 FactCheckBox.qml
FactComboBox 1.0 FactComboBox.qml FactComboBox 1.0 FactComboBox.qml
FactLabel 1.0 FactLabel.qml FactLabel 1.0 FactLabel.qml
FactPanel 1.0 FactPanel.qml
FactTextField 1.0 FactTextField.qml FactTextField 1.0 FactTextField.qml
FactTextFieldGrid 1.0 FactTextFieldGrid.qml FactTextFieldGrid 1.0 FactTextFieldGrid.qml
FactTextFieldRow 1.0 FactTextFieldRow.qml FactTextFieldRow 1.0 FactTextFieldRow.qml
......
...@@ -13,10 +13,9 @@ import QtQuick.Controls 1.2 ...@@ -13,10 +13,9 @@ import QtQuick.Controls 1.2
import QGroundControl.FactSystem 1.0 import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0 import QGroundControl.FactControls 1.0
FactPanel { Item {
id: panel
FactPanelController { id: controller; factPanel: panel } FactPanelController { id: controller; }
// Use default component id // Use default component id
TextInput { TextInput {
......
...@@ -30,11 +30,7 @@ import QGroundControl.ScreenTools 1.0 ...@@ -30,11 +30,7 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0 import QGroundControl.Vehicle 1.0
/// Flight Display View /// Flight Display View
QGCView { Item {
id: root
viewPanel: _panel
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
PlanMasterController { PlanMasterController {
id: planMasterController id: planMasterController
...@@ -111,11 +107,6 @@ QGCView { ...@@ -111,11 +107,6 @@ QGCView {
return true; return true;
} }
PlanMasterController {
id: masterController
Component.onCompleted: start(true /* flyView */)
}
BuiltInPreFlightCheckModel { BuiltInPreFlightCheckModel {
id: preFlightCheckModel id: preFlightCheckModel
} }
...@@ -149,7 +140,7 @@ QGCView { ...@@ -149,7 +140,7 @@ QGCView {
if (promptForMissionRemove && (_missionController.containsItems || _geoFenceController.containsItems || _rallyPointController.containsItems)) { if (promptForMissionRemove && (_missionController.containsItems || _geoFenceController.containsItems || _rallyPointController.containsItems)) {
// ArduPilot has a strange bug which prevents mission clear from working at certain times, so we can't show this dialog // ArduPilot has a strange bug which prevents mission clear from working at certain times, so we can't show this dialog
if (!activeVehicle.apmFirmware) { if (!activeVehicle.apmFirmware) {
root.showDialog(missionCompleteDialogComponent, qsTr("Flight Plan complete"), showDialogDefaultWidth, StandardButton.Close) mainWindow.showDialog(missionCompleteDialogComponent, qsTr("Flight Plan complete"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
} }
} }
promptForMissionRemove = false promptForMissionRemove = false
...@@ -297,7 +288,7 @@ QGCView { ...@@ -297,7 +288,7 @@ QGCView {
QGCMapPalette { id: mapPal; lightColors: _mainIsMap ? _flightMap.isSatelliteMap : true } QGCMapPalette { id: mapPal; lightColors: _mainIsMap ? _flightMap.isSatelliteMap : true }
QGCViewPanel { Item {
id: _panel id: _panel
anchors.fill: parent anchors.fill: parent
...@@ -334,7 +325,6 @@ QGCView { ...@@ -334,7 +325,6 @@ QGCView {
guidedActionsController: _guidedController guidedActionsController: _guidedController
flightWidgets: flightDisplayViewWidgets flightWidgets: flightDisplayViewWidgets
rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9 rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9
qgcView: root
multiVehicleView: !singleVehicleView.checked multiVehicleView: !singleVehicleView.checked
scaleState: (_mainIsMap && flyViewOverlay.item) ? (flyViewOverlay.item.scaleState ? flyViewOverlay.item.scaleState : "bottomMode") : "bottomMode" scaleState: (_mainIsMap && flyViewOverlay.item) ? (flyViewOverlay.item.scaleState ? flyViewOverlay.item.scaleState : "bottomMode") : "bottomMode"
} }
...@@ -507,7 +497,6 @@ QGCView { ...@@ -507,7 +497,6 @@ QGCView {
anchors.left: parent.left anchors.left: parent.left
anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
qgcView: root
useLightColors: isBackgroundDark useLightColors: isBackgroundDark
missionController: _missionController missionController: _missionController
visible: singleVehicleView.checked && !QGroundControl.videoManager.fullScreen visible: singleVehicleView.checked && !QGroundControl.videoManager.fullScreen
...@@ -523,8 +512,6 @@ QGCView { ...@@ -523,8 +512,6 @@ QGCView {
anchors.left: parent.left anchors.left: parent.left
anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
property var qgcView: root
} }
MultiVehicleList { MultiVehicleList {
......
...@@ -38,7 +38,6 @@ FlightMap { ...@@ -38,7 +38,6 @@ FlightMap {
property var guidedActionsController property var guidedActionsController
property var flightWidgets property var flightWidgets
property var rightPanelWidth property var rightPanelWidth
property var qgcView ///< QGCView control which contains this map
property var multiVehicleView ///< true: multi-vehicle view, false: single vehicle view property var multiVehicleView ///< true: multi-vehicle view, false: single vehicle view
property rect centerViewport: Qt.rect(0, 0, width, height) property rect centerViewport: Qt.rect(0, 0, width, height)
......
...@@ -27,7 +27,6 @@ import QGroundControl.Airmap 1.0 ...@@ -27,7 +27,6 @@ import QGroundControl.Airmap 1.0
Item { Item {
id: widgetRoot id: widgetRoot
property var qgcView
property bool useLightColors property bool useLightColors
property var missionController property var missionController
property bool showValues: !QGroundControl.airspaceManager.airspaceVisible property bool showValues: !QGroundControl.airspaceManager.airspaceVisible
...@@ -173,7 +172,6 @@ Item { ...@@ -173,7 +172,6 @@ Item {
Loader { Loader {
id: instrumentsLoader id: instrumentsLoader
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5 anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
property var qgcView: widgetRoot.qgcView
property real maxHeight: widgetRoot ? widgetRoot.height - instrumentsColumn.y - airspaceControl.height - (ScreenTools.defaultFontPixelHeight * 4) : 0 property real maxHeight: widgetRoot ? widgetRoot.height - instrumentsColumn.y - airspaceControl.height - (ScreenTools.defaultFontPixelHeight * 4) : 0
states: [ states: [
State { State {
......
...@@ -58,7 +58,7 @@ Rectangle { ...@@ -58,7 +58,7 @@ Rectangle {
Layout.minimumWidth: _width Layout.minimumWidth: _width
Layout.maximumWidth: _width Layout.maximumWidth: _width
property real _width: Math.min(root.width * 0.8, actionRow.width) property real _width: Math.min(_root.width * 0.8, actionRow.width)
RowLayout { RowLayout {
id: actionRow id: actionRow
......
...@@ -35,14 +35,13 @@ Map { ...@@ -35,14 +35,13 @@ Map {
property string mapName: 'defaultMap' property string mapName: 'defaultMap'
property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1 property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1
property var gcsPosition: QGroundControl.qgcPositionManger.gcsPosition property var gcsPosition: QGroundControl.qgcPositionManger.gcsPosition
property var gcsHeading: QGroundControl.qgcPositionManger.gcsHeading property int gcsHeading: QGroundControl.qgcPositionManger.gcsHeading
property bool userPanned: false ///< true: the user has manually panned the map property bool userPanned: false ///< true: the user has manually panned the map
property bool allowGCSLocationCenter: false ///< true: map will center/zoom to gcs location one time property bool allowGCSLocationCenter: false ///< true: map will center/zoom to gcs location one time
property bool allowVehicleLocationCenter: false ///< true: map will center/zoom to vehicle location one time property bool allowVehicleLocationCenter: false ///< true: map will center/zoom to vehicle location one time
property bool firstGCSPositionReceived: false ///< true: first gcs position update was responded to property bool firstGCSPositionReceived: false ///< true: first gcs position update was responded to
property bool firstVehiclePositionReceived: false ///< true: first vehicle position update was responded to property bool firstVehiclePositionReceived: false ///< true: first vehicle position update was responded to
property bool planView: false ///< true: map being using for Plan view, items should be draggable property bool planView: false ///< true: map being using for Plan view, items should be draggable
property var qgcView
readonly property real maxZoomLevel: 20 readonly property real maxZoomLevel: 20
...@@ -66,13 +65,11 @@ Map { ...@@ -66,13 +65,11 @@ Map {
} }
function centerToSpecifiedLocation() { function centerToSpecifiedLocation() {
qgcView.showDialog(specifyMapPositionDialog, qsTr("Specify Position"), qgcView.showDialogDefaultWidth, StandardButton.Close) mainWindow.showDialog(specifyMapPositionDialog, qsTr("Specify Position"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
} }
Component { Component {
id: specifyMapPositionDialog id: specifyMapPositionDialog
EditPositionDialog { EditPositionDialog {
coordinate: center coordinate: center
onCoordinateChanged: center = coordinate onCoordinateChanged: center = coordinate
......
...@@ -48,7 +48,7 @@ Column { ...@@ -48,7 +48,7 @@ Column {
property int _curCameraIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0 property int _curCameraIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0
function showSettings() { function showSettings() {
qgcView.showDialog(cameraSettings, _cameraVideoMode ? qsTr("Video Settings") : qsTr("Camera Settings"), 70, StandardButton.Ok) mainWindow.showDialog(cameraSettings, _cameraVideoMode ? qsTr("Video Settings") : qsTr("Camera Settings"), 70, StandardButton.Ok)
} }
//-- Dumb camera trigger if no actual camera interface exists //-- Dumb camera trigger if no actual camera interface exists
......
...@@ -11,7 +11,6 @@ Item { ...@@ -11,7 +11,6 @@ Item {
clip: true clip: true
height: column.height height: column.height
property var qgcView ///< QGCView to use for showing dialogs
property color textColor property color textColor
property color backgroundColor property color backgroundColor
property var maxHeight ///< Maximum height that should be taken, smaller than this is ok property var maxHeight ///< Maximum height that should be taken, smaller than this is ok
...@@ -57,23 +56,19 @@ Item { ...@@ -57,23 +56,19 @@ Item {
Row { Row {
id: pageRow id: pageRow
ValuesWidget { ValuesWidget {
id: valuesPage id: valuesPage
width: _pageWidth width: _pageWidth
qgcView: _root.qgcView
textColor: _root.textColor textColor: _root.textColor
maxHeight: _root.maxHeight maxHeight: _root.maxHeight
} }
CameraWidget { CameraWidget {
width: _pageWidth width: _pageWidth
qgcView: _root.qgcView
textColor: _root.textColor textColor: _root.textColor
maxHeight: _root.maxHeight maxHeight: _root.maxHeight
} }
VehicleHealthWidget { VehicleHealthWidget {
width: _pageWidth width: _pageWidth
qgcView: _root.qgcView
textColor: _root.textColor textColor: _root.textColor
maxHeight: _root.maxHeight maxHeight: _root.maxHeight
} }
......
...@@ -25,7 +25,6 @@ Rectangle { ...@@ -25,7 +25,6 @@ Rectangle {
border.width: _showLargeCompass ? 1 : 0 border.width: _showLargeCompass ? 1 : 0
border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
property var _qgcView: qgcView
property real _maxHeight: maxHeight property real _maxHeight: maxHeight
property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9) property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
property color _backgroundColor: qgcPal.window property color _backgroundColor: qgcPal.window
...@@ -148,7 +147,6 @@ Rectangle { ...@@ -148,7 +147,6 @@ Rectangle {
anchors.margins: 1 anchors.margins: 1
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
qgcView: instrumentPanel._qgcView
textColor: qgcPal.text textColor: qgcPal.text
backgroundColor: _backgroundColor backgroundColor: _backgroundColor
maxHeight: _availableValueHeight maxHeight: _availableValueHeight
......
...@@ -26,7 +26,6 @@ Rectangle { ...@@ -26,7 +26,6 @@ Rectangle {
border.width: 1 border.width: 1
border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
property var _qgcView: qgcView
property real _innerRadius: (width - (_topBottomMargin * 3)) / 4 property real _innerRadius: (width - (_topBottomMargin * 3)) / 4
property real _outerRadius: _innerRadius + _topBottomMargin property real _outerRadius: _innerRadius + _topBottomMargin
property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9) property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
...@@ -86,7 +85,6 @@ Rectangle { ...@@ -86,7 +85,6 @@ Rectangle {
anchors.margins: 1 anchors.margins: 1
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
qgcView: root._qgcView
maxHeight: _availableValueHeight maxHeight: _availableValueHeight
} }
} }
......
...@@ -37,7 +37,7 @@ Column { ...@@ -37,7 +37,7 @@ Column {
} }
function showSettings() { function showSettings() {
qgcView.showDialog(propertyPicker, qsTr("Value Widget Setup"), qgcView.showDialogDefaultWidth, StandardButton.Ok) mainWindow.showDialog(propertyPicker, qsTr("Value Widget Setup"), mainWindow.showDialogDefaultWidth, StandardButton.Ok)
} }
function listContains(list, value) { function listContains(list, value) {
......
This diff is collapsed.
...@@ -24,7 +24,6 @@ import QGroundControl.ShapeFileHelper 1.0 ...@@ -24,7 +24,6 @@ import QGroundControl.ShapeFileHelper 1.0
Item { Item {
id: _root id: _root
property var qgcView ///< QGCView for popping dialogs
property var mapControl ///< Map control to place item in property var mapControl ///< Map control to place item in
property var mapPolygon ///< QGCMapPolygon object property var mapPolygon ///< QGCMapPolygon object
property bool interactive: mapPolygon.interactive property bool interactive: mapPolygon.interactive
...@@ -173,7 +172,6 @@ Item { ...@@ -173,7 +172,6 @@ Item {
QGCFileDialog { QGCFileDialog {
id: kmlOrSHPLoadDialog id: kmlOrSHPLoadDialog
qgcView: _root.qgcView
folder: QGroundControl.settingsManager.appSettings.missionSavePath folder: QGroundControl.settingsManager.appSettings.missionSavePath
title: qsTr("Select Polygon File") title: qsTr("Select Polygon File")
selectExisting: true selectExisting: true
...@@ -237,13 +235,13 @@ Item { ...@@ -237,13 +235,13 @@ Item {
MenuItem { MenuItem {
text: qsTr("Edit position..." ) text: qsTr("Edit position..." )
visible: _circle visible: _circle
onTriggered: qgcView.showDialog(editCenterPositionDialog, qsTr("Edit Center Position"), qgcView.showDialogDefaultWidth, StandardButton.Close) onTriggered: mainWindow.showDialog(editCenterPositionDialog, qsTr("Edit Center Position"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
} }
MenuItem { MenuItem {
text: qsTr("Edit position..." ) text: qsTr("Edit position..." )
visible: !_circle && menu._editingVertexIndex >= 0 visible: !_circle && menu._editingVertexIndex >= 0
onTriggered: qgcView.showDialog(editVertexPositionDialog, qsTr("Edit Vertex Position"), qgcView.showDialogDefaultWidth, StandardButton.Close) onTriggered: mainWindow.showDialog(editVertexPositionDialog, qsTr("Edit Vertex Position"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
} }
MenuItem { MenuItem {
......
...@@ -24,7 +24,6 @@ import QGroundControl.ShapeFileHelper 1.0 ...@@ -24,7 +24,6 @@ import QGroundControl.ShapeFileHelper 1.0
Item { Item {
id: _root id: _root
property var qgcView ///< QGCView for popping dialogs
property var mapControl ///< Map control to place item in property var mapControl ///< Map control to place item in
property var mapPolyline ///< QGCMapPolyline object property var mapPolyline ///< QGCMapPolyline object
property bool interactive: mapPolyline.interactive property bool interactive: mapPolyline.interactive
...@@ -115,7 +114,6 @@ Item { ...@@ -115,7 +114,6 @@ Item {
QGCFileDialog { QGCFileDialog {
id: kmlLoadDialog id: kmlLoadDialog
qgcView: _root.qgcView
folder: QGroundControl.settingsManager.appSettings.missionSavePath folder: QGroundControl.settingsManager.appSettings.missionSavePath
title: qsTr("Select KML File") title: qsTr("Select KML File")
selectExisting: true selectExisting: true
...@@ -150,7 +148,7 @@ Item { ...@@ -150,7 +148,7 @@ Item {
MenuItem { MenuItem {
text: qsTr("Edit position..." ) text: qsTr("Edit position..." )
onTriggered: qgcView.showDialog(editPositionDialog, qsTr("Edit Position"), qgcView.showDialogDefaultWidth, StandardButton.Cancel) onTriggered: mainWindow.showDialog(editPositionDialog, qsTr("Edit Position"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel)
} }
MenuItem { MenuItem {
......
...@@ -20,7 +20,6 @@ Item { ...@@ -20,7 +20,6 @@ Item {
id: _root id: _root
property var map ///< Map control to place item in property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var _missionItem: object property var _missionItem: object
property var _entryCoordinate property var _entryCoordinate
...@@ -54,7 +53,6 @@ Item { ...@@ -54,7 +53,6 @@ Item {
} }
QGCMapPolygonVisuals { QGCMapPolygonVisuals {
qgcView: _root.qgcView
mapControl: map mapControl: map
mapPolygon: object.surveyAreaPolygon mapPolygon: object.surveyAreaPolygon
interactive: false interactive: false
...@@ -64,7 +62,6 @@ Item { ...@@ -64,7 +62,6 @@ Item {
QGCMapPolylineVisuals { QGCMapPolylineVisuals {
id: mapPolylineVisuals id: mapPolylineVisuals
qgcView: _root.qgcView
mapControl: map mapControl: map
mapPolyline: object.corridorPolyline mapPolyline: object.corridorPolyline
interactive: _missionItem.isCurrentItem interactive: _missionItem.isCurrentItem
......
...@@ -23,7 +23,6 @@ Item { ...@@ -23,7 +23,6 @@ Item {
id: _root id: _root
property var map ///< Map control to place item in property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
signal clicked(int sequenceNumber) signal clicked(int sequenceNumber)
......
...@@ -147,7 +147,7 @@ Rectangle { ...@@ -147,7 +147,7 @@ Rectangle {
MenuItem { MenuItem {
text: qsTr("Edit position...") text: qsTr("Edit position...")
visible: missionItem.specifiesCoordinate visible: missionItem.specifiesCoordinate
onTriggered: qgcView.showDialog(editPositionDialog, qsTr("Edit Position"), qgcView.showDialogDefaultWidth, StandardButton.Close) onTriggered: mainWindow.showDialog(editPositionDialog, qsTr("Edit Position"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
} }
MenuSeparator { MenuSeparator {
...@@ -165,7 +165,7 @@ Rectangle { ...@@ -165,7 +165,7 @@ Rectangle {
if (missionItem.friendlyEditAllowed) { if (missionItem.friendlyEditAllowed) {
missionItem.rawEdit = false missionItem.rawEdit = false
} else { } else {
qgcView.showMessage(qsTr("Mission Edit"), qsTr("You have made changes to the mission item which cannot be shown in Simple Mode"), StandardButton.Ok) mainWindow.showMessageDialog(qsTr("Mission Edit"), qsTr("You have made changes to the mission item which cannot be shown in Simple Mode"))
} }
} else { } else {
missionItem.rawEdit = true missionItem.rawEdit = true
...@@ -194,7 +194,7 @@ Rectangle { ...@@ -194,7 +194,7 @@ Rectangle {
} }
} }
onClicked: qgcView.showDialog(commandDialog, qsTr("Select Mission Command"), qgcView.showDialogDefaultWidth, StandardButton.Cancel) onClicked: mainWindow.showDialog(commandDialog, qsTr("Select Mission Command"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel)
} }
QGCLabel { QGCLabel {
......
...@@ -22,7 +22,6 @@ Item { ...@@ -22,7 +22,6 @@ Item {
id: _root id: _root
property var map ///< Map control to place item in property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
signal clicked(int sequenceNumber) signal clicked(int sequenceNumber)
...@@ -34,7 +33,7 @@ Item { ...@@ -34,7 +33,7 @@ Item {
if (component.status === Component.Error) { if (component.status === Component.Error) {
console.log("Error loading Qml: ", object.mapVisualQML, component.errorString()) console.log("Error loading Qml: ", object.mapVisualQML, component.errorString())
} }
_visualItem = component.createObject(map, { "map": _root.map, "qgcView": _root.qgcView }) _visualItem = component.createObject(map, { "map": _root.map })
_visualItem.clicked.connect(_root.clicked) _visualItem.clicked.connect(_root.clicked)
} }
} }
......
...@@ -30,9 +30,8 @@ import QGroundControl.Airmap 1.0 ...@@ -30,9 +30,8 @@ import QGroundControl.Airmap 1.0
/// Mission Editor /// Mission Editor
QGCView { Item {
id: _qgcView id: _root
viewPanel: panel
z: QGroundControl.zOrderTopMost z: QGroundControl.zOrderTopMost
property bool planControlColapsed: false property bool planControlColapsed: false
...@@ -59,7 +58,7 @@ QGCView { ...@@ -59,7 +58,7 @@ QGCView {
property bool _addWaypointOnClick: false property bool _addWaypointOnClick: false
property bool _addROIOnClick: false property bool _addROIOnClick: false
property bool _singleComplexItem: _missionController.complexMissionItemNames.length === 1 property bool _singleComplexItem: _missionController.complexMissionItemNames.length === 1
property real _toolbarHeight: _qgcView.height - ScreenTools.availableHeight property real _toolbarHeight: _root.height - ScreenTools.availableHeight
property int _editingLayer: _layerMission property int _editingLayer: _layerMission
property int _toolStripBottom: toolStrip.height + toolStrip.y property int _toolStripBottom: toolStrip.height + toolStrip.y
property var _appSettings: QGroundControl.settingsManager.appSettings property var _appSettings: QGroundControl.settingsManager.appSettings
...@@ -132,7 +131,7 @@ QGCView { ...@@ -132,7 +131,7 @@ QGCView {
onRawValueChanged: { onRawValueChanged: {
if (_visualItems.count > 1) { if (_visualItems.count > 1) {
_qgcView.showDialog(applyNewAltitude, qsTr("Apply new alititude"), showDialogDefaultWidth, StandardButton.Yes | StandardButton.No) mainWindow.showDialog(applyNewAltitude, qsTr("Apply new alititude"), mainWindow.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No)
} }
} }
} }
...@@ -206,7 +205,7 @@ QGCView { ...@@ -206,7 +205,7 @@ QGCView {
} }
function waitingOnDataMessage() { function waitingOnDataMessage() {
_qgcView.showMessage(qsTr("Unable to Save/Upload"), qsTr("Plan is waiting on terrain data from server for correct altitude values."), StandardButton.Ok) mainWindow.showMessageDialog(qsTr("Unable to Save/Upload"), qsTr("Plan is waiting on terrain data from server for correct altitude values."))
} }
function upload() { function upload() {
...@@ -215,7 +214,7 @@ QGCView { ...@@ -215,7 +214,7 @@ QGCView {
return return
} }
if (activeVehicle && activeVehicle.armed && activeVehicle.flightMode === activeVehicle.missionFlightMode) { if (activeVehicle && activeVehicle.armed && activeVehicle.flightMode === activeVehicle.missionFlightMode) {
_qgcView.showDialog(activeMissionUploadDialogComponent, qsTr("Plan Upload"), _qgcView.showDialogDefaultWidth, StandardButton.Cancel) mainWindow.showDialog(activeMissionUploadDialogComponent, qsTr("Plan Upload"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel)
} else { } else {
sendToVehicle() sendToVehicle()
} }
...@@ -313,7 +312,6 @@ QGCView { ...@@ -313,7 +312,6 @@ QGCView {
QGCFileDialog { QGCFileDialog {
id: fileDialog id: fileDialog
qgcView: _qgcView
folder: _appSettings.missionSavePath folder: _appSettings.missionSavePath
property bool planFiles: true ///< true: working with plan files, false: working with kml file property bool planFiles: true ///< true: working with plan files, false: working with kml file
...@@ -335,14 +333,14 @@ QGCView { ...@@ -335,14 +333,14 @@ QGCView {
} else { } else {
var retList = ShapeFileHelper.determineShapeType(file) var retList = ShapeFileHelper.determineShapeType(file)
if (retList[0] == ShapeFileHelper.Error) { if (retList[0] == ShapeFileHelper.Error) {
_qgcView.showMessage("Error", retList[1], StandardButton.Ok) mainWindow.showMessageDialog("Error", retList[1])
} else if (retList[0] == ShapeFileHelper.Polygon) { } else if (retList[0] == ShapeFileHelper.Polygon) {
var editVehicle = activeVehicle ? activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle var editVehicle = activeVehicle ? activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
if (editVehicle.fixedWing) { if (editVehicle.fixedWing) {
insertComplexMissionItemFromKMLOrSHP(_missionController.surveyComplexItemName, file, -1) insertComplexMissionItemFromKMLOrSHP(_missionController.surveyComplexItemName, file, -1)
} else { } else {
polygonSelectPatternFile = file polygonSelectPatternFile = file
_qgcView.showDialog(patternPolygonSelectDialog, fileDialog.title, _qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) mainWindow.showDialog(patternPolygonSelectDialog, fileDialog.title, mainWindow.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
} }
} else if (retList[0] == ShapeFileHelper.Polyline) { } else if (retList[0] == ShapeFileHelper.Polyline) {
insertComplexMissionItemFromKMLOrSHP(_missionController.corridorScanComplexItemName, file, -1) insertComplexMissionItemFromKMLOrSHP(_missionController.corridorScanComplexItemName, file, -1)
...@@ -434,7 +432,7 @@ QGCView { ...@@ -434,7 +432,7 @@ QGCView {
} }
} }
QGCViewPanel { Item {
id: panel id: panel
anchors.fill: parent anchors.fill: parent
...@@ -445,7 +443,6 @@ QGCView { ...@@ -445,7 +443,6 @@ QGCView {
allowGCSLocationCenter: true allowGCSLocationCenter: true
allowVehicleLocationCenter: true allowVehicleLocationCenter: true
planView: true planView: true
qgcView: _qgcView
// This is the center rectangle of the map which is not obscured by tools // This is the center rectangle of the map which is not obscured by tools
property rect centerViewport: Qt.rect(_leftToolWidth, _toolbarHeight, editorMap.width - _leftToolWidth - _rightPanelWidth, editorMap.height - _statusHeight - _toolbarHeight) property rect centerViewport: Qt.rect(_leftToolWidth, _toolbarHeight, editorMap.width - _leftToolWidth - _rightPanelWidth, editorMap.height - _statusHeight - _toolbarHeight)
...@@ -510,10 +507,8 @@ QGCView { ...@@ -510,10 +507,8 @@ QGCView {
// Add the mission item visuals to the map // Add the mission item visuals to the map
Repeater { Repeater {
model: _editingLayer == _layerMission ? _missionController.visualItems : undefined model: _editingLayer == _layerMission ? _missionController.visualItems : undefined
delegate: MissionItemMapVisual { delegate: MissionItemMapVisual {
map: editorMap map: editorMap
qgcView: _qgcView
onClicked: _missionController.setCurrentPlanViewIndex(sequenceNumber, false) onClicked: _missionController.setCurrentPlanViewIndex(sequenceNumber, false)
visible: _editingLayer == _layerMission visible: _editingLayer == _layerMission
} }
...@@ -837,7 +832,7 @@ QGCView { ...@@ -837,7 +832,7 @@ QGCView {
missionItem: object missionItem: object
width: parent.width width: parent.width
readOnly: false readOnly: false
rootQgcView: _qgcView rootQgcView: _root
onClicked: _missionController.setCurrentPlanViewIndex(object.sequenceNumber, false) onClicked: _missionController.setCurrentPlanViewIndex(object.sequenceNumber, false)
onRemove: { onRemove: {
var removeIndex = index var removeIndex = index
...@@ -1044,7 +1039,7 @@ QGCView { ...@@ -1044,7 +1039,7 @@ QGCView {
enabled: _visualItems.count > 1 enabled: _visualItems.count > 1
onClicked: { onClicked: {
dropPanel.hide() dropPanel.hide()
_qgcView.showDialog(removeAllPromptDialog, qsTr("New Plan"), _qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No) mainWindow.showDialog(removeAllPromptDialog, qsTr("New Plan"), mainWindow.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No)
} }
} }
...@@ -1055,7 +1050,7 @@ QGCView { ...@@ -1055,7 +1050,7 @@ QGCView {
onClicked: { onClicked: {
dropPanel.hide() dropPanel.hide()
if (masterController.dirty) { if (masterController.dirty) {
_qgcView.showDialog(syncLoadFromFileOverwrite, columnHolder._overwriteText, _qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel) mainWindow.showDialog(syncLoadFromFileOverwrite, columnHolder._overwriteText, mainWindow.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
} else { } else {
masterController.loadFromSelectedFile() masterController.loadFromSelectedFile()
} }
...@@ -1093,7 +1088,7 @@ QGCView { ...@@ -1093,7 +1088,7 @@ QGCView {
onClicked: { onClicked: {
// First point does not count // First point does not count
if (_visualItems.count < 2) { if (_visualItems.count < 2) {
_qgcView.showDialog(noItemForKML, qsTr("KML"), _qgcView.showDialogDefaultWidth, StandardButton.Cancel) mainWindow.showDialog(noItemForKML, qsTr("KML"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel)
return return
} }
dropPanel.hide() dropPanel.hide()
...@@ -1130,7 +1125,7 @@ QGCView { ...@@ -1130,7 +1125,7 @@ QGCView {
onClicked: { onClicked: {
dropPanel.hide() dropPanel.hide()
if (masterController.dirty) { if (masterController.dirty) {
_qgcView.showDialog(syncLoadFromVehicleOverwrite, columnHolder._overwriteText, _qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel) mainWindow.showDialog(syncLoadFromVehicleOverwrite, columnHolder._overwriteText, mainWindow.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
} else { } else {
masterController.loadFromVehicle() masterController.loadFromVehicle()
} }
...@@ -1145,7 +1140,7 @@ QGCView { ...@@ -1145,7 +1140,7 @@ QGCView {
visible: !QGroundControl.corePlugin.options.disableVehicleConnection visible: !QGroundControl.corePlugin.options.disableVehicleConnection
onClicked: { onClicked: {
dropPanel.hide() dropPanel.hide()
_qgcView.showDialog(clearVehicleMissionDialog, text, _qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel) mainWindow.showDialog(clearVehicleMissionDialog, text, mainWindow.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
} }
} }
......
...@@ -23,7 +23,6 @@ Item { ...@@ -23,7 +23,6 @@ Item {
id: _root id: _root
property var map ///< Map control to place item in property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var _missionItem: object property var _missionItem: object
property var _itemVisual property var _itemVisual
......
...@@ -23,7 +23,6 @@ Item { ...@@ -23,7 +23,6 @@ Item {
id: _root id: _root
property var map ///< Map control to place item in property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var _missionItem: object property var _missionItem: object
property var _structurePolygon: object.structurePolygon property var _structurePolygon: object.structurePolygon
...@@ -87,7 +86,6 @@ Item { ...@@ -87,7 +86,6 @@ Item {
} }
QGCMapPolygonVisuals { QGCMapPolygonVisuals {
qgcView: _root.qgcView
mapControl: map mapControl: map
mapPolygon: _structurePolygon mapPolygon: _structurePolygon
interactive: _missionItem.isCurrentItem interactive: _missionItem.isCurrentItem
...@@ -98,7 +96,6 @@ Item { ...@@ -98,7 +96,6 @@ Item {
} }
QGCMapPolygonVisuals { QGCMapPolygonVisuals {
qgcView: _root.qgcView
mapControl: map mapControl: map
mapPolygon: _flightPolygon mapPolygon: _flightPolygon
interactive: false interactive: false
......
...@@ -23,7 +23,6 @@ Item { ...@@ -23,7 +23,6 @@ Item {
id: _root id: _root
property var map ///< Map control to place item in property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var _missionItem: object property var _missionItem: object
property var _mapPolygon: object.surveyAreaPolygon property var _mapPolygon: object.surveyAreaPolygon
...@@ -90,7 +89,6 @@ Item { ...@@ -90,7 +89,6 @@ Item {
QGCMapPolygonVisuals { QGCMapPolygonVisuals {
id: mapPolygonVisuals id: mapPolygonVisuals
qgcView: _root.qgcView
mapControl: map mapControl: map
mapPolygon: _mapPolygon mapPolygon: _mapPolygon
interactive: _missionItem.isCurrentItem interactive: _missionItem.isCurrentItem
......
...@@ -152,26 +152,9 @@ static QObject* shapeFileHelperSingletonFactory(QQmlEngine*, QJSEngine*) ...@@ -152,26 +152,9 @@ static QObject* shapeFileHelperSingletonFactory(QQmlEngine*, QJSEngine*)
QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
: QGuiApplication (argc, argv) : QGuiApplication (argc, argv)
, _qmlAppEngine (nullptr)
, _runningUnitTests (unitTesting) , _runningUnitTests (unitTesting)
, _logOutput (false)
, _fakeMobile (false)
, _settingsUpgraded (false)
, _majorVersion (0)
, _minorVersion (0)
, _buildVersion (0)
, _currentVersionDownload (nullptr)
, _gpsRtkFactGroup (nullptr)
, _toolbox (nullptr)
, _bluetoothAvailable (false)
{ {
_app = this; _app = this;
// This prevents usage of QQuickWidget to fail since it doesn't support native widget siblings
#ifndef __android__
setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
#endif
// Setup for network proxy support // Setup for network proxy support
QNetworkProxyFactory::setUseSystemConfiguration(true); QNetworkProxyFactory::setUseSystemConfiguration(true);
...@@ -398,7 +381,7 @@ void QGCApplication::setLanguage() ...@@ -398,7 +381,7 @@ void QGCApplication::setLanguage()
_app->installTranslator(&_QGCTranslator); _app->installTranslator(&_QGCTranslator);
} }
void QGCApplication::_shutdown(void) void QGCApplication::_shutdown()
{ {
shutdownVideoStreaming(); shutdownVideoStreaming();
delete _toolbox; delete _toolbox;
...@@ -410,7 +393,7 @@ QGCApplication::~QGCApplication() ...@@ -410,7 +393,7 @@ QGCApplication::~QGCApplication()
_app = nullptr; _app = nullptr;
} }
void QGCApplication::_initCommon(void) void QGCApplication::_initCommon()
{ {
static const char* kRefOnly = "Reference only"; static const char* kRefOnly = "Reference only";
static const char* kQGCControllers = "QGroundControl.Controllers"; static const char* kQGCControllers = "QGroundControl.Controllers";
...@@ -479,7 +462,7 @@ void QGCApplication::_initCommon(void) ...@@ -479,7 +462,7 @@ void QGCApplication::_initCommon(void)
qmlRegisterSingletonType<ShapeFileHelper> ("QGroundControl.ShapeFileHelper", 1, 0, "ShapeFileHelper", shapeFileHelperSingletonFactory); qmlRegisterSingletonType<ShapeFileHelper> ("QGroundControl.ShapeFileHelper", 1, 0, "ShapeFileHelper", shapeFileHelperSingletonFactory);
} }
bool QGCApplication::_initForNormalAppBoot(void) bool QGCApplication::_initForNormalAppBoot()
{ {
QSettings settings; QSettings settings;
...@@ -515,7 +498,7 @@ bool QGCApplication::_initForNormalAppBoot(void) ...@@ -515,7 +498,7 @@ bool QGCApplication::_initForNormalAppBoot(void)
return true; return true;
} }
bool QGCApplication::_initForUnitTests(void) bool QGCApplication::_initForUnitTests()
{ {
return true; return true;
} }
...@@ -585,7 +568,7 @@ void QGCApplication::saveTelemetryLogOnMainThread(QString tempLogfile) ...@@ -585,7 +568,7 @@ void QGCApplication::saveTelemetryLogOnMainThread(QString tempLogfile)
QFile::remove(tempLogfile); QFile::remove(tempLogfile);
} }
void QGCApplication::checkTelemetrySavePathOnMainThread(void) void QGCApplication::checkTelemetrySavePathOnMainThread()
{ {
// This is called with an active vehicle so don't pop message boxes which holds ui thread // This is called with an active vehicle so don't pop message boxes which holds ui thread
_checkTelemetrySavePath(false /* useMessageBox */); _checkTelemetrySavePath(false /* useMessageBox */);
...@@ -661,14 +644,22 @@ void QGCApplication::showMessage(const QString& message) ...@@ -661,14 +644,22 @@ void QGCApplication::showMessage(const QString& message)
} }
} }
void QGCApplication::showSetupView(void) QQuickItem* QGCApplication::mainQmlWindow()
{
if(_mainQmlWindow) {
_mainQmlWindow = reinterpret_cast<QQuickItem*>(_rootQmlObject());
}
return _mainQmlWindow;
}
void QGCApplication::showSetupView()
{ {
if(_rootQmlObject()) { if(_rootQmlObject()) {
QMetaObject::invokeMethod(_rootQmlObject(), "showSetupView"); QMetaObject::invokeMethod(_rootQmlObject(), "showSetupView");
} }
} }
void QGCApplication::qmlAttemptWindowClose(void) void QGCApplication::qmlAttemptWindowClose()
{ {
if(_rootQmlObject()) { if(_rootQmlObject()) {
QMetaObject::invokeMethod(_rootQmlObject(), "attemptWindowClose"); QMetaObject::invokeMethod(_rootQmlObject(), "attemptWindowClose");
...@@ -680,7 +671,7 @@ bool QGCApplication::isInternetAvailable() ...@@ -680,7 +671,7 @@ bool QGCApplication::isInternetAvailable()
return getQGCMapEngine()->isInternetActive(); return getQGCMapEngine()->isInternetActive();
} }
void QGCApplication::_checkForNewVersion(void) void QGCApplication::_checkForNewVersion()
{ {
#ifndef __mobile__ #ifndef __mobile__
if (!_runningUnitTests) { if (!_runningUnitTests) {
......
...@@ -95,7 +95,8 @@ public: ...@@ -95,7 +95,8 @@ public:
static QString cachedParameterMetaDataFile(void); static QString cachedParameterMetaDataFile(void);
static QString cachedAirframeMetaDataFile(void); static QString cachedAirframeMetaDataFile(void);
void setLanguage(); void setLanguage();
QQuickItem* mainQmlWindow();
public slots: public slots:
/// You can connect to this slot to show an information message box from a different thread. /// You can connect to this slot to show an information message box from a different thread.
...@@ -107,35 +108,35 @@ public slots: ...@@ -107,35 +108,35 @@ public slots:
/// You can connect to this slot to show a critical message box from a different thread. /// You can connect to this slot to show a critical message box from a different thread.
void criticalMessageBoxOnMainThread(const QString& title, const QString& msg); void criticalMessageBoxOnMainThread(const QString& title, const QString& msg);
void showSetupView(void); void showSetupView();
void qmlAttemptWindowClose(void); void qmlAttemptWindowClose();
/// Save the specified telemetry Log /// Save the specified telemetry Log
void saveTelemetryLogOnMainThread(QString tempLogfile); void saveTelemetryLogOnMainThread(QString tempLogfile);
/// Check that the telemetry save path is set correctly /// Check that the telemetry save path is set correctly
void checkTelemetrySavePathOnMainThread(void); void checkTelemetrySavePathOnMainThread();
signals: signals:
/// This is connected to MAVLinkProtocol::checkForLostLogFiles. We signal this to ourselves to call the slot /// This is connected to MAVLinkProtocol::checkForLostLogFiles. We signal this to ourselves to call the slot
/// on the MAVLinkProtocol thread; /// on the MAVLinkProtocol thread;
void checkForLostLogFiles(void); void checkForLostLogFiles();
public: public:
// Although public, these methods are internal and should only be called by UnitTest code // Although public, these methods are internal and should only be called by UnitTest code
/// @brief Perform initialize which is common to both normal application running and unit tests. /// @brief Perform initialize which is common to both normal application running and unit tests.
/// Although public should only be called by main. /// Although public should only be called by main.
void _initCommon(void); void _initCommon();
/// @brief Initialize the application for normal application boot. Or in other words we are not going to run /// @brief Initialize the application for normal application boot. Or in other words we are not going to run
/// unit tests. Although public should only be called by main. /// unit tests. Although public should only be called by main.
bool _initForNormalAppBoot(void); bool _initForNormalAppBoot();
/// @brief Initialize the application for normal application boot. Or in other words we are not going to run /// @brief Initialize the application for normal application boot. Or in other words we are not going to run
/// unit tests. Although public should only be called by main. /// unit tests. Although public should only be called by main.
bool _initForUnitTests(void); bool _initForUnitTests();
static QGCApplication* _app; ///< Our own singleton. Should be reference directly by qgcApp static QGCApplication* _app; ///< Our own singleton. Should be reference directly by qgcApp
...@@ -143,7 +144,7 @@ public: ...@@ -143,7 +144,7 @@ public:
// Although public, these methods are internal and should only be called by UnitTest code // Although public, these methods are internal and should only be called by UnitTest code
/// Shutdown the application object /// Shutdown the application object
void _shutdown(void); void _shutdown();
bool _checkTelemetrySavePath(bool useMessageBox); bool _checkTelemetrySavePath(bool useMessageBox);
...@@ -158,32 +159,30 @@ private slots: ...@@ -158,32 +159,30 @@ private slots:
void _gpsNumSatellites(int numSatellites); void _gpsNumSatellites(int numSatellites);
private: private:
QObject* _rootQmlObject(void); QObject* _rootQmlObject ();
void _checkForNewVersion(void); void _checkForNewVersion ();
QQmlApplicationEngine* _qmlAppEngine;
bool _runningUnitTests; ///< true: running unit tests, false: normal app bool _runningUnitTests; ///< true: running unit tests, false: normal app
bool _logOutput; ///< true: Log Qt debug output to file
static const char* _darkStyleFile; static const char* _darkStyleFile;
static const char* _lightStyleFile; static const char* _lightStyleFile;
static const int _missingParamsDelayedDisplayTimerTimeout = 1000; ///< Timeout to wait for next missing fact to come in before display static const int _missingParamsDelayedDisplayTimerTimeout = 1000; ///< Timeout to wait for next missing fact to come in before display
QTimer _missingParamsDelayedDisplayTimer; ///< Timer use to delay missing fact display QTimer _missingParamsDelayedDisplayTimer; ///< Timer use to delay missing fact display
QStringList _missingParams; ///< List of missing facts to be displayed QStringList _missingParams; ///< List of missing facts to be displayed
bool _fakeMobile; ///< true: Fake ui into displaying mobile interface
bool _settingsUpgraded; ///< true: Settings format has been upgrade to new version
int _majorVersion;
int _minorVersion;
int _buildVersion;
QGCFileDownload* _currentVersionDownload;
GPSRTKFactGroup* _gpsRtkFactGroup;
QGCToolbox* _toolbox;
QTranslator _QGCTranslator;
bool _bluetoothAvailable; QQmlApplicationEngine* _qmlAppEngine = nullptr;
bool _logOutput = false; ///< true: Log Qt debug output to file
bool _fakeMobile = false; ///< true: Fake ui into displaying mobile interface
bool _settingsUpgraded = false; ///< true: Settings format has been upgrade to new version
int _majorVersion = 0;
int _minorVersion = 0;
int _buildVersion = 0;
QGCFileDownload* _currentVersionDownload = nullptr;
GPSRTKFactGroup* _gpsRtkFactGroup = nullptr;
QGCToolbox* _toolbox = nullptr;
QQuickItem* _mainQmlWindow = nullptr;
bool _bluetoothAvailable = false;
QTranslator _QGCTranslator;
static const char* _settingsVersionKey; ///< Settings key which hold settings version static const char* _settingsVersionKey; ///< Settings key which hold settings version
static const char* _deleteAllSettingsKey; ///< If this settings key is set on boot, all settings will be deleted static const char* _deleteAllSettingsKey; ///< If this settings key is set on boot, all settings will be deleted
......
...@@ -20,25 +20,18 @@ import QGroundControl.FactControls 1.0 ...@@ -20,25 +20,18 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
QGCView { Item {
id: qgcView id: _root
viewPanel: panel
property bool loaded: false property bool loaded: false
property var _qgcView: qgcView
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
Component { Component {
id: filtersDialogComponent id: filtersDialogComponent
QGCViewDialog { QGCViewDialog {
QGCFlickable { QGCFlickable {
anchors.fill: parent anchors.fill: parent
contentHeight: categoryColumn.height contentHeight: categoryColumn.height
clip: true clip: true
Column { Column {
id: categoryColumn id: categoryColumn
spacing: ScreenTools.defaultFontPixelHeight / 2 spacing: ScreenTools.defaultFontPixelHeight / 2
...@@ -55,7 +48,6 @@ QGCView { ...@@ -55,7 +48,6 @@ QGCView {
categoryRepeater.model = QGroundControl.loggingCategories() categoryRepeater.model = QGroundControl.loggingCategories()
} }
} }
Repeater { Repeater {
id: categoryRepeater id: categoryRepeater
model: QGroundControl.loggingCategories() model: QGroundControl.loggingCategories()
...@@ -71,10 +63,10 @@ QGCView { ...@@ -71,10 +63,10 @@ QGCView {
} }
} }
} }
} // QGCViewDialog }
} // Component - filtersDialogComponent }
QGCViewPanel { Item {
id: panel id: panel
anchors.fill: parent anchors.fill: parent
...@@ -136,7 +128,7 @@ QGCView { ...@@ -136,7 +128,7 @@ QGCView {
fileExtension: qsTr("txt") fileExtension: qsTr("txt")
selectExisting: false selectExisting: false
title: qsTr("Select log save file") title: qsTr("Select log save file")
qgcView: _qgcView root: _root
onAcceptedForSave: { onAcceptedForSave: {
debugMessageModel.writeMessages(file); debugMessageModel.writeMessages(file);
visible = false; visible = false;
...@@ -198,9 +190,9 @@ QGCView { ...@@ -198,9 +190,9 @@ QGCView {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
text: qsTr("Set Logging") text: qsTr("Set Logging")
onClicked: showDialog(filtersDialogComponent, qsTr("Turn on logging categories"), qgcView.showDialogDefaultWidth, StandardButton.Close) onClicked: mainWindow.showDialog(filtersDialogComponent, qsTr("Turn on logging categories"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
} }
} }
} // QGCViewPanel }
} // QGCView }
...@@ -29,14 +29,11 @@ Column { ...@@ -29,14 +29,11 @@ Column {
/// } /// }
property ListModel sliderModel property ListModel sliderModel
property var qgcViewPanel
property real _margins: ScreenTools.defaultFontPixelHeight property real _margins: ScreenTools.defaultFontPixelHeight
property bool _loadComplete: false property bool _loadComplete: false
FactPanelController { FactPanelController {
id: controller id: controller
factPanel: qgcViewPanel
} }
QGCPalette { id: palette; colorGroupEnabled: enabled } QGCPalette { id: palette; colorGroupEnabled: enabled }
...@@ -83,8 +80,8 @@ Column { ...@@ -83,8 +80,8 @@ Column {
anchors.right: parent.right anchors.right: parent.right
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
} }
} // Column }
} // Rectangle }
} // Repeater }
} // Column }
} // QGCView }
...@@ -12,7 +12,6 @@ Rectangle { ...@@ -12,7 +12,6 @@ Rectangle {
color: qgcPal.window color: qgcPal.window
radius: ScreenTools.defaultFontPixelWidth * 0.5 radius: ScreenTools.defaultFontPixelWidth * 0.5
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 maxHeight ///< Maximum height that should be taken, smaller than this is ok
property real _margins: ScreenTools.defaultFontPixelWidth / 2 property real _margins: ScreenTools.defaultFontPixelWidth / 2
...@@ -64,9 +63,7 @@ Rectangle { ...@@ -64,9 +63,7 @@ Rectangle {
Loader { Loader {
id: pageWidgetLoader id: pageWidgetLoader
source: _instrumentPages[pageCombo.currentIndex].url source: _instrumentPages[pageCombo.currentIndex].url
property real pageWidth: parent.width
property var qgcView: _root.qgcView
property real pageWidth: parent.width
} }
} }
} }
This diff is collapsed.
...@@ -37,7 +37,7 @@ QGCViewDialog { ...@@ -37,7 +37,7 @@ QGCViewDialog {
property bool _allowForceSave: QGroundControl.corePlugin.showAdvancedUI || !_editingParameter property bool _allowForceSave: QGroundControl.corePlugin.showAdvancedUI || !_editingParameter
property bool _allowDefaultReset: fact.defaultValueAvailable && (QGroundControl.corePlugin.showAdvancedUI || !_editingParameter) property bool _allowDefaultReset: fact.defaultValueAvailable && (QGroundControl.corePlugin.showAdvancedUI || !_editingParameter)
ParameterEditorController { id: controller; factPanel: parent } ParameterEditorController { id: controller; }
QGCPalette { id: qgcPal; colorGroupEnabled: true } QGCPalette { id: qgcPal; colorGroupEnabled: true }
...@@ -112,7 +112,7 @@ QGCViewDialog { ...@@ -112,7 +112,7 @@ QGCViewDialog {
} }
RowLayout { RowLayout {
spacing: defaultTextWidth spacing: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
...@@ -201,7 +201,7 @@ QGCViewDialog { ...@@ -201,7 +201,7 @@ QGCViewDialog {
} }
Row { Row {
spacing: defaultTextWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
id: minValueDisplay id: minValueDisplay
......
...@@ -14,7 +14,6 @@ Item { ...@@ -14,7 +14,6 @@ Item {
id: _root id: _root
visible: false visible: false
property var qgcView
property string folder // Due to Qt bug with file url parsing this must be an absolute path property string folder // Due to Qt bug with file url parsing this must be an absolute path
property var nameFilters property var nameFilters
property string fileExtension // Primary file extension to search for property string fileExtension // Primary file extension to search for
...@@ -44,7 +43,7 @@ Item { ...@@ -44,7 +43,7 @@ Item {
function openForLoad() { function openForLoad() {
_openForLoad = true _openForLoad = true
if (_mobileDlg && folder.length !== 0) { if (_mobileDlg && folder.length !== 0) {
qgcView.showDialog(mobileFileOpenDialog, title, qgcView.showDialogDefaultWidth, StandardButton.Cancel) mainWindow.showDialog(mobileFileOpenDialog, title, mainWindow.showDialogDefaultWidth, StandardButton.Cancel)
} else { } else {
fullFileDialog.open() fullFileDialog.open()
} }
...@@ -53,7 +52,7 @@ Item { ...@@ -53,7 +52,7 @@ Item {
function openForSave() { function openForSave() {
_openForLoad = false _openForLoad = false
if (_mobileDlg && folder.length !== 0) { if (_mobileDlg && folder.length !== 0) {
qgcView.showDialog(mobileFileSaveDialog, title, qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) mainWindow.showDialog(mobileFileSaveDialog, title, mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
} else { } else {
fullFileDialog.open() fullFileDialog.open()
} }
......
/****************************************************************************
*
* (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.
*
****************************************************************************/
/// @file
/// @author Don Gagne <don@thegagnes.com>
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
FactPanel {
id: _rootItem
property var qgcView: _rootItem ///< Used by Fact controls for validation dialogs
property bool completedSignalled: false
property var viewPanel
/// This is signalled when the top level Item reaches Component.onCompleted. This allows
/// the view subcomponent to connect to this signal and do work once the full ui is ready
/// to go.
signal completed
function _checkForEarlyDialog(title) {
if (!completedSignalled) {
console.warn(qsTr("showDialog called before QGCView.completed signalled"), title)
}
}
/// Shows a QGCViewDialog component
/// @param compoent QGCViewDialog component
/// @param title Title for dialog
/// @param charWidth Width of dialog in characters
/// @param buttons Buttons to show in dialog using StandardButton enum
readonly property int showDialogFullWidth: -1 ///< Use for full width dialog
readonly property int showDialogDefaultWidth: 40 ///< Use for default dialog width
function showDialog(component, title, charWidth, buttons) {
if (_checkForEarlyDialog(title)) {
return
}
var dialogComponent = Qt.createComponent("QGCViewDialogContainer.qml")
if (dialogComponent.status === Component.Error) {
console.log("Error loading QGCViewDialogContainer.qml: ", dialogComponent.errorString())
return
}
var dialogWidth = charWidth === showDialogFullWidth ? parent.width : ScreenTools.defaultFontPixelWidth * charWidth
var dialog = dialogComponent.createObject(_rootItem,
{
"anchors.fill": _rootItem,
"dialogWidth": dialogWidth,
"dialogTitle": title,
"dialogComponent": component,
"viewPanel": viewPanel
})
dialog.setupDialogButtons(buttons)
dialog.focus = true
viewPanel.enabled = false
}
function showMessage(title, message, buttons) {
_messageDialogText = message
showDialog(_messageDialog, title, showDialogDefaultWidth, buttons)
}
QGCPalette { id: _qgcPal; colorGroupEnabled: true }
property real defaultTextWidth: ScreenTools.defaultFontPixelWidth
property real defaultTextHeight: ScreenTools.defaultFontPixelHeight
property string _messageDialogText
function _signalCompleted() {
// When we use this control inside a QGCQmlWidgetHolder Component.onCompleted is signalled
// before the width and height are adjusted. So we need to wait for width and heigth to be
// set before we signal our own completed signal.
if (!completedSignalled && width != 0 && height != 0) {
completedSignalled = true
completed()
}
}
Component.onCompleted: _signalCompleted()
onWidthChanged: _signalCompleted()
onHeightChanged: _signalCompleted()
Component {
id: _messageDialog
QGCViewMessage {
message: _messageDialogText
}
}
}
...@@ -16,11 +16,7 @@ import QGroundControl.FactSystem 1.0 ...@@ -16,11 +16,7 @@ import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0 import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
FactPanel { Item {
property real defaultTextWidth: ScreenTools.defaultFontPixelWidth
property real defaultTextHeight: ScreenTools.defaultFontPixelHeight
QGCPalette { id: __qgcPal; colorGroupEnabled: enabled }
signal hideDialog signal hideDialog
...@@ -48,5 +44,4 @@ FactPanel { ...@@ -48,5 +44,4 @@ FactPanel {
} }
} }
color: __qgcPal.windowShadeDark
} }
...@@ -7,31 +7,24 @@ ...@@ -7,31 +7,24 @@
* *
****************************************************************************/ ****************************************************************************/
import QtQuick 2.3 import QtQuick 2.12
import QtQuick.Controls 1.2 import QtQuick.Controls 2.4
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.3
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
FocusScope { Item {
id: _root anchors.fill: parent
z: 5000
focus: true
property alias dialogWidth: _dialogPanel.width property real _defaultTextHeight: _textMeasure.contentHeight
property alias dialogTitle: titleLabel.text property real _defaultTextWidth: _textMeasure.contentWidth
property alias dialogComponent: _dialogComponentLoader.sourceComponent
property var viewPanel
property real _defaultTextHeight: _textMeasure.contentHeight function setupDialogButtons() {
property real _defaultTextWidth: _textMeasure.contentWidth
function setupDialogButtons(buttons) {
_acceptButton.visible = false _acceptButton.visible = false
_rejectButton.visible = false _rejectButton.visible = false
var buttons = mainWindowDialog.dialogButtons
// Accept role buttons // Accept role buttons
if (buttons & StandardButton.Ok) { if (buttons & StandardButton.Ok) {
_acceptButton.text = qsTr("Ok") _acceptButton.text = qsTr("Ok")
...@@ -92,89 +85,54 @@ FocusScope { ...@@ -92,89 +85,54 @@ FocusScope {
Connections { Connections {
target: _dialogComponentLoader.item target: _dialogComponentLoader.item
onHideDialog: { onHideDialog: {
viewPanel.enabled = true mainWindowDialog.close()
_root.destroy()
} }
} }
QGCPalette { id: _qgcPal; colorGroupEnabled: true }
QGCLabel { id: _textMeasure; text: "X"; visible: false } QGCLabel { id: _textMeasure; text: "X"; visible: false }
Rectangle { // This is the main dialog panel
anchors.top: parent.top Item {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: _dialogPanel.left
opacity: 0.5
color: _qgcPal.window
z: 5000
}
// This is the main dialog panel which is anchored to the right edge
Rectangle {
id: _dialogPanel id: _dialogPanel
height: ScreenTools.availableHeight ? ScreenTools.availableHeight : parent.height anchors.fill: parent
anchors.bottom: parent.bottom
anchors.right: parent.right
color: _qgcPal.windowShadeDark
Rectangle { Rectangle {
id: _header id: _header
width: parent.width width: parent.width
height: _acceptButton.visible ? _acceptButton.height : _rejectButton.height height: _acceptButton.visible ? _acceptButton.height : _rejectButton.height
color: _qgcPal.windowShade color: qgcPal.windowShade
function _hidePanel() {
_fullPanel.visible = false
}
QGCLabel { QGCLabel {
id: titleLabel id: titleLabel
x: _defaultTextWidth x: _defaultTextWidth
text: mainWindowDialog.dialogTitle
height: parent.height height: parent.height
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
QGCButton { QGCButton {
id: _rejectButton id: _rejectButton
anchors.right: _acceptButton.visible ? _acceptButton.left : parent.right anchors.right: _acceptButton.visible ? _acceptButton.left : parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
onClicked: { onClicked: {
enabled = false // prevent multiple clicks
_dialogComponentLoader.item.reject() _dialogComponentLoader.item.reject()
if (!viewPanel.enabled) { mainWindowDialog.close()
// Dialog was not closed, re-enable button
enabled = true
}
} }
} }
QGCButton { QGCButton {
id: _acceptButton id: _acceptButton
anchors.right: parent.right anchors.right: parent.right
primary: true primary: true
onClicked: { onClicked: {
enabled = false // prevent multiple clicks
_dialogComponentLoader.item.accept() _dialogComponentLoader.item.accept()
if (!viewPanel.enabled) { mainWindowDialog.close()
// Dialog was not closed, re-enable button
enabled = true
}
} }
} }
} }
Item { Item {
id: _spacer id: _spacer
width: 10 width: 10
height: 10 height: 10
anchors.top: _header.bottom anchors.top: _header.bottom
} }
Loader { Loader {
id: _dialogComponentLoader id: _dialogComponentLoader
anchors.margins: 5 anchors.margins: 5
...@@ -182,11 +140,10 @@ FocusScope { ...@@ -182,11 +140,10 @@ FocusScope {
anchors.right: parent.right anchors.right: parent.right
anchors.top: _spacer.bottom anchors.top: _spacer.bottom
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
sourceComponent: _dialogComponent sourceComponent: mainWindowDialog.dialogComponent
focus: true focus: true
property bool acceptAllowed: _acceptButton.visible property bool acceptAllowed: _acceptButton.visible
property bool rejectAllowed: _rejectButton.visible property bool rejectAllowed: _rejectButton.visible
} }
} // Rectangle - Dialog panel }
} }
/****************************************************************************
*
* (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.
*
****************************************************************************/
/// @file
/// @author Don Gagne <don@thegagnes.com>
import QtQuick 2.3
import QtQuick.Controls 1.2
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
FactPanel {
}
...@@ -59,11 +59,9 @@ QGCSlider 1.0 QGCSlider.qml ...@@ -59,11 +59,9 @@ QGCSlider 1.0 QGCSlider.qml
QGCSwitch 1.0 QGCSwitch.qml QGCSwitch 1.0 QGCSwitch.qml
QGCTextField 1.0 QGCTextField.qml QGCTextField 1.0 QGCTextField.qml
QGCToolBarButton 1.0 QGCToolBarButton.qml QGCToolBarButton 1.0 QGCToolBarButton.qml
QGCView 1.0 QGCView.qml
QGCViewDialog 1.0 QGCViewDialog.qml QGCViewDialog 1.0 QGCViewDialog.qml
QGCViewDialogContainer 1.0 QGCViewDialogContainer.qml QGCViewDialogContainer 1.0 QGCViewDialogContainer.qml
QGCViewMessage 1.0 QGCViewMessage.qml QGCViewMessage 1.0 QGCViewMessage.qml
QGCViewPanel 1.0 QGCViewPanel.qml
RallyPointEditorHeader 1.0 RallyPointEditorHeader.qml RallyPointEditorHeader 1.0 RallyPointEditorHeader.qml
RallyPointItemEditor 1.0 RallyPointItemEditor.qml RallyPointItemEditor 1.0 RallyPointItemEditor.qml
RallyPointMapVisuals 1.0 RallyPointMapVisuals.qml RallyPointMapVisuals 1.0 RallyPointMapVisuals.qml
......
...@@ -20,7 +20,7 @@ import QGroundControl.FactControls 1.0 ...@@ -20,7 +20,7 @@ import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
FactPanel { Item {
id: _root id: _root
height: monitorColumn.height height: monitorColumn.height
...@@ -30,11 +30,8 @@ FactPanel { ...@@ -30,11 +30,8 @@ FactPanel {
readonly property int _pwmMax: 2200 readonly property int _pwmMax: 2200
readonly property int _pwmRange: _pwmMax - _pwmMin readonly property int _pwmRange: _pwmMax - _pwmMin
QGCPalette { id: qgcPal; colorGroupEnabled: _root.enabled }
RCChannelMonitorController { RCChannelMonitorController {
id: controller id: controller
factPanel: _root
} }
// Live channel monitor control component // Live channel monitor control component
...@@ -62,7 +59,7 @@ FactPanel { ...@@ -62,7 +59,7 @@ FactPanel {
// Center point // Center point
Rectangle { Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: ScreenTools.defaultTextWidth / 2 width: ScreenTools.ScreenTools.defaultFontPixelWidth / 2
height: parent.height height: parent.height
color: qgcPal.window color: qgcPal.window
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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