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 @@
</qresource>
<qresource prefix="/qml">
<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/CorridorScanMapVisual.qml">src/PlanView/CorridorScanMapVisual.qml</file>
<file alias="QGroundControl/Controls/EditPositionDialog.qml">src/QmlControls/EditPositionDialog.qml</file>
......@@ -45,9 +46,7 @@
<file alias="LinkSettings.qml">src/ui/preferences/LinkSettings.qml</file>
<file alias="LogDownloadPage.qml">src/AnalyzeView/LogDownloadPage.qml</file>
<file alias="LogReplaySettings.qml">src/ui/preferences/LogReplaySettings.qml</file>
<file alias="MainWindowHybrid.qml">src/ui/MainWindowHybrid.qml</file>
<file alias="MainWindowInner.qml">src/ui/MainWindowInner.qml</file>
<file alias="MainWindowNative.qml">src/ui/MainWindowNative.qml</file>
<file alias="MainQmlWindow.qml">src/ui/MainQmlWindow.qml</file>
<file alias="MavlinkConsolePage.qml">src/AnalyzeView/MavlinkConsolePage.qml</file>
<file alias="MavlinkSettings.qml">src/ui/preferences/MavlinkSettings.qml</file>
<file alias="MissionSettingsEditor.qml">src/PlanView/MissionSettingsEditor.qml</file>
......@@ -115,11 +114,8 @@
<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/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/QGCViewDialogContainer.qml">src/QmlControls/QGCViewDialogContainer.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/RallyPointEditorHeader.qml">src/PlanView/RallyPointEditorHeader.qml</file>
<file alias="QGroundControl/Controls/RallyPointItemEditor.qml">src/PlanView/RallyPointItemEditor.qml</file>
......@@ -143,7 +139,6 @@
<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/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/FactTextFieldGrid.qml">src/FactSystem/FactControls/FactTextFieldGrid.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
import QGroundControl.ScreenTools 1.0
/// Base view control for all Analyze pages
QGCView {
id: analyePage
viewPanel: analyzePanel
Item {
anchors.fill: parent
property alias pageComponent: pageLoader.sourceComponent
property alias pageName: pageNameLabel.text
property alias pageDescription: pageDescriptionLabel.text
property real availableWidth: width - pageLoader.x
property real availableHeight: height - pageLoader.y
property real _margins: ScreenTools.defaultFontPixelHeight / 2
QGCPalette { id: qgcPal; colorGroupEnabled: analyzePanel.enabled }
QGCViewPanel {
id: analyzePanel
property real _margins: ScreenTools.defaultFontPixelHeight * 0.5
QGCFlickable {
anchors.fill: parent
QGCFlickable {
anchors.fill: parent
contentWidth: pageLoader.x + pageLoader.item.width
contentHeight: pageLoader.y + pageLoader.item.height
clip: true
Column {
id: headingColumn
width: analyzePanel.width
spacing: _margins
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
}
contentWidth: pageLoader.x + pageLoader.item.width
contentHeight: pageLoader.y + pageLoader.item.height
clip: true
Column {
id: headingColumn
width: parent.width
spacing: _margins
QGCLabel {
id: pageNameLabel
font.pointSize: ScreenTools.largeFontPointSize
visible: !ScreenTools.isShortScreen
}
Loader {
id: pageLoader
anchors.topMargin: _margins
anchors.top: headingColumn.bottom
QGCLabel {
id: pageDescriptionLabel
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
visible: !ScreenTools.isShortScreen
}
}
Loader {
id: pageLoader
anchors.topMargin: _margins
anchors.top: headingColumn.bottom
}
}
}
......@@ -40,7 +40,7 @@ AnalyzePage {
ProgressBar {
id: progressBar
width: qgcView.width -_margin * 5
width: geoTagPage.width -_margin * 5
maximumValue: 100
value: geoController.progress
}
......@@ -62,7 +62,7 @@ AnalyzePage {
// Horizontal spacer line
Rectangle {
height: 1
width: qgcView.width * 1.0
width: geoTagPage.width * 1.0
color: qgcPal.windowShadeDark
anchors.horizontalCenter: parent.horizontalCenter
}
......@@ -118,7 +118,7 @@ AnalyzePage {
// Horizontal spacer line
Rectangle {
height: 1
width: qgcView.width * 1.0
width: geoTagPage.width * 1.0
color: qgcPal.windowShadeDark
anchors.horizontalCenter: parent.horizontalCenter
}
......
......@@ -117,25 +117,21 @@ AnalyzePage {
}
}
}
Column {
spacing: _margin
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
QGCButton {
enabled: !logController.requestingList && !logController.downloadingLogs
text: qsTr("Refresh")
width: _butttonWidth
onClicked: {
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 {
logController.refresh()
}
}
}
QGCButton {
enabled: !logController.requestingList && !logController.downloadingLogs && tableView.selection.count > 0
text: qsTr("Download")
......@@ -151,54 +147,46 @@ AnalyzePage {
var o = logController.model.get(rowIndex)
if (o) o.selected = true
})
fileDialog.qgcView = logDownloadPage
fileDialog.title = qsTr("Select save directory")
fileDialog.selectExisting = true
fileDialog.folder = QGroundControl.settingsManager.appSettings.logSavePath
fileDialog.selectFolder = true
fileDialog.openForLoad()
}
QGCFileDialog {
id: fileDialog
onAcceptedForLoad: {
logController.download(file)
close()
}
}
}
QGCButton {
enabled: !logController.requestingList && !logController.downloadingLogs && logController.model.count > 0
text: qsTr("Erase All")
width: _butttonWidth
onClicked: logDownloadPage.showDialog(eraseAllMessage,
qsTr("Delete All Log Files"),
logDownloadPage.showDialogDefaultWidth,
StandardButton.Yes | StandardButton.No)
onClicked: mainWindow.showDialog(
eraseAllMessage,
qsTr("Delete All Log Files"),
mainWindow.showDialogDefaultWidth,
StandardButton.Yes | StandardButton.No)
Component {
id: eraseAllMessage
QGCViewMessage {
message: qsTr("All log files will be erased permanently. Is this really what you want?")
function accept() {
hideDialog()
logController.eraseAll()
}
}
}
}
QGCButton {
text: qsTr("Cancel")
width: _butttonWidth
enabled: logController.requestingList || logController.downloadingLogs
onClicked: logController.cancel()
}
} // Column - Buttons
} // RowLayout
} // Component
} // AnalyzePage
}
}
}
}
......@@ -33,7 +33,6 @@ SetupPage {
APMAirframeComponentController {
id: controller
factPanel: airframePage.viewPanel
}
ExclusiveGroup {
......
......@@ -7,19 +7,16 @@ import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
APMAirframeComponentController {
id: controller
factPanel: panel
}
property bool _frameAvailable: controller.parameterExists(-1, "FRAME")
property Fact _frame: controller.getParameterFact(-1, "FRAME", false)
property Fact _frameClass: controller.getParameterFact(-1, "FRAME_CLASS", false)
property Fact _frameType: controller.getParameterFact(-1, "FRAME_TYPE", false)
......
......@@ -28,7 +28,7 @@ SetupPage {
spacing: _margins
width: availableWidth
FactPanelController { id: controller; factPanel: cameraPage.viewPanel }
FactPanelController { id: controller; }
QGCPalette { id: palette; colorGroupEnabled: true }
......
import QtQuick 2.3
import QtQuick.Controls 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact _mountRCInTilt: controller.getParameterFact(-1, "MNT_RC_IN_TILT")
property Fact _mountRCInRoll: controller.getParameterFact(-1, "MNT_RC_IN_ROLL")
......
......@@ -31,7 +31,7 @@ SetupPage {
spacing: _margins
width: availableWidth
FactPanelController { id: controller; factPanel: cameraPage.viewPanel }
FactPanelController { id: controller; }
QGCPalette { id: palette; colorGroupEnabled: true }
......
......@@ -37,7 +37,6 @@ SetupPage {
APMFlightModesComponentController {
id: controller
factPanel: flightModePage.viewPanel
}
Component {
......
......@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property var _vehicle: controller.vehicle
......
......@@ -30,7 +30,7 @@ SetupPage {
width: availableWidth
spacing: _margins
FactPanelController { id: controller; factPanel: safetyPage.viewPanel }
FactPanelController { id: controller; }
QGCPalette { id: ggcPal; colorGroupEnabled: true }
......
......@@ -29,7 +29,7 @@ SetupPage {
spacing: _margins
width: availableWidth
FactPanelController { id: controller; factPanel: lightsPage.viewPanel }
FactPanelController { id: controller; }
QGCPalette { id: palette; colorGroupEnabled: true }
......
......@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact _rc5Function: controller.getParameterFact(-1, "r.SERVO5_FUNCTION")
property Fact _rc6Function: controller.getParameterFact(-1, "r.SERVO6_FUNCTION")
......
......@@ -25,7 +25,6 @@ SetupPage {
FactPanelController {
id: controller
factPanel: powerPage.viewPanel
}
Component {
......@@ -388,7 +387,7 @@ SetupPage {
onClicked: {
_calcVoltageDlgVehicleVoltage = vehicleVoltage
_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 {
onClicked: {
_calcAmpsPerVoltDlgVehicleCurrent = vehicleCurrent
_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
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact _batt1Monitor: controller.getParameterFact(-1, "BATT_MONITOR")
property Fact _batt2Monitor: controller.getParameterFact(-1, "BATT2_MONITOR", false /* reportMissing */)
property bool _batt2MonitorAvailable: controller.parameterExists(-1, "BATT2_MONITOR")
property bool _batt1MonitorEnabled: _batt1Monitor.rawValue !== 0
property bool _batt2MonitorEnabled: _batt2MonitorAvailable && _batt2Monitor.rawValue !== 0
property Fact _battCapacity: controller.getParameterFact(-1, "BATT_CAPACITY", false /* reportMissing */)
property Fact _batt2Capacity: controller.getParameterFact(-1, "BATT2_CAPACITY", false /* reportMissing */)
property bool _battCapacityAvailable: controller.parameterExists(-1, "BATT_CAPACITY")
......
......@@ -6,13 +6,12 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact mapRollFact: controller.getParameterFact(-1, "RCMAP_ROLL")
property Fact mapPitchFact: controller.getParameterFact(-1, "RCMAP_PITCH")
......
......@@ -30,7 +30,7 @@ SetupPage {
width: availableWidth
spacing: _margins
FactPanelController { id: controller; factPanel: safetyPage.viewPanel }
FactPanelController { id: controller; }
QGCPalette { id: ggcPal; colorGroupEnabled: true }
......
......@@ -31,7 +31,7 @@ SetupPage {
width: availableWidth
spacing: _margins
FactPanelController { id: controller; factPanel: safetyPage.viewPanel }
FactPanelController { id: controller; }
QGCPalette { id: ggcPal; colorGroupEnabled: true }
......
......@@ -6,14 +6,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact _copterFenceAction: controller.getParameterFact(-1, "FENCE_ACTION", false /* reportMissing */)
property Fact _copterFenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE", false /* reportMissing */)
......
......@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact _failsafeThrEnable: controller.getParameterFact(-1, "FS_THR_ENABLE")
......
......@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact _failsafeBattMah: controller.getParameterFact(-1, "FS_BATT_MAH")
property Fact _failsafeBattVoltage: controller.getParameterFact(-1, "FS_BATT_VOLTAGE")
......
......@@ -15,13 +15,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact _failsafeThrEnable: controller.getParameterFact(-1, "FS_THR_ENABLE")
property Fact _failsafeThrValue: controller.getParameterFact(-1, "FS_THR_VALUE")
......
......@@ -7,16 +7,13 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
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; factPanel: panel }
FactPanelController { id: controller; }
// Enable/Action parameters
property Fact _failsafeBatteryEnable: controller.getParameterFact(-1, "r.BATT_FS_LOW_ACT")
......
......@@ -108,7 +108,7 @@ SetupPage {
break
}
showDialog(orientationsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, buttons)
mainWindow.showDialog(orientationsDialogComponent, dialogTitle, mainWindow.showDialogDefaultWidth, buttons)
}
APMSensorParams {
......@@ -118,7 +118,6 @@ SetupPage {
APMSensorsComponentController {
id: controller
factPanel: sensorsPage.viewPanel
statusLog: statusTextArea
progressBar: progressBar
nextButton: nextButton
......@@ -131,20 +130,20 @@ SetupPage {
onWaitingForCancelChanged: {
if (controller.waitingForCancel) {
showDialog(waitForCancelDialogComponent, qsTr("Calibration Cancel"), qgcView.showDialogDefaultWidth, 0)
mainWindow.showDialog(waitForCancelDialogComponent, qsTr("Calibration Cancel"), mainWindow.showDialogDefaultWidth, 0)
}
}
onCalibrationComplete: {
switch (calType) {
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
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
case APMSensorsComponentController.CalTypeOnboardCompass:
showDialog(postOnboardCompassCalibrationComponent, qsTr("Calibration complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok)
mainWindow.showDialog(postOnboardCompassCalibrationComponent, qsTr("Calibration complete"), mainWindow.showDialogDefaultWidth, StandardButton.Ok)
break
}
}
......@@ -158,7 +157,7 @@ SetupPage {
var usingUDP = controller.usingUDPLink()
var isSub = QGroundControl.multiVehicleManager.activeVehicle.sub;
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 {
onClicked: {
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 {
showOrientationsDialog(_calTypeCompass)
}
......@@ -571,9 +570,9 @@ SetupPage {
onClicked: {
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 {
showDialog(levelHorizonDialogComponent, _levelHorizonText, qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
mainWindow.showDialog(levelHorizonDialogComponent, _levelHorizonText, mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
}
}
}
......@@ -581,7 +580,7 @@ SetupPage {
QGCButton {
width: _buttonWidth
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")
}
......@@ -591,7 +590,7 @@ SetupPage {
text: qsTr("CompassMot")
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 {
......
......@@ -13,14 +13,11 @@ import QGroundControl.ArduPilot 1.0
IMPORTANT NOTE: Any changes made here must also be made to SensorsComponentSummary.qml
*/
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
APMSensorsComponentController { id: controller; factPanel: panel }
APMSensorsComponentController { id: controller; }
APMSensorParams {
id: sensorParams
......
......@@ -27,7 +27,7 @@ SetupPage {
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _oldFW: _activeVehicle.versionCompare(3 ,5 ,2) < 0
APMAirframeComponentController { id: controller; factPanel: subFramePage.viewPanel }
APMAirframeComponentController { id: controller; }
Component {
id: subFramePageComponent
......@@ -115,7 +115,7 @@ SetupPage {
id: defaultsButton
anchors.left: parent.left
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
import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact frameFact: controller.getParameterFact(-1, "FRAME_CONFIG")
......
......@@ -30,7 +30,6 @@ SetupPage {
FactPanelController {
id: controller
factPanel: motorPage.viewPanel
}
function setMotorDirection(num, reversed) {
......
......@@ -28,8 +28,6 @@ SetupPage {
width: availableWidth
spacing: _margins
FactPanelController { id: controller; factPanel: tuningPage.viewPanel }
QGCPalette { id: palette; colorGroupEnabled: true }
property bool _rcFeelAvailable: controller.parameterExists(-1, "RC_FEEL")
......
......@@ -28,7 +28,7 @@ SetupPage {
width: availableWidth
spacing: _margins
FactPanelController { id: controller; factPanel: tuningPage.viewPanel }
FactPanelController { id: controller; }
QGCPalette { id: palette; colorGroupEnabled: true }
......
......@@ -21,11 +21,7 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
QGCView {
id: qgcView
viewPanel: panel
QGCPalette { id: palette; colorGroupEnabled: panel.enabled }
Item {
property real _margins: ScreenTools.defaultFontPixelHeight
property real _middleRowWidth: ScreenTools.defaultFontPixelWidth * 18
......@@ -40,8 +36,7 @@ QGCView {
property bool stResetCounters:false
ESP8266ComponentController {
id: controller
factPanel: panel
id: controller
}
Timer {
......@@ -103,7 +98,7 @@ QGCView {
property Fact hostPort: controller.getParameterFact(controller.componentID, "WIFI_UDP_HPORT")
property Fact clientPort: controller.getParameterFact(controller.componentID, "WIFI_UDP_CPORT")
QGCViewPanel {
Item {
id: panel
anchors.fill: parent
......@@ -122,7 +117,7 @@ QGCView {
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
color: palette.windowShade
color: qgcPal.windowShade
width: statusLayout.width + _margins * 4
height: settingsRow.height + _margins * 2
Row {
......@@ -130,7 +125,7 @@ QGCView {
spacing: _margins * 4
anchors.centerIn: parent
QGCColoredImage {
color: palette.text
color: qgcPal.text
width: ScreenTools.defaultFontPixelWidth * 12
height: width * 1.45
sourceSize.height: width * 1.45
......@@ -283,7 +278,7 @@ QGCView {
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
color: palette.windowShade
color: qgcPal.windowShade
width: statusLayout.width + _margins * 4
height: statusLayout.height + _margins * 2
GridLayout {
......
......@@ -7,17 +7,14 @@ import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controllers 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
ESP8266ComponentController {
id: esp8266
factPanel: panel
}
property Fact debugEnabled: controller.getParameterFact(esp8266.componentID, "DEBUG_ENABLED")
......
......@@ -26,7 +26,6 @@ SetupPage {
FactPanelController {
id: controller
factPanel: motorPage.viewPanel
}
Component {
......
......@@ -31,8 +31,7 @@ SetupPage {
width: availableWidth
height: Math.max(leftColumn.height, rightColumn.height)
readonly property string dialogTitle: qsTr("Radio")
readonly property real labelToMonitorMargin: defaultTextWidth * 3
readonly property string dialogTitle: qsTr("Radio")
property bool controllerCompleted: false
property bool controllerAndViewReady: false
......@@ -53,7 +52,6 @@ SetupPage {
RadioComponentController {
id: controller
factPanel: radioPage.viewPanel
statusText: statusText
cancelButton: cancelButton
nextButton: nextButton
......@@ -61,16 +59,14 @@ SetupPage {
Component.onCompleted: {
controllerCompleted = true
if (qgcView.completedSignalled) {
controllerAndViewReady = true
controller.start()
updateChannelCount()
}
controllerAndViewReady = true
controller.start()
updateChannelCount()
}
onChannelCountChanged: updateChannelCount()
onFunctionMappingChangedAPMReboot: showMessage(qsTr("Reboot required"), qsTr("Your stick mappings have changed, you must reboot the vehicle for correct operation."), StandardButton.Ok)
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)
onFunctionMappingChangedAPMReboot: mainWindow.showMessageDialog(qsTr("Reboot required"), qsTr("Your stick mappings have changed, you must reboot the vehicle for correct operation."))
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 {
......@@ -248,11 +244,11 @@ SetupPage {
id: rollLoader
anchors.left: rollLabel.right
anchors.right: parent.right
height: radioPage.defaultTextHeight
height: defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: radioPage.defaultTextWidth
property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.rollChannelMapped
property bool reversed: controller.rollChannelReversed
}
......@@ -278,11 +274,11 @@ SetupPage {
id: pitchLoader
anchors.left: pitchLabel.right
anchors.right: parent.right
height: radioPage.defaultTextHeight
height: defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: radioPage.defaultTextWidth
property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.pitchChannelMapped
property bool reversed: controller.pitchChannelReversed
}
......@@ -308,11 +304,11 @@ SetupPage {
id: yawLoader
anchors.left: yawLabel.right
anchors.right: parent.right
height: radioPage.defaultTextHeight
height: defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: radioPage.defaultTextWidth
property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.yawChannelMapped
property bool reversed: controller.yawChannelReversed
}
......@@ -338,11 +334,11 @@ SetupPage {
id: throttleLoader
anchors.left: throttleLabel.right
anchors.right: parent.right
height: radioPage.defaultTextHeight
height: defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: radioPage.defaultTextWidth
property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.throttleChannelMapped
property bool reversed: controller.throttleChannelReversed
}
......@@ -377,7 +373,7 @@ SetupPage {
onClicked: {
if (text === qsTr("Calibrate")) {
showDialog(zeroTrimsDialogComponent, dialogTitle, radioPage.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
mainWindow.showDialog(zeroTrimsDialogComponent, dialogTitle, mainWindow.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
} else {
controller.nextButtonClicked()
}
......@@ -437,12 +433,12 @@ SetupPage {
QGCButton {
id: bindButton
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 {
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
......@@ -495,6 +491,6 @@ SetupPage {
twoColumn: true
}
} // Column - Right Column
} // Item
} // Item
} // Component - pageComponent
} // SetupPage
......@@ -21,9 +21,8 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
/// Base view control for all Setup pages
QGCView {
Item {
id: setupView
viewPanel: setupPanel
enabled: !_disableDueToArmed && !_disableDueToFlying
property alias pageComponent: pageLoader.sourceComponent
......@@ -42,69 +41,59 @@ QGCView {
// 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 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
property string _pageTitle: qsTr("%1 Setup").arg(pageName)
QGCPalette { id: qgcPal; colorGroupEnabled: setupPanel.enabled }
QGCViewPanel {
id: setupPanel
QGCFlickable {
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 {
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
Column {
spacing: _margins
layoutDirection: Qt.RightToLeft
Layout.fillWidth: true
QGCCheckBox {
id: advancedCheckBox
text: qsTr("Advanced")
visible: showAdvanced
QGCLabel {
font.pointSize: ScreenTools.largeFontPointSize
text: !setupView.enabled ? _pageTitle + "<font color=\"red\">" + qsTr(" (Disabled while the vehicle is %1)").arg(_disableReason) + "</font>" : _pageTitle
visible: !ScreenTools.isShortScreen
}
Column {
spacing: _margins
Layout.fillWidth: true
QGCLabel {
font.pointSize: ScreenTools.largeFontPointSize
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
}
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
text: pageDescription
visible: pageDescription !== "" && !ScreenTools.isShortScreen
}
}
Loader {
id: pageLoader
anchors.topMargin: _margins
anchors.top: headingRow.bottom
}
// Overlay to display when vehicle is armed and this setup page needs
// to be disabled
Rectangle {
visible: !setupView.enabled
anchors.fill: pageLoader
color: "black"
opacity: 0.5
}
}
Loader {
id: pageLoader
anchors.topMargin: _margins
anchors.top: headingRow.bottom
}
// Overlay to display when vehicle is armed and this setup page needs
// to be disabled
Rectangle {
visible: !setupView.enabled
anchors.fill: pageLoader
color: "black"
opacity: 0.5
}
}
}
......@@ -37,7 +37,6 @@ SetupPage {
SyslinkComponentController {
id: controller
factPanel: syslinkPage.viewPanel
}
QGCLabel {
......
......@@ -63,11 +63,9 @@ SetupPage {
AirframeComponentController {
id: controller
factPanel: airframePage.viewPanel
Component.onCompleted: {
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.")
anchors.right: parent.right
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
import QGroundControl.Controllers 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
AirframeComponentController { id: controller; factPanel: panel }
AirframeComponentController { id: controller; }
property Fact sysIdFact: controller.getParameterFact(-1, "MAV_SYS_ID")
property Fact sysAutoStartFact: controller.getParameterFact(-1, "SYS_AUTOSTART")
......
......@@ -31,7 +31,7 @@ SetupPage {
width: Math.max(availableWidth, innerColumn.width)
height: innerColumn.height
FactPanelController { id: controller; factPanel: cameraPage.viewPanel }
FactPanelController { id: controller; }
property real _margins: ScreenTools.defaultFontPixelHeight
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 25
......
......@@ -6,13 +6,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact _camTriggerMode: controller.getParameterFact(-1, "TRIG_MODE", false)
property Fact _camTriggerInterface: controller.getParameterFact(-1, "TRIG_INTERFACE", false)
......
......@@ -7,13 +7,10 @@ import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact _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
Item {
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
// User visible strings
......@@ -93,8 +89,6 @@ Item {
PX4AdvancedFlightModesController {
id: controller
factPanel: qgcViewPanel
onModeRowsChanged: recalcModePositions()
}
......
......@@ -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
/// based on current parameter settings.
SetupPage {
id: flightModesPage
pageComponent: pageComponent
Component {
id: pageComponent
Loader {
width: availableWidth
height: availableHeight
......@@ -43,11 +40,7 @@ SetupPage {
FactPanelController {
id: controller
factPanel: flightModesPage.viewPanel
}
property var qgcView: flightModesPage
property var qgcViewPanel: flightModesPage.viewPanel
}
}
}
......@@ -6,13 +6,10 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact mapRollFact: controller.getParameterFact(-1, "RC_MAP_ROLL")
property Fact mapPitchFact: controller.getParameterFact(-1, "RC_MAP_PITCH")
......
......@@ -21,10 +21,6 @@ import QGroundControl.ScreenTools 1.0
Item {
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 var _switchNameList: [ "ACRO", "ARM", "GEAR", "KILL", "LOITER", "OFFB", "POSCTL", "RATT", "RETURN", "STAB" ]
property var _switchFactList: [ ]
......@@ -53,7 +49,6 @@ Item {
PX4SimpleFlightModesController {
id: controller
factPanel: qgcViewPanel
}
QGCFlickable {
......@@ -207,6 +202,6 @@ Item {
controller.getParameterFact(-1, "RC_MAP_FLTMODE").value = 0
}
}
} // Column
} // QGCFlickable
} // QGCView
}
}
}
......@@ -34,13 +34,11 @@ SetupPage {
FactPanelController {
id: controller
factPanel: tuningPage.viewPanel
}
// Standard tuning page
FactSliderPanel {
width: availableWidth
qgcViewPanel: tuningPage.viewPanel
visible: !advanced
sliderModel: ListModel {
......
......@@ -34,15 +34,12 @@ SetupPage {
FactPanelController {
id: controller
factPanel: tuningPage.viewPanel
}
// Standard tuning page
FactSliderPanel {
width: availableWidth
qgcViewPanel: tuningPage.viewPanel
visible: !advanced
sliderModel: ListModel {
ListElement {
title: qsTr("Cruise throttle")
......@@ -55,7 +52,6 @@ SetupPage {
}
}
Loader {
anchors.left: parent.left
anchors.right: parent.right
......
......@@ -22,8 +22,6 @@ SetupPage {
FactSliderPanel {
width: availableWidth
qgcViewPanel: tuningPage.viewPanel
sliderModel: ListModel {
ListElement {
......
......@@ -88,15 +88,13 @@ SetupPage {
PowerComponentController {
id: controller
factPanel: powerPage.viewPanel
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)
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)
onBatteryConnected: showMessage(qsTr("ESC Calibration"), qsTr("Performing calibration. This will take a few seconds.."), 0)
onCalibrationFailed: showMessage(qsTr("ESC Calibration failed"), errorMessage, StandardButton.Ok)
onCalibrationSuccess: showMessage(qsTr("ESC Calibration"), qsTr("Calibration complete. You can disconnect your battery now if you like."), StandardButton.Ok)
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)
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))
onBatteryConnected: mainWindow.showMessageDialog(qsTr("ESC Calibration"), qsTr("Performing calibration. This will take a few seconds.."))
onCalibrationFailed: mainWindow.showMessageDialog(qsTr("ESC Calibration failed"), errorMessage)
onCalibrationSuccess: mainWindow.showMessageDialog(qsTr("ESC Calibration"), qsTr("Calibration complete. You can disconnect your battery now if you like."))
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."))
onDisconnectBattery: mainWindow.showMessageDialog(qsTr("ESC Calibration failed"), qsTr("You must disconnect the battery prior to performing ESC Calibration. Disconnect your battery and try again."))
}
Component {
......@@ -302,7 +300,7 @@ SetupPage {
QGCButton {
id: voltMultCalculateButton
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 }
......@@ -330,7 +328,7 @@ SetupPage {
QGCButton {
id: ampPerVoltCalculateButton
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 }
......
......@@ -20,13 +20,11 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact batVChargedFact: controller.getParameterFact(-1, "BAT_V_CHARGED")
property Fact batVEmptyFact: controller.getParameterFact(-1, "BAT_V_EMPTY")
......
......@@ -23,7 +23,6 @@ import QGroundControl.ScreenTools 1.0
SetupPage {
id: safetyPage
pageComponent: pageComponent
Component {
id: pageComponent
......@@ -33,7 +32,6 @@ SetupPage {
FactPanelController {
id: controller
factPanel: safetyPage.viewPanel
}
readonly property string hitlParam: "SYS_HITL"
......
......@@ -6,13 +6,10 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact returnAltFact: controller.getParameterFact(-1, "RTL_RETURN_ALT")
property Fact _descendAltFact: controller.getParameterFact(-1, "RTL_DESCEND_ALT")
......
......@@ -13,16 +13,12 @@ import QGroundControl.Controls 1.0
import QGroundControl.PX4 1.0
SetupPage {
id: sensorsPage
pageComponent: pageComponent
Component {
id: pageComponent
SensorsSetup {
width: availableWidth
height: availableHeight
qgcView: sensorsPage
}
} // Component
} // SetupPage
}
}
......@@ -11,13 +11,10 @@ import QGroundControl.Palette 1.0
IMPORTANT NOTE: Any changes made here must also be made to SensorsComponentSummary.qml
*/
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact mag0IdFact: controller.getParameterFact(-1, "CAL_MAG0_ID")
property Fact mag1IdFact: controller.getParameterFact(-1, "CAL_MAG1_ID")
......
......@@ -10,13 +10,11 @@ import QGroundControl.Palette 1.0
IMPORTANT NOTE: Any changes made here must also be made to SensorsComponentSummary.qml
*/
FactPanel {
id: panel
Item {
anchors.fill: parent
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
property Fact mag0IdFact: controller.getParameterFact(-1, "CAL_MAG0_ID")
property Fact gyro0IdFact: controller.getParameterFact(-1, "CAL_GYRO0_ID")
......
......@@ -25,7 +25,6 @@ import QGroundControl.Controllers 1.0
Item {
id: _root
property var qgcView ///< QGCView must be passed in
property bool showSensorCalibrationCompass: true ///< true: Show this calibration button
property bool showSensorCalibrationGyro: true ///< true: Show this calibration button
property bool showSensorCalibrationAccel: true ///< true: Show this calibration button
......@@ -117,7 +116,6 @@ Item {
SensorsComponentController {
id: controller
factPanel: _root.qgcView.viewPanel
statusLog: statusTextArea
progressBar: progressBar
compassButton: compassButton
......@@ -133,12 +131,12 @@ Item {
onMagCalComplete: {
setOrientationsDialogShowBoardOrientation = false
showDialog(setOrientationsDialogComponent, qsTr("Compass Calibration Complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok)
mainWindow.showDialog(setOrientationsDialogComponent, qsTr("Compass Calibration Complete"), mainWindow.showDialogDefaultWidth, StandardButton.Ok)
}
onWaitingForCancelChanged: {
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 {
Component.onCompleted: {
var usingUDP = controller.usingUDPLink()
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 {
onClicked: {
preCalibrationDialogType = "compass"
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 {
onClicked: {
preCalibrationDialogType = "gyro"
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 {
onClicked: {
preCalibrationDialogType = "accel"
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 {
onClicked: {
preCalibrationDialogType = "level"
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 {
onClicked: {
preCalibrationDialogType = "airspeed"
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 {
onClicked: {
setOrientationsDialogShowBoardOrientation = true
showDialog(setOrientationsDialogComponent, qsTr("Set Orientations"), qgcView.showDialogDefaultWidth, StandardButton.Ok)
mainWindow.showDialog(setOrientationsDialogComponent, qsTr("Set Orientations"), mainWindow.showDialogDefaultWidth, StandardButton.Ok)
}
}
} // 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 @@
QGC_LOGGING_CATEGORY(FactPanelControllerLog, "FactPanelControllerLog")
FactPanelController::FactPanelController(bool standaloneUnitTesting)
: _vehicle(NULL)
, _uas(NULL)
, _autopilot(NULL)
, _factPanel(NULL)
FactPanelController::FactPanelController()
{
_vehicle = qgcApp()->toolbox()->multiVehicleManager()->activeVehicle();
if (_vehicle) {
_uas = _vehicle->uas();
_autopilot = _vehicle->autopilotPlugin();
} else {
_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)
{
if (_factPanel) {
if (qgcApp()->mainQmlWindow()) {
QVariant returnedValue;
QMetaObject::invokeMethod(_factPanel,
"showMissingParameterOverlay",
Q_RETURN_ARG(QVariant, returnedValue),
Q_ARG(QVariant, missingParam));
QMetaObject::invokeMethod(
qgcApp()->mainQmlWindow(),
"showMissingParameterOverlay",
Q_RETURN_ARG(QVariant, returnedValue),
Q_ARG(QVariant, missingParam));
}
}
void FactPanelController::_notifyPanelErrorMsg(const QString& errorMsg)
{
if (_factPanel) {
if(qgcApp()->mainQmlWindow()) {
QVariant returnedValue;
QMetaObject::invokeMethod(_factPanel,
"showError",
Q_RETURN_ARG(QVariant, returnedValue),
Q_ARG(QVariant, errorMsg));
QMetaObject::invokeMethod(
qgcApp()->mainQmlWindow(),
"showFactError",
Q_RETURN_ARG(QVariant, returnedValue),
Q_ARG(QVariant, errorMsg));
}
}
......@@ -94,7 +67,7 @@ void FactPanelController::_reportMissingParameter(int componentId, const QString
// 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
// send out for real.
if (_factPanel) {
if (qgcApp()->mainQmlWindow()) {
_notifyPanelMissingParameter(missingParam);
} else {
_delayedMissingParams += missingParam;
......@@ -115,12 +88,6 @@ bool FactPanelController::_allParametersExists(int componentId, QStringList name
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)
{
......@@ -132,7 +99,7 @@ Fact* FactPanelController::getParameterFact(int componentId, const QString& name
if (reportMissing) {
_reportMissingParameter(componentId, name);
}
return NULL;
return nullptr;
}
}
......
......@@ -8,8 +8,7 @@
****************************************************************************/
#ifndef FactPanelController_H
#define FactPanelController_H
#pragma once
/// @file
/// @author Don Gagne <don@thegagnes.com>
......@@ -23,47 +22,35 @@
Q_DECLARE_LOGGING_CATEGORY(FactPanelControllerLog)
/// FactPanelController is used in combination with the FactPanel Qml control for handling
/// missing Facts from C++ code.
/// FactPanelController is used for handling missing Facts from C++ code.
class FactPanelController : public QObject
{
Q_OBJECT
public:
/// @param standaloneUnitTesting true: being run without factPanel, false: normal operation, factPanel is required
FactPanelController(bool standaloneUnitTesting = false);
FactPanelController();
Q_PROPERTY(QQuickItem* factPanel READ factPanel WRITE setFactPanel)
Q_PROPERTY(Vehicle* vehicle MEMBER _vehicle CONSTANT)
Q_INVOKABLE Fact* getParameterFact (int componentId, const QString& name, bool reportMissing = true);
Q_INVOKABLE bool parameterExists (int componentId, const QString& name);
QQuickItem* factPanel(void);
void setFactPanel(QQuickItem* panel);
protected:
/// Checks for existence of the specified parameters
/// @return true: all parameters exists, false: parameters missing and reported
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);
Vehicle* _vehicle;
UASInterface* _uas;
AutoPilotPlugin* _autopilot;
private slots:
void _checkForMissingFactPanel(void);
Vehicle* _vehicle = nullptr;
UASInterface* _uas = nullptr;
AutoPilotPlugin* _autopilot = nullptr;
private:
void _notifyPanelMissingParameter(const QString& missingParam);
void _notifyPanelErrorMsg(const QString& errorMsg);
void _showInternalError(const QString& errorMsg);
QQuickItem* _factPanel;
QStringList _delayedMissingParams;
QStringList _delayedMissingParams;
};
#endif
......@@ -27,28 +27,20 @@ QGCTextField {
Qt.ImhFormattedNumbersOnly // Forces use of virtual numeric keyboard
onEditingFinished: {
if (typeof qgcView !== 'undefined' && qgcView) {
var errorString = fact.validate(text, false /* convertOnly */)
if (errorString === "") {
fact.value = text
_textField.updated()
} else {
_validateString = text
qgcView.showDialog(validationErrorDialogComponent, qsTr("Invalid Value"), qgcView.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
}
} else {
var errorString = fact.validate(text, false /* convertOnly */)
if (errorString === "") {
fact.value = text
fact.valueChanged(fact.value)
_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 {
id: validationErrorDialogComponent
ParameterEditorDialog {
validate: true
validateValue: _validateString
......@@ -58,7 +50,6 @@ QGCTextField {
Component {
id: helpDialogComponent
ParameterEditorDialog {
fact: _textField.fact
}
......
......@@ -97,7 +97,7 @@ Rectangle {
onClicked: {
valueListView.focus = true
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 {
_currentIndex = index
valueListView.positionViewAtIndex(_currentIndex, ListView.Center)
......
......@@ -5,7 +5,6 @@ FactBitmask 1.0 FactBitmask.qml
FactCheckBox 1.0 FactCheckBox.qml
FactComboBox 1.0 FactComboBox.qml
FactLabel 1.0 FactLabel.qml
FactPanel 1.0 FactPanel.qml
FactTextField 1.0 FactTextField.qml
FactTextFieldGrid 1.0 FactTextFieldGrid.qml
FactTextFieldRow 1.0 FactTextFieldRow.qml
......
......@@ -13,10 +13,9 @@ import QtQuick.Controls 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
FactPanel {
id: panel
Item {
FactPanelController { id: controller; factPanel: panel }
FactPanelController { id: controller; }
// Use default component id
TextInput {
......
......@@ -30,11 +30,7 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
/// Flight Display View
QGCView {
id: root
viewPanel: _panel
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
Item {
PlanMasterController {
id: planMasterController
......@@ -111,11 +107,6 @@ QGCView {
return true;
}
PlanMasterController {
id: masterController
Component.onCompleted: start(true /* flyView */)
}
BuiltInPreFlightCheckModel {
id: preFlightCheckModel
}
......@@ -149,7 +140,7 @@ QGCView {
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
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
......@@ -297,7 +288,7 @@ QGCView {
QGCMapPalette { id: mapPal; lightColors: _mainIsMap ? _flightMap.isSatelliteMap : true }
QGCViewPanel {
Item {
id: _panel
anchors.fill: parent
......@@ -334,7 +325,6 @@ QGCView {
guidedActionsController: _guidedController
flightWidgets: flightDisplayViewWidgets
rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9
qgcView: root
multiVehicleView: !singleVehicleView.checked
scaleState: (_mainIsMap && flyViewOverlay.item) ? (flyViewOverlay.item.scaleState ? flyViewOverlay.item.scaleState : "bottomMode") : "bottomMode"
}
......@@ -507,7 +497,6 @@ QGCView {
anchors.left: parent.left
anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right
anchors.bottom: parent.bottom
qgcView: root
useLightColors: isBackgroundDark
missionController: _missionController
visible: singleVehicleView.checked && !QGroundControl.videoManager.fullScreen
......@@ -523,8 +512,6 @@ QGCView {
anchors.left: parent.left
anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right
anchors.bottom: parent.bottom
property var qgcView: root
}
MultiVehicleList {
......
......@@ -38,7 +38,6 @@ FlightMap {
property var guidedActionsController
property var flightWidgets
property var rightPanelWidth
property var qgcView ///< QGCView control which contains this map
property var multiVehicleView ///< true: multi-vehicle view, false: single vehicle view
property rect centerViewport: Qt.rect(0, 0, width, height)
......
......@@ -27,7 +27,6 @@ import QGroundControl.Airmap 1.0
Item {
id: widgetRoot
property var qgcView
property bool useLightColors
property var missionController
property bool showValues: !QGroundControl.airspaceManager.airspaceVisible
......@@ -173,7 +172,6 @@ Item {
Loader {
id: instrumentsLoader
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
states: [
State {
......
......@@ -58,7 +58,7 @@ Rectangle {
Layout.minimumWidth: _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 {
id: actionRow
......
......@@ -35,14 +35,13 @@ Map {
property string mapName: 'defaultMap'
property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1
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 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 firstGCSPositionReceived: false ///< true: first gcs 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 var qgcView
readonly property real maxZoomLevel: 20
......@@ -66,13 +65,11 @@ Map {
}
function centerToSpecifiedLocation() {
qgcView.showDialog(specifyMapPositionDialog, qsTr("Specify Position"), qgcView.showDialogDefaultWidth, StandardButton.Close)
mainWindow.showDialog(specifyMapPositionDialog, qsTr("Specify Position"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
}
Component {
id: specifyMapPositionDialog
EditPositionDialog {
coordinate: center
onCoordinateChanged: center = coordinate
......
......@@ -48,7 +48,7 @@ Column {
property int _curCameraIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0
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
......
......@@ -11,7 +11,6 @@ Item {
clip: true
height: column.height
property var qgcView ///< QGCView to use for showing dialogs
property color textColor
property color backgroundColor
property var maxHeight ///< Maximum height that should be taken, smaller than this is ok
......@@ -57,23 +56,19 @@ Item {
Row {
id: pageRow
ValuesWidget {
id: valuesPage
width: _pageWidth
qgcView: _root.qgcView
textColor: _root.textColor
maxHeight: _root.maxHeight
}
CameraWidget {
width: _pageWidth
qgcView: _root.qgcView
textColor: _root.textColor
maxHeight: _root.maxHeight
}
VehicleHealthWidget {
width: _pageWidth
qgcView: _root.qgcView
textColor: _root.textColor
maxHeight: _root.maxHeight
}
......
......@@ -25,7 +25,6 @@ Rectangle {
border.width: _showLargeCompass ? 1 : 0
border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
property var _qgcView: qgcView
property real _maxHeight: maxHeight
property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
property color _backgroundColor: qgcPal.window
......@@ -148,7 +147,6 @@ Rectangle {
anchors.margins: 1
anchors.left: parent.left
anchors.right: parent.right
qgcView: instrumentPanel._qgcView
textColor: qgcPal.text
backgroundColor: _backgroundColor
maxHeight: _availableValueHeight
......
......@@ -26,7 +26,6 @@ Rectangle {
border.width: 1
border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
property var _qgcView: qgcView
property real _innerRadius: (width - (_topBottomMargin * 3)) / 4
property real _outerRadius: _innerRadius + _topBottomMargin
property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
......@@ -86,7 +85,6 @@ Rectangle {
anchors.margins: 1
anchors.left: parent.left
anchors.right: parent.right
qgcView: root._qgcView
maxHeight: _availableValueHeight
}
}
......
......@@ -37,7 +37,7 @@ Column {
}
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) {
......
This diff is collapsed.
......@@ -24,7 +24,6 @@ import QGroundControl.ShapeFileHelper 1.0
Item {
id: _root
property var qgcView ///< QGCView for popping dialogs
property var mapControl ///< Map control to place item in
property var mapPolygon ///< QGCMapPolygon object
property bool interactive: mapPolygon.interactive
......@@ -173,7 +172,6 @@ Item {
QGCFileDialog {
id: kmlOrSHPLoadDialog
qgcView: _root.qgcView
folder: QGroundControl.settingsManager.appSettings.missionSavePath
title: qsTr("Select Polygon File")
selectExisting: true
......@@ -237,13 +235,13 @@ Item {
MenuItem {
text: qsTr("Edit position..." )
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 {
text: qsTr("Edit position..." )
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 {
......
......@@ -24,7 +24,6 @@ import QGroundControl.ShapeFileHelper 1.0
Item {
id: _root
property var qgcView ///< QGCView for popping dialogs
property var mapControl ///< Map control to place item in
property var mapPolyline ///< QGCMapPolyline object
property bool interactive: mapPolyline.interactive
......@@ -115,7 +114,6 @@ Item {
QGCFileDialog {
id: kmlLoadDialog
qgcView: _root.qgcView
folder: QGroundControl.settingsManager.appSettings.missionSavePath
title: qsTr("Select KML File")
selectExisting: true
......@@ -150,7 +148,7 @@ Item {
MenuItem {
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 {
......
......@@ -20,7 +20,6 @@ Item {
id: _root
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var _missionItem: object
property var _entryCoordinate
......@@ -54,7 +53,6 @@ Item {
}
QGCMapPolygonVisuals {
qgcView: _root.qgcView
mapControl: map
mapPolygon: object.surveyAreaPolygon
interactive: false
......@@ -64,7 +62,6 @@ Item {
QGCMapPolylineVisuals {
id: mapPolylineVisuals
qgcView: _root.qgcView
mapControl: map
mapPolyline: object.corridorPolyline
interactive: _missionItem.isCurrentItem
......
......@@ -23,7 +23,6 @@ Item {
id: _root
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
signal clicked(int sequenceNumber)
......
......@@ -147,7 +147,7 @@ Rectangle {
MenuItem {
text: qsTr("Edit position...")
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 {
......@@ -165,7 +165,7 @@ Rectangle {
if (missionItem.friendlyEditAllowed) {
missionItem.rawEdit = false
} 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 {
missionItem.rawEdit = true
......@@ -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 {
......
......@@ -22,7 +22,6 @@ Item {
id: _root
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
signal clicked(int sequenceNumber)
......@@ -34,7 +33,7 @@ Item {
if (component.status === Component.Error) {
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)
}
}
......
......@@ -30,9 +30,8 @@ import QGroundControl.Airmap 1.0
/// Mission Editor
QGCView {
id: _qgcView
viewPanel: panel
Item {
id: _root
z: QGroundControl.zOrderTopMost
property bool planControlColapsed: false
......@@ -59,7 +58,7 @@ QGCView {
property bool _addWaypointOnClick: false
property bool _addROIOnClick: false
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 _toolStripBottom: toolStrip.height + toolStrip.y
property var _appSettings: QGroundControl.settingsManager.appSettings
......@@ -132,7 +131,7 @@ QGCView {
onRawValueChanged: {
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 {
}
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() {
......@@ -215,7 +214,7 @@ QGCView {
return
}
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 {
sendToVehicle()
}
......@@ -313,7 +312,6 @@ QGCView {
QGCFileDialog {
id: fileDialog
qgcView: _qgcView
folder: _appSettings.missionSavePath
property bool planFiles: true ///< true: working with plan files, false: working with kml file
......@@ -335,14 +333,14 @@ QGCView {
} else {
var retList = ShapeFileHelper.determineShapeType(file)
if (retList[0] == ShapeFileHelper.Error) {
_qgcView.showMessage("Error", retList[1], StandardButton.Ok)
mainWindow.showMessageDialog("Error", retList[1])
} else if (retList[0] == ShapeFileHelper.Polygon) {
var editVehicle = activeVehicle ? activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
if (editVehicle.fixedWing) {
insertComplexMissionItemFromKMLOrSHP(_missionController.surveyComplexItemName, file, -1)
} else {
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) {
insertComplexMissionItemFromKMLOrSHP(_missionController.corridorScanComplexItemName, file, -1)
......@@ -434,7 +432,7 @@ QGCView {
}
}
QGCViewPanel {
Item {
id: panel
anchors.fill: parent
......@@ -445,7 +443,6 @@ QGCView {
allowGCSLocationCenter: true
allowVehicleLocationCenter: true
planView: true
qgcView: _qgcView
// 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)
......@@ -510,10 +507,8 @@ QGCView {
// Add the mission item visuals to the map
Repeater {
model: _editingLayer == _layerMission ? _missionController.visualItems : undefined
delegate: MissionItemMapVisual {
map: editorMap
qgcView: _qgcView
onClicked: _missionController.setCurrentPlanViewIndex(sequenceNumber, false)
visible: _editingLayer == _layerMission
}
......@@ -837,7 +832,7 @@ QGCView {
missionItem: object
width: parent.width
readOnly: false
rootQgcView: _qgcView
rootQgcView: _root
onClicked: _missionController.setCurrentPlanViewIndex(object.sequenceNumber, false)
onRemove: {
var removeIndex = index
......@@ -1044,7 +1039,7 @@ QGCView {
enabled: _visualItems.count > 1
onClicked: {
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 {
onClicked: {
dropPanel.hide()
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 {
masterController.loadFromSelectedFile()
}
......@@ -1093,7 +1088,7 @@ QGCView {
onClicked: {
// First point does not count
if (_visualItems.count < 2) {
_qgcView.showDialog(noItemForKML, qsTr("KML"), _qgcView.showDialogDefaultWidth, StandardButton.Cancel)
mainWindow.showDialog(noItemForKML, qsTr("KML"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel)
return
}
dropPanel.hide()
......@@ -1130,7 +1125,7 @@ QGCView {
onClicked: {
dropPanel.hide()
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 {
masterController.loadFromVehicle()
}
......@@ -1145,7 +1140,7 @@ QGCView {
visible: !QGroundControl.corePlugin.options.disableVehicleConnection
onClicked: {
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 {
id: _root
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var _missionItem: object
property var _itemVisual
......
......@@ -23,7 +23,6 @@ Item {
id: _root
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var _missionItem: object
property var _structurePolygon: object.structurePolygon
......@@ -87,7 +86,6 @@ Item {
}
QGCMapPolygonVisuals {
qgcView: _root.qgcView
mapControl: map
mapPolygon: _structurePolygon
interactive: _missionItem.isCurrentItem
......@@ -98,7 +96,6 @@ Item {
}
QGCMapPolygonVisuals {
qgcView: _root.qgcView
mapControl: map
mapPolygon: _flightPolygon
interactive: false
......
......@@ -23,7 +23,6 @@ Item {
id: _root
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
property var _missionItem: object
property var _mapPolygon: object.surveyAreaPolygon
......@@ -90,7 +89,6 @@ Item {
QGCMapPolygonVisuals {
id: mapPolygonVisuals
qgcView: _root.qgcView
mapControl: map
mapPolygon: _mapPolygon
interactive: _missionItem.isCurrentItem
......
......@@ -152,26 +152,9 @@ static QObject* shapeFileHelperSingletonFactory(QQmlEngine*, QJSEngine*)
QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
: QGuiApplication (argc, argv)
, _qmlAppEngine (nullptr)
, _runningUnitTests (unitTesting)
, _logOutput (false)
, _fakeMobile (false)
, _settingsUpgraded (false)
, _majorVersion (0)
, _minorVersion (0)
, _buildVersion (0)
, _currentVersionDownload (nullptr)
, _gpsRtkFactGroup (nullptr)
, _toolbox (nullptr)
, _bluetoothAvailable (false)
{
_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
QNetworkProxyFactory::setUseSystemConfiguration(true);
......@@ -398,7 +381,7 @@ void QGCApplication::setLanguage()
_app->installTranslator(&_QGCTranslator);
}
void QGCApplication::_shutdown(void)
void QGCApplication::_shutdown()
{
shutdownVideoStreaming();
delete _toolbox;
......@@ -410,7 +393,7 @@ QGCApplication::~QGCApplication()
_app = nullptr;
}
void QGCApplication::_initCommon(void)
void QGCApplication::_initCommon()
{
static const char* kRefOnly = "Reference only";
static const char* kQGCControllers = "QGroundControl.Controllers";
......@@ -479,7 +462,7 @@ void QGCApplication::_initCommon(void)
qmlRegisterSingletonType<ShapeFileHelper> ("QGroundControl.ShapeFileHelper", 1, 0, "ShapeFileHelper", shapeFileHelperSingletonFactory);
}
bool QGCApplication::_initForNormalAppBoot(void)
bool QGCApplication::_initForNormalAppBoot()
{
QSettings settings;
......@@ -515,7 +498,7 @@ bool QGCApplication::_initForNormalAppBoot(void)
return true;
}
bool QGCApplication::_initForUnitTests(void)
bool QGCApplication::_initForUnitTests()
{
return true;
}
......@@ -585,7 +568,7 @@ void QGCApplication::saveTelemetryLogOnMainThread(QString 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
_checkTelemetrySavePath(false /* useMessageBox */);
......@@ -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()) {
QMetaObject::invokeMethod(_rootQmlObject(), "showSetupView");
}
}
void QGCApplication::qmlAttemptWindowClose(void)
void QGCApplication::qmlAttemptWindowClose()
{
if(_rootQmlObject()) {
QMetaObject::invokeMethod(_rootQmlObject(), "attemptWindowClose");
......@@ -680,7 +671,7 @@ bool QGCApplication::isInternetAvailable()
return getQGCMapEngine()->isInternetActive();
}
void QGCApplication::_checkForNewVersion(void)
void QGCApplication::_checkForNewVersion()
{
#ifndef __mobile__
if (!_runningUnitTests) {
......
......@@ -95,7 +95,8 @@ public:
static QString cachedParameterMetaDataFile(void);
static QString cachedAirframeMetaDataFile(void);
void setLanguage();
void setLanguage();
QQuickItem* mainQmlWindow();
public slots:
/// You can connect to this slot to show an information message box from a different thread.
......@@ -107,35 +108,35 @@ public slots:
/// 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 showSetupView(void);
void showSetupView();
void qmlAttemptWindowClose(void);
void qmlAttemptWindowClose();
/// Save the specified telemetry Log
void saveTelemetryLogOnMainThread(QString tempLogfile);
/// Check that the telemetry save path is set correctly
void checkTelemetrySavePathOnMainThread(void);
void checkTelemetrySavePathOnMainThread();
signals:
/// This is connected to MAVLinkProtocol::checkForLostLogFiles. We signal this to ourselves to call the slot
/// on the MAVLinkProtocol thread;
void checkForLostLogFiles(void);
void checkForLostLogFiles();
public:
// 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.
/// 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
/// 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
/// 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
......@@ -143,7 +144,7 @@ public:
// Although public, these methods are internal and should only be called by UnitTest code
/// Shutdown the application object
void _shutdown(void);
void _shutdown();
bool _checkTelemetrySavePath(bool useMessageBox);
......@@ -158,32 +159,30 @@ private slots:
void _gpsNumSatellites(int numSatellites);
private:
QObject* _rootQmlObject(void);
void _checkForNewVersion(void);
QObject* _rootQmlObject ();
void _checkForNewVersion ();
QQmlApplicationEngine* _qmlAppEngine;
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* _lightStyleFile;
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
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* _deleteAllSettingsKey; ///< If this settings key is set on boot, all settings will be deleted
......
......@@ -20,25 +20,18 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
id: qgcView
viewPanel: panel
Item {
id: _root
property bool loaded: false
property var _qgcView: qgcView
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
Component {
id: filtersDialogComponent
QGCViewDialog {
QGCFlickable {
anchors.fill: parent
contentHeight: categoryColumn.height
clip: true
Column {
id: categoryColumn
spacing: ScreenTools.defaultFontPixelHeight / 2
......@@ -55,7 +48,6 @@ QGCView {
categoryRepeater.model = QGroundControl.loggingCategories()
}
}
Repeater {
id: categoryRepeater
model: QGroundControl.loggingCategories()
......@@ -71,10 +63,10 @@ QGCView {
}
}
}
} // QGCViewDialog
} // Component - filtersDialogComponent
}
}
QGCViewPanel {
Item {
id: panel
anchors.fill: parent
......@@ -136,7 +128,7 @@ QGCView {
fileExtension: qsTr("txt")
selectExisting: false
title: qsTr("Select log save file")
qgcView: _qgcView
root: _root
onAcceptedForSave: {
debugMessageModel.writeMessages(file);
visible = false;
......@@ -198,9 +190,9 @@ QGCView {
anchors.bottom: parent.bottom
anchors.right: parent.right
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 {
/// }
property ListModel sliderModel
property var qgcViewPanel
property real _margins: ScreenTools.defaultFontPixelHeight
property bool _loadComplete: false
FactPanelController {
id: controller
factPanel: qgcViewPanel
id: controller
}
QGCPalette { id: palette; colorGroupEnabled: enabled }
......@@ -83,8 +80,8 @@ Column {
anchors.right: parent.right
wrapMode: Text.WordWrap
}
} // Column
} // Rectangle
} // Repeater
} // Column
} // QGCView
}
}
}
}
}
......@@ -12,7 +12,6 @@ Rectangle {
color: qgcPal.window
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 _margins: ScreenTools.defaultFontPixelWidth / 2
......@@ -64,9 +63,7 @@ Rectangle {
Loader {
id: pageWidgetLoader
source: _instrumentPages[pageCombo.currentIndex].url
property var qgcView: _root.qgcView
property real pageWidth: parent.width
property real pageWidth: parent.width
}
}
}
This diff is collapsed.
......@@ -37,7 +37,7 @@ QGCViewDialog {
property bool _allowForceSave: 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 }
......@@ -112,7 +112,7 @@ QGCViewDialog {
}
RowLayout {
spacing: defaultTextWidth
spacing: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.right: parent.right
......@@ -201,7 +201,7 @@ QGCViewDialog {
}
Row {
spacing: defaultTextWidth
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
id: minValueDisplay
......
......@@ -14,7 +14,6 @@ Item {
id: _root
visible: false
property var qgcView
property string folder // Due to Qt bug with file url parsing this must be an absolute path
property var nameFilters
property string fileExtension // Primary file extension to search for
......@@ -44,7 +43,7 @@ Item {
function openForLoad() {
_openForLoad = true
if (_mobileDlg && folder.length !== 0) {
qgcView.showDialog(mobileFileOpenDialog, title, qgcView.showDialogDefaultWidth, StandardButton.Cancel)
mainWindow.showDialog(mobileFileOpenDialog, title, mainWindow.showDialogDefaultWidth, StandardButton.Cancel)
} else {
fullFileDialog.open()
}
......@@ -53,7 +52,7 @@ Item {
function openForSave() {
_openForLoad = false
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 {
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
import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0
FactPanel {
property real defaultTextWidth: ScreenTools.defaultFontPixelWidth
property real defaultTextHeight: ScreenTools.defaultFontPixelHeight
QGCPalette { id: __qgcPal; colorGroupEnabled: enabled }
Item {
signal hideDialog
......@@ -48,5 +44,4 @@ FactPanel {
}
}
color: __qgcPal.windowShadeDark
}
......@@ -7,31 +7,24 @@
*
****************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import QtQuick 2.12
import QtQuick.Controls 2.4
import QtQuick.Dialogs 1.3
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
FocusScope {
id: _root
z: 5000
focus: true
Item {
anchors.fill: parent
property alias dialogWidth: _dialogPanel.width
property alias dialogTitle: titleLabel.text
property alias dialogComponent: _dialogComponentLoader.sourceComponent
property var viewPanel
property real _defaultTextHeight: _textMeasure.contentHeight
property real _defaultTextWidth: _textMeasure.contentWidth
property real _defaultTextHeight: _textMeasure.contentHeight
property real _defaultTextWidth: _textMeasure.contentWidth
function setupDialogButtons(buttons) {
function setupDialogButtons() {
_acceptButton.visible = false
_rejectButton.visible = false
var buttons = mainWindowDialog.dialogButtons
// Accept role buttons
if (buttons & StandardButton.Ok) {
_acceptButton.text = qsTr("Ok")
......@@ -92,89 +85,54 @@ FocusScope {
Connections {
target: _dialogComponentLoader.item
onHideDialog: {
viewPanel.enabled = true
_root.destroy()
mainWindowDialog.close()
}
}
QGCPalette { id: _qgcPal; colorGroupEnabled: true }
QGCLabel { id: _textMeasure; text: "X"; visible: false }
Rectangle {
anchors.top: parent.top
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 {
// This is the main dialog panel
Item {
id: _dialogPanel
height: ScreenTools.availableHeight ? ScreenTools.availableHeight : parent.height
anchors.bottom: parent.bottom
anchors.right: parent.right
color: _qgcPal.windowShadeDark
anchors.fill: parent
Rectangle {
id: _header
width: parent.width
height: _acceptButton.visible ? _acceptButton.height : _rejectButton.height
color: _qgcPal.windowShade
function _hidePanel() {
_fullPanel.visible = false
}
color: qgcPal.windowShade
QGCLabel {
id: titleLabel
x: _defaultTextWidth
text: mainWindowDialog.dialogTitle
height: parent.height
verticalAlignment: Text.AlignVCenter
}
QGCButton {
id: _rejectButton
anchors.right: _acceptButton.visible ? _acceptButton.left : parent.right
anchors.bottom: parent.bottom
onClicked: {
enabled = false // prevent multiple clicks
_dialogComponentLoader.item.reject()
if (!viewPanel.enabled) {
// Dialog was not closed, re-enable button
enabled = true
}
mainWindowDialog.close()
}
}
QGCButton {
id: _acceptButton
anchors.right: parent.right
primary: true
onClicked: {
enabled = false // prevent multiple clicks
_dialogComponentLoader.item.accept()
if (!viewPanel.enabled) {
// Dialog was not closed, re-enable button
enabled = true
}
mainWindowDialog.close()
}
}
}
Item {
id: _spacer
width: 10
height: 10
anchors.top: _header.bottom
}
Loader {
id: _dialogComponentLoader
anchors.margins: 5
......@@ -182,11 +140,10 @@ FocusScope {
anchors.right: parent.right
anchors.top: _spacer.bottom
anchors.bottom: parent.bottom
sourceComponent: _dialogComponent
sourceComponent: mainWindowDialog.dialogComponent
focus: true
property bool acceptAllowed: _acceptButton.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
QGCSwitch 1.0 QGCSwitch.qml
QGCTextField 1.0 QGCTextField.qml
QGCToolBarButton 1.0 QGCToolBarButton.qml
QGCView 1.0 QGCView.qml
QGCViewDialog 1.0 QGCViewDialog.qml
QGCViewDialogContainer 1.0 QGCViewDialogContainer.qml
QGCViewMessage 1.0 QGCViewMessage.qml
QGCViewPanel 1.0 QGCViewPanel.qml
RallyPointEditorHeader 1.0 RallyPointEditorHeader.qml
RallyPointItemEditor 1.0 RallyPointItemEditor.qml
RallyPointMapVisuals 1.0 RallyPointMapVisuals.qml
......
......@@ -20,7 +20,7 @@ import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
FactPanel {
Item {
id: _root
height: monitorColumn.height
......@@ -30,11 +30,8 @@ FactPanel {
readonly property int _pwmMax: 2200
readonly property int _pwmRange: _pwmMax - _pwmMin
QGCPalette { id: qgcPal; colorGroupEnabled: _root.enabled }
RCChannelMonitorController {
id: controller
factPanel: _root
}
// Live channel monitor control component
......@@ -62,7 +59,7 @@ FactPanel {
// Center point
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: ScreenTools.defaultTextWidth / 2
width: ScreenTools.ScreenTools.defaultFontPixelWidth / 2
height: parent.height
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