diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 17444051b79e23d88c609ed755ffe2ceac4d5551..80fbe5984068ce64b5dbc6ba94508e31219aa8a3 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -18,6 +18,7 @@ src/PlanView/CorridorScanEditor.qml + src/QmlControls/QGCViewDialogContainer.qml src/PlanView/CameraCalc.qml src/PlanView/CorridorScanMapVisual.qml src/QmlControls/EditPositionDialog.qml @@ -45,9 +46,7 @@ src/ui/preferences/LinkSettings.qml src/AnalyzeView/LogDownloadPage.qml src/ui/preferences/LogReplaySettings.qml - src/ui/MainWindowHybrid.qml - src/ui/MainWindowInner.qml - src/ui/MainWindowNative.qml + src/ui/MainQmlWindow.qml src/AnalyzeView/MavlinkConsolePage.qml src/ui/preferences/MavlinkSettings.qml src/PlanView/MissionSettingsEditor.qml @@ -115,11 +114,8 @@ src/QmlControls/QGCSwitch.qml src/QmlControls/QGCTextField.qml src/QmlControls/QGCToolBarButton.qml - src/QmlControls/QGCView.qml src/QmlControls/QGCViewDialog.qml - src/QmlControls/QGCViewDialogContainer.qml src/QmlControls/QGCViewMessage.qml - src/QmlControls/QGCViewPanel.qml src/QmlControls/QGroundControl.Controls.qmldir src/PlanView/RallyPointEditorHeader.qml src/PlanView/RallyPointItemEditor.qml @@ -143,7 +139,6 @@ src/FactSystem/FactControls/FactCheckBox.qml src/FactSystem/FactControls/FactComboBox.qml src/FactSystem/FactControls/FactLabel.qml - src/FactSystem/FactControls/FactPanel.qml src/FactSystem/FactControls/FactTextField.qml src/FactSystem/FactControls/FactTextFieldGrid.qml src/FactSystem/FactControls/FactTextFieldRow.qml diff --git a/src/Airmap/AirmapSettings.qml b/src/Airmap/AirmapSettings.qml index eda38ccaefee581439f6c309b3b64d24d4216a8b..377bfd80532629ddc8758a7e5796a525e5a46c9b 100644 --- a/src/Airmap/AirmapSettings.qml +++ b/src/Airmap/AirmapSettings.qml @@ -30,9 +30,8 @@ import QGroundControl.Palette 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.SettingsManager 1.0 -QGCView { - id: _qgcView - viewPanel: panel +Item { + id: _root color: qgcPal.window anchors.fill: parent anchors.margins: ScreenTools.defaultFontPixelWidth @@ -40,354 +39,348 @@ QGCView { property real _labelWidth: ScreenTools.defaultFontPixelWidth * 20 property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 20 property real _buttonWidth: ScreenTools.defaultFontPixelWidth * 18 - property real _panelWidth: _qgcView.width * _internalWidthRatio + property real _panelWidth: _root.width * _internalWidthRatio property Fact _enableAirMapFact: QGroundControl.settingsManager.airMapSettings.enableAirMap property bool _airMapEnabled: _enableAirMapFact.rawValue property var _authStatus: QGroundControl.airspaceManager.authStatus readonly property real _internalWidthRatio: 0.8 - QGCPalette { id: qgcPal } - - QGCViewPanel { - id: panel - anchors.fill: parent - QGCFlickable { - clip: true - anchors.fill: parent - contentHeight: settingsColumn.height - contentWidth: settingsColumn.width - Column { - id: settingsColumn - width: _qgcView.width - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - anchors.margins: ScreenTools.defaultFontPixelWidth - //----------------------------------------------------------------- - //-- General - Item { - width: _panelWidth - height: generalLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - id: generalLabel - text: qsTr("General") - font.family: ScreenTools.demiboldFontFamily - } + QGCFlickable { + clip: true + anchors.fill: parent + contentHeight: settingsColumn.height + contentWidth: settingsColumn.width + Column { + id: settingsColumn + width: _root.width + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.margins: ScreenTools.defaultFontPixelWidth + //----------------------------------------------------------------- + //-- General + Item { + width: _panelWidth + height: generalLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + QGCLabel { + id: generalLabel + text: qsTr("General") + font.family: ScreenTools.demiboldFontFamily } - Rectangle { - height: generalRow.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - Row { - id: generalRow - spacing: ScreenTools.defaultFontPixelWidth * 4 - anchors.centerIn: parent - Column { - spacing: ScreenTools.defaultFontPixelWidth - FactCheckBox { - text: qsTr("Enable AirMap Services") - fact: _enableAirMapFact - visible: _enableAirMapFact.visible - } - FactCheckBox { - text: qsTr("Enable Telemetry") - fact: _enableTelemetryFact - visible: _enableTelemetryFact.visible - enabled: _airMapEnabled - property Fact _enableTelemetryFact: QGroundControl.settingsManager.airMapSettings.enableTelemetry - } - FactCheckBox { - text: qsTr("Show Airspace on Map (Experimental)") - fact: _enableAirspaceFact - visible: _enableAirspaceFact.visible - enabled: _airMapEnabled - property Fact _enableAirspaceFact: QGroundControl.settingsManager.airMapSettings.enableAirspace - } + } + Rectangle { + height: generalRow.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + Row { + id: generalRow + spacing: ScreenTools.defaultFontPixelWidth * 4 + anchors.centerIn: parent + Column { + spacing: ScreenTools.defaultFontPixelWidth + FactCheckBox { + text: qsTr("Enable AirMap Services") + fact: _enableAirMapFact + visible: _enableAirMapFact.visible } - QGCButton { - text: qsTr("Clear Saved Answers") - enabled: _enableAirMapFact.rawValue - onClicked: clearDialog.open() - anchors.verticalCenter: parent.verticalCenter - MessageDialog { - id: clearDialog - visible: false - icon: StandardIcon.Warning - standardButtons: StandardButton.Yes | StandardButton.No - title: qsTr("Clear Saved Answers") - text: qsTr("All saved ruleset answers will be cleared. Is this really what you want?") - onYes: { - QGroundControl.airspaceManager.ruleSets.clearAllFeatures() - clearDialog.close() - } - onNo: { - clearDialog.close() - } + FactCheckBox { + text: qsTr("Enable Telemetry") + fact: _enableTelemetryFact + visible: _enableTelemetryFact.visible + enabled: _airMapEnabled + property Fact _enableTelemetryFact: QGroundControl.settingsManager.airMapSettings.enableTelemetry + } + FactCheckBox { + text: qsTr("Show Airspace on Map (Experimental)") + fact: _enableAirspaceFact + visible: _enableAirspaceFact.visible + enabled: _airMapEnabled + property Fact _enableAirspaceFact: QGroundControl.settingsManager.airMapSettings.enableAirspace + } + } + QGCButton { + text: qsTr("Clear Saved Answers") + enabled: _enableAirMapFact.rawValue + onClicked: clearDialog.open() + anchors.verticalCenter: parent.verticalCenter + MessageDialog { + id: clearDialog + visible: false + icon: StandardIcon.Warning + standardButtons: StandardButton.Yes | StandardButton.No + title: qsTr("Clear Saved Answers") + text: qsTr("All saved ruleset answers will be cleared. Is this really what you want?") + onYes: { + QGroundControl.airspaceManager.ruleSets.clearAllFeatures() + clearDialog.close() + } + onNo: { + clearDialog.close() } } } } - //----------------------------------------------------------------- - //-- Connection Status - Item { - width: _panelWidth - height: statusLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: QGroundControl.settingsManager.appSettings.visible && _airMapEnabled - QGCLabel { - id: statusLabel - text: qsTr("Connection Status") - font.family: ScreenTools.demiboldFontFamily - } + } + //----------------------------------------------------------------- + //-- Connection Status + Item { + width: _panelWidth + height: statusLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: QGroundControl.settingsManager.appSettings.visible && _airMapEnabled + QGCLabel { + id: statusLabel + text: qsTr("Connection Status") + font.family: ScreenTools.demiboldFontFamily } - Rectangle { - height: statusCol.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - visible: QGroundControl.settingsManager.appSettings.visible && _airMapEnabled - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: statusCol - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - width: parent.width - anchors.centerIn: parent - QGCLabel { - text: QGroundControl.airspaceManager.connected ? qsTr("Connected") : qsTr("Not Connected") - color: QGroundControl.airspaceManager.connected ? qgcPal.colorGreen : qgcPal.colorRed - anchors.horizontalCenter: parent.horizontalCenter - } - QGCLabel { - text: QGroundControl.airspaceManager.connectStatus - visible: QGroundControl.airspaceManager.connectStatus != "" - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignHCenter - width: parent.width * 0.8 - anchors.horizontalCenter: parent.horizontalCenter - } + } + Rectangle { + height: statusCol.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + visible: QGroundControl.settingsManager.appSettings.visible && _airMapEnabled + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + Column { + id: statusCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + width: parent.width + anchors.centerIn: parent + QGCLabel { + text: QGroundControl.airspaceManager.connected ? qsTr("Connected") : qsTr("Not Connected") + color: QGroundControl.airspaceManager.connected ? qgcPal.colorGreen : qgcPal.colorRed + anchors.horizontalCenter: parent.horizontalCenter } - } - //----------------------------------------------------------------- - //-- Login / Registration - Item { - width: _panelWidth - height: loginLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter QGCLabel { - id: loginLabel - text: qsTr("Login / Registration") - font.family: ScreenTools.demiboldFontFamily + text: QGroundControl.airspaceManager.connectStatus + visible: QGroundControl.airspaceManager.connectStatus != "" + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + width: parent.width * 0.8 + anchors.horizontalCenter: parent.horizontalCenter } } - Rectangle { - height: loginGrid.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - GridLayout { - id: loginGrid - columns: 3 - columnSpacing: ScreenTools.defaultFontPixelWidth - rowSpacing: ScreenTools.defaultFontPixelHeight * 0.25 - anchors.centerIn: parent - QGCLabel { text: qsTr("User Name:") } - FactTextField { - fact: _usernameFact - width: _editFieldWidth - enabled: _airMapEnabled - visible: _usernameFact.visible - Layout.fillWidth: true - Layout.minimumWidth: _editFieldWidth - property Fact _usernameFact: QGroundControl.settingsManager.airMapSettings.userName - } - QGCLabel { - text: { - if(!QGroundControl.airspaceManager.connected) - return qsTr("Not Connected") - switch(_authStatus) { - case AirspaceManager.Unknown: - return qsTr("") - case AirspaceManager.Anonymous: - return qsTr("Anonymous") - case AirspaceManager.Authenticated: - return qsTr("Authenticated") - default: - return qsTr("Authentication Error") - } - } - Layout.rowSpan: 2 - Layout.alignment: Qt.AlignVCenter - } - QGCLabel { text: qsTr("Password:") } - FactTextField { - fact: _passwordFact - width: _editFieldWidth - enabled: _airMapEnabled - visible: _passwordFact.visible - echoMode: TextInput.Password - Layout.fillWidth: true - Layout.minimumWidth: _editFieldWidth - property Fact _passwordFact: QGroundControl.settingsManager.airMapSettings.password - } - Item { - width: 1 - height: 1 - } - Item { - width: 1 - height: 1 - Layout.columnSpan: 3 - } - QGCLabel { - text: qsTr("Forgot Your AirMap Password?") - Layout.alignment: Qt.AlignHCenter - Layout.columnSpan: 3 - } - Item { - width: 1 - height: 1 - Layout.columnSpan: 3 - } - QGCButton { - text: qsTr("Register for an AirMap Account") - Layout.alignment: Qt.AlignHCenter - Layout.columnSpan: 3 - enabled: _airMapEnabled - onClicked: { - Qt.openUrlExternally("https://www.airmap.com"); + } + //----------------------------------------------------------------- + //-- Login / Registration + Item { + width: _panelWidth + height: loginLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + QGCLabel { + id: loginLabel + text: qsTr("Login / Registration") + font.family: ScreenTools.demiboldFontFamily + } + } + Rectangle { + height: loginGrid.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + GridLayout { + id: loginGrid + columns: 3 + columnSpacing: ScreenTools.defaultFontPixelWidth + rowSpacing: ScreenTools.defaultFontPixelHeight * 0.25 + anchors.centerIn: parent + QGCLabel { text: qsTr("User Name:") } + FactTextField { + fact: _usernameFact + width: _editFieldWidth + enabled: _airMapEnabled + visible: _usernameFact.visible + Layout.fillWidth: true + Layout.minimumWidth: _editFieldWidth + property Fact _usernameFact: QGroundControl.settingsManager.airMapSettings.userName + } + QGCLabel { + text: { + if(!QGroundControl.airspaceManager.connected) + return qsTr("Not Connected") + switch(_authStatus) { + case AirspaceManager.Unknown: + return qsTr("") + case AirspaceManager.Anonymous: + return qsTr("Anonymous") + case AirspaceManager.Authenticated: + return qsTr("Authenticated") + default: + return qsTr("Authentication Error") } } + Layout.rowSpan: 2 + Layout.alignment: Qt.AlignVCenter } - } - //----------------------------------------------------------------- - //-- Pilot Profile - Item { - //-- Disabled for now - width: _panelWidth - height: profileLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: false // QGroundControl.settingsManager.appSettings.visible - QGCLabel { - id: profileLabel - text: qsTr("Pilot Profile (WIP)") - font.family: ScreenTools.demiboldFontFamily + QGCLabel { text: qsTr("Password:") } + FactTextField { + fact: _passwordFact + width: _editFieldWidth + enabled: _airMapEnabled + visible: _passwordFact.visible + echoMode: TextInput.Password + Layout.fillWidth: true + Layout.minimumWidth: _editFieldWidth + property Fact _passwordFact: QGroundControl.settingsManager.airMapSettings.password } - } - Rectangle { - //-- Disabled for now - height: profileGrid.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - visible: false // QGroundControl.settingsManager.appSettings.visible - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - GridLayout { - id: profileGrid - columns: 2 - columnSpacing: ScreenTools.defaultFontPixelHeight * 2 - rowSpacing: ScreenTools.defaultFontPixelWidth * 0.25 - anchors.centerIn: parent - QGCLabel { text: qsTr("Name:") } - QGCLabel { text: qsTr("John Doe") } - QGCLabel { text: qsTr("User Name:") } - QGCLabel { text: qsTr("joe36") } - QGCLabel { text: qsTr("Email:") } - QGCLabel { text: qsTr("jonh@doe.com") } - QGCLabel { text: qsTr("Phone:") } - QGCLabel { text: qsTr("+1 212 555 1212") } + Item { + width: 1 + height: 1 + } + Item { + width: 1 + height: 1 + Layout.columnSpan: 3 } - } - //----------------------------------------------------------------- - //-- License (Will this stay here?) - Item { - width: _panelWidth - height: licenseLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: QGroundControl.settingsManager.airMapSettings.usePersonalApiKey.visible QGCLabel { - id: licenseLabel - text: qsTr("License") - font.family: ScreenTools.demiboldFontFamily + text: qsTr("Forgot Your AirMap Password?") + Layout.alignment: Qt.AlignHCenter + Layout.columnSpan: 3 } - } - Rectangle { - height: licenseGrid.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: QGroundControl.settingsManager.airMapSettings.usePersonalApiKey.visible - GridLayout { - id: licenseGrid - columns: 2 - columnSpacing: ScreenTools.defaultFontPixelHeight * 2 - rowSpacing: ScreenTools.defaultFontPixelWidth * 0.25 - anchors.centerIn: parent - FactCheckBox { - id: hasPrivateKey - text: qsTr("Personal API Key") - fact: QGroundControl.settingsManager.airMapSettings.usePersonalApiKey - Layout.columnSpan: 2 - } - Item { - width: 1 - height: 1 - visible: hasPrivateKey.checked - Layout.columnSpan: 2 + Item { + width: 1 + height: 1 + Layout.columnSpan: 3 + } + QGCButton { + text: qsTr("Register for an AirMap Account") + Layout.alignment: Qt.AlignHCenter + Layout.columnSpan: 3 + enabled: _airMapEnabled + onClicked: { + Qt.openUrlExternally("https://www.airmap.com"); } - QGCLabel { text: qsTr("API Key:"); visible: hasPrivateKey.checked; } - FactTextField { fact: QGroundControl.settingsManager.airMapSettings.apiKey; width: _editFieldWidth * 2; visible: hasPrivateKey.checked; Layout.fillWidth: true; Layout.minimumWidth: _editFieldWidth * 2; } - QGCLabel { text: qsTr("Client ID:"); visible: hasPrivateKey.checked; } - FactTextField { fact: QGroundControl.settingsManager.airMapSettings.clientID; width: _editFieldWidth * 2; visible: hasPrivateKey.checked; Layout.fillWidth: true; Layout.minimumWidth: _editFieldWidth * 2; } } } - //----------------------------------------------------------------- - //-- Flight List - Item { - width: _panelWidth - height: flightListLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: QGroundControl.settingsManager.appSettings.visible - QGCLabel { - id: flightListLabel - text: qsTr("Flight List Management") - font.family: ScreenTools.demiboldFontFamily + } + //----------------------------------------------------------------- + //-- Pilot Profile + Item { + //-- Disabled for now + width: _panelWidth + height: profileLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: false // QGroundControl.settingsManager.appSettings.visible + QGCLabel { + id: profileLabel + text: qsTr("Pilot Profile (WIP)") + font.family: ScreenTools.demiboldFontFamily + } + } + Rectangle { + //-- Disabled for now + height: profileGrid.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + visible: false // QGroundControl.settingsManager.appSettings.visible + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + GridLayout { + id: profileGrid + columns: 2 + columnSpacing: ScreenTools.defaultFontPixelHeight * 2 + rowSpacing: ScreenTools.defaultFontPixelWidth * 0.25 + anchors.centerIn: parent + QGCLabel { text: qsTr("Name:") } + QGCLabel { text: qsTr("John Doe") } + QGCLabel { text: qsTr("User Name:") } + QGCLabel { text: qsTr("joe36") } + QGCLabel { text: qsTr("Email:") } + QGCLabel { text: qsTr("jonh@doe.com") } + QGCLabel { text: qsTr("Phone:") } + QGCLabel { text: qsTr("+1 212 555 1212") } + } + } + //----------------------------------------------------------------- + //-- License (Will this stay here?) + Item { + width: _panelWidth + height: licenseLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: QGroundControl.settingsManager.airMapSettings.usePersonalApiKey.visible + QGCLabel { + id: licenseLabel + text: qsTr("License") + font.family: ScreenTools.demiboldFontFamily + } + } + Rectangle { + height: licenseGrid.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: QGroundControl.settingsManager.airMapSettings.usePersonalApiKey.visible + GridLayout { + id: licenseGrid + columns: 2 + columnSpacing: ScreenTools.defaultFontPixelHeight * 2 + rowSpacing: ScreenTools.defaultFontPixelWidth * 0.25 + anchors.centerIn: parent + FactCheckBox { + id: hasPrivateKey + text: qsTr("Personal API Key") + fact: QGroundControl.settingsManager.airMapSettings.usePersonalApiKey + Layout.columnSpan: 2 } + Item { + width: 1 + height: 1 + visible: hasPrivateKey.checked + Layout.columnSpan: 2 + } + QGCLabel { text: qsTr("API Key:"); visible: hasPrivateKey.checked; } + FactTextField { fact: QGroundControl.settingsManager.airMapSettings.apiKey; width: _editFieldWidth * 2; visible: hasPrivateKey.checked; Layout.fillWidth: true; Layout.minimumWidth: _editFieldWidth * 2; } + QGCLabel { text: qsTr("Client ID:"); visible: hasPrivateKey.checked; } + FactTextField { fact: QGroundControl.settingsManager.airMapSettings.clientID; width: _editFieldWidth * 2; visible: hasPrivateKey.checked; Layout.fillWidth: true; Layout.minimumWidth: _editFieldWidth * 2; } } - Rectangle { - height: flightListButton.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - QGCButton { - id: flightListButton - text: qsTr("Show Flight List") - backRadius: 4 - heightFactor: 0.3333 - showBorder: true - width: ScreenTools.defaultFontPixelWidth * 16 - anchors.centerIn: parent - onClicked: { - panelLoader.sourceComponent = flightList - } + } + //----------------------------------------------------------------- + //-- Flight List + Item { + width: _panelWidth + height: flightListLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: QGroundControl.settingsManager.appSettings.visible + QGCLabel { + id: flightListLabel + text: qsTr("Flight List Management") + font.family: ScreenTools.demiboldFontFamily + } + } + Rectangle { + height: flightListButton.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + QGCButton { + id: flightListButton + text: qsTr("Show Flight List") + backRadius: 4 + heightFactor: 0.3333 + showBorder: true + width: ScreenTools.defaultFontPixelWidth * 16 + anchors.centerIn: parent + onClicked: { + panelLoader.sourceComponent = flightList } } } } - Loader { - id: panelLoader - anchors.centerIn: parent - } + } + Loader { + id: panelLoader + anchors.centerIn: parent } //--------------------------------------------------------------- //-- Flight List @@ -395,8 +388,8 @@ QGCView { id: flightList Rectangle { id: flightListRoot - width: _qgcView.width - height: _qgcView.height + width: _root.width + height: _root.height color: qgcPal.window property var _flightList: QGroundControl.airspaceManager.flightPlan.flightList property real _mapWidth: ScreenTools.defaultFontPixelWidth * 40 diff --git a/src/AnalyzeView/AnalyzePage.qml b/src/AnalyzeView/AnalyzePage.qml index 79699a44dcebe08461f08677f8e4d084a8ade903..b3d3bdb66e3470e658aff22ea8c8327928fd99d5 100644 --- a/src/AnalyzeView/AnalyzePage.qml +++ b/src/AnalyzeView/AnalyzePage.qml @@ -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 + } } } diff --git a/src/AnalyzeView/GeoTagPage.qml b/src/AnalyzeView/GeoTagPage.qml index c64147e401dc9178f2ab4024ee27cda29f3365d9..165eda875524aa0853223a8b23e35a06ec871db3 100644 --- a/src/AnalyzeView/GeoTagPage.qml +++ b/src/AnalyzeView/GeoTagPage.qml @@ -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 } diff --git a/src/AnalyzeView/LogDownloadPage.qml b/src/AnalyzeView/LogDownloadPage.qml index 298d19e797cfaedb9f4ee580958b9ac87ca8a839..fa928db9c0333a4f0dd125d5a9bf60f5fa30bc04 100644 --- a/src/AnalyzeView/LogDownloadPage.qml +++ b/src/AnalyzeView/LogDownloadPage.qml @@ -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 + } + } + } +} diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponent.qml b/src/AutoPilotPlugins/APM/APMAirframeComponent.qml index e29e7fdc734245c463cf8ebbbf3523505984bd1d..cc274db74b7c1bcfc951452b296a951121b945f2 100644 --- a/src/AutoPilotPlugins/APM/APMAirframeComponent.qml +++ b/src/AutoPilotPlugins/APM/APMAirframeComponent.qml @@ -33,7 +33,6 @@ SetupPage { APMAirframeComponentController { id: controller - factPanel: airframePage.viewPanel } ExclusiveGroup { diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml b/src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml index d5f6e3261cc59e7354130aa4e6a3ac625ebc0438..d48eaf78c59683c9c93db6bcc7ee3567c8033a37 100644 --- a/src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml @@ -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) diff --git a/src/AutoPilotPlugins/APM/APMCameraComponent.qml b/src/AutoPilotPlugins/APM/APMCameraComponent.qml index df52605d179c8b001108d6a0c50af24995e9afc4..645bd69d0cdfb6d8e7673c33757bf05cbdba666f 100644 --- a/src/AutoPilotPlugins/APM/APMCameraComponent.qml +++ b/src/AutoPilotPlugins/APM/APMCameraComponent.qml @@ -28,7 +28,7 @@ SetupPage { spacing: _margins width: availableWidth - FactPanelController { id: controller; factPanel: cameraPage.viewPanel } + FactPanelController { id: controller; } QGCPalette { id: palette; colorGroupEnabled: true } diff --git a/src/AutoPilotPlugins/APM/APMCameraComponentSummary.qml b/src/AutoPilotPlugins/APM/APMCameraComponentSummary.qml index d2cf18393e68c76fa79681932604d107cc06b4d0..985946f32a4037e7ae219701e77fce694851a2b3 100644 --- a/src/AutoPilotPlugins/APM/APMCameraComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMCameraComponentSummary.qml @@ -1,18 +1,16 @@ 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") diff --git a/src/AutoPilotPlugins/APM/APMCameraSubComponent.qml b/src/AutoPilotPlugins/APM/APMCameraSubComponent.qml index d4106d05fcc828f8db255770b1d40aca20ee0629..a59da7492e26bf2c4073c387c11c302a4024b87f 100644 --- a/src/AutoPilotPlugins/APM/APMCameraSubComponent.qml +++ b/src/AutoPilotPlugins/APM/APMCameraSubComponent.qml @@ -31,7 +31,7 @@ SetupPage { spacing: _margins width: availableWidth - FactPanelController { id: controller; factPanel: cameraPage.viewPanel } + FactPanelController { id: controller; } QGCPalette { id: palette; colorGroupEnabled: true } diff --git a/src/AutoPilotPlugins/APM/APMFlightModesComponent.qml b/src/AutoPilotPlugins/APM/APMFlightModesComponent.qml index 5505473f3a3a8351a22604306bc43781775f5639..091b4277c29f52139dcd30be3ac7c691f412e60c 100644 --- a/src/AutoPilotPlugins/APM/APMFlightModesComponent.qml +++ b/src/AutoPilotPlugins/APM/APMFlightModesComponent.qml @@ -37,7 +37,6 @@ SetupPage { APMFlightModesComponentController { id: controller - factPanel: flightModePage.viewPanel } Component { diff --git a/src/AutoPilotPlugins/APM/APMFlightModesComponentSummary.qml b/src/AutoPilotPlugins/APM/APMFlightModesComponentSummary.qml index 1a6037697956da1d2663de10b73093977a577177..23204a04ee3e6cc24ce89a657134002356253ad3 100644 --- a/src/AutoPilotPlugins/APM/APMFlightModesComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMFlightModesComponentSummary.qml @@ -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 diff --git a/src/AutoPilotPlugins/APM/APMHeliComponent.qml b/src/AutoPilotPlugins/APM/APMHeliComponent.qml index 0e74f7cd7b82a3b0eac5166ae28a9b31738f71de..458272d18eca187c08f7fb5c8a050b6bcbed9da4 100644 --- a/src/AutoPilotPlugins/APM/APMHeliComponent.qml +++ b/src/AutoPilotPlugins/APM/APMHeliComponent.qml @@ -30,7 +30,7 @@ SetupPage { width: availableWidth spacing: _margins - FactPanelController { id: controller; factPanel: safetyPage.viewPanel } + FactPanelController { id: controller; } QGCPalette { id: ggcPal; colorGroupEnabled: true } diff --git a/src/AutoPilotPlugins/APM/APMLightsComponent.qml b/src/AutoPilotPlugins/APM/APMLightsComponent.qml index d976fb41d0884f820e25b74e76ba3c7ae88dbf77..1c78d82a2d39d4f8c24cd838cdee415494e263b6 100644 --- a/src/AutoPilotPlugins/APM/APMLightsComponent.qml +++ b/src/AutoPilotPlugins/APM/APMLightsComponent.qml @@ -29,7 +29,7 @@ SetupPage { spacing: _margins width: availableWidth - FactPanelController { id: controller; factPanel: lightsPage.viewPanel } + FactPanelController { id: controller; } QGCPalette { id: palette; colorGroupEnabled: true } diff --git a/src/AutoPilotPlugins/APM/APMLightsComponentSummary.qml b/src/AutoPilotPlugins/APM/APMLightsComponentSummary.qml index ab5ceebe2af948304029a1969fe26a4957c43d1e..1a1a6321060b2038de36957adb48c5268ace5c7e 100644 --- a/src/AutoPilotPlugins/APM/APMLightsComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMLightsComponentSummary.qml @@ -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") diff --git a/src/AutoPilotPlugins/APM/APMPowerComponent.qml b/src/AutoPilotPlugins/APM/APMPowerComponent.qml index 7bb93fc8ec50eccae858f8e10d81b1273719ddf5..43b5003968722006ed930b73d059592042cec9b8 100644 --- a/src/AutoPilotPlugins/APM/APMPowerComponent.qml +++ b/src/AutoPilotPlugins/APM/APMPowerComponent.qml @@ -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) } } diff --git a/src/AutoPilotPlugins/APM/APMPowerComponentSummary.qml b/src/AutoPilotPlugins/APM/APMPowerComponentSummary.qml index 642dc15b588642573b09117feb043db917024106..b3aa8750e21baf742fbc0182494c2a329831aab9 100644 --- a/src/AutoPilotPlugins/APM/APMPowerComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMPowerComponentSummary.qml @@ -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") diff --git a/src/AutoPilotPlugins/APM/APMRadioComponentSummary.qml b/src/AutoPilotPlugins/APM/APMRadioComponentSummary.qml index 47937ec2d32237baabdd4db3fe3c4e32f213b4d8..5eaf9f38161a52b592db1509389f90da6fa7fc30 100644 --- a/src/AutoPilotPlugins/APM/APMRadioComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMRadioComponentSummary.qml @@ -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") diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponent.qml b/src/AutoPilotPlugins/APM/APMSafetyComponent.qml index afd669665aac7ea7994e625cde2dd32c06e0a55d..7444bd5e72c944815296cdc40d419590320a2372 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponent.qml +++ b/src/AutoPilotPlugins/APM/APMSafetyComponent.qml @@ -30,7 +30,7 @@ SetupPage { width: availableWidth spacing: _margins - FactPanelController { id: controller; factPanel: safetyPage.viewPanel } + FactPanelController { id: controller; } QGCPalette { id: ggcPal; colorGroupEnabled: true } diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml b/src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml index 611401f84daae9856e7c231eeb79ab5125fac4f8..93c3d41ec2c24f358f008f3c5cadbd4cc88e8256 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml +++ b/src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml @@ -31,7 +31,7 @@ SetupPage { width: availableWidth spacing: _margins - FactPanelController { id: controller; factPanel: safetyPage.viewPanel } + FactPanelController { id: controller; } QGCPalette { id: ggcPal; colorGroupEnabled: true } diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponentSummary.qml b/src/AutoPilotPlugins/APM/APMSafetyComponentSummary.qml index f193895e5119b3c3cce34a80c8d798bcf6e639e3..679f1c1a1674c2a30c0fa5851646a2aedded3876 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMSafetyComponentSummary.qml @@ -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 */) diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponentSummaryCopter.qml b/src/AutoPilotPlugins/APM/APMSafetyComponentSummaryCopter.qml index 03c2ec5c647f61ef294a9dce7c0b478c3c22ca48..d72a300784600f503adb709cd93bb0c120b428e9 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponentSummaryCopter.qml +++ b/src/AutoPilotPlugins/APM/APMSafetyComponentSummaryCopter.qml @@ -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") diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponentSummaryPlane.qml b/src/AutoPilotPlugins/APM/APMSafetyComponentSummaryPlane.qml index 10f0638464a5e8dfe7aa5cffd8421ab950030e5f..f3977e6b1acec803ddb6709ca6b9cdd7031cf151 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponentSummaryPlane.qml +++ b/src/AutoPilotPlugins/APM/APMSafetyComponentSummaryPlane.qml @@ -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") diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponentSummaryRover.qml b/src/AutoPilotPlugins/APM/APMSafetyComponentSummaryRover.qml index a71f5f9f52edcef1e8527985bfe1ad33811f43b8..623cceb604f9077bfda373ce0b0320716a8b6fae 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponentSummaryRover.qml +++ b/src/AutoPilotPlugins/APM/APMSafetyComponentSummaryRover.qml @@ -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") diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml b/src/AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml index 6fb1196b3e90f67877e05a9f5c71f7a42a4e61f1..48859b766ab79566349c1f45c58404a4fcaa8bca 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml +++ b/src/AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml @@ -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") diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml index dad8815f0e4d9559165d2f623b4062506bb6996e..e6519caee7d3fa4308315585720748388c26be67 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml +++ b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml @@ -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 { diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponentSummary.qml b/src/AutoPilotPlugins/APM/APMSensorsComponentSummary.qml index 10fc56d14c839335f4af7fb8df0ee495b0df6b5c..31bdf68929bb00890c865e1bf7d1112575268848 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMSensorsComponentSummary.qml @@ -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 diff --git a/src/AutoPilotPlugins/APM/APMSubFrameComponent.qml b/src/AutoPilotPlugins/APM/APMSubFrameComponent.qml index 90839926a2e490291c803c73098da6ae28ac27f2..b5a62fd5946a15ab1d52a0fd9ea34ba64be50e01 100644 --- a/src/AutoPilotPlugins/APM/APMSubFrameComponent.qml +++ b/src/AutoPilotPlugins/APM/APMSubFrameComponent.qml @@ -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) } } diff --git a/src/AutoPilotPlugins/APM/APMSubFrameComponentSummary.qml b/src/AutoPilotPlugins/APM/APMSubFrameComponentSummary.qml index 9c2d3a364c5cea5e38e131747ab7c7baab9e5239..fe3b35df4f0ae442099d950d22770d0a7bb28a99 100644 --- a/src/AutoPilotPlugins/APM/APMSubFrameComponentSummary.qml +++ b/src/AutoPilotPlugins/APM/APMSubFrameComponentSummary.qml @@ -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") diff --git a/src/AutoPilotPlugins/APM/APMSubMotorComponent.qml b/src/AutoPilotPlugins/APM/APMSubMotorComponent.qml index 9692cd7f02f8bf96d1ec50f9da232569b436cb2d..609e0c345cee2e9239d3bffc8c952b112a82f84b 100644 --- a/src/AutoPilotPlugins/APM/APMSubMotorComponent.qml +++ b/src/AutoPilotPlugins/APM/APMSubMotorComponent.qml @@ -30,7 +30,6 @@ SetupPage { FactPanelController { id: controller - factPanel: motorPage.viewPanel } function setMotorDirection(num, reversed) { diff --git a/src/AutoPilotPlugins/APM/APMTuningComponentCopter.qml b/src/AutoPilotPlugins/APM/APMTuningComponentCopter.qml index 50b9f0aa10fc890895ab9a79d00de718684b72c6..ca064e8cd2f0da61add0087fdb853a5be9c2990f 100644 --- a/src/AutoPilotPlugins/APM/APMTuningComponentCopter.qml +++ b/src/AutoPilotPlugins/APM/APMTuningComponentCopter.qml @@ -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") diff --git a/src/AutoPilotPlugins/APM/APMTuningComponentSub.qml b/src/AutoPilotPlugins/APM/APMTuningComponentSub.qml index ebda0c2cd1ae0cce5b8ad328c4061bab681bb94d..2c205798145bea13035d848170fbc26efba981c1 100644 --- a/src/AutoPilotPlugins/APM/APMTuningComponentSub.qml +++ b/src/AutoPilotPlugins/APM/APMTuningComponentSub.qml @@ -28,7 +28,7 @@ SetupPage { width: availableWidth spacing: _margins - FactPanelController { id: controller; factPanel: tuningPage.viewPanel } + FactPanelController { id: controller; } QGCPalette { id: palette; colorGroupEnabled: true } diff --git a/src/AutoPilotPlugins/Common/ESP8266Component.qml b/src/AutoPilotPlugins/Common/ESP8266Component.qml index fb5324ed8fc23d2636bb0db6a9cd47010eae0a01..6b964e16621341477185120dd64483a511fa7f3b 100644 --- a/src/AutoPilotPlugins/Common/ESP8266Component.qml +++ b/src/AutoPilotPlugins/Common/ESP8266Component.qml @@ -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 { diff --git a/src/AutoPilotPlugins/Common/ESP8266ComponentSummary.qml b/src/AutoPilotPlugins/Common/ESP8266ComponentSummary.qml index 25f3506ce6cfb62432f83f5eb949dbee23ab316f..b7dd51fed816f478c68a2204492851d9c545f4c0 100644 --- a/src/AutoPilotPlugins/Common/ESP8266ComponentSummary.qml +++ b/src/AutoPilotPlugins/Common/ESP8266ComponentSummary.qml @@ -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") diff --git a/src/AutoPilotPlugins/Common/MotorComponent.qml b/src/AutoPilotPlugins/Common/MotorComponent.qml index a964c547f88d72650d379157d5c8c69c0733211c..4e57025164e5ac6a9f055eab967cc74181e0aa18 100644 --- a/src/AutoPilotPlugins/Common/MotorComponent.qml +++ b/src/AutoPilotPlugins/Common/MotorComponent.qml @@ -26,7 +26,6 @@ SetupPage { FactPanelController { id: controller - factPanel: motorPage.viewPanel } Component { diff --git a/src/AutoPilotPlugins/Common/RadioComponent.qml b/src/AutoPilotPlugins/Common/RadioComponent.qml index d37133f3d711cabbfb3d4b794a634a62b4534aec..87871d95c9f35b73da61d53137f7f28e2b85d106 100644 --- a/src/AutoPilotPlugins/Common/RadioComponent.qml +++ b/src/AutoPilotPlugins/Common/RadioComponent.qml @@ -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 diff --git a/src/AutoPilotPlugins/Common/SetupPage.qml b/src/AutoPilotPlugins/Common/SetupPage.qml index b4a14e9a2c648123ec317433c7ef0f4df498063c..479e4bc3ec2feff35975daa0c3567edecb41614a 100644 --- a/src/AutoPilotPlugins/Common/SetupPage.qml +++ b/src/AutoPilotPlugins/Common/SetupPage.qml @@ -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 + "" + qsTr(" (Disabled while the vehicle is %1)").arg(_disableReason) + "" : _pageTitle + visible: !ScreenTools.isShortScreen } - Column { - spacing: _margins - Layout.fillWidth: true - - QGCLabel { - font.pointSize: ScreenTools.largeFontPointSize - text: !setupView.enabled ? _pageTitle + "" + qsTr(" (Disabled while the vehicle is %1)").arg(_disableReason) + "" : _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 } } } diff --git a/src/AutoPilotPlugins/Common/SyslinkComponent.qml b/src/AutoPilotPlugins/Common/SyslinkComponent.qml index d2ae061276e6e3e31f9e4e15d4e136ceaa84bb64..bc1018b98d81bcb13f9b3673d02f23dcec3c7283 100644 --- a/src/AutoPilotPlugins/Common/SyslinkComponent.qml +++ b/src/AutoPilotPlugins/Common/SyslinkComponent.qml @@ -37,7 +37,6 @@ SetupPage { SyslinkComponentController { id: controller - factPanel: syslinkPage.viewPanel } QGCLabel { diff --git a/src/AutoPilotPlugins/PX4/AirframeComponent.qml b/src/AutoPilotPlugins/PX4/AirframeComponent.qml index 3d14454af217afd28efdbb22ba2229cbd4005ec9..ec3e3ba1921d892e514dc3f5065ef5c652ac479d 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponent.qml +++ b/src/AutoPilotPlugins/PX4/AirframeComponent.qml @@ -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) } } diff --git a/src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml b/src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml index 35d531a471e2c69996e8b7b758b2c323fd8e1484..79396bea6df79a51f85450fe84ee77a6106df134 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml +++ b/src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml @@ -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") diff --git a/src/AutoPilotPlugins/PX4/CameraComponent.qml b/src/AutoPilotPlugins/PX4/CameraComponent.qml index 2c291d22824e6fc51ff89318d19ddfc6b75eada9..05af4f9a95ed9afeb3c7150902b3a75bbc18dfd4 100644 --- a/src/AutoPilotPlugins/PX4/CameraComponent.qml +++ b/src/AutoPilotPlugins/PX4/CameraComponent.qml @@ -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 diff --git a/src/AutoPilotPlugins/PX4/CameraComponentSummary.qml b/src/AutoPilotPlugins/PX4/CameraComponentSummary.qml index dd0e451a44c76b1188a704df131eacd796354070..8b22d0902572d8ee905a1e467b1fad2bd967ceaa 100644 --- a/src/AutoPilotPlugins/PX4/CameraComponentSummary.qml +++ b/src/AutoPilotPlugins/PX4/CameraComponentSummary.qml @@ -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) diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml b/src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml index 600c05ca9110b0dbe91c2be5e17ae8e901f147f7..be4223a0847682d890f981e3242b3a834b2dfeae 100644 --- a/src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml +++ b/src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml @@ -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 diff --git a/src/AutoPilotPlugins/PX4/PX4AdvancedFlightModes.qml b/src/AutoPilotPlugins/PX4/PX4AdvancedFlightModes.qml index 1abe5caf876aa5e6beaec9998fd9e10e686a109e..2463ac998479a196a0f03c7d5357f0cefface4e7 100644 --- a/src/AutoPilotPlugins/PX4/PX4AdvancedFlightModes.qml +++ b/src/AutoPilotPlugins/PX4/PX4AdvancedFlightModes.qml @@ -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() } diff --git a/src/AutoPilotPlugins/PX4/PX4FlightModes.qml b/src/AutoPilotPlugins/PX4/PX4FlightModes.qml index 952d81fa2e1e4982916c02070686fd71f5886a92..842e77a65779c95adb02dfd324971621d3b30559 100644 --- a/src/AutoPilotPlugins/PX4/PX4FlightModes.qml +++ b/src/AutoPilotPlugins/PX4/PX4FlightModes.qml @@ -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 } } } diff --git a/src/AutoPilotPlugins/PX4/PX4RadioComponentSummary.qml b/src/AutoPilotPlugins/PX4/PX4RadioComponentSummary.qml index 13a7e849afc3755e7f55a3aea6e23db487fdf1a0..d766b4d385908d1ef96c71d47ee8eb2a8f481705 100644 --- a/src/AutoPilotPlugins/PX4/PX4RadioComponentSummary.qml +++ b/src/AutoPilotPlugins/PX4/PX4RadioComponentSummary.qml @@ -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") diff --git a/src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml b/src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml index 5d64be9e27391ba946b92b4722e60630a2b6a9a2..7a40d669d12ab11618079e4f7c058dfd4393d588 100644 --- a/src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml +++ b/src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml @@ -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 + } + } +} diff --git a/src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml b/src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml index 4c57ab20399f02f8fff24b6de755f77cd72db68c..2917b74f1bf27d8330f59b3a7765fa32536c779a 100644 --- a/src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml +++ b/src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml @@ -34,13 +34,11 @@ SetupPage { FactPanelController { id: controller - factPanel: tuningPage.viewPanel } // Standard tuning page FactSliderPanel { width: availableWidth - qgcViewPanel: tuningPage.viewPanel visible: !advanced sliderModel: ListModel { diff --git a/src/AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml b/src/AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml index bc3a4916966d681d6afe8bce68b7c272ab7f9ef1..cc290787901f7b2c683fc19738e6776a3f71fbf0 100644 --- a/src/AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml +++ b/src/AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml @@ -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 diff --git a/src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml b/src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml index dd572435258a1e784b7bb527e2c302cfe7125d0e..ee290d80546ed3c7b24bda01a39f0db00365ea28 100644 --- a/src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml +++ b/src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml @@ -22,8 +22,6 @@ SetupPage { FactSliderPanel { width: availableWidth - qgcViewPanel: tuningPage.viewPanel - sliderModel: ListModel { ListElement { diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.qml b/src/AutoPilotPlugins/PX4/PowerComponent.qml index 3eeec49131fd0703cf030c9746a5c57f0047b32c..ce039c26678990f78a285fab44b58bcd7e3c06d2 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponent.qml +++ b/src/AutoPilotPlugins/PX4/PowerComponent.qml @@ -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 } diff --git a/src/AutoPilotPlugins/PX4/PowerComponentSummary.qml b/src/AutoPilotPlugins/PX4/PowerComponentSummary.qml index 3e81f1d194d2554ce8b36c88dea30d480db53cb6..d0e4e94fd647a74759d600ba77456b61a4aa171b 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponentSummary.qml +++ b/src/AutoPilotPlugins/PX4/PowerComponentSummary.qml @@ -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") diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.qml b/src/AutoPilotPlugins/PX4/SafetyComponent.qml index 314fd1ff3a9c4055a93e75f108974a47ad9884ba..d99a300717d92305be2b3963a3f709c6be70458a 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.qml +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.qml @@ -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" diff --git a/src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml b/src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml index 2cf19b336d0b4ee8b64bd3d25c2e7b59631fcb04..77c5da77df5a94f43e516dd8b5eb58d1db98891b 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml +++ b/src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml @@ -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") diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.qml b/src/AutoPilotPlugins/PX4/SensorsComponent.qml index 6f785058117998f56e1b16fc47e0f1876a6ce609..97c150b8e5459b0c7ff904b5a7205020f7c1d5c8 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponent.qml +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.qml @@ -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 + } +} diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml b/src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml index 121bd9dff37730ab389de772bddc23cf93829a01..c1a5aeb93195ea011038462a229d1d90f72ae124 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml +++ b/src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml @@ -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") diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml b/src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml index 3dcb546be5d361f385c8bb76211e3fa198d94fae..65bfeb73abf7448617eb7ab58c8fdebc5e4f3ae7 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml +++ b/src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml @@ -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") diff --git a/src/AutoPilotPlugins/PX4/SensorsSetup.qml b/src/AutoPilotPlugins/PX4/SensorsSetup.qml index d6c4902728e0abae9291d774ef6e4c1bdd079732..45b441fdf825f7753dc2deaad756c2ca6b0ec3b1 100644 --- a/src/AutoPilotPlugins/PX4/SensorsSetup.qml +++ b/src/AutoPilotPlugins/PX4/SensorsSetup.qml @@ -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 diff --git a/src/FactSystem/FactControls/FactPanel.qml b/src/FactSystem/FactControls/FactPanel.qml deleted file mode 100644 index 43aadeff9c0efc95446c63c4c192e1219f5a95ff..0000000000000000000000000000000000000000 --- a/src/FactSystem/FactControls/FactPanel.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -/// @file -/// @author Don Gagne - -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) - } - } - } -} diff --git a/src/FactSystem/FactControls/FactPanelController.cc b/src/FactSystem/FactControls/FactPanelController.cc index ea3e6aded19985f502c5c54b88c940a84d7be01a..be0438a55ef16ce6ef226b8683c1f8abcc2ab679 100644 --- a/src/FactSystem/FactControls/FactPanelController.cc +++ b/src/FactSystem/FactControls/FactPanelController.cc @@ -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; } } diff --git a/src/FactSystem/FactControls/FactPanelController.h b/src/FactSystem/FactControls/FactPanelController.h index 98ca8ff3eb18da0b0f31a9d27991124f70a761be..4fa7ce67d3283443d3c22dbbf018e6982fdc02a0 100644 --- a/src/FactSystem/FactControls/FactPanelController.h +++ b/src/FactSystem/FactControls/FactPanelController.h @@ -8,8 +8,7 @@ ****************************************************************************/ -#ifndef FactPanelController_H -#define FactPanelController_H +#pragma once /// @file /// @author Don Gagne @@ -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 diff --git a/src/FactSystem/FactControls/FactTextField.qml b/src/FactSystem/FactControls/FactTextField.qml index 34ed20e839264c10557c8507c61ced0b9b415d67..b160d8b8907faf28724f138d6d42639f88fb60ef 100644 --- a/src/FactSystem/FactControls/FactTextField.qml +++ b/src/FactSystem/FactControls/FactTextField.qml @@ -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 } diff --git a/src/FactSystem/FactControls/FactValueSlider.qml b/src/FactSystem/FactControls/FactValueSlider.qml index d434bed5b45591a0e48530c52b9a5bed49aca81b..4deb7bffca5439f0136ce954444f09a5262f9d6f 100644 --- a/src/FactSystem/FactControls/FactValueSlider.qml +++ b/src/FactSystem/FactControls/FactValueSlider.qml @@ -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) diff --git a/src/FactSystem/FactControls/qmldir b/src/FactSystem/FactControls/qmldir index 81e0178f85dfeed9f7472d3e4b26295bd94f2076..9cd5d7ddecdffcdc1998b5916cc5a5f7037943ae 100644 --- a/src/FactSystem/FactControls/qmldir +++ b/src/FactSystem/FactControls/qmldir @@ -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 diff --git a/src/FactSystem/FactSystemTest.qml b/src/FactSystem/FactSystemTest.qml index 4789f8ac5b9bcef2da8b1c23b4c6368445c49a62..b630abec73cea14526ceee1312ceb3f71c8530c2 100644 --- a/src/FactSystem/FactSystemTest.qml +++ b/src/FactSystem/FactSystemTest.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 { diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 6cdb2e22ac5be8b9f3c80072bfd25257da188b3f..1c33a8a584b227c90f483ca65864d217d8e3901c 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -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 { diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml index fc83449562bb2c2802f855961973547dd3709f53..447695430f5e7af2e588df2a0add66d95f9ef66d 100644 --- a/src/FlightDisplay/FlightDisplayViewMap.qml +++ b/src/FlightDisplay/FlightDisplayViewMap.qml @@ -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) diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml index 78cd4d5cb52e42aa82b84312785cecd133f82917..07b943670d12a1d9ce681def49adb531765a242a 100644 --- a/src/FlightDisplay/FlightDisplayViewWidgets.qml +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -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 { diff --git a/src/FlightDisplay/GuidedActionList.qml b/src/FlightDisplay/GuidedActionList.qml index b4bfbcd5e4c0a0483156b6f66a7854ed125d8433..9995fcf56628c426cfb8a4eb76982972f45b31d0 100644 --- a/src/FlightDisplay/GuidedActionList.qml +++ b/src/FlightDisplay/GuidedActionList.qml @@ -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 diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml index c12bfb5315791da773627ddbfa3c69fab31e623a..1b2a4c94ee7a67411e40f9ceb564e7d266d11da9 100644 --- a/src/FlightMap/FlightMap.qml +++ b/src/FlightMap/FlightMap.qml @@ -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 diff --git a/src/FlightMap/Widgets/CameraPageWidget.qml b/src/FlightMap/Widgets/CameraPageWidget.qml index 37f6a25f4817d87ef3d8673e8efaac72edae32f7..d5ae396c474201c67a5fe2fa6dd4cd79b384f729 100644 --- a/src/FlightMap/Widgets/CameraPageWidget.qml +++ b/src/FlightMap/Widgets/CameraPageWidget.qml @@ -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 diff --git a/src/FlightMap/Widgets/InstrumentSwipeView.qml b/src/FlightMap/Widgets/InstrumentSwipeView.qml index fb1ca53950fc9ac67ef21c1673de9c5fd9081e59..c5aabec4b80bd73c4bcf063ecc91c76e2a48119b 100644 --- a/src/FlightMap/Widgets/InstrumentSwipeView.qml +++ b/src/FlightMap/Widgets/InstrumentSwipeView.qml @@ -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 } diff --git a/src/FlightMap/Widgets/QGCInstrumentWidget.qml b/src/FlightMap/Widgets/QGCInstrumentWidget.qml index ca7f77863483cf0f959cd60e080b18edee861c55..ce763892b083691ce94a91f724aa7ea568cdd434 100644 --- a/src/FlightMap/Widgets/QGCInstrumentWidget.qml +++ b/src/FlightMap/Widgets/QGCInstrumentWidget.qml @@ -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 diff --git a/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml b/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml index 43253cab5adb37b11ae5b2313f9655620729a15a..71df61ae07ce573adfb3e786a17ee059b1b18529 100644 --- a/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml +++ b/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml @@ -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 } } diff --git a/src/FlightMap/Widgets/ValuePageWidget.qml b/src/FlightMap/Widgets/ValuePageWidget.qml index 703dabac3366f8ee65268af7af3b0a0b3dac1d4d..f9a114b6a9e42c2b522529968cedd47bbbbbb094 100644 --- a/src/FlightMap/Widgets/ValuePageWidget.qml +++ b/src/FlightMap/Widgets/ValuePageWidget.qml @@ -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) { diff --git a/src/Microhard/MicrohardSettings.qml b/src/Microhard/MicrohardSettings.qml index cba02450d941554b18d27aef8005a0e2ed2ff570..50eeb2ef757096667aa8b7c5dd475771c2ab8ac3 100644 --- a/src/Microhard/MicrohardSettings.qml +++ b/src/Microhard/MicrohardSettings.qml @@ -27,270 +27,263 @@ import QGroundControl.Palette 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.SettingsManager 1.0 -QGCView { - id: _qgcView - viewPanel: panel +Item { + id: _root color: qgcPal.window anchors.fill: parent anchors.margins: ScreenTools.defaultFontPixelWidth property real _labelWidth: ScreenTools.defaultFontPixelWidth * 26 property real _valueWidth: ScreenTools.defaultFontPixelWidth * 20 - property real _panelWidth: _qgcView.width * _internalWidthRatio + property real _panelWidth: _root.width * _internalWidthRatio property Fact _microhardEnabledFact: QGroundControl.settingsManager.appSettings.enableMicrohard property bool _microhardEnabled: _microhardEnabledFact.rawValue readonly property real _internalWidthRatio: 0.8 - QGCPalette { id: qgcPal } - - QGCViewPanel { - id: panel - anchors.fill: parent - QGCFlickable { - clip: true - anchors.fill: parent - contentHeight: settingsColumn.height - contentWidth: settingsColumn.width - Column { - id: settingsColumn - width: _qgcView.width - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - anchors.margins: ScreenTools.defaultFontPixelWidth - //----------------------------------------------------------------- - //-- General - Item { - width: _panelWidth - height: generalLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - id: generalLabel - text: qsTr("General") - font.family: ScreenTools.demiboldFontFamily - } + QGCFlickable { + clip: true + anchors.fill: parent + contentHeight: settingsColumn.height + contentWidth: settingsColumn.width + Column { + id: settingsColumn + width: _root.width + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.margins: ScreenTools.defaultFontPixelWidth + //----------------------------------------------------------------- + //-- General + Item { + width: _panelWidth + height: generalLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + QGCLabel { + id: generalLabel + text: qsTr("General") + font.family: ScreenTools.demiboldFontFamily } - Rectangle { - height: generalRow.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - Row { - id: generalRow - spacing: ScreenTools.defaultFontPixelWidth * 4 - anchors.centerIn: parent - Column { - spacing: ScreenTools.defaultFontPixelWidth - FactCheckBox { - text: qsTr("Enable Microhard") - fact: _microhardEnabledFact - enabled: true - visible: _microhardEnabledFact.visible - } + } + Rectangle { + height: generalRow.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + Row { + id: generalRow + spacing: ScreenTools.defaultFontPixelWidth * 4 + anchors.centerIn: parent + Column { + spacing: ScreenTools.defaultFontPixelWidth + FactCheckBox { + text: qsTr("Enable Microhard") + fact: _microhardEnabledFact + enabled: true + visible: _microhardEnabledFact.visible } } } - //----------------------------------------------------------------- - //-- Connection Status - Item { - width: _panelWidth - height: statusLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: _microhardEnabled - QGCLabel { - id: statusLabel - text: qsTr("Connection Status") - font.family: ScreenTools.demiboldFontFamily - } + } + //----------------------------------------------------------------- + //-- Connection Status + Item { + width: _panelWidth + height: statusLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: _microhardEnabled + QGCLabel { + id: statusLabel + text: qsTr("Connection Status") + font.family: ScreenTools.demiboldFontFamily } - Rectangle { - height: statusCol.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - visible: _microhardEnabled - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: statusCol - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - width: parent.width - anchors.centerIn: parent - GridLayout { - anchors.margins: ScreenTools.defaultFontPixelHeight - columnSpacing: ScreenTools.defaultFontPixelWidth * 2 - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - QGCLabel { - text: qsTr("Ground Unit:") - Layout.minimumWidth: _labelWidth - } - QGCLabel { - text: QGroundControl.microhardManager.connected ? qsTr("Connected") : qsTr("Not Connected") - color: QGroundControl.microhardManager.connected ? qgcPal.colorGreen : qgcPal.colorRed - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Air Unit:") - } - QGCLabel { - text: QGroundControl.microhardManager.linkConnected ? qsTr("Connected") : qsTr("Not Connected") - color: QGroundControl.microhardManager.linkConnected ? qgcPal.colorGreen : qgcPal.colorRed - } - QGCLabel { - text: qsTr("Uplink RSSI:") - } - QGCLabel { - text: QGroundControl.microhardManager.linkConnected && QGroundControl.microhardManager.uplinkRSSI < 0 ? QGroundControl.microhardManager.uplinkRSSI : "" - } - QGCLabel { - text: qsTr("Downlink RSSI:") - } - QGCLabel { - text: QGroundControl.microhardManager.linkConnected && QGroundControl.microhardManager.downlinkRSSI < 0 ? QGroundControl.microhardManager.downlinkRSSI : "" - } + } + Rectangle { + height: statusCol.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + visible: _microhardEnabled + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + Column { + id: statusCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + width: parent.width + anchors.centerIn: parent + GridLayout { + anchors.margins: ScreenTools.defaultFontPixelHeight + columnSpacing: ScreenTools.defaultFontPixelWidth * 2 + anchors.horizontalCenter: parent.horizontalCenter + columns: 2 + QGCLabel { + text: qsTr("Ground Unit:") + Layout.minimumWidth: _labelWidth + } + QGCLabel { + text: QGroundControl.microhardManager.connected ? qsTr("Connected") : qsTr("Not Connected") + color: QGroundControl.microhardManager.connected ? qgcPal.colorGreen : qgcPal.colorRed + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Air Unit:") + } + QGCLabel { + text: QGroundControl.microhardManager.linkConnected ? qsTr("Connected") : qsTr("Not Connected") + color: QGroundControl.microhardManager.linkConnected ? qgcPal.colorGreen : qgcPal.colorRed + } + QGCLabel { + text: qsTr("Uplink RSSI:") + } + QGCLabel { + text: QGroundControl.microhardManager.linkConnected && QGroundControl.microhardManager.uplinkRSSI < 0 ? QGroundControl.microhardManager.uplinkRSSI : "" + } + QGCLabel { + text: qsTr("Downlink RSSI:") + } + QGCLabel { + text: QGroundControl.microhardManager.linkConnected && QGroundControl.microhardManager.downlinkRSSI < 0 ? QGroundControl.microhardManager.downlinkRSSI : "" } } } - //----------------------------------------------------------------- - //-- IP Settings - Item { - width: _panelWidth - height: ipSettingsLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: _microhardEnabled - QGCLabel { - id: ipSettingsLabel - text: qsTr("Network Settings") - font.family: ScreenTools.demiboldFontFamily - } + } + //----------------------------------------------------------------- + //-- IP Settings + Item { + width: _panelWidth + height: ipSettingsLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: _microhardEnabled + QGCLabel { + id: ipSettingsLabel + text: qsTr("Network Settings") + font.family: ScreenTools.demiboldFontFamily } - Rectangle { - height: ipSettingsCol.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - visible: _microhardEnabled - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: ipSettingsCol - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - width: parent.width - anchors.centerIn: parent - GridLayout { - anchors.margins: ScreenTools.defaultFontPixelHeight - columnSpacing: ScreenTools.defaultFontPixelWidth * 2 - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - QGCLabel { - text: qsTr("Local IP Address:") - Layout.minimumWidth: _labelWidth - } - QGCTextField { - id: localIP - text: QGroundControl.microhardManager.localIPAddr - enabled: true - inputMethodHints: Qt.ImhFormattedNumbersOnly - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Remote IP Address:") - } - QGCTextField { - id: remoteIP - text: QGroundControl.microhardManager.remoteIPAddr - enabled: true - inputMethodHints: Qt.ImhFormattedNumbersOnly - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Ground Unit IP Address:") - Layout.minimumWidth: _labelWidth - } - QGCTextField { - id: groundIP - text: QGroundControl.microhardManager.groundIPAddr - enabled: true - inputMethodHints: Qt.ImhFormattedNumbersOnly - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Air Unit IP Address:") - } - QGCTextField { - id: airIP - text: QGroundControl.microhardManager.airIPAddr - enabled: true - inputMethodHints: Qt.ImhFormattedNumbersOnly - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Network Mask:") - } - QGCTextField { - id: netMask - text: QGroundControl.microhardManager.netMask - enabled: true - inputMethodHints: Qt.ImhFormattedNumbersOnly - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Configuration password:") - } - QGCTextField { - id: configPassword - text: QGroundControl.microhardManager.configPassword - enabled: true - inputMethodHints: Qt.ImhHiddenText - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Encryption key:") - } - QGCTextField { - id: encryptionKey - text: QGroundControl.microhardManager.encryptionKey - enabled: true - inputMethodHints: Qt.ImhHiddenText - Layout.minimumWidth: _valueWidth - } + } + Rectangle { + height: ipSettingsCol.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + visible: _microhardEnabled + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + Column { + id: ipSettingsCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + width: parent.width + anchors.centerIn: parent + GridLayout { + anchors.margins: ScreenTools.defaultFontPixelHeight + columnSpacing: ScreenTools.defaultFontPixelWidth * 2 + anchors.horizontalCenter: parent.horizontalCenter + columns: 2 + QGCLabel { + text: qsTr("Local IP Address:") + Layout.minimumWidth: _labelWidth } - Item { - width: 1 - height: ScreenTools.defaultFontPixelHeight + QGCTextField { + id: localIP + text: QGroundControl.microhardManager.localIPAddr + enabled: true + inputMethodHints: Qt.ImhFormattedNumbersOnly + Layout.minimumWidth: _valueWidth } - QGCButton { - function validateIPaddress(ipaddress) { - if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress)) - return true - return false - } - function testEnabled() { - if(localIP.text === QGroundControl.microhardManager.localIPAddr && - remoteIP.text === QGroundControl.microhardManager.remoteIPAddr && - groundIP.text === QGroundControl.microhardManager.groundIPAddr && - airIP.text === QGroundControl.microhardManager.airIPAddr && - netMask.text === QGroundControl.microhardManager.netMask && - configPassword.text === QGroundControl.microhardManager.configPassword && - encryptionKey.text === QGroundControl.microhardManager.encryptionKey) - return false - if(!validateIPaddress(localIP.text)) return false - if(!validateIPaddress(remoteIP.text)) return false - if(!validateIPaddress(groundIP.text)) return false - if(!validateIPaddress(airIP.text)) return false - if(!validateIPaddress(netMask.text)) return false + QGCLabel { + text: qsTr("Remote IP Address:") + } + QGCTextField { + id: remoteIP + text: QGroundControl.microhardManager.remoteIPAddr + enabled: true + inputMethodHints: Qt.ImhFormattedNumbersOnly + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Ground Unit IP Address:") + Layout.minimumWidth: _labelWidth + } + QGCTextField { + id: groundIP + text: QGroundControl.microhardManager.groundIPAddr + enabled: true + inputMethodHints: Qt.ImhFormattedNumbersOnly + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Air Unit IP Address:") + } + QGCTextField { + id: airIP + text: QGroundControl.microhardManager.airIPAddr + enabled: true + inputMethodHints: Qt.ImhFormattedNumbersOnly + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Network Mask:") + } + QGCTextField { + id: netMask + text: QGroundControl.microhardManager.netMask + enabled: true + inputMethodHints: Qt.ImhFormattedNumbersOnly + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Configuration password:") + } + QGCTextField { + id: configPassword + text: QGroundControl.microhardManager.configPassword + enabled: true + inputMethodHints: Qt.ImhHiddenText + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Encryption key:") + } + QGCTextField { + id: encryptionKey + text: QGroundControl.microhardManager.encryptionKey + enabled: true + inputMethodHints: Qt.ImhHiddenText + Layout.minimumWidth: _valueWidth + } + } + Item { + width: 1 + height: ScreenTools.defaultFontPixelHeight + } + QGCButton { + function validateIPaddress(ipaddress) { + if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress)) return true - } - enabled: testEnabled() - text: qsTr("Apply") - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - QGroundControl.microhardManager.setIPSettings(localIP.text, remoteIP.text, groundIP.text, airIP.text, netMask.text, configPassword.text, encryptionKey.text) - } - + return false } + function testEnabled() { + if(localIP.text === QGroundControl.microhardManager.localIPAddr && + remoteIP.text === QGroundControl.microhardManager.remoteIPAddr && + groundIP.text === QGroundControl.microhardManager.groundIPAddr && + airIP.text === QGroundControl.microhardManager.airIPAddr && + netMask.text === QGroundControl.microhardManager.netMask && + configPassword.text === QGroundControl.microhardManager.configPassword && + encryptionKey.text === QGroundControl.microhardManager.encryptionKey) + return false + if(!validateIPaddress(localIP.text)) return false + if(!validateIPaddress(remoteIP.text)) return false + if(!validateIPaddress(groundIP.text)) return false + if(!validateIPaddress(airIP.text)) return false + if(!validateIPaddress(netMask.text)) return false + return true + } + enabled: testEnabled() + text: qsTr("Apply") + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + QGroundControl.microhardManager.setIPSettings(localIP.text, remoteIP.text, groundIP.text, airIP.text, netMask.text, configPassword.text, encryptionKey.text) + } + } } } diff --git a/src/MissionManager/QGCMapPolygonVisuals.qml b/src/MissionManager/QGCMapPolygonVisuals.qml index 8c9a093fb6bf20cc6ed38f7c22ca368f642b1e3c..f5c7991f827e87ad501ab9baadc4d8ce565d3dd0 100644 --- a/src/MissionManager/QGCMapPolygonVisuals.qml +++ b/src/MissionManager/QGCMapPolygonVisuals.qml @@ -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 { diff --git a/src/MissionManager/QGCMapPolylineVisuals.qml b/src/MissionManager/QGCMapPolylineVisuals.qml index ad5a88fbd0f254df583ebab44e33db19e93555b3..a3d1c910612d92f083d8401775384156c8bf16af 100644 --- a/src/MissionManager/QGCMapPolylineVisuals.qml +++ b/src/MissionManager/QGCMapPolylineVisuals.qml @@ -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 { diff --git a/src/PlanView/CorridorScanMapVisual.qml b/src/PlanView/CorridorScanMapVisual.qml index 762fb5a209f03bfd8928d9bff14ae6f21485823f..ec9e052c60f078f18f5e837cf90e3748dc49546d 100644 --- a/src/PlanView/CorridorScanMapVisual.qml +++ b/src/PlanView/CorridorScanMapVisual.qml @@ -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 diff --git a/src/PlanView/FWLandingPatternMapVisual.qml b/src/PlanView/FWLandingPatternMapVisual.qml index 8a7ca65af16b739e7ade34c530e2b8868c64d3a4..62b6bbff6c36db7b7be59b4e5c03cfacfb4bb2cb 100644 --- a/src/PlanView/FWLandingPatternMapVisual.qml +++ b/src/PlanView/FWLandingPatternMapVisual.qml @@ -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) diff --git a/src/PlanView/MissionItemEditor.qml b/src/PlanView/MissionItemEditor.qml index 694eecb93db4c8f62d9d8f3db7d6efb0f07e46fa..d798b4f711c2f8b06eacfd48b7b70bafab5869b5 100644 --- a/src/PlanView/MissionItemEditor.qml +++ b/src/PlanView/MissionItemEditor.qml @@ -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 { diff --git a/src/PlanView/MissionItemMapVisual.qml b/src/PlanView/MissionItemMapVisual.qml index 96d07ff67e432bbb20d331ed5c32b23c03dcc1c1..01df7c2f6b6a115e430c14da489ada3c7170af7f 100644 --- a/src/PlanView/MissionItemMapVisual.qml +++ b/src/PlanView/MissionItemMapVisual.qml @@ -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) } } diff --git a/src/PlanView/PlanView.qml b/src/PlanView/PlanView.qml index 45406d556d1888bbcea4c2fa76af78c19129b379..2cd3f8f515b55945d2d7a5620076ead3c15ad0b7 100644 --- a/src/PlanView/PlanView.qml +++ b/src/PlanView/PlanView.qml @@ -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) } } diff --git a/src/PlanView/SimpleItemMapVisual.qml b/src/PlanView/SimpleItemMapVisual.qml index 244c7f4c2a42d345d872bca56933fd827d7f9fdb..2ff9eaf6e263a802bb55bf56e9ba4162c2f622ec 100644 --- a/src/PlanView/SimpleItemMapVisual.qml +++ b/src/PlanView/SimpleItemMapVisual.qml @@ -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 diff --git a/src/PlanView/StructureScanMapVisual.qml b/src/PlanView/StructureScanMapVisual.qml index 333c53b992738b7678c945162f12b564f6c2935e..b485dc307e67ada67456f1aff9cbc72b359d1df4 100644 --- a/src/PlanView/StructureScanMapVisual.qml +++ b/src/PlanView/StructureScanMapVisual.qml @@ -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 diff --git a/src/PlanView/SurveyMapVisual.qml b/src/PlanView/SurveyMapVisual.qml index dbcc03f3ef3320ff7b393a3dbe45c385de53275d..afd4a92317b41bacca2070a6adf1743b8088020b 100644 --- a/src/PlanView/SurveyMapVisual.qml +++ b/src/PlanView/SurveyMapVisual.qml @@ -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 diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index ff803f10938754ce346aca5c3f4e84d362afc316..116e7b39054eff7be5666a36834a1140087ccd2b 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -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 ("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(_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) { diff --git a/src/QGCApplication.h b/src/QGCApplication.h index d877a6cc99a1efd90cab75370d72b831b1434714..716fad18faa8af65a92d03d086fde25f6e6c9a2d 100644 --- a/src/QGCApplication.h +++ b/src/QGCApplication.h @@ -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 diff --git a/src/QmlControls/AppMessages.qml b/src/QmlControls/AppMessages.qml index 600a812d1b4f3bc1c468a5ce00fe10a276822ec4..c62d41dada6cc50cef43671666911f771c25d3b2 100644 --- a/src/QmlControls/AppMessages.qml +++ b/src/QmlControls/AppMessages.qml @@ -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 + } +} diff --git a/src/QmlControls/FactSliderPanel.qml b/src/QmlControls/FactSliderPanel.qml index ac4cc10d722d69cda79475f30eefd20087e0eca9..924c5e6af02031c6c4eefcb9d6fbbac6bee403c8 100644 --- a/src/QmlControls/FactSliderPanel.qml +++ b/src/QmlControls/FactSliderPanel.qml @@ -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 + } + } + } + } +} diff --git a/src/QmlControls/PageView.qml b/src/QmlControls/PageView.qml index 72bcf0d8f20bdc64f19fc65be23a7b89b00837f9..f097b65eb08ebdf16dddfe10a21ad006a187957c 100644 --- a/src/QmlControls/PageView.qml +++ b/src/QmlControls/PageView.qml @@ -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 } } } diff --git a/src/QmlControls/ParameterEditor.qml b/src/QmlControls/ParameterEditor.qml index 5d3eda1b746bd20f81a7717160b72b99276bf209..04f8b89e04147200eec60306beb7056dfdedd51f 100644 --- a/src/QmlControls/ParameterEditor.qml +++ b/src/QmlControls/ParameterEditor.qml @@ -20,11 +20,8 @@ import QGroundControl.Controllers 1.0 import QGroundControl.FactSystem 1.0 import QGroundControl.FactControls 1.0 -QGCView { - id: qgcView - viewPanel: panel - - QGCPalette { id: __qgcPal; colorGroupEnabled: true } +Item { + id: _root property Fact _editorDialogFact: Fact { } property int _rowHeight: ScreenTools.defaultFontPixelHeight * 2 @@ -37,259 +34,253 @@ QGCView { ParameterEditorController { id: controller; - factPanel: panel onShowErrorMessage: { - showMessage(qsTr("Parameter Load Errors"), errorMsg, StandardButton.Ok) + mainWindow.showMessageDialog(qsTr("Parameter Load Errors")) } } ExclusiveGroup { id: sectionGroup } - QGCViewPanel { - id: panel - anchors.fill: parent + //--------------------------------------------- + //-- Header + Row { + id: header + anchors.left: parent.left + anchors.right: parent.right + spacing: ScreenTools.defaultFontPixelWidth + + Timer { + id: clearTimer + interval: 100; + running: false; + repeat: false + onTriggered: { + searchText.text = "" + controller.searchText = "" + } + } - //--------------------------------------------- - //-- Header - Row { - id: header - anchors.left: parent.left - anchors.right: parent.right - spacing: ScreenTools.defaultFontPixelWidth + QGCLabel { + anchors.verticalCenter: parent.verticalCenter + text: qsTr("Search:") + } - Timer { - id: clearTimer - interval: 100; - running: false; - repeat: false - onTriggered: { - searchText.text = "" - controller.searchText = "" + QGCTextField { + id: searchText + text: controller.searchText + onDisplayTextChanged: controller.searchText = displayText + anchors.verticalCenter: parent.verticalCenter + } + + QGCButton { + text: qsTr("Clear") + onClicked: { + if(ScreenTools.isMobile) { + Qt.inputMethod.hide(); } + clearTimer.start() } + anchors.verticalCenter: parent.verticalCenter + } - QGCLabel { - anchors.verticalCenter: parent.verticalCenter - text: qsTr("Search:") + QGCCheckBox { + text: qsTr("Show modified only") + checked: controller.showModifiedOnly + anchors.verticalCenter: parent.verticalCenter + onClicked: { + controller.showModifiedOnly = !controller.showModifiedOnly } - - QGCTextField { - id: searchText - text: controller.searchText - onDisplayTextChanged: controller.searchText = displayText - anchors.verticalCenter: parent.verticalCenter + } + } // Row - Header + + QGCButton { + anchors.top: header.top + anchors.bottom: header.bottom + anchors.right: parent.right + text: qsTr("Tools") + visible: !_searchFilter + + menu: Menu { + MenuItem { + text: qsTr("Refresh") + onTriggered: controller.refresh() } - - QGCButton { - text: qsTr("Clear") - onClicked: { - if(ScreenTools.isMobile) { - Qt.inputMethod.hide(); - } - clearTimer.start() - } - anchors.verticalCenter: parent.verticalCenter + MenuItem { + text: qsTr("Reset all to defaults") + visible: !_activeVehicle.apmFirmware + onTriggered: mainWindow.showDialog(resetToDefaultConfirmComponent, qsTr("Reset All"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Reset) } - - QGCCheckBox { - text: qsTr("Show modified only") - checked: controller.showModifiedOnly - anchors.verticalCenter: parent.verticalCenter - onClicked: { - controller.showModifiedOnly = !controller.showModifiedOnly + MenuSeparator { } + MenuItem { + text: qsTr("Load from file...") + onTriggered: { + fileDialog._root = _root + fileDialog.title = qsTr("Load Parameters") + fileDialog.selectExisting = true + fileDialog.openForLoad() } } - } // Row - Header - - QGCButton { - anchors.top: header.top - anchors.bottom: header.bottom - anchors.right: parent.right - text: qsTr("Tools") - visible: !_searchFilter - - menu: Menu { - MenuItem { - text: qsTr("Refresh") - onTriggered: controller.refresh() - } - MenuItem { - text: qsTr("Reset all to defaults") - visible: !_activeVehicle.apmFirmware - onTriggered: showDialog(resetToDefaultConfirmComponent, qsTr("Reset All"), qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Reset) - } - MenuSeparator { } - MenuItem { - text: qsTr("Load from file...") - onTriggered: { - fileDialog.qgcView = qgcView - fileDialog.title = qsTr("Load Parameters") - fileDialog.selectExisting = true - fileDialog.openForLoad() - } - } - MenuItem { - text: qsTr("Save to file...") - onTriggered: { - fileDialog.qgcView = qgcView - fileDialog.title = qsTr("Save Parameters") - fileDialog.selectExisting = false - fileDialog.openForSave() - } - } - MenuSeparator { visible: _showRCToParam } - MenuItem { - text: qsTr("Clear RC to Param") - onTriggered: controller.clearRCToParam() - visible: _showRCToParam - } - MenuSeparator { } - MenuItem { - text: qsTr("Reboot Vehicle") - onTriggered: showDialog(rebootVehicleConfirmComponent, qsTr("Reboot Vehicle"), qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) + MenuItem { + text: qsTr("Save to file...") + onTriggered: { + fileDialog._root = _root + fileDialog.title = qsTr("Save Parameters") + fileDialog.selectExisting = false + fileDialog.openForSave() } } + MenuSeparator { visible: _showRCToParam } + MenuItem { + text: qsTr("Clear RC to Param") + onTriggered: controller.clearRCToParam() + visible: _showRCToParam + } + MenuSeparator { } + MenuItem { + text: qsTr("Reboot Vehicle") + onTriggered: mainWindow.showDialog(rebootVehicleConfirmComponent, qsTr("Reboot Vehicle"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) + } } + } - /// Group buttons - QGCFlickable { - id : groupScroll - width: ScreenTools.defaultFontPixelWidth * 25 - anchors.top: header.bottom - anchors.bottom: parent.bottom - clip: true - pixelAligned: true - contentHeight: groupedViewCategoryColumn.height - flickableDirection: Flickable.VerticalFlick - visible: !_searchFilter && !controller.showModifiedOnly - - ColumnLayout { - id: groupedViewCategoryColumn - anchors.left: parent.left - anchors.right: parent.right - spacing: Math.ceil(ScreenTools.defaultFontPixelHeight * 0.25) + /// Group buttons + QGCFlickable { + id : groupScroll + width: ScreenTools.defaultFontPixelWidth * 25 + anchors.top: header.bottom + anchors.bottom: parent.bottom + clip: true + pixelAligned: true + contentHeight: groupedViewCategoryColumn.height + flickableDirection: Flickable.VerticalFlick + visible: !_searchFilter && !controller.showModifiedOnly + + ColumnLayout { + id: groupedViewCategoryColumn + anchors.left: parent.left + anchors.right: parent.right + spacing: Math.ceil(ScreenTools.defaultFontPixelHeight * 0.25) - Repeater { - model: controller.categories + Repeater { + model: controller.categories - Column { - Layout.fillWidth: true - spacing: Math.ceil(ScreenTools.defaultFontPixelHeight * 0.25) + Column { + Layout.fillWidth: true + spacing: Math.ceil(ScreenTools.defaultFontPixelHeight * 0.25) - readonly property string category: modelData + readonly property string category: modelData - SectionHeader { - id: categoryHeader - text: category - checked: controller.currentCategory === text - exclusiveGroup: sectionGroup + SectionHeader { + id: categoryHeader + text: category + checked: controller.currentCategory === text + exclusiveGroup: sectionGroup - onCheckedChanged: { - if (checked) { - controller.currentCategory = category - controller.currentGroup = controller.getGroupsForCategory(category)[0] - } + onCheckedChanged: { + if (checked) { + controller.currentCategory = category + controller.currentGroup = controller.getGroupsForCategory(category)[0] } } + } - ExclusiveGroup { id: buttonGroup } + ExclusiveGroup { id: buttonGroup } - Repeater { - model: categoryHeader.checked ? controller.getGroupsForCategory(category) : 0 + Repeater { + model: categoryHeader.checked ? controller.getGroupsForCategory(category) : 0 - QGCButton { - width: ScreenTools.defaultFontPixelWidth * 25 - text: groupName - height: _rowHeight - checked: controller.currentGroup === text - exclusiveGroup: buttonGroup + QGCButton { + width: ScreenTools.defaultFontPixelWidth * 25 + text: groupName + height: _rowHeight + checked: controller.currentGroup === text + exclusiveGroup: buttonGroup - readonly property string groupName: modelData + readonly property string groupName: modelData - onClicked: { - checked = true - _rowWidth = 10 - controller.currentCategory = category - controller.currentGroup = groupName - } + onClicked: { + checked = true + _rowWidth = 10 + controller.currentCategory = category + controller.currentGroup = groupName } } } } } } + } - /// Parameter list - QGCListView { - id: editorListView - anchors.leftMargin: ScreenTools.defaultFontPixelWidth - anchors.left: (_searchFilter || controller.showModifiedOnly) ? parent.left : groupScroll.right - anchors.right: parent.right - anchors.top: header.bottom - anchors.bottom: parent.bottom - orientation: ListView.Vertical - model: controller.parameters - cacheBuffer: height > 0 ? height * 2 : 0 - clip: true - - delegate: Rectangle { - height: _rowHeight - width: _rowWidth - color: Qt.rgba(0,0,0,0) - - Row { - id: factRow - spacing: Math.ceil(ScreenTools.defaultFontPixelWidth * 0.5) - anchors.verticalCenter: parent.verticalCenter + /// Parameter list + QGCListView { + id: editorListView + anchors.leftMargin: ScreenTools.defaultFontPixelWidth + anchors.left: (_searchFilter || controller.showModifiedOnly) ? parent.left : groupScroll.right + anchors.right: parent.right + anchors.top: header.bottom + anchors.bottom: parent.bottom + orientation: ListView.Vertical + model: controller.parameters + cacheBuffer: height > 0 ? height * 2 : 0 + clip: true + + delegate: Rectangle { + height: _rowHeight + width: _rowWidth + color: Qt.rgba(0,0,0,0) + + Row { + id: factRow + spacing: Math.ceil(ScreenTools.defaultFontPixelWidth * 0.5) + anchors.verticalCenter: parent.verticalCenter - property Fact modelFact: object + property Fact modelFact: object - QGCLabel { - id: nameLabel - width: ScreenTools.defaultFontPixelWidth * 20 - text: factRow.modelFact.name - clip: true - } + QGCLabel { + id: nameLabel + width: ScreenTools.defaultFontPixelWidth * 20 + text: factRow.modelFact.name + clip: true + } - QGCLabel { - id: valueLabel - width: ScreenTools.defaultFontPixelWidth * 20 - color: factRow.modelFact.defaultValueAvailable ? (factRow.modelFact.valueEqualsDefault ? __qgcPal.text : __qgcPal.warningText) : __qgcPal.text - text: factRow.modelFact.enumStrings.length === 0 ? factRow.modelFact.valueString + " " + factRow.modelFact.units : factRow.modelFact.enumStringValue - clip: true - } + QGCLabel { + id: valueLabel + width: ScreenTools.defaultFontPixelWidth * 20 + color: factRow.modelFact.defaultValueAvailable ? (factRow.modelFact.valueEqualsDefault ? qgcPal.text : qgcPal.warningText) : qgcPal.text + text: factRow.modelFact.enumStrings.length === 0 ? factRow.modelFact.valueString + " " + factRow.modelFact.units : factRow.modelFact.enumStringValue + clip: true + } - QGCLabel { - text: factRow.modelFact.shortDescription - } + QGCLabel { + text: factRow.modelFact.shortDescription + } - Component.onCompleted: { - if(_rowWidth < factRow.width + ScreenTools.defaultFontPixelWidth) { - _rowWidth = factRow.width + ScreenTools.defaultFontPixelWidth - } + Component.onCompleted: { + if(_rowWidth < factRow.width + ScreenTools.defaultFontPixelWidth) { + _rowWidth = factRow.width + ScreenTools.defaultFontPixelWidth } } + } - Rectangle { - width: _rowWidth - height: 1 - color: __qgcPal.text - opacity: 0.15 - anchors.bottom: parent.bottom - anchors.left: parent.left - } + Rectangle { + width: _rowWidth + height: 1 + color: qgcPal.text + opacity: 0.15 + anchors.bottom: parent.bottom + anchors.left: parent.left + } - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.LeftButton - onClicked: { - _editorDialogFact = factRow.modelFact - showDialog(editorDialogComponent, qsTr("Parameter Editor"), qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Save) - } + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton + onClicked: { + _editorDialogFact = factRow.modelFact + mainWindow.showDialog(editorDialogComponent, qsTr("Parameter Editor"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Save) } } } - } // QGCViewPanel + } QGCFileDialog { id: fileDialog @@ -350,4 +341,4 @@ QGCView { } } } -} // QGCView +} diff --git a/src/QmlControls/ParameterEditorDialog.qml b/src/QmlControls/ParameterEditorDialog.qml index 001f9a4daf1b7e48d8d4f1e544c4c7b2ca2653ba..d38c6b1ed88302f28943258d651af9e6c57f0b1d 100644 --- a/src/QmlControls/ParameterEditorDialog.qml +++ b/src/QmlControls/ParameterEditorDialog.qml @@ -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 diff --git a/src/QmlControls/QGCFileDialog.qml b/src/QmlControls/QGCFileDialog.qml index cdf6afc387d6a6c4de126e6988a44823139d1eb0..352904b866402d0ada6caa42a094e77f2e5a943c 100644 --- a/src/QmlControls/QGCFileDialog.qml +++ b/src/QmlControls/QGCFileDialog.qml @@ -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() } diff --git a/src/QmlControls/QGCView.qml b/src/QmlControls/QGCView.qml deleted file mode 100644 index 4a4c2cef313167c767b2033012aef975f2cedc94..0000000000000000000000000000000000000000 --- a/src/QmlControls/QGCView.qml +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -/// @file -/// @author Don Gagne - -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 - } - } -} diff --git a/src/QmlControls/QGCViewDialog.qml b/src/QmlControls/QGCViewDialog.qml index 228432734d119843e2b6832008775ca1c5e0aae0..b390e8c8841fc8ccbcd659f57b02b6df660a880b 100644 --- a/src/QmlControls/QGCViewDialog.qml +++ b/src/QmlControls/QGCViewDialog.qml @@ -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 } diff --git a/src/QmlControls/QGCViewDialogContainer.qml b/src/QmlControls/QGCViewDialogContainer.qml index f22dc7a55a275bee3dfb746191d2ca8f5d2a3996..f31aa1d9e6161a1f210b0bf07f3b983739e8f70d 100644 --- a/src/QmlControls/QGCViewDialogContainer.qml +++ b/src/QmlControls/QGCViewDialogContainer.qml @@ -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 + } } diff --git a/src/QmlControls/QGCViewPanel.qml b/src/QmlControls/QGCViewPanel.qml deleted file mode 100644 index cd179138f74dce5858059f4a3e8b5cd690380fd3..0000000000000000000000000000000000000000 --- a/src/QmlControls/QGCViewPanel.qml +++ /dev/null @@ -1,25 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -/// @file -/// @author Don Gagne - -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 { - -} diff --git a/src/QmlControls/QGroundControl.Controls.qmldir b/src/QmlControls/QGroundControl.Controls.qmldir index 5a059c5ee72a210e484ad1dd743253f3e95cb3ca..0bdca15007593b6a8a8d4ef3a23cbe623b1371b7 100644 --- a/src/QmlControls/QGroundControl.Controls.qmldir +++ b/src/QmlControls/QGroundControl.Controls.qmldir @@ -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 diff --git a/src/QmlControls/RCChannelMonitor.qml b/src/QmlControls/RCChannelMonitor.qml index 22d897d08a4aedd75c66ec746473846d62f5497b..b83e8cb27562c5e37d5b0bd86565d5004c9f47e3 100644 --- a/src/QmlControls/RCChannelMonitor.qml +++ b/src/QmlControls/RCChannelMonitor.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 } diff --git a/src/QtLocationPlugin/QMLControl/OfflineMap.qml b/src/QtLocationPlugin/QMLControl/OfflineMap.qml index 7388ba9e2c63fd8650a579401a38ffe7a06726ca..0d41263fd22faea3c079cad6cbe31371f5d433e2 100644 --- a/src/QtLocationPlugin/QMLControl/OfflineMap.qml +++ b/src/QtLocationPlugin/QMLControl/OfflineMap.qml @@ -24,9 +24,8 @@ import QGroundControl.QGCMapEngineManager 1.0 import QGroundControl.FactSystem 1.0 import QGroundControl.FactControls 1.0 -QGCView { +Item { id: offlineMapView - viewPanel: panel anchors.fill: parent property var _currentSelection: null @@ -215,7 +214,6 @@ QGCView { QGCFileDialog { id: fileDialog - qgcView: offlineMapView folder: QGroundControl.settingsManager.appSettings.missionSavePath nameFilters: ["Tile Sets (*.qgctiledb)"] fileExtension: "qgctiledb" @@ -366,8 +364,7 @@ QGCView { } } - QGCViewPanel { - id: panel + Item { anchors.fill: parent FlightMap { @@ -378,7 +375,6 @@ QGCView { allowVehicleLocationCenter: false gesture.flickDeceleration: 3000 mapName: "OfflineMap" - qgcView: offlineMapView property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1 @@ -545,7 +541,7 @@ QGCView { QGCButton { text: qsTr("Delete") width: ScreenTools.defaultFontPixelWidth * (infoView._extraButton ? 6 : 10) - onClicked: showDialog(deleteConfirmationDialogComponent, qsTr("Confirm Delete"), qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No) + onClicked: mainWindow.showDialog(deleteConfirmationDialogComponent, qsTr("Confirm Delete"), mainWindow.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No) } QGCButton { text: qsTr("Ok") @@ -1024,7 +1020,7 @@ QGCView { QGCButton { text: qsTr("Options") width: _buttonSize - onClicked: showDialog(optionsDialogComponent, qsTr("Offline Maps Options"), qgcView.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel) + onClicked: mainWindow.showDialog(optionsDialogComponent, qsTr("Offline Maps Options"), mainWindow.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel) } } @@ -1099,7 +1095,7 @@ QGCView { onClicked: showList() } } - } // QGCViewPanel + } Component { id: exportToDiskProgress @@ -1263,5 +1259,4 @@ QGCView { } } } - -} // QGCView +} diff --git a/src/Taisync/TaisyncSettings.qml b/src/Taisync/TaisyncSettings.qml index 82513fa9bce6514cf743fdf2e98819f43be1471a..fd13dd129902eb1cbe4669a76fa7f763bb8e647f 100644 --- a/src/Taisync/TaisyncSettings.qml +++ b/src/Taisync/TaisyncSettings.qml @@ -27,512 +27,505 @@ import QGroundControl.Palette 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.SettingsManager 1.0 -QGCView { - id: _qgcView - viewPanel: panel +Item { + id: _root color: qgcPal.window anchors.fill: parent anchors.margins: ScreenTools.defaultFontPixelWidth property real _labelWidth: ScreenTools.defaultFontPixelWidth * 26 property real _valueWidth: ScreenTools.defaultFontPixelWidth * 20 - property real _panelWidth: _qgcView.width * _internalWidthRatio + property real _panelWidth: _root.width * _internalWidthRatio property Fact _taisyncEnabledFact: QGroundControl.settingsManager.appSettings.enableTaisync property Fact _taisyncVideoEnabledFact: QGroundControl.settingsManager.appSettings.enableTaisyncVideo property bool _taisyncEnabled: _taisyncEnabledFact.rawValue readonly property real _internalWidthRatio: 0.8 - QGCPalette { id: qgcPal } - - QGCViewPanel { - id: panel - anchors.fill: parent - QGCFlickable { - clip: true - anchors.fill: parent - contentHeight: settingsColumn.height - contentWidth: settingsColumn.width - Column { - id: settingsColumn - width: _qgcView.width - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - anchors.margins: ScreenTools.defaultFontPixelWidth + QGCFlickable { + clip: true + anchors.fill: parent + contentHeight: settingsColumn.height + contentWidth: settingsColumn.width + Column { + id: settingsColumn + width: _root.width + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.margins: ScreenTools.defaultFontPixelWidth + QGCLabel { + text: qsTr("Reboot ground unit for changes to take effect.") + color: qgcPal.colorOrange + visible: QGroundControl.taisyncManager.needReboot + font.family: ScreenTools.demiboldFontFamily + anchors.horizontalCenter: parent.horizontalCenter + } + //----------------------------------------------------------------- + //-- General + Item { + width: _panelWidth + height: generalLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter QGCLabel { - text: qsTr("Reboot ground unit for changes to take effect.") - color: qgcPal.colorOrange - visible: QGroundControl.taisyncManager.needReboot + id: generalLabel + text: qsTr("General") font.family: ScreenTools.demiboldFontFamily - anchors.horizontalCenter: parent.horizontalCenter } - //----------------------------------------------------------------- - //-- General - Item { - width: _panelWidth - height: generalLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - id: generalLabel - text: qsTr("General") - font.family: ScreenTools.demiboldFontFamily + } + Rectangle { + height: generalRow.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + Row { + id: generalRow + spacing: ScreenTools.defaultFontPixelWidth * 4 + anchors.centerIn: parent + Column { + spacing: ScreenTools.defaultFontPixelWidth + FactCheckBox { + text: qsTr("Enable Taisync") + fact: _taisyncEnabledFact + enabled: !QGroundControl.taisyncManager.needReboot + visible: _taisyncEnabledFact.visible + } + FactCheckBox { + text: qsTr("Enable Taisync Video") + fact: _taisyncVideoEnabledFact + visible: _taisyncVideoEnabledFact.visible + enabled: _taisyncEnabled && !QGroundControl.taisyncManager.needReboot + } } } - Rectangle { - height: generalRow.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - Row { - id: generalRow - spacing: ScreenTools.defaultFontPixelWidth * 4 - anchors.centerIn: parent - Column { - spacing: ScreenTools.defaultFontPixelWidth - FactCheckBox { - text: qsTr("Enable Taisync") - fact: _taisyncEnabledFact - enabled: !QGroundControl.taisyncManager.needReboot - visible: _taisyncEnabledFact.visible - } - FactCheckBox { - text: qsTr("Enable Taisync Video") - fact: _taisyncVideoEnabledFact - visible: _taisyncVideoEnabledFact.visible - enabled: _taisyncEnabled && !QGroundControl.taisyncManager.needReboot - } + } + //----------------------------------------------------------------- + //-- Connection Status + Item { + width: _panelWidth + height: statusLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: _taisyncEnabled + QGCLabel { + id: statusLabel + text: qsTr("Connection Status") + font.family: ScreenTools.demiboldFontFamily + } + } + Rectangle { + height: statusCol.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + visible: _taisyncEnabled + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + Column { + id: statusCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + width: parent.width + anchors.centerIn: parent + GridLayout { + anchors.margins: ScreenTools.defaultFontPixelHeight + columnSpacing: ScreenTools.defaultFontPixelWidth * 2 + anchors.horizontalCenter: parent.horizontalCenter + columns: 2 + QGCLabel { + text: qsTr("Ground Unit:") + Layout.minimumWidth: _labelWidth + } + QGCLabel { + text: QGroundControl.taisyncManager.connected ? qsTr("Connected") : qsTr("Not Connected") + color: QGroundControl.taisyncManager.connected ? qgcPal.colorGreen : qgcPal.colorRed + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Air Unit:") + } + QGCLabel { + text: QGroundControl.taisyncManager.linkConnected ? qsTr("Connected") : qsTr("Not Connected") + color: QGroundControl.taisyncManager.linkConnected ? qgcPal.colorGreen : qgcPal.colorRed + } + QGCLabel { + text: qsTr("Uplink RSSI:") + } + QGCLabel { + text: QGroundControl.taisyncManager.linkConnected ? QGroundControl.taisyncManager.uplinkRSSI : "" + } + QGCLabel { + text: qsTr("Downlink RSSI:") + } + QGCLabel { + text: QGroundControl.taisyncManager.linkConnected ? QGroundControl.taisyncManager.downlinkRSSI : "" } } } - //----------------------------------------------------------------- - //-- Connection Status - Item { - width: _panelWidth - height: statusLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: _taisyncEnabled - QGCLabel { - id: statusLabel - text: qsTr("Connection Status") - font.family: ScreenTools.demiboldFontFamily - } + } + //----------------------------------------------------------------- + //-- Device Info + Item { + width: _panelWidth + height: devInfoLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: _taisyncEnabled && QGroundControl.taisyncManager.connected + QGCLabel { + id: devInfoLabel + text: qsTr("Device Info") + font.family: ScreenTools.demiboldFontFamily } - Rectangle { - height: statusCol.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - visible: _taisyncEnabled - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: statusCol - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - width: parent.width - anchors.centerIn: parent - GridLayout { - anchors.margins: ScreenTools.defaultFontPixelHeight - columnSpacing: ScreenTools.defaultFontPixelWidth * 2 - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - QGCLabel { - text: qsTr("Ground Unit:") - Layout.minimumWidth: _labelWidth - } - QGCLabel { - text: QGroundControl.taisyncManager.connected ? qsTr("Connected") : qsTr("Not Connected") - color: QGroundControl.taisyncManager.connected ? qgcPal.colorGreen : qgcPal.colorRed - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Air Unit:") - } - QGCLabel { - text: QGroundControl.taisyncManager.linkConnected ? qsTr("Connected") : qsTr("Not Connected") - color: QGroundControl.taisyncManager.linkConnected ? qgcPal.colorGreen : qgcPal.colorRed - } - QGCLabel { - text: qsTr("Uplink RSSI:") - } - QGCLabel { - text: QGroundControl.taisyncManager.linkConnected ? QGroundControl.taisyncManager.uplinkRSSI : "" - } - QGCLabel { - text: qsTr("Downlink RSSI:") - } - QGCLabel { - text: QGroundControl.taisyncManager.linkConnected ? QGroundControl.taisyncManager.downlinkRSSI : "" - } + } + Rectangle { + height: devInfoCol.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + visible: _taisyncEnabled && QGroundControl.taisyncManager.connected + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + Column { + id: devInfoCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + width: parent.width + anchors.centerIn: parent + GridLayout { + anchors.margins: ScreenTools.defaultFontPixelHeight + columnSpacing: ScreenTools.defaultFontPixelWidth * 2 + anchors.horizontalCenter: parent.horizontalCenter + columns: 2 + QGCLabel { + text: qsTr("Serial Number:") + Layout.minimumWidth: _labelWidth + } + QGCLabel { + text: QGroundControl.taisyncManager.connected ? QGroundControl.taisyncManager.serialNumber : qsTr("") + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Firmware Version:") + } + QGCLabel { + text: QGroundControl.taisyncManager.connected ? QGroundControl.taisyncManager.fwVersion : qsTr("") } } } - //----------------------------------------------------------------- - //-- Device Info - Item { - width: _panelWidth - height: devInfoLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: _taisyncEnabled && QGroundControl.taisyncManager.connected - QGCLabel { - id: devInfoLabel - text: qsTr("Device Info") - font.family: ScreenTools.demiboldFontFamily - } + } + //----------------------------------------------------------------- + //-- Radio Settings + Item { + width: _panelWidth + height: radioSettingsLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: _taisyncEnabled && QGroundControl.taisyncManager.linkConnected + QGCLabel { + id: radioSettingsLabel + text: qsTr("Radio Settings") + font.family: ScreenTools.demiboldFontFamily } - Rectangle { - height: devInfoCol.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - visible: _taisyncEnabled && QGroundControl.taisyncManager.connected - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: devInfoCol - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - width: parent.width - anchors.centerIn: parent - GridLayout { - anchors.margins: ScreenTools.defaultFontPixelHeight - columnSpacing: ScreenTools.defaultFontPixelWidth * 2 - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - QGCLabel { - text: qsTr("Serial Number:") - Layout.minimumWidth: _labelWidth - } - QGCLabel { - text: QGroundControl.taisyncManager.connected ? QGroundControl.taisyncManager.serialNumber : qsTr("") - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Firmware Version:") - } - QGCLabel { - text: QGroundControl.taisyncManager.connected ? QGroundControl.taisyncManager.fwVersion : qsTr("") - } + } + Rectangle { + height: radioSettingsCol.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + visible: _taisyncEnabled && QGroundControl.taisyncManager.linkConnected + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + Column { + id: radioSettingsCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + width: parent.width + anchors.centerIn: parent + GridLayout { + anchors.margins: ScreenTools.defaultFontPixelHeight + columnSpacing: ScreenTools.defaultFontPixelWidth * 2 + anchors.horizontalCenter: parent.horizontalCenter + columns: 2 + QGCLabel { + text: qsTr("Radio Mode:") + Layout.minimumWidth: _labelWidth + } + FactComboBox { + fact: QGroundControl.taisyncManager.radioMode + indexModel: true + enabled: QGroundControl.taisyncManager.linkConnected && !QGroundControl.taisyncManager.needReboot + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Radio Frequency:") + } + FactComboBox { + fact: QGroundControl.taisyncManager.radioChannel + indexModel: true + enabled: QGroundControl.taisyncManager.linkConnected && QGroundControl.taisyncManager.radioMode.rawValue > 0 && !QGroundControl.taisyncManager.needReboot + Layout.minimumWidth: _valueWidth } } } - //----------------------------------------------------------------- - //-- Radio Settings - Item { - width: _panelWidth - height: radioSettingsLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: _taisyncEnabled && QGroundControl.taisyncManager.linkConnected - QGCLabel { - id: radioSettingsLabel - text: qsTr("Radio Settings") - font.family: ScreenTools.demiboldFontFamily - } + } + //----------------------------------------------------------------- + //-- Video Settings + Item { + width: _panelWidth + height: videoSettingsLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: _taisyncEnabled && QGroundControl.taisyncManager.linkConnected + QGCLabel { + id: videoSettingsLabel + text: qsTr("Video Settings") + font.family: ScreenTools.demiboldFontFamily } - Rectangle { - height: radioSettingsCol.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - visible: _taisyncEnabled && QGroundControl.taisyncManager.linkConnected - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: radioSettingsCol - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - width: parent.width - anchors.centerIn: parent - GridLayout { - anchors.margins: ScreenTools.defaultFontPixelHeight - columnSpacing: ScreenTools.defaultFontPixelWidth * 2 - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - QGCLabel { - text: qsTr("Radio Mode:") - Layout.minimumWidth: _labelWidth - } - FactComboBox { - fact: QGroundControl.taisyncManager.radioMode - indexModel: true - enabled: QGroundControl.taisyncManager.linkConnected && !QGroundControl.taisyncManager.needReboot - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Radio Frequency:") - } - FactComboBox { - fact: QGroundControl.taisyncManager.radioChannel - indexModel: true - enabled: QGroundControl.taisyncManager.linkConnected && QGroundControl.taisyncManager.radioMode.rawValue > 0 && !QGroundControl.taisyncManager.needReboot - Layout.minimumWidth: _valueWidth - } + } + Rectangle { + height: videoSettingsCol.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + visible: _taisyncEnabled && QGroundControl.taisyncManager.linkConnected + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + Column { + id: videoSettingsCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + width: parent.width + anchors.centerIn: parent + GridLayout { + anchors.margins: ScreenTools.defaultFontPixelHeight + columnSpacing: ScreenTools.defaultFontPixelWidth * 2 + anchors.horizontalCenter: parent.horizontalCenter + columns: 2 + QGCLabel { + text: qsTr("Video Output:") + Layout.minimumWidth: _labelWidth + } + FactComboBox { + fact: QGroundControl.taisyncManager.videoOutput + indexModel: true + enabled: QGroundControl.taisyncManager.linkConnected && !QGroundControl.taisyncManager.needReboot + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Encoder:") + } + FactComboBox { + fact: QGroundControl.taisyncManager.videoMode + indexModel: true + enabled: QGroundControl.taisyncManager.linkConnected && !QGroundControl.taisyncManager.needReboot + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Bit Rate:") + } + FactComboBox { + fact: QGroundControl.taisyncManager.videoRate + indexModel: true + enabled: QGroundControl.taisyncManager.linkConnected && !QGroundControl.taisyncManager.needReboot + Layout.minimumWidth: _valueWidth } } } - //----------------------------------------------------------------- - //-- Video Settings - Item { - width: _panelWidth - height: videoSettingsLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: _taisyncEnabled && QGroundControl.taisyncManager.linkConnected - QGCLabel { - id: videoSettingsLabel - text: qsTr("Video Settings") - font.family: ScreenTools.demiboldFontFamily - } + } + //----------------------------------------------------------------- + //-- RTSP Settings + Item { + width: _panelWidth + height: rtspSettingsLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: _taisyncEnabled && QGroundControl.taisyncManager.connected + QGCLabel { + id: rtspSettingsLabel + text: qsTr("Streaming Settings") + font.family: ScreenTools.demiboldFontFamily } - Rectangle { - height: videoSettingsCol.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - visible: _taisyncEnabled && QGroundControl.taisyncManager.linkConnected - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: videoSettingsCol - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - width: parent.width - anchors.centerIn: parent - GridLayout { - anchors.margins: ScreenTools.defaultFontPixelHeight - columnSpacing: ScreenTools.defaultFontPixelWidth * 2 - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - QGCLabel { - text: qsTr("Video Output:") - Layout.minimumWidth: _labelWidth - } - FactComboBox { - fact: QGroundControl.taisyncManager.videoOutput - indexModel: true - enabled: QGroundControl.taisyncManager.linkConnected && !QGroundControl.taisyncManager.needReboot - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Encoder:") - } - FactComboBox { - fact: QGroundControl.taisyncManager.videoMode - indexModel: true - enabled: QGroundControl.taisyncManager.linkConnected && !QGroundControl.taisyncManager.needReboot - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Bit Rate:") - } - FactComboBox { - fact: QGroundControl.taisyncManager.videoRate - indexModel: true - enabled: QGroundControl.taisyncManager.linkConnected && !QGroundControl.taisyncManager.needReboot - Layout.minimumWidth: _valueWidth - } + } + Rectangle { + height: rtspSettingsCol.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + visible: _taisyncEnabled && QGroundControl.taisyncManager.connected + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + Column { + id: rtspSettingsCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + width: parent.width + anchors.centerIn: parent + GridLayout { + anchors.margins: ScreenTools.defaultFontPixelHeight + columnSpacing: ScreenTools.defaultFontPixelWidth * 2 + anchors.horizontalCenter: parent.horizontalCenter + columns: 2 + QGCLabel { + text: qsTr("RTSP URI:") + Layout.minimumWidth: _labelWidth + } + QGCTextField { + id: rtspURI + text: QGroundControl.taisyncManager.rtspURI + enabled: QGroundControl.taisyncManager.connected && !QGroundControl.taisyncManager.needReboot + inputMethodHints: Qt.ImhUrlCharactersOnly + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Account:") + } + QGCTextField { + id: rtspAccount + text: QGroundControl.taisyncManager.rtspAccount + enabled: QGroundControl.taisyncManager.connected && !QGroundControl.taisyncManager.needReboot + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Password:") + } + QGCTextField { + id: rtspPassword + text: QGroundControl.taisyncManager.rtspPassword + enabled: QGroundControl.taisyncManager.connected && !QGroundControl.taisyncManager.needReboot + inputMethodHints: Qt.ImhHiddenText + Layout.minimumWidth: _valueWidth } } - } - //----------------------------------------------------------------- - //-- RTSP Settings - Item { - width: _panelWidth - height: rtspSettingsLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: _taisyncEnabled && QGroundControl.taisyncManager.connected - QGCLabel { - id: rtspSettingsLabel - text: qsTr("Streaming Settings") - font.family: ScreenTools.demiboldFontFamily + Item { + width: 1 + height: ScreenTools.defaultFontPixelHeight } - } - Rectangle { - height: rtspSettingsCol.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - visible: _taisyncEnabled && QGroundControl.taisyncManager.connected - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: rtspSettingsCol - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - width: parent.width - anchors.centerIn: parent - GridLayout { - anchors.margins: ScreenTools.defaultFontPixelHeight - columnSpacing: ScreenTools.defaultFontPixelWidth * 2 - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - QGCLabel { - text: qsTr("RTSP URI:") - Layout.minimumWidth: _labelWidth - } - QGCTextField { - id: rtspURI - text: QGroundControl.taisyncManager.rtspURI - enabled: QGroundControl.taisyncManager.connected && !QGroundControl.taisyncManager.needReboot - inputMethodHints: Qt.ImhUrlCharactersOnly - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Account:") - } - QGCTextField { - id: rtspAccount - text: QGroundControl.taisyncManager.rtspAccount - enabled: QGroundControl.taisyncManager.connected && !QGroundControl.taisyncManager.needReboot - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Password:") - } - QGCTextField { - id: rtspPassword - text: QGroundControl.taisyncManager.rtspPassword - enabled: QGroundControl.taisyncManager.connected && !QGroundControl.taisyncManager.needReboot - inputMethodHints: Qt.ImhHiddenText - Layout.minimumWidth: _valueWidth - } + QGCButton { + function testEnabled() { + if(!QGroundControl.taisyncManager.connected) + return false + if(rtspPassword.text === QGroundControl.taisyncManager.rtspPassword && + rtspAccount.text === QGroundControl.taisyncManager.rtspAccount && + rtspURI.text === QGroundControl.taisyncManager.rtspURI) + return false + if(rtspURI === "") + return false + return true } - Item { - width: 1 - height: ScreenTools.defaultFontPixelHeight - } - QGCButton { - function testEnabled() { - if(!QGroundControl.taisyncManager.connected) - return false - if(rtspPassword.text === QGroundControl.taisyncManager.rtspPassword && - rtspAccount.text === QGroundControl.taisyncManager.rtspAccount && - rtspURI.text === QGroundControl.taisyncManager.rtspURI) - return false - if(rtspURI === "") - return false - return true - } - enabled: testEnabled() && !QGroundControl.taisyncManager.needReboot - text: qsTr("Apply") - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - setRTSPDialog.open() - } - MessageDialog { - id: setRTSPDialog - icon: StandardIcon.Warning - standardButtons: StandardButton.Yes | StandardButton.No - title: qsTr("Set Streaming Settings") - text: qsTr("Once changed, you will need to reboot the ground unit for the changes to take effect.\n\nConfirm change?") - onYes: { - QGroundControl.taisyncManager.setRTSPSettings(rtspURI.text, rtspAccount.text, rtspPassword.text) - setRTSPDialog.close() - } - onNo: { - setRTSPDialog.close() - } + enabled: testEnabled() && !QGroundControl.taisyncManager.needReboot + text: qsTr("Apply") + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + setRTSPDialog.open() + } + MessageDialog { + id: setRTSPDialog + icon: StandardIcon.Warning + standardButtons: StandardButton.Yes | StandardButton.No + title: qsTr("Set Streaming Settings") + text: qsTr("Once changed, you will need to reboot the ground unit for the changes to take effect.\n\nConfirm change?") + onYes: { + QGroundControl.taisyncManager.setRTSPSettings(rtspURI.text, rtspAccount.text, rtspPassword.text) + setRTSPDialog.close() + } + onNo: { + setRTSPDialog.close() } } } } - //----------------------------------------------------------------- - //-- IP Settings - Item { - width: _panelWidth - height: ipSettingsLabel.height - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: _taisyncEnabled && (!ScreenTools.isiOS && !ScreenTools.isAndroid) - QGCLabel { - id: ipSettingsLabel - text: qsTr("Network Settings") - font.family: ScreenTools.demiboldFontFamily - } + } + //----------------------------------------------------------------- + //-- IP Settings + Item { + width: _panelWidth + height: ipSettingsLabel.height + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + visible: _taisyncEnabled && (!ScreenTools.isiOS && !ScreenTools.isAndroid) + QGCLabel { + id: ipSettingsLabel + text: qsTr("Network Settings") + font.family: ScreenTools.demiboldFontFamily } - Rectangle { - height: ipSettingsCol.height + (ScreenTools.defaultFontPixelHeight * 2) - width: _panelWidth - color: qgcPal.windowShade - visible: _taisyncEnabled && (!ScreenTools.isiOS && !ScreenTools.isAndroid) - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: ipSettingsCol - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - width: parent.width - anchors.centerIn: parent - GridLayout { - anchors.margins: ScreenTools.defaultFontPixelHeight - columnSpacing: ScreenTools.defaultFontPixelWidth * 2 - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - QGCLabel { - text: qsTr("Local IP Address:") - Layout.minimumWidth: _labelWidth - } - QGCTextField { - id: localIP - text: QGroundControl.taisyncManager.localIPAddr - enabled: !QGroundControl.taisyncManager.needReboot - inputMethodHints: Qt.ImhFormattedNumbersOnly - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Ground Unit IP Address:") - } - QGCTextField { - id: remoteIP - text: QGroundControl.taisyncManager.remoteIPAddr - enabled: !QGroundControl.taisyncManager.needReboot - inputMethodHints: Qt.ImhFormattedNumbersOnly - Layout.minimumWidth: _valueWidth - } - QGCLabel { - text: qsTr("Network Mask:") - } - QGCTextField { - id: netMask - text: QGroundControl.taisyncManager.netMask - enabled: !QGroundControl.taisyncManager.needReboot - inputMethodHints: Qt.ImhFormattedNumbersOnly - Layout.minimumWidth: _valueWidth - } + } + Rectangle { + height: ipSettingsCol.height + (ScreenTools.defaultFontPixelHeight * 2) + width: _panelWidth + color: qgcPal.windowShade + visible: _taisyncEnabled && (!ScreenTools.isiOS && !ScreenTools.isAndroid) + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.horizontalCenter: parent.horizontalCenter + Column { + id: ipSettingsCol + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + width: parent.width + anchors.centerIn: parent + GridLayout { + anchors.margins: ScreenTools.defaultFontPixelHeight + columnSpacing: ScreenTools.defaultFontPixelWidth * 2 + anchors.horizontalCenter: parent.horizontalCenter + columns: 2 + QGCLabel { + text: qsTr("Local IP Address:") + Layout.minimumWidth: _labelWidth } - Item { - width: 1 - height: ScreenTools.defaultFontPixelHeight + QGCTextField { + id: localIP + text: QGroundControl.taisyncManager.localIPAddr + enabled: !QGroundControl.taisyncManager.needReboot + inputMethodHints: Qt.ImhFormattedNumbersOnly + Layout.minimumWidth: _valueWidth } - QGCButton { - function validateIPaddress(ipaddress) { - if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress)) - return true - return false - } - function testEnabled() { - if(localIP.text === QGroundControl.taisyncManager.localIPAddr && - remoteIP.text === QGroundControl.taisyncManager.remoteIPAddr && - netMask.text === QGroundControl.taisyncManager.netMask) - return false - if(!validateIPaddress(localIP.text)) return false - if(!validateIPaddress(remoteIP.text)) return false - if(!validateIPaddress(netMask.text)) return false + QGCLabel { + text: qsTr("Ground Unit IP Address:") + } + QGCTextField { + id: remoteIP + text: QGroundControl.taisyncManager.remoteIPAddr + enabled: !QGroundControl.taisyncManager.needReboot + inputMethodHints: Qt.ImhFormattedNumbersOnly + Layout.minimumWidth: _valueWidth + } + QGCLabel { + text: qsTr("Network Mask:") + } + QGCTextField { + id: netMask + text: QGroundControl.taisyncManager.netMask + enabled: !QGroundControl.taisyncManager.needReboot + inputMethodHints: Qt.ImhFormattedNumbersOnly + Layout.minimumWidth: _valueWidth + } + } + Item { + width: 1 + height: ScreenTools.defaultFontPixelHeight + } + QGCButton { + function validateIPaddress(ipaddress) { + if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress)) return true - } - enabled: testEnabled() && !QGroundControl.taisyncManager.needReboot - text: qsTr("Apply") - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - setIPDialog.open() - } - MessageDialog { - id: setIPDialog - icon: StandardIcon.Warning - standardButtons: StandardButton.Yes | StandardButton.No - title: qsTr("Set Network Settings") - text: qsTr("Once changed, you will need to reboot the ground unit for the changes to take effect. The local IP address must match the one entered (%1).\n\nConfirm change?").arg(localIP.text) - onYes: { - QGroundControl.taisyncManager.setIPSettings(localIP.text, remoteIP.text, netMask.text) - setIPDialog.close() - } - onNo: { - setIPDialog.close() - } + return false + } + function testEnabled() { + if(localIP.text === QGroundControl.taisyncManager.localIPAddr && + remoteIP.text === QGroundControl.taisyncManager.remoteIPAddr && + netMask.text === QGroundControl.taisyncManager.netMask) + return false + if(!validateIPaddress(localIP.text)) return false + if(!validateIPaddress(remoteIP.text)) return false + if(!validateIPaddress(netMask.text)) return false + return true + } + enabled: testEnabled() && !QGroundControl.taisyncManager.needReboot + text: qsTr("Apply") + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + setIPDialog.open() + } + MessageDialog { + id: setIPDialog + icon: StandardIcon.Warning + standardButtons: StandardButton.Yes | StandardButton.No + title: qsTr("Set Network Settings") + text: qsTr("Once changed, you will need to reboot the ground unit for the changes to take effect. The local IP address must match the one entered (%1).\n\nConfirm change?").arg(localIP.text) + onYes: { + QGroundControl.taisyncManager.setIPSettings(localIP.text, remoteIP.text, netMask.text) + setIPDialog.close() + } + onNo: { + setIPDialog.close() } } } diff --git a/src/VehicleSetup/FirmwareUpgrade.qml b/src/VehicleSetup/FirmwareUpgrade.qml index 113506ae7959199301ddf1da2dc7fd658a2813d8..13c58f03090d971e8a3f5be335d503fcc7bf74b7 100644 --- a/src/VehicleSetup/FirmwareUpgrade.qml +++ b/src/VehicleSetup/FirmwareUpgrade.qml @@ -87,10 +87,7 @@ SetupPage { Component.onCompleted: { controllerCompleted = true - if (qgcView.completedSignalled) { - // We can only start the board search when the Qml and Controller are completely done loading - controller.startBoardSearch() - } + controller.startBoardSearch() } onActiveVehicleChanged: { @@ -123,7 +120,7 @@ SetupPage { // We end up here when we detect a board plugged in after we've started upgrade statusTextArea.append(highlightPrefix + qsTr("Found device") + highlightSuffix + ": " + controller.boardType) if (controller.pixhawkBoard || controller.px4FlowBoard) { - showDialog(pixhawkFirmwareSelectDialogComponent, title, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) + mainWindow.showDialog(pixhawkFirmwareSelectDialogComponent, title, mainWindow.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) } } } diff --git a/src/VehicleSetup/JoystickConfig.qml b/src/VehicleSetup/JoystickConfig.qml index db6c1a4af40f6ac2a99991e9a95497087a69f4a8..782d97853a308389f7bcf92d06a7a28c6a3f88a6 100644 --- a/src/VehicleSetup/JoystickConfig.qml +++ b/src/VehicleSetup/JoystickConfig.qml @@ -49,14 +49,13 @@ SetupPage { property bool controllerCompleted: false property bool controllerAndViewReady: false - readonly property real labelToMonitorMargin: defaultTextWidth * 3 + readonly property real labelToMonitorMargin: ScreenTools.defaultFontPixelWidth * 3 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeJoystick: joystickManager.activeJoystick JoystickConfigController { id: controller - factPanel: joystickPage.viewPanel statusText: statusText cancelButton: cancelButton nextButton: nextButton @@ -117,7 +116,7 @@ SetupPage { // Center point Rectangle { anchors.horizontalCenter: parent.horizontalCenter - width: defaultTextWidth / 2 + width: ScreenTools.defaultFontPixelWidth / 2 height: parent.height color: qgcPal.window } @@ -188,7 +187,7 @@ SetupPage { QGCLabel { id: rollLabel - width: defaultTextWidth * 10 + width: ScreenTools.defaultFontPixelWidth * 10 text: _activeVehicle.sub ? qsTr("Lateral") : qsTr("Roll") } @@ -200,7 +199,7 @@ SetupPage { width: 100 sourceComponent: axisMonitorDisplayComponent - property real defaultTextWidth: ScreenTools.defaultFontPixelWidth + property real ScreenTools.defaultFontPixelWidth: ScreenTools.defaultFontPixelWidth property bool mapped: controller.rollAxisMapped property bool reversed: controller.rollAxisReversed } @@ -218,7 +217,7 @@ SetupPage { QGCLabel { id: pitchLabel - width: defaultTextWidth * 10 + width: ScreenTools.defaultFontPixelWidth * 10 text: _activeVehicle.sub ? qsTr("Forward") : qsTr("Pitch") } @@ -230,7 +229,7 @@ SetupPage { width: 100 sourceComponent: axisMonitorDisplayComponent - property real defaultTextWidth: ScreenTools.defaultFontPixelWidth + property real ScreenTools.defaultFontPixelWidth: ScreenTools.defaultFontPixelWidth property bool mapped: controller.pitchAxisMapped property bool reversed: controller.pitchAxisReversed } @@ -248,7 +247,7 @@ SetupPage { QGCLabel { id: yawLabel - width: defaultTextWidth * 10 + width: ScreenTools.defaultFontPixelWidth * 10 text: qsTr("Yaw") } @@ -260,7 +259,7 @@ SetupPage { width: 100 sourceComponent: axisMonitorDisplayComponent - property real defaultTextWidth: ScreenTools.defaultFontPixelWidth + property real ScreenTools.defaultFontPixelWidth: ScreenTools.defaultFontPixelWidth property bool mapped: controller.yawAxisMapped property bool reversed: controller.yawAxisReversed } @@ -278,7 +277,7 @@ SetupPage { QGCLabel { id: throttleLabel - width: defaultTextWidth * 10 + width: ScreenTools.defaultFontPixelWidth * 10 text: qsTr("Throttle") } @@ -290,7 +289,7 @@ SetupPage { width: 100 sourceComponent: axisMonitorDisplayComponent - property real defaultTextWidth: ScreenTools.defaultFontPixelWidth + property real ScreenTools.defaultFontPixelWidth: ScreenTools.defaultFontPixelWidth property bool mapped: controller.throttleAxisMapped property bool reversed: controller.throttleAxisReversed } @@ -740,7 +739,7 @@ SetupPage { id: rightColumn anchors.top: parent.top anchors.right: parent.right - width: Math.min(joystickPage.defaultTextWidth * 35, availableWidth * 0.4) + width: Math.min(joystickPage.ScreenTools.defaultFontPixelWidth * 35, availableWidth * 0.4) spacing: ScreenTools.defaultFontPixelHeight / 2 Row { @@ -843,7 +842,7 @@ SetupPage { sourceComponent: axisMonitorDisplayComponent Component.onCompleted: item.narrowIndicator = true - property real defaultTextWidth: ScreenTools.defaultFontPixelWidth + property real ScreenTools.defaultFontPixelWidth: ScreenTools.defaultFontPixelWidth property bool mapped: true readonly property bool reversed: false diff --git a/src/VehicleSetup/PX4FlowSensor.qml b/src/VehicleSetup/PX4FlowSensor.qml index bae6244eb9b45685b804065ff1fdbb707ed574ba..2d3141561665279ca0b09b5a698688c0083bdb3f 100644 --- a/src/VehicleSetup/PX4FlowSensor.qml +++ b/src/VehicleSetup/PX4FlowSensor.qml @@ -15,37 +15,20 @@ import QtQuick.Dialogs 1.2 import QGroundControl 1.0 import QGroundControl.Controls 1.0 -import QGroundControl.FactSystem 1.0 -import QGroundControl.FactControls 1.0 -import QGroundControl.Palette 1.0 -import QGroundControl.Controllers 1.0 import QGroundControl.ScreenTools 1.0 -QGCView { - id: qgcView - viewPanel: panel - - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle - - QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } - - QGCViewPanel { - id: panel - anchors.fill: parent - - QGCLabel { - id: titleLabel - text: qsTr("PX4Flow Camera") - font.family: ScreenTools.demiboldFontFamily - } - - Image { - source: _activeVehicle ? "image://QGCImages/" + _activeVehicle.id + "/" + _activeVehicle.flowImageIndex : "" - width: parent.width * 0.5 - height: width * 0.75 - cache: false - anchors.centerIn: parent - fillMode: Image.PreserveAspectFit - } +Item { + QGCLabel { + id: titleLabel + text: qsTr("PX4Flow Camera") + font.family: ScreenTools.demiboldFontFamily + } + Image { + source: activeVehicle ? "image://QGCImages/" + activeVehicle.id + "/" + activeVehicle.flowImageIndex : "" + width: parent.width * 0.5 + height: width * 0.75 + cache: false + fillMode: Image.PreserveAspectFit + anchors.centerIn: parent } } diff --git a/src/ViewWidgets/CustomCommandWidget.qml b/src/ViewWidgets/CustomCommandWidget.qml index fae5abf1471777da76df5df2618860ff95f128ff..077cb4bf0dbdfa8b0066275d2e620d4f556581ee 100644 --- a/src/ViewWidgets/CustomCommandWidget.qml +++ b/src/ViewWidgets/CustomCommandWidget.qml @@ -18,9 +18,7 @@ import QGroundControl.Controls 1.0 import QGroundControl.Controllers 1.0 import QGroundControl.ScreenTools 1.0 -QGCView { - id: qgcView - viewPanel: panel +Item { property var _activeVehicle: QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable ? QGroundControl.multiVehicleManager.activeVehicle : null property real _margins: ScreenTools.defaultFontPixelHeight @@ -40,8 +38,6 @@ QGCView { CustomCommandWidgetController { id: controller - factPanel: panel - onCustomQmlFileChanged: _updateLoader() } @@ -62,8 +58,7 @@ QGCView { } } - QGCViewPanel { - id: panel + Item { anchors.fill: parent Rectangle { diff --git a/src/api/QGCCorePlugin.cc b/src/api/QGCCorePlugin.cc index 5358b08d78ac3dc1076af9d2ad2876ba62c94b69..2da91e0d74b77017a5ece841e226651caaed01a4 100644 --- a/src/api/QGCCorePlugin.cc +++ b/src/api/QGCCorePlugin.cc @@ -178,7 +178,7 @@ QVariantList &QGCCorePlugin::settingsPages() return _p->settingsList; } -QVariantList& QGCCorePlugin::instrumentPages(void) +QVariantList& QGCCorePlugin::instrumentPages() { if (!_p->valuesPageWidgetInfo) { _p->valuesPageWidgetInfo = new QmlComponentInfo(tr("Values"), QUrl::fromUserInput("qrc:/qml/ValuePageWidget.qml")); @@ -280,7 +280,7 @@ void QGCCorePlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorI Q_UNUSED(colorInfo); } -QString QGCCorePlugin::showAdvancedUIMessage(void) const +QString QGCCorePlugin::showAdvancedUIMessage() const { return tr("WARNING: You are about to enter Advanced Mode. " "If used incorrectly, this may cause your vehicle to malfunction thus voiding your warranty. " @@ -300,7 +300,7 @@ QQmlApplicationEngine* QGCCorePlugin::createRootWindow(QObject *parent) pEngine->addImportPath("qrc:/qml"); pEngine->rootContext()->setContextProperty("joystickManager", qgcApp()->toolbox()->joystickManager()); pEngine->rootContext()->setContextProperty("debugMessageModel", AppMessages::getModel()); - pEngine->load(QUrl(QStringLiteral("qrc:/qml/MainWindowNative.qml"))); + pEngine->load(QUrl(QStringLiteral("qrc:/qml/MainQmlWindow.qml"))); return pEngine; } @@ -313,7 +313,7 @@ bool QGCCorePlugin::mavlinkMessage(Vehicle* vehicle, LinkInterface* link, mavlin return true; } -QmlObjectListModel* QGCCorePlugin::customMapItems(void) +QmlObjectListModel* QGCCorePlugin::customMapItems() { return &_p->_emptyCustomMapItems; } @@ -323,12 +323,12 @@ VideoReceiver* QGCCorePlugin::createVideoReceiver(QObject* parent) return new VideoReceiver(parent); } -bool QGCCorePlugin::guidedActionsControllerLogging(void) const +bool QGCCorePlugin::guidedActionsControllerLogging() const { return GuidedActionsControllerLog().isDebugEnabled(); } -QString QGCCorePlugin::stableVersionCheckFileUrl(void) const +QString QGCCorePlugin::stableVersionCheckFileUrl() const { #ifdef QGC_CUSTOM_BUILD // Custom builds must override to turn on and provide their own location diff --git a/src/api/QGCCorePlugin.h b/src/api/QGCCorePlugin.h index a4812577ec933c2593e3647e866efb722b113ad0..1162b541814a244d985c50c60dcfb424db897566 100644 --- a/src/api/QGCCorePlugin.h +++ b/src/api/QGCCorePlugin.h @@ -52,23 +52,23 @@ public: Q_PROPERTY(QString brandImageOutdoor READ brandImageOutdoor CONSTANT) Q_PROPERTY(QmlObjectListModel* customMapItems READ customMapItems CONSTANT) - Q_INVOKABLE bool guidedActionsControllerLogging(void) const; + Q_INVOKABLE bool guidedActionsControllerLogging() const; /// The list of settings under the Settings Menu /// @return A list of QGCSettings - virtual QVariantList& settingsPages(void); + virtual QVariantList& settingsPages(); /// The list of PageWidget pages shown in the instrument panel /// @return A list of QmlPageInfo - virtual QVariantList& instrumentPages(void); + virtual QVariantList& instrumentPages(); /// The default settings panel to show /// @return The settings index - virtual int defaultSettings(void); + virtual int defaultSettings(); /// Global options /// @return An instance of QGCOptions - virtual QGCOptions* options(void); + virtual QGCOptions* options(); /// Allows the core plugin to override the visibility for a settings group /// @param name - SettingsGroup name @@ -82,13 +82,13 @@ public: virtual bool adjustSettingMetaData(const QString& settingsGroup, FactMetaData& metaData); /// Return the resource file which contains the brand image for for Indoor theme. - virtual QString brandImageIndoor(void) const { return QString(); } + virtual QString brandImageIndoor() const { return QString(); } /// Return the resource file which contains the brand image for for Outdoor theme. - virtual QString brandImageOutdoor(void) const { return QString(); } + virtual QString brandImageOutdoor() const { return QString(); } /// @return The message to show to the user when they a re prompted to confirm turning on advanced ui. - virtual QString showAdvancedUIMessage(void) const; + virtual QString showAdvancedUIMessage() const; /// @return An instance of an alternate position source (or NULL if not available) virtual QGeoPositionInfoSource* createPositionSource(QObject* parent) { Q_UNUSED(parent); return nullptr; } @@ -111,7 +111,7 @@ public: /// Allows custom builds to add custom items to the FlightMap. Objects put into QmlObjectListModel /// should derive from QmlComponentInfo and set the url property. - virtual QmlObjectListModel* customMapItems(void); + virtual QmlObjectListModel* customMapItems(); /// Allows custom builds to add custom items to the plan file. Either before the document is /// created or after. @@ -133,19 +133,19 @@ public: /// The contents of this file should be a single line in the form: /// v3.4.4 /// This indicates the latest stable version number. - virtual QString stableVersionCheckFileUrl(void) const; + virtual QString stableVersionCheckFileUrl() const; /// Returns the user visible url to show user where to download new stable builds from. /// Custom builds must override to provide their own location. - virtual QString stableDownloadLocation(void) const { return QString("qgroundcontrol.com"); } + virtual QString stableDownloadLocation() const { return QString("qgroundcontrol.com"); } /// Returns the complex mission items to display in the Plan UI /// @param complexMissionItemNames Default set of complex items /// @return Complex items to be made available to user virtual QStringList complexMissionItemNames(Vehicle* vehicle, const QStringList& complexMissionItemNames) { Q_UNUSED(vehicle); return complexMissionItemNames; } - bool showTouchAreas(void) const { return _showTouchAreas; } - bool showAdvancedUI(void) const { return _showAdvancedUI; } + bool showTouchAreas() const { return _showTouchAreas; } + bool showAdvancedUI() const { return _showAdvancedUI; } void setShowTouchAreas(bool show); void setShowAdvancedUI(bool show); @@ -153,8 +153,8 @@ public: void setToolbox (QGCToolbox* toolbox); signals: - void settingsPagesChanged (void); - void instrumentPagesChanged (void); + void settingsPagesChanged (); + void instrumentPagesChanged (); void showTouchAreasChanged (bool showTouchAreas); void showAdvancedUIChanged (bool showAdvancedUI); diff --git a/src/api/QGCOptions.cc b/src/api/QGCOptions.cc index 0955cec12d1e46520cf663d8d759ebd24ef45479..4d0a90e2ae766f8ae507d2cbc89114237db83402 100644 --- a/src/api/QGCOptions.cc +++ b/src/api/QGCOptions.cc @@ -16,7 +16,7 @@ QGCOptions::QGCOptions(QObject* parent) : QObject(parent) - , _defaultInstrumentWidget(NULL) + , _defaultInstrumentWidget(nullptr) { qmlRegisterUncreatableType("QGroundControl", 1, 0, "CustomInstrumentWidget", "Reference only"); } @@ -30,9 +30,15 @@ QGCOptions::instrumentWidget() return _defaultInstrumentWidget; } +QUrl +QGCOptions::mainToolbarIndicatorsUrl() const +{ + return QUrl(QStringLiteral("qrc:/toolbar/MainToolBarIndicators.qml")); +} + + CustomInstrumentWidget::CustomInstrumentWidget(QObject* parent) : QObject(parent) { } - diff --git a/src/api/QGCOptions.h b/src/api/QGCOptions.h index 39a400fbebd8247ff20b2195288e4804e3589080..695630efe7c7f28c0781bdd7081c65af549197ef 100644 --- a/src/api/QGCOptions.h +++ b/src/api/QGCOptions.h @@ -22,13 +22,14 @@ class QGCOptions : public QObject { Q_OBJECT public: - QGCOptions(QObject* parent = NULL); + QGCOptions(QObject* parent = nullptr); Q_PROPERTY(bool combineSettingsAndSetup READ combineSettingsAndSetup CONSTANT) Q_PROPERTY(double toolbarHeightMultiplier READ toolbarHeightMultiplier CONSTANT) Q_PROPERTY(bool enablePlanViewSelector READ enablePlanViewSelector CONSTANT) Q_PROPERTY(CustomInstrumentWidget* instrumentWidget READ instrumentWidget CONSTANT) Q_PROPERTY(QUrl flyViewOverlay READ flyViewOverlay CONSTANT) + Q_PROPERTY(QUrl mainToolbarIndicatorsUrl READ mainToolbarIndicatorsUrl CONSTANT) Q_PROPERTY(bool showSensorCalibrationCompass READ showSensorCalibrationCompass NOTIFY showSensorCalibrationCompassChanged) Q_PROPERTY(bool showSensorCalibrationGyro READ showSensorCalibrationGyro NOTIFY showSensorCalibrationGyroChanged) Q_PROPERTY(bool showSensorCalibrationAccel READ showSensorCalibrationAccel NOTIFY showSensorCalibrationAccelChanged) @@ -77,6 +78,8 @@ public: /// Allows access to the full fly view window virtual QUrl flyViewOverlay () const { return QUrl(); } + /// Allows replacing the toolbar container + virtual QUrl mainToolbarIndicatorsUrl () const; /// By returning false you can hide the following sensor calibration pages virtual bool showSensorCalibrationCompass () const { return true; } virtual bool showSensorCalibrationGyro () const { return true; } diff --git a/src/ui/MainQmlWindow.qml b/src/ui/MainQmlWindow.qml new file mode 100644 index 0000000000000000000000000000000000000000..7321327de2dd4904eb26b83d9c8cc4919e77bf37 --- /dev/null +++ b/src/ui/MainQmlWindow.qml @@ -0,0 +1,705 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + + +import QtQuick 2.12 +import QtQuick.Controls 2.4 +import QtQuick.Dialogs 1.3 +import QtQuick.Layouts 1.12 + +import QGroundControl 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.FlightDisplay 1.0 +import QGroundControl.FlightMap 1.0 + +/// Native QML top level window +ApplicationWindow { + id: mainWindow + width: 1024 + height: 768 + visible: true + + Component.onCompleted: { + toolbarIndicators.source = _mainToolbarIndicators + } + + readonly property real _topBottomMargins: ScreenTools.defaultFontPixelHeight * 0.5 + readonly property string _mainToolbarIndicators: QGroundControl.corePlugin.options.mainToolbarIndicatorsUrl + readonly property string _settingsViewSource: "AppSettings.qml" + readonly property string _setupViewSource: "SetupView.qml" + readonly property string _planViewSource: "PlanView.qml" + readonly property string _analyzeViewSource: !ScreenTools.isMobile ? "AnalyzeView.qml" : "MavlinkConsolePage.qml" + + //------------------------------------------------------------------------- + //-- Global Scope Variables + + property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle + property bool communicationLost: activeVehicle ? activeVehicle.connectionLost : false + property string formatedMessage: activeVehicle ? activeVehicle.formatedMessage : "" + + readonly property string navButtonWidth: ScreenTools.defaultFontPixelWidth * 24 + readonly property real defaultTextHeight: ScreenTools.defaultFontPixelHeight + readonly property real defaultTextWidth: ScreenTools.defaultFontPixelWidth + + QGCPalette { id: qgcPal; colorGroupEnabled: true } + + //------------------------------------------------------------------------- + //-- Global Scope Functions + + function disableToolbar() { + drawer.enabled = false + } + + function enableToolbar() { + drawer.enabled = true + } + + function viewSwitch(isPlanView) { + enableToolbar() + drawer.close() + if(isPlanView) { + + } else { + if(toolbarIndicators.source !== _mainToolbarIndicators) { + toolbarIndicators.source = _mainToolbarIndicators + } + } + } + + function showFlyView() { + viewSwitch(false) + mainContentWindow.source = "" + if(toolbarIndicators.source !== _mainToolbarIndicators) { + toolbarIndicators.source = _mainToolbarIndicators + } + } + + function showPlanView() { + viewSwitch(true) + if (mainContentWindow.source !== _planViewSource) { + mainContentWindow.source = _planViewSource + } + } + + function showAnalyzeView() { + viewSwitch(false) + if (mainContentWindow.source !== _analyzeViewSource) { + mainContentWindow.source = _analyzeViewSource + } + } + + function showSetupView() { + viewSwitch(false) + if (mainContentWindow.source !== _setupViewSource) { + mainContentWindow.source = _setupViewSource + } + } + + function showSettingsView() { + viewSwitch(false) + if (mainContentWindow.source !== _settingsViewSource) { + mainContentWindow.source = _settingsViewSource + } + } + + //------------------------------------------------------------------------- + //-- Global simple message dialog + + function showMessageDialog(title, text) { + if(simpleMessageDialog.visible) { + simpleMessageDialog.close() + } + simpleMessageDialog.title = title + simpleMessageDialog.text = text + simpleMessageDialog.open() + } + + MessageDialog { + id: simpleMessageDialog + standardButtons: StandardButton.Ok + modality: Qt.ApplicationModal + visible: false + } + + //------------------------------------------------------------------------- + //-- Global complex dialog + + /// Shows a QGCViewDialog component + /// @param component 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) { + var dialogWidth = charWidth === showDialogFullWidth ? mainWindow.width : ScreenTools.defaultFontPixelWidth * charWidth + mainWindowDialog.width = dialogWidth + mainWindowDialog.dialogComponent = component + mainWindowDialog.dialogTitle = title + mainWindowDialog.dialogButtons = buttons + mainWindowDialog.open() + } + + Drawer { + id: mainWindowDialog + y: mainWindow.header.height + height: mainWindow.height - mainWindow.header.height + edge: Qt.RightEdge + interactive: false + background: Rectangle { + color: qgcPal.windowShadeDark + } + property var dialogComponent: null + property var dialogButtons: null + property string dialogTitle: "" + Loader { + id: dlgLoader + anchors.fill: parent + onLoaded: { + item.setupDialogButtons() + } + } + onOpened: { + dlgLoader.source = "QGCViewDialogContainer.qml" + } + onClosed: { + dlgLoader.source = "" + } + } + + //------------------------------------------------------------------------- + //-- Weird hack that has to be fixed elsewhere and have this removed + + property bool _forceClose: false + + onClosing: { + if (!_forceClose) { + activeConnectionsCloseDialog.check() + close.accepted = false + } + } + + function reallyClose() { + _forceClose = true + mainWindow.close() + } + + function finishCloseProcess() { + QGroundControl.linkManager.shutdown() + // The above shutdown causes a flurry of activity as the vehicle components are removed. This in turn + // causes the Windows Version of Qt to crash if you allow the close event to be accepted. In order to prevent + // the crash, we ignore the close event and setup a delayed timer to close the window after things settle down. + if(ScreenTools.isWindows) { + delayedWindowCloseTimer.start() + } else { + reallyClose() + } + } + + Timer { + id: delayedWindowCloseTimer + interval: 1500 + running: false + repeat: false + onTriggered: { + reallyClose() + } + } + + MessageDialog { + id: activeConnectionsCloseDialog + title: qsTr("%1 close").arg(QGroundControl.appName) + text: qsTr("There are still active connections to vehicles. Are you sure you want to exit?") + standardButtons: StandardButton.Yes | StandardButton.Cancel + modality: Qt.ApplicationModal + visible: false + onYes: finishCloseProcess() + function check() { + if (QGroundControl.multiVehicleManager.activeVehicle) { + activeConnectionsCloseDialog.open() + } else { + finishCloseProcess() + } + } + } + + //------------------------------------------------------------------------- + //-- Main, full window background + background: Item { + id: rootBackground + anchors.fill: parent + FlightDisplayView { + id: flightView + anchors.fill: parent + } + } + + //------------------------------------------------------------------------- + //-- Global Indicator Bar + header: ToolBar { + height: ScreenTools.toolbarHeight + visible: !QGroundControl.videoManager.fullScreen + background: Rectangle { + color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.8) : Qt.rgba(0,0,0,0.75) + } + RowLayout { + anchors.fill: parent + Rectangle { + height: parent.height + width: height + color: qgcPal.brandingPurple + QGCColoredImage { + anchors.centerIn: parent + height: ScreenTools.defaultFontPixelHeight * 2 + width: height + sourceSize.height: parent.height + fillMode: Image.PreserveAspectFit + source: "/res/QGCLogoWhite" + color: "white" + } + MouseArea { + anchors.fill: parent + onClicked:{ + if(drawer.visible) { + drawer.close() + } else { + drawer.open() + } + } + } + } + Item { + height: 1 + width: ScreenTools.defaultFontPixelWidth * 2 + } + Loader { + id: toolbarIndicators + height: parent.height + Layout.fillWidth: true + } + } + } + + //------------------------------------------------------------------------- + // Small parameter download progress bar + Rectangle { + x: 0 + y: header.height + height: ScreenTools.toolbarHeight * 0.05 + width: activeVehicle ? activeVehicle.parameterManager.loadProgress * mainWindow.width : 0 + color: qgcPal.colorGreen + visible: !largeProgressBar.visible + } + + //------------------------------------------------------------------------- + // Large parameter download progress bar + Rectangle { + id: largeProgressBar + x: 0 + y: header.height + height: ScreenTools.toolbarHeight + width: mainWindow.width + color: qgcPal.window + visible: _showLargeProgress + + property bool _initialDownloadComplete: activeVehicle ? activeVehicle.parameterManager.parametersReady : true + property bool _userHide: false + property bool _showLargeProgress: !_initialDownloadComplete && !_userHide && qgcPal.globalTheme === QGCPalette.Light + + Connections { + target: QGroundControl.multiVehicleManager + onActiveVehicleChanged: largeProgressBar._userHide = false + } + Rectangle { + anchors.top: parent.top + anchors.bottom: parent.bottom + width: activeVehicle ? activeVehicle.parameterManager.loadProgress * mainWindow.width : 0 + color: qgcPal.colorGreen + } + QGCLabel { + anchors.centerIn: parent + text: qsTr("Downloading Parameters") + font.pointSize: ScreenTools.largeFontPointSize + } + QGCLabel { + anchors.margins: _margin + anchors.right: parent.right + anchors.bottom: parent.bottom + text: qsTr("Click anywhere to hide") + + property real _margin: ScreenTools.defaultFontPixelWidth * 0.5 + } + MouseArea { + anchors.fill: parent + onClicked: largeProgressBar._userHide = true + } + } + + //------------------------------------------------------------------------- + //-- Navigation Drawer (Left to Right, on command or using touch gestures) + Drawer { + id: drawer + y: header.height + width: navButtonWidth + height: mainWindow.height - header.height + background: Rectangle { + color: qgcPal.globalTheme === QGCPalette.Light ? "white" : "black" + } + ButtonGroup { + buttons: buttons.children + } + ColumnLayout { + id: buttons + anchors.top: parent.top + anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.left: parent.left + anchors.right: parent.right + spacing: ScreenTools.defaultFontPixelHeight * 0.5 + QGCToolBarButton { + text: "Fly" + icon.source: "/qmlimages/PaperPlane.svg" + Layout.fillWidth: true + onClicked: { + checked = true + showFlyView() + } + } + QGCToolBarButton { + text: "Plan" + icon.source: "/qmlimages/Plan.svg" + Layout.fillWidth: true + onClicked: { + checked = true + showPlanView() + } + } + QGCToolBarButton { + text: "Analyze" + icon.source: "/qmlimages/Analyze.svg" + Layout.fillWidth: true + onClicked: { + checked = true + showAnalyzeView() + } + } + QGCToolBarButton { + text: "Vehicle Setup" + icon.source: "/qmlimages/Gears.svg" + Layout.fillWidth: true + onClicked: { + checked = true + showSetupView() + } + } + QGCToolBarButton { + text: "Settings" + icon.source: "/qmlimages/Gears.svg" + Layout.fillWidth: true + onClicked: { + checked = true + showSettingsView() + } + } + } + } + + //------------------------------------------------------------------------- + //-- Current content + Loader { + id: mainContentWindow + anchors.fill: parent + } + + //------------------------------------------------------------------------- + //-- Loader helper for any child, no matter how deep can display an element + // in the middle of the main window. + Loader { + id: rootLoader + anchors.centerIn: parent + } + + //------------------------------------------------------------------------- + //-- System Messages + + function formatMessage(message) { + message = message.replace(new RegExp("<#E>", "g"), "color: " + qgcPal.warningText + "; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;"); + message = message.replace(new RegExp("<#I>", "g"), "color: " + qgcPal.warningText + "; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;"); + message = message.replace(new RegExp("<#N>", "g"), "color: " + qgcPal.text + "; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;"); + return message; + } + + function showMessageArea() { + if(!messageArea.visible) { + if(QGroundControl.multiVehicleManager.activeVehicleAvailable) { + messageText.text = formatMessage(activeVehicle.formatedMessages) + //-- Hack to scroll to last message + for (var i = 0; i < activeVehicle.messageCount; i++) + messageFlick.flick(0,-5000) + activeVehicle.resetMessages() + } else { + messageText.text = qsTr("No Messages") + } + messageArea.open() + } + } + + onFormatedMessageChanged: { + if(messageArea.visible) { + messageText.append(formatMessage(formatedMessage)) + //-- Hack to scroll down + messageFlick.flick(0,-500) + } + } + + Popup { + id: messageArea + width: mainWindow.width * 0.666 + height: mainWindow.height * 0.666 + modal: true + focus: true + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside + anchors.centerIn: parent + background: Rectangle { + anchors.fill: parent + color: qgcPal.window + border.color: qgcPal.text + radius: ScreenTools.defaultFontPixelHeight * 0.5 + } + QGCFlickable { + id: messageFlick + anchors.margins: ScreenTools.defaultFontPixelHeight + anchors.fill: parent + contentHeight: messageText.height + contentWidth: messageText.width + pixelAligned: true + clip: true + TextEdit { + id: messageText + readOnly: true + textFormat: TextEdit.RichText + color: qgcPal.text + } + } + //-- Dismiss System Message + QGCColoredImage { + anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.top: parent.top + anchors.right: parent.right + width: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight + height: width + sourceSize.height: width + source: "/res/XDelete.svg" + fillMode: Image.PreserveAspectFit + mipmap: true + smooth: true + color: qgcPal.text + MouseArea { + anchors.fill: parent + anchors.margins: ScreenTools.isMobile ? -ScreenTools.defaultFontPixelHeight : 0 + onClicked: { + messageArea.close() + } + } + } + //-- Clear Messages + QGCColoredImage { + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5 + height: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight + width: height + sourceSize.height: height + source: "/res/TrashDelete.svg" + fillMode: Image.PreserveAspectFit + mipmap: true + smooth: true + color: qgcPal.text + MouseArea { + anchors.fill: parent + onClicked: { + if(QGroundControl.multiVehicleManager.activeVehicleAvailable) { + activeVehicle.clearMessages(); + messageArea.close() + } + } + } + } + } + + //------------------------------------------------------------------------- + //-- Critical System Messages + + property var _messageQueue: [] + property string _criticalMessage: "" + + function showMessage(message) { + if(criticalMmessageArea.visible || QGroundControl.videoManager.fullScreen) { + _messageQueue.push(message) + } else { + _criticalMessage = message + criticalMmessageArea.open() + } + } + + function showMissingParameterOverlay(missingParamName) { + showError(qsTr("Parameters missing: %1").arg(missingParamName)) + } + + function showFactError(errorMsg) { + showError(qsTr("Fact error: %1").arg(errorMsg)) + } + + Popup { + id: criticalMmessageArea + y: ScreenTools.defaultFontPixelHeight + x: (mainWindow.width - width) * 0.5 + width: mainWindow.width * 0.55 + height: Math.min(criticalMessageText.height + (ScreenTools.defaultFontPixelHeight * 2), ScreenTools.defaultFontPixelHeight * 6) + modal: false + focus: true + closePolicy: Popup.CloseOnEscape + + background: Rectangle { + anchors.fill: parent + color: qgcPal.alertBackground + radius: ScreenTools.defaultFontPixelHeight * 0.5 + border.color: qgcPal.alertBorder + border.width: 2 + } + + onOpened: { + console.log('Critical Message: ' + mainWindow._criticalMessage) + criticalMessageText.text = mainWindow._criticalMessage + } + + onClosed: { + //-- Are there messages in the waiting queue? + if(mainWindow._messageQueue.length) { + mainWindow._criticalMessage = "" + //-- Show all messages in queue + for (var i = 0; i < mainWindow._messageQueue.length; i++) { + var text = mainWindow._messageQueue[i] + mainWindow._criticalMessage.append(text) + } + //-- Clear it + mainWindow._messageQueue = [] + criticalMmessageArea.open() + } else { + mainWindow._criticalMessage = "" + } + } + + Flickable { + id: criticalMessageFlick + anchors.margins: ScreenTools.defaultFontPixelHeight + anchors.fill: parent + contentHeight: criticalMessageText.height + contentWidth: criticalMessageText.width + boundsBehavior: Flickable.StopAtBounds + pixelAligned: true + clip: true + TextEdit { + id: criticalMessageText + width: criticalMmessageArea.width - criticalClose.width - (ScreenTools.defaultFontPixelHeight * 2) + anchors.left: parent.left + readOnly: true + textFormat: TextEdit.RichText + font.pointSize: ScreenTools.defaultFontPointSize + font.family: ScreenTools.demiboldFontFamily + wrapMode: TextEdit.WordWrap + color: qgcPal.alertText + } + } + + //-- Dismiss Critical Message + QGCColoredImage { + id: criticalClose + anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.top: parent.top + anchors.right: parent.right + width: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight + height: width + sourceSize.height: width + source: "/res/XDelete.svg" + fillMode: Image.PreserveAspectFit + color: qgcPal.alertText + MouseArea { + anchors.fill: parent + anchors.margins: ScreenTools.isMobile ? -ScreenTools.defaultFontPixelHeight : 0 + onClicked: { + criticalMmessageArea.close() + } + } + } + + //-- More text below indicator + QGCColoredImage { + anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.bottom: parent.bottom + anchors.right: parent.right + width: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight + height: width + sourceSize.height: width + source: "/res/ArrowDown.svg" + fillMode: Image.PreserveAspectFit + visible: criticalMessageText.lineCount > 5 + color: qgcPal.alertText + MouseArea { + anchors.fill: parent + onClicked: { + criticalMessageFlick.flick(0,-500) + } + } + } + } + + //------------------------------------------------------------------------- + //-- Indicator Popups + + function showPopUp(dropItem, centerX) { + indicatorDropdown.centerX = centerX + indicatorDropdown.currentIndicator = dropItem + indicatorDropdown.open() + } + + Popup { + id: indicatorDropdown + y: ScreenTools.defaultFontPixelHeight + modal: true + focus: true + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside + property var currentIndicator: null + property real centerX: 0 + background: Rectangle { + width: loader.width + height: loader.height + color: Qt.rgba(0,0,0,0) + } + Loader { + id: loader + onLoaded: { + indicatorDropdown.x = mapFromGlobal(indicatorDropdown.centerX, 0).x + console.log(indicatorDropdown.x) + } + } + onOpened: { + loader.sourceComponent = indicatorDropdown.currentIndicator + } + onClosed: { + loader.sourceComponent = null + indicatorDropdown.currentIndicator = null + } + } + +} + diff --git a/src/ui/MainWindowNative.qml b/src/ui/MainWindowNative.qml deleted file mode 100644 index 1738a8c944741b8832627acb32f493bddd95ef01..0000000000000000000000000000000000000000 --- a/src/ui/MainWindowNative.qml +++ /dev/null @@ -1,249 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -import QtQuick 2.3 -import QtQuick.Window 2.2 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.0 - -import QGroundControl 1.0 -import QGroundControl.Palette 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.FlightDisplay 1.0 -import QGroundControl.FlightMap 1.0 - -/// Native QML top level window -ApplicationWindow { - id: mainWindow - width: 1024 - height: 768 - visible: true - - onClosing: { - //if (!_forceClose) { - // mainWindowInner.item.attemptWindowClose() - // close.accepted = false - //} - } - - Component.onCompleted: { - toolbarIndicators.source = _toolbarIndicators - } - - property bool _forceClose: false - - readonly property real _topBottomMargins: ScreenTools.defaultFontPixelHeight * 0.5 - readonly property string _settingsViewSource: "AppSettings.qml" - readonly property string _setupViewSource: "SetupView.qml" - readonly property string _planViewSource: "PlanView.qml" - readonly property string _toolbarIndicators: "/toolbar/MainToolBarIndicators.qml" - readonly property string _analyzeViewSource: !ScreenTools.isMobile ? "AnalyzeView.qml" : "MavlinkConsolePage.qml" - - //------------------------------------------------------------------------- - //-- Global Scope Variables - - property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle - readonly property string navButtonWidth: ScreenTools.defaultFontPixelWidth * 24 - - QGCPalette { id: qgcPal; colorGroupEnabled: true } - - //------------------------------------------------------------------------- - //-- Global Scope Functions - function showMessage(message) { - - } - - function disableToolbar() { - drawer.enabled = false - } - - function enableToolbar() { - drawer.enabled = true - } - - function viewSwitch(isPlanView) { - enableToolbar() - drawer.close() - if(isPlanView) { - - } else { - if(toolbarIndicators.source !== _toolbarIndicators) { - toolbarIndicators.source = _toolbarIndicators - } - } - } - - function showFlyView() { - viewSwitch(false) - mainWindowInner.source = "" - if(toolbarIndicators.source !== _toolbarIndicators) { - toolbarIndicators.source = _toolbarIndicators - } - } - - function showPlanView() { - viewSwitch(true) - if (mainWindowInner.source !== _planViewSource) { - mainWindowInner.source = _planViewSource - } - } - - function showAnalyzeView() { - viewSwitch(false) - if (mainWindowInner.source !== _analyzeViewSource) { - mainWindowInner.source = _analyzeViewSource - } - } - - function showSetupView() { - viewSwitch(false) - if (mainWindowInner.source !== _setupViewSource) { - mainWindowInner.source = _setupViewSource - } - } - - function showSettingsView() { - viewSwitch(false) - if (mainWindowInner.source !== _settingsViewSource) { - mainWindowInner.source = _settingsViewSource - } - } - - //------------------------------------------------------------------------- - //-- Main, full window background - background: Item { - id: rootBackground - anchors.fill: parent - FlightDisplayView { - id: flightView - anchors.fill: parent - } - } - - //------------------------------------------------------------------------- - //-- Global ToolBar - header: ToolBar { - height: ScreenTools.toolbarHeight - visible: !QGroundControl.videoManager.fullScreen - background: Rectangle { - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.8) : Qt.rgba(0,0,0,0.75) - } - RowLayout { - anchors.fill: parent - Rectangle { - height: parent.height - width: height - color: qgcPal.brandingPurple - QGCColoredImage { - anchors.centerIn: parent - height: ScreenTools.defaultFontPixelHeight * 2 - width: height - sourceSize.height: parent.height - fillMode: Image.PreserveAspectFit - source: "/res/QGCLogoWhite" - color: "white" - } - MouseArea { - anchors.fill: parent - onClicked:{ - if(drawer.visible) { - drawer.close() - } else { - drawer.open() - } - } - } - } - Loader { - id: toolbarIndicators - height: parent.height - Layout.fillWidth: true - } - } - } - - //------------------------------------------------------------------------- - //-- Navigation Drawer (Left to Right, on command or using touch gestures) - Drawer { - id: drawer - y: header.height - width: navButtonWidth - height: mainWindow.height - header.height - background: Rectangle { - color: qgcPal.globalTheme === QGCPalette.Light ? "white" : "black" - } - ButtonGroup { - buttons: buttons.children - } - ColumnLayout { - id: buttons - anchors.top: parent.top - anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5 - anchors.left: parent.left - anchors.right: parent.right - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - QGCToolBarButton { - text: "Fly" - icon.source: "/qmlimages/PaperPlane.svg" - Layout.fillWidth: true - onClicked: { - checked = true - showFlyView() - } - } - QGCToolBarButton { - text: "Plan" - icon.source: "/qmlimages/Plan.svg" - Layout.fillWidth: true - onClicked: { - checked = true - showPlanView() - } - } - QGCToolBarButton { - text: "Analyze" - icon.source: "/qmlimages/Analyze.svg" - Layout.fillWidth: true - onClicked: { - checked = true - showAnalyzeView() - } - } - QGCToolBarButton { - text: "Vehicle Setup" - icon.source: "/qmlimages/Gears.svg" - Layout.fillWidth: true - onClicked: { - checked = true - showSetupView() - } - } - QGCToolBarButton { - text: "Settings" - icon.source: "/qmlimages/Gears.svg" - Layout.fillWidth: true - onClicked: { - checked = true - showSettingsView() - } - } - } - } - - //------------------------------------------------------------------------- - //-- Current content - Loader { - id: mainWindowInner - anchors.fill: parent - } -} - diff --git a/src/ui/preferences/DebugWindow.qml b/src/ui/preferences/DebugWindow.qml index 8ffe9b4fa31115ca5a5e8ab6663f9ecdfb92c64c..266e5b613aae7ff577effc28138e6c5d9c425c29 100644 --- a/src/ui/preferences/DebugWindow.qml +++ b/src/ui/preferences/DebugWindow.qml @@ -11,259 +11,250 @@ import QtQuick 2.3 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.4 -import QtQuick.Dialogs 1.2 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.2 +import QtQuick.Window 2.2 import QGroundControl.Controls 1.0 import QGroundControl.Palette 1.0 import QGroundControl.Controllers 1.0 import QGroundControl.ScreenTools 1.0 -QGCView { - id: qgcView - viewPanel: panel +Item { - QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } - - QGCViewPanel { - id: panel - anchors.fill: parent + Text { + id: _textMeasure + text: "X" + color: qgcPal.window + font.family: ScreenTools.normalFontFamily + } + GridLayout { + anchors.margins: 20 + anchors.top: parent.top + anchors.left: parent.left + columns: 3 Text { - id: _textMeasure - text: "X" - color: qgcPal.window + text: qsTr("Qt Platform:") + color: qgcPal.text font.family: ScreenTools.normalFontFamily } - - GridLayout { - anchors.margins: 20 - anchors.top: parent.top - anchors.left: parent.left - columns: 3 - Text { - text: qsTr("Qt Platform:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: Qt.platform.os - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 10") - color: qgcPal.text - font.pointSize: 10 - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Default font width:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: _textMeasure.contentWidth - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 10.5") - color: qgcPal.text - font.pointSize: 10.5 - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Default font height:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: _textMeasure.contentHeight - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 11") - color: qgcPal.text - font.pointSize: 11 - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Default font pixel size:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: _textMeasure.font.pointSize - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 11.5") - color: qgcPal.text - font.pointSize: 11.5 - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Default font point size:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: _textMeasure.font.pointSize - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 12") - color: qgcPal.text - font.pointSize: 12 - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("QML Screen Desktop:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: Screen.desktopAvailableWidth + " x " + Screen.desktopAvailableHeight - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 12.5") - color: qgcPal.text - font.pointSize: 12.5 - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("QML Screen Size:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: Screen.width + " x " + Screen.height - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 13") - color: qgcPal.text - font.pointSize: 13 - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("QML Pixel Density:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: Screen.pixelDensity.toFixed(4) - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 13.5") - color: qgcPal.text - font.pointSize: 13.5 - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("QML Pixel Ratio:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: Screen.devicePixelRatio - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 14") - color: qgcPal.text - font.pointSize: 14 - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Default Point:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: ScreenTools.defaultFontPointSize - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 14.5") - color: qgcPal.text - font.pointSize: 14.5 - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Computed Font Height:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: ScreenTools.defaultFontPixelHeight - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 15") - color: qgcPal.text - font.pointSize: 15 - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Computed Screen Height:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: (Screen.height / Screen.pixelDensity * Screen.devicePixelRatio).toFixed(0) - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 15.5") - color: qgcPal.text - font.pointSize: 15.5 - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Computed Screen Width:") - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: (Screen.width / Screen.pixelDensity * Screen.devicePixelRatio).toFixed(0) - color: qgcPal.text - font.family: ScreenTools.normalFontFamily - } - Text { - text: qsTr("Font Point Size 16") - color: qgcPal.text - font.pointSize: 16 - font.family: ScreenTools.normalFontFamily - } + Text { + text: Qt.platform.os + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 10") + color: qgcPal.text + font.pointSize: 10 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Default font width:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: _textMeasure.contentWidth + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 10.5") + color: qgcPal.text + font.pointSize: 10.5 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Default font height:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: _textMeasure.contentHeight + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 11") + color: qgcPal.text + font.pointSize: 11 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Default font pixel size:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: _textMeasure.font.pointSize + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 11.5") + color: qgcPal.text + font.pointSize: 11.5 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Default font point size:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: _textMeasure.font.pointSize + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 12") + color: qgcPal.text + font.pointSize: 12 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("QML Screen Desktop:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: Screen.desktopAvailableWidth + " x " + Screen.desktopAvailableHeight + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 12.5") + color: qgcPal.text + font.pointSize: 12.5 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("QML Screen Size:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: Screen.width + " x " + Screen.height + color: qgcPal.text + font.family: ScreenTools.normalFontFamily } + Text { + text: qsTr("Font Point Size 13") + color: qgcPal.text + font.pointSize: 13 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("QML Pixel Density:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: Screen.pixelDensity.toFixed(4) + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 13.5") + color: qgcPal.text + font.pointSize: 13.5 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("QML Pixel Ratio:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: Screen.devicePixelRatio + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 14") + color: qgcPal.text + font.pointSize: 14 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Default Point:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: ScreenTools.defaultFontPointSize + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 14.5") + color: qgcPal.text + font.pointSize: 14.5 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Computed Font Height:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: ScreenTools.defaultFontPixelHeight + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 15") + color: qgcPal.text + font.pointSize: 15 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Computed Screen Height:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: (Screen.height / Screen.pixelDensity * Screen.devicePixelRatio).toFixed(0) + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 15.5") + color: qgcPal.text + font.pointSize: 15.5 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Computed Screen Width:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: (Screen.width / Screen.pixelDensity * Screen.devicePixelRatio).toFixed(0) + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 16") + color: qgcPal.text + font.pointSize: 16 + font.family: ScreenTools.normalFontFamily + } + } - Rectangle { - width: 100 - height: 100 - color: qgcPal.text - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.margins: 10 - Text { - text: "100x100" - anchors.centerIn: parent - color: qgcPal.window - } + Rectangle { + width: 100 + height: 100 + color: qgcPal.text + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 10 + Text { + text: "100x100" + anchors.centerIn: parent + color: qgcPal.window } } } diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index ad4a90a634bdc032e48388e8a625883b0a98bfc3..d8fd4980bba9521b465ee02ba59806e753ae0d94 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -24,9 +24,8 @@ import QGroundControl.Palette 1.0 import QGroundControl.Controllers 1.0 import QGroundControl.SettingsManager 1.0 -QGCView { - id: _qgcView - viewPanel: panel +Item { + id: _root color: qgcPal.window anchors.fill: parent anchors.margins: ScreenTools.defaultFontPixelWidth @@ -42,7 +41,7 @@ QGCView { property Fact _mapProvider: QGroundControl.settingsManager.flightMapSettings.mapProvider property Fact _mapType: QGroundControl.settingsManager.flightMapSettings.mapType property Fact _followTarget: QGroundControl.settingsManager.appSettings.followTarget - property real _panelWidth: _qgcView.width * _internalWidthRatio + property real _panelWidth: _root.width * _internalWidthRatio property real _margins: ScreenTools.defaultFontPixelWidth property string _videoSource: QGroundControl.settingsManager.videoSettings.videoSource.value @@ -57,950 +56,932 @@ QGCView { readonly property real _internalWidthRatio: 0.8 - QGCPalette { id: qgcPal } - - QGCViewPanel { - id: panel - anchors.fill: parent - - QGCFlickable { - clip: true - anchors.fill: parent - contentHeight: outerItem.height - contentWidth: outerItem.width - - Item { - id: outerItem - width: Math.max(panel.width, settingsColumn.width) - height: settingsColumn.height - - ColumnLayout { - id: settingsColumn - anchors.horizontalCenter: parent.horizontalCenter - - QGCLabel { - id: unitsSectionLabel - text: qsTr("Units") - visible: QGroundControl.settingsManager.unitsSettings.visible + QGCFlickable { + clip: true + anchors.fill: parent + contentHeight: outerItem.height + contentWidth: outerItem.width + + Item { + id: outerItem + width: Math.max(_root.width, settingsColumn.width) + height: settingsColumn.height + + ColumnLayout { + id: settingsColumn + anchors.horizontalCenter: parent.horizontalCenter + + QGCLabel { + id: unitsSectionLabel + text: qsTr("Units") + visible: QGroundControl.settingsManager.unitsSettings.visible + } + Rectangle { + Layout.preferredHeight: unitsGrid.height + (_margins * 2) + Layout.preferredWidth: unitsGrid.width + (_margins * 2) + color: qgcPal.windowShade + visible: miscSectionLabel.visible + Layout.fillWidth: true + + GridLayout { + id: unitsGrid + anchors.topMargin: _margins + anchors.top: parent.top + Layout.fillWidth: false + anchors.horizontalCenter: parent.horizontalCenter + flow: GridLayout.TopToBottom + rows: 4 + + Repeater { + model: [ qsTr("Distance"), qsTr("Area"), qsTr("Speed"), qsTr("Temperature") ] + QGCLabel { text: modelData } + } + Repeater { + model: [ QGroundControl.settingsManager.unitsSettings.distanceUnits, QGroundControl.settingsManager.unitsSettings.areaUnits, QGroundControl.settingsManager.unitsSettings.speedUnits, QGroundControl.settingsManager.unitsSettings.temperatureUnits ] + FactComboBox { + Layout.preferredWidth: _comboFieldWidth + fact: modelData + indexModel: false + } + } } - Rectangle { - Layout.preferredHeight: unitsGrid.height + (_margins * 2) - Layout.preferredWidth: unitsGrid.width + (_margins * 2) - color: qgcPal.windowShade - visible: miscSectionLabel.visible - Layout.fillWidth: true + } + + Item { width: 1; height: _margins } + + QGCLabel { + id: miscSectionLabel + text: qsTr("Miscellaneous") + visible: QGroundControl.settingsManager.appSettings.visible + } + Rectangle { + Layout.preferredWidth: Math.max(comboGrid.width, miscCol.width) + (_margins * 2) + Layout.preferredHeight: (pathRow.visible ? pathRow.y + pathRow.height : miscColItem.y + miscColItem.height) + (_margins * 2) + Layout.fillWidth: true + color: qgcPal.windowShade + visible: miscSectionLabel.visible + + Item { + id: comboGridItem + anchors.margins: _margins + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: comboGrid.height GridLayout { - id: unitsGrid - anchors.topMargin: _margins - anchors.top: parent.top - Layout.fillWidth: false + id: comboGrid anchors.horizontalCenter: parent.horizontalCenter - flow: GridLayout.TopToBottom - rows: 4 + columns: 2 - Repeater { - model: [ qsTr("Distance"), qsTr("Area"), qsTr("Speed"), qsTr("Temperature") ] - QGCLabel { text: modelData } + QGCLabel { + text: qsTr("Language") + visible: QGroundControl.settingsManager.appSettings.language.visible } - Repeater { - model: [ QGroundControl.settingsManager.unitsSettings.distanceUnits, QGroundControl.settingsManager.unitsSettings.areaUnits, QGroundControl.settingsManager.unitsSettings.speedUnits, QGroundControl.settingsManager.unitsSettings.temperatureUnits ] - FactComboBox { - Layout.preferredWidth: _comboFieldWidth - fact: modelData - indexModel: false - } + FactComboBox { + Layout.preferredWidth: _comboFieldWidth + fact: QGroundControl.settingsManager.appSettings.language + indexModel: false + visible: QGroundControl.settingsManager.appSettings.language.visible } - } - } - - Item { width: 1; height: _margins } - QGCLabel { - id: miscSectionLabel - text: qsTr("Miscellaneous") - visible: QGroundControl.settingsManager.appSettings.visible - } - Rectangle { - Layout.preferredWidth: Math.max(comboGrid.width, miscCol.width) + (_margins * 2) - Layout.preferredHeight: (pathRow.visible ? pathRow.y + pathRow.height : miscColItem.y + miscColItem.height) + (_margins * 2) - Layout.fillWidth: true - color: qgcPal.windowShade - visible: miscSectionLabel.visible - - Item { - id: comboGridItem - anchors.margins: _margins - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - height: comboGrid.height - - GridLayout { - id: comboGrid - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - - QGCLabel { - text: qsTr("Language") - visible: QGroundControl.settingsManager.appSettings.language.visible - } - FactComboBox { - Layout.preferredWidth: _comboFieldWidth - fact: QGroundControl.settingsManager.appSettings.language - indexModel: false - visible: QGroundControl.settingsManager.appSettings.language.visible - } - - QGCLabel { - text: qsTr("Color Scheme") - visible: QGroundControl.settingsManager.appSettings.indoorPalette.visible - } - FactComboBox { - Layout.preferredWidth: _comboFieldWidth - fact: QGroundControl.settingsManager.appSettings.indoorPalette - indexModel: false - visible: QGroundControl.settingsManager.appSettings.indoorPalette.visible - } - - QGCLabel { - text: qsTr("Map Provider") - width: _labelWidth - visible: _mapProvider.visible - } - FactComboBox { - Layout.preferredWidth: _comboFieldWidth - fact: _mapProvider - indexModel: false - visible: _mapProvider.visible - } - - QGCLabel { - text: qsTr("Map Type") - visible: _mapType.visible - } - FactComboBox { - id: mapTypes - Layout.preferredWidth: _comboFieldWidth - fact: _mapType - indexModel: false - visible: _mapType.visible - Connections { - target: QGroundControl.settingsManager.flightMapSettings - onMapTypeChanged: { - mapTypes.model = _mapType.enumStrings - } - } - } - - QGCLabel { - text: qsTr("Stream GCS Position") - visible: _followTarget.visible - } - FactComboBox { - Layout.preferredWidth: _comboFieldWidth - fact: _followTarget - indexModel: false - visible: _followTarget.visible - } + QGCLabel { + text: qsTr("Color Scheme") + visible: QGroundControl.settingsManager.appSettings.indoorPalette.visible } - } - - Item { - id: miscColItem - anchors.margins: _margins - anchors.left: parent.left - anchors.right: parent.right - anchors.top: comboGridItem.bottom - height: miscCol.height - - ColumnLayout { - id: miscCol - anchors.horizontalCenter: parent.horizontalCenter - spacing: _margins - - RowLayout { - Layout.fillWidth: false - Layout.alignment: Qt.AlignHCenter - visible: _appFontPointSize ? _appFontPointSize.visible : false - - QGCLabel { - text: qsTr("Font Size:") - } - QGCButton { - Layout.preferredWidth: height - Layout.preferredHeight: baseFontEdit.height - text: "-" - onClicked: { - if (_appFontPointSize.value > _appFontPointSize.min) { - _appFontPointSize.value = _appFontPointSize.value - 1 - } - } - } - FactTextField { - id: baseFontEdit - Layout.preferredWidth: _valueFieldWidth - fact: QGroundControl.settingsManager.appSettings.appFontPointSize - } - QGCButton { - Layout.preferredWidth: height - Layout.preferredHeight: baseFontEdit.height - text: "+" - onClicked: { - if (_appFontPointSize.value < _appFontPointSize.max) { - _appFontPointSize.value = _appFontPointSize.value + 1 - } - } - } - } - - - FactCheckBox { - text: qsTr("Mute all audio output") - fact: _audioMuted - visible: _audioMuted.visible - property Fact _audioMuted: QGroundControl.settingsManager.appSettings.audioMuted - } - - FactCheckBox { - text: qsTr("AutoLoad Missions") - fact: _autoLoad - visible: _autoLoad.visible - - property Fact _autoLoad: QGroundControl.settingsManager.appSettings.autoLoadMissions - } - - QGCCheckBox { - id: clearCheck - text: qsTr("Clear all settings on next start") - checked: false - onClicked: { - checked ? clearDialog.visible = true : QGroundControl.clearDeleteAllSettingsNextBoot() - } - MessageDialog { - id: clearDialog - visible: false - icon: StandardIcon.Warning - standardButtons: StandardButton.Yes | StandardButton.No - title: qsTr("Clear Settings") - text: qsTr("All saved settings will be reset the next time you start %1. Is this really what you want?").arg(QGroundControl.appName) - onYes: { - QGroundControl.deleteAllSettingsNextBoot() - clearDialog.visible = false - } - onNo: { - clearCheck.checked = false - clearDialog.visible = false - } - } - } - - RowLayout { - visible: QGroundControl.settingsManager.appSettings.batteryPercentRemainingAnnounce.visible - - QGCCheckBox { - id: announcePercentCheckbox - text: qsTr("Announce battery lower than") - checked: _percentRemainingAnnounce.value !== 0 - onClicked: { - if (checked) { - _percentRemainingAnnounce.value = _percentRemainingAnnounce.defaultValueString - } else { - _percentRemainingAnnounce.value = 0 - } - } - } - FactTextField { - fact: _percentRemainingAnnounce - Layout.preferredWidth: _valueFieldWidth - enabled: announcePercentCheckbox.checked - } - } + FactComboBox { + Layout.preferredWidth: _comboFieldWidth + fact: QGroundControl.settingsManager.appSettings.indoorPalette + indexModel: false + visible: QGroundControl.settingsManager.appSettings.indoorPalette.visible } - } - //----------------------------------------------------------------- - //-- Save path - RowLayout { - id: pathRow - anchors.margins: _margins - anchors.left: parent.left - anchors.right: parent.right - anchors.top: miscColItem.bottom - visible: _savePath.visible && !ScreenTools.isMobile - - QGCLabel { text: qsTr("Application Load/Save Path") } - QGCTextField { - Layout.fillWidth: true - readOnly: true - text: _savePath.rawValue === "" ? qsTr("") : _savePath.value + QGCLabel { + text: qsTr("Map Provider") + width: _labelWidth + visible: _mapProvider.visible } - QGCButton { - text: qsTr("Browse") - onClicked: savePathBrowseDialog.openForLoad() - - QGCFileDialog { - id: savePathBrowseDialog - qgcView: _qgcView - title: qsTr("Choose the location to save/load files") - folder: _savePath.rawValue - selectExisting: true - selectFolder: true - - onAcceptedForLoad: _savePath.rawValue = file - } + FactComboBox { + Layout.preferredWidth: _comboFieldWidth + fact: _mapProvider + indexModel: false + visible: _mapProvider.visible } - } - } - Item { width: 1; height: _margins } - QGCLabel { - id: loggingSectionLabel - text: qsTr("Data Persistence") - } - Rectangle { - Layout.preferredHeight: dataPersistCol.height + (_margins * 2) - Layout.preferredWidth: dataPersistCol.width + (_margins * 2) - color: qgcPal.windowShade - Layout.fillWidth: true - ColumnLayout { - id: dataPersistCol - anchors.margins: _margins - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - spacing: _margins * 1.5 - FactCheckBox { - id: disableDataPersistence - text: qsTr("Disable all data persistence") - fact: _disableDataPersistence - visible: _disableDataPersistence.visible - property Fact _disableDataPersistence: QGroundControl.settingsManager.appSettings.disableAllPersistence - } QGCLabel { - text: qsTr("When Data Persistence is disabled, all telemetry logging and map tile caching is disabled and not written to disk.") - wrapMode: Text.WordWrap - font.pointSize: ScreenTools.smallFontPointSize - Layout.maximumWidth: logIfNotArmed.visible ? logIfNotArmed.width : disableDataPersistence.width * 1.5 - } - } - } - - Item { width: 1; height: _margins } - QGCLabel { - text: qsTr("Telemetry Logs from Vehicle") - } - Rectangle { - Layout.preferredHeight: loggingCol.height + (_margins * 2) - Layout.preferredWidth: loggingCol.width + (_margins * 2) - color: qgcPal.windowShade - Layout.fillWidth: true - ColumnLayout { - id: loggingCol - anchors.margins: _margins - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - spacing: _margins - FactCheckBox { - id: promptSaveLog - text: qsTr("Save log after each flight") - fact: _telemetrySave - visible: _telemetrySave.visible - enabled: !disableDataPersistence.checked - property Fact _telemetrySave: QGroundControl.settingsManager.appSettings.telemetrySave + text: qsTr("Map Type") + visible: _mapType.visible } - FactCheckBox { - id: logIfNotArmed - text: qsTr("Save logs even if vehicle was not armed") - fact: _telemetrySaveNotArmed - visible: _telemetrySaveNotArmed.visible - enabled: promptSaveLog.checked && !disableDataPersistence.checked - property Fact _telemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.telemetrySaveNotArmed - } - } - } - - Item { width: 1; height: _margins } - QGCLabel { - id: flyViewSectionLabel - text: qsTr("Fly View") - visible: QGroundControl.settingsManager.flyViewSettings.visible - } - Rectangle { - Layout.preferredHeight: flyViewCol.height + (_margins * 2) - Layout.preferredWidth: flyViewCol.width + (_margins * 2) - color: qgcPal.windowShade - visible: flyViewSectionLabel.visible - Layout.fillWidth: true - - ColumnLayout { - id: flyViewCol - anchors.margins: _margins - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - spacing: _margins - - FactCheckBox { - text: qsTr("Use preflight checklist") - fact: _useChecklist - visible: _useChecklist.visible - - property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist + FactComboBox { + id: mapTypes + Layout.preferredWidth: _comboFieldWidth + fact: _mapType + indexModel: false + visible: _mapType.visible + Connections { + target: QGroundControl.settingsManager.flightMapSettings + onMapTypeChanged: { + mapTypes.model = _mapType.enumStrings + } + } } - FactCheckBox { - text: qsTr("Virtual Joystick") - visible: _virtualJoystick.visible - fact: _virtualJoystick - - property Fact _virtualJoystick: QGroundControl.settingsManager.appSettings.virtualJoystick + QGCLabel { + text: qsTr("Stream GCS Position") + visible: _followTarget.visible } - - GridLayout { - columns: 2 - - QGCLabel { text: qsTr("Guided Minimum Altitude") } - FactTextField { - Layout.preferredWidth: _valueFieldWidth - fact: QGroundControl.settingsManager.flyViewSettings.guidedMinimumAltitude - } - - QGCLabel { text: qsTr("Guided Maximum Altitude") } - FactTextField { - Layout.preferredWidth: _valueFieldWidth - fact: QGroundControl.settingsManager.flyViewSettings.guidedMaximumAltitude - } + FactComboBox { + Layout.preferredWidth: _comboFieldWidth + fact: _followTarget + indexModel: false + visible: _followTarget.visible } } } - Item { width: 1; height: _margins } - - QGCLabel { - id: planViewSectionLabel - text: qsTr("Plan View") - visible: QGroundControl.settingsManager.planViewSettings.visible - } - Rectangle { - Layout.preferredHeight: planViewCol.height + (_margins * 2) - Layout.preferredWidth: planViewCol.width + (_margins * 2) - color: qgcPal.windowShade - visible: planViewSectionLabel.visible - Layout.fillWidth: true + Item { + id: miscColItem + anchors.margins: _margins + anchors.left: parent.left + anchors.right: parent.right + anchors.top: comboGridItem.bottom + height: miscCol.height ColumnLayout { - id: planViewCol - anchors.margins: _margins - anchors.top: parent.top + id: miscCol anchors.horizontalCenter: parent.horizontalCenter spacing: _margins RowLayout { - spacing: ScreenTools.defaultFontPixelWidth - visible: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude.visible + Layout.fillWidth: false + Layout.alignment: Qt.AlignHCenter + visible: _appFontPointSize ? _appFontPointSize.visible : false - QGCLabel { text: qsTr("Default Mission Altitude") } + QGCLabel { + text: qsTr("Font Size:") + } + QGCButton { + Layout.preferredWidth: height + Layout.preferredHeight: baseFontEdit.height + text: "-" + onClicked: { + if (_appFontPointSize.value > _appFontPointSize.min) { + _appFontPointSize.value = _appFontPointSize.value - 1 + } + } + } FactTextField { + id: baseFontEdit Layout.preferredWidth: _valueFieldWidth - fact: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude + fact: QGroundControl.settingsManager.appSettings.appFontPointSize + } + QGCButton { + Layout.preferredWidth: height + Layout.preferredHeight: baseFontEdit.height + text: "+" + onClicked: { + if (_appFontPointSize.value < _appFontPointSize.max) { + _appFontPointSize.value = _appFontPointSize.value + 1 + } + } } } - } - } - Item { width: 1; height: _margins } - QGCLabel { - id: autoConnectSectionLabel - text: qsTr("AutoConnect to the following devices") - visible: QGroundControl.settingsManager.autoConnectSettings.visible - } - Rectangle { - Layout.preferredWidth: autoConnectCol.width + (_margins * 2) - Layout.preferredHeight: autoConnectCol.height + (_margins * 2) - color: qgcPal.windowShade - visible: autoConnectSectionLabel.visible - Layout.fillWidth: true + FactCheckBox { + text: qsTr("Mute all audio output") + fact: _audioMuted + visible: _audioMuted.visible + property Fact _audioMuted: QGroundControl.settingsManager.appSettings.audioMuted + } - ColumnLayout { - id: autoConnectCol - anchors.margins: _margins - anchors.left: parent.left - anchors.top: parent.top - spacing: _margins + FactCheckBox { + text: qsTr("AutoLoad Missions") + fact: _autoLoad + visible: _autoLoad.visible - RowLayout { - spacing: _margins - - Repeater { - id: autoConnectRepeater - model: [ QGroundControl.settingsManager.autoConnectSettings.autoConnectPixhawk, - QGroundControl.settingsManager.autoConnectSettings.autoConnectSiKRadio, - QGroundControl.settingsManager.autoConnectSettings.autoConnectPX4Flow, - QGroundControl.settingsManager.autoConnectSettings.autoConnectLibrePilot, - QGroundControl.settingsManager.autoConnectSettings.autoConnectUDP, - QGroundControl.settingsManager.autoConnectSettings.autoConnectRTKGPS - ] - - property var names: [ qsTr("Pixhawk"), qsTr("SiK Radio"), qsTr("PX4 Flow"), qsTr("LibrePilot"), qsTr("UDP"), qsTr("RTK GPS") ] - - FactCheckBox { - text: autoConnectRepeater.names[index] - fact: modelData - visible: modelData.visible - } - } + property Fact _autoLoad: QGroundControl.settingsManager.appSettings.autoLoadMissions } - GridLayout { - Layout.fillWidth: false - Layout.alignment: Qt.AlignHCenter - columns: 2 - visible: !ScreenTools.isMobile - && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.visible - && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.visible - - QGCLabel { - text: qsTr("NMEA GPS Device") + QGCCheckBox { + id: clearCheck + text: qsTr("Clear all settings on next start") + checked: false + onClicked: { + checked ? clearDialog.visible = true : QGroundControl.clearDeleteAllSettingsNextBoot() } - QGCComboBox { - id: nmeaPortCombo - Layout.preferredWidth: _comboFieldWidth - - model: ListModel { - } - - onActivated: { - if (index != -1) { - QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.value = textAt(index); - } + MessageDialog { + id: clearDialog + visible: false + icon: StandardIcon.Warning + standardButtons: StandardButton.Yes | StandardButton.No + title: qsTr("Clear Settings") + text: qsTr("All saved settings will be reset the next time you start %1. Is this really what you want?").arg(QGroundControl.appName) + onYes: { + QGroundControl.deleteAllSettingsNextBoot() + clearDialog.visible = false } - Component.onCompleted: { - model.append({text: gpsDisabled}) - model.append({text: gpsUdpPort}) - - for (var i in QGroundControl.linkManager.serialPorts) { - nmeaPortCombo.model.append({text:QGroundControl.linkManager.serialPorts[i]}) - } - var index = nmeaPortCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.valueString); - nmeaPortCombo.currentIndex = index; - if (QGroundControl.linkManager.serialPorts.length === 0) { - nmeaPortCombo.model.append({text: "Serial "}) - } + onNo: { + clearCheck.checked = false + clearDialog.visible = false } } + } - QGCLabel { - visible: nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled - text: qsTr("NMEA GPS Baudrate") - } - QGCComboBox { - visible: nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled - id: nmeaBaudCombo - Layout.preferredWidth: _comboFieldWidth - model: [4800, 9600, 19200, 38400, 57600, 115200] - - onActivated: { - if (index != -1) { - QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.value = textAt(index); + RowLayout { + visible: QGroundControl.settingsManager.appSettings.batteryPercentRemainingAnnounce.visible + + QGCCheckBox { + id: announcePercentCheckbox + text: qsTr("Announce battery lower than") + checked: _percentRemainingAnnounce.value !== 0 + onClicked: { + if (checked) { + _percentRemainingAnnounce.value = _percentRemainingAnnounce.defaultValueString + } else { + _percentRemainingAnnounce.value = 0 } } - Component.onCompleted: { - var index = nmeaBaudCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.valueString); - nmeaBaudCombo.currentIndex = index; - } - } - - QGCLabel { - text: qsTr("NMEA stream UDP port") - visible: nmeaPortCombo.currentText === gpsUdpPort } FactTextField { - visible: nmeaPortCombo.currentText === gpsUdpPort + fact: _percentRemainingAnnounce Layout.preferredWidth: _valueFieldWidth - fact: QGroundControl.settingsManager.autoConnectSettings.nmeaUdpPort + enabled: announcePercentCheckbox.checked } } } } - Item { width: 1; height: _margins } - - QGCLabel { - id: rtkSectionLabel - text: qsTr("RTK GPS") - visible: QGroundControl.settingsManager.rtkSettings.visible + //----------------------------------------------------------------- + //-- Save path + RowLayout { + id: pathRow + anchors.margins: _margins + anchors.left: parent.left + anchors.right: parent.right + anchors.top: miscColItem.bottom + visible: _savePath.visible && !ScreenTools.isMobile + + QGCLabel { text: qsTr("Application Load/Save Path") } + QGCTextField { + Layout.fillWidth: true + readOnly: true + text: _savePath.rawValue === "" ? qsTr("") : _savePath.value + } + QGCButton { + text: qsTr("Browse") + onClicked: savePathBrowseDialog.openForLoad() + QGCFileDialog { + id: savePathBrowseDialog + title: qsTr("Choose the location to save/load files") + folder: _savePath.rawValue + selectExisting: true + selectFolder: true + onAcceptedForLoad: _savePath.rawValue = file + } + } } - Rectangle { - Layout.preferredHeight: rtkGrid.height + (_margins * 2) - Layout.preferredWidth: rtkGrid.width + (_margins * 2) - color: qgcPal.windowShade - visible: rtkSectionLabel.visible - Layout.fillWidth: true - - GridLayout { - id: rtkGrid - anchors.topMargin: _margins - anchors.top: parent.top - Layout.fillWidth: true - anchors.horizontalCenter: parent.horizontalCenter - columns: 3 + } + + Item { width: 1; height: _margins } + QGCLabel { + id: loggingSectionLabel + text: qsTr("Data Persistence") + } + Rectangle { + Layout.preferredHeight: dataPersistCol.height + (_margins * 2) + Layout.preferredWidth: dataPersistCol.width + (_margins * 2) + color: qgcPal.windowShade + Layout.fillWidth: true + ColumnLayout { + id: dataPersistCol + anchors.margins: _margins + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + spacing: _margins * 1.5 + FactCheckBox { + id: disableDataPersistence + text: qsTr("Disable all data persistence") + fact: _disableDataPersistence + visible: _disableDataPersistence.visible + property Fact _disableDataPersistence: QGroundControl.settingsManager.appSettings.disableAllPersistence + } + QGCLabel { + text: qsTr("When Data Persistence is disabled, all telemetry logging and map tile caching is disabled and not written to disk.") + wrapMode: Text.WordWrap + font.pointSize: ScreenTools.smallFontPointSize + Layout.maximumWidth: logIfNotArmed.visible ? logIfNotArmed.width : disableDataPersistence.width * 1.5 + } + } + } + + Item { width: 1; height: _margins } + QGCLabel { + text: qsTr("Telemetry Logs from Vehicle") + } + Rectangle { + Layout.preferredHeight: loggingCol.height + (_margins * 2) + Layout.preferredWidth: loggingCol.width + (_margins * 2) + color: qgcPal.windowShade + Layout.fillWidth: true + ColumnLayout { + id: loggingCol + anchors.margins: _margins + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + spacing: _margins + FactCheckBox { + id: promptSaveLog + text: qsTr("Save log after each flight") + fact: _telemetrySave + visible: _telemetrySave.visible + enabled: !disableDataPersistence.checked + property Fact _telemetrySave: QGroundControl.settingsManager.appSettings.telemetrySave + } + FactCheckBox { + id: logIfNotArmed + text: qsTr("Save logs even if vehicle was not armed") + fact: _telemetrySaveNotArmed + visible: _telemetrySaveNotArmed.visible + enabled: promptSaveLog.checked && !disableDataPersistence.checked + property Fact _telemetrySaveNotArmed: QGroundControl.settingsManager.appSettings.telemetrySaveNotArmed + } + } + } + + Item { width: 1; height: _margins } + QGCLabel { + id: flyViewSectionLabel + text: qsTr("Fly View") + visible: QGroundControl.settingsManager.flyViewSettings.visible + } + Rectangle { + Layout.preferredHeight: flyViewCol.height + (_margins * 2) + Layout.preferredWidth: flyViewCol.width + (_margins * 2) + color: qgcPal.windowShade + visible: flyViewSectionLabel.visible + Layout.fillWidth: true + + ColumnLayout { + id: flyViewCol + anchors.margins: _margins + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + spacing: _margins + + FactCheckBox { + text: qsTr("Use preflight checklist") + fact: _useChecklist + visible: _useChecklist.visible + + property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist + } - property var rtkSettings: QGroundControl.settingsManager.rtkSettings - property bool useFixedPosition: rtkSettings.useFixedBasePosition.rawValue - property real firstColWidth: ScreenTools.defaultFontPixelWidth * 3 + FactCheckBox { + text: qsTr("Virtual Joystick") + visible: _virtualJoystick.visible + fact: _virtualJoystick - ExclusiveGroup { - id: useFixedBasePositionRadioGroup - } + property Fact _virtualJoystick: QGroundControl.settingsManager.appSettings.virtualJoystick + } - QGCRadioButton { - text: qsTr("Perform Survey-In") - visible: rtkGrid.rtkSettings.useFixedBasePosition.visible - checked: rtkGrid.rtkSettings.useFixedBasePosition.value == false - onClicked: rtkGrid.rtkSettings.useFixedBasePosition.value = false - exclusiveGroup: useFixedBasePositionRadioGroup - Layout.columnSpan: 3 - } + GridLayout { + columns: 2 - Item { width: rtkGrid.firstColWidth; height: 1 } - QGCLabel { - text: rtkGrid.rtkSettings.surveyInAccuracyLimit.shortDescription - visible: rtkGrid.rtkSettings.surveyInAccuracyLimit.visible - enabled: !rtkGrid.useFixedPosition - } + QGCLabel { text: qsTr("Guided Minimum Altitude") } FactTextField { - fact: rtkGrid.rtkSettings.surveyInAccuracyLimit - visible: rtkGrid.rtkSettings.surveyInAccuracyLimit.visible - enabled: !rtkGrid.useFixedPosition Layout.preferredWidth: _valueFieldWidth + fact: QGroundControl.settingsManager.flyViewSettings.guidedMinimumAltitude } - Item { width: rtkGrid.firstColWidth; height: 1 } - QGCLabel { - text: rtkGrid.rtkSettings.surveyInMinObservationDuration.shortDescription - visible: rtkGrid.rtkSettings.surveyInMinObservationDuration.visible - enabled: !rtkGrid.useFixedPosition - } + QGCLabel { text: qsTr("Guided Maximum Altitude") } FactTextField { - fact: rtkGrid.rtkSettings.surveyInMinObservationDuration - visible: rtkGrid.rtkSettings.surveyInMinObservationDuration.visible - enabled: !rtkGrid.useFixedPosition Layout.preferredWidth: _valueFieldWidth + fact: QGroundControl.settingsManager.flyViewSettings.guidedMaximumAltitude } + } + } + } + + Item { width: 1; height: _margins } + + QGCLabel { + id: planViewSectionLabel + text: qsTr("Plan View") + visible: QGroundControl.settingsManager.planViewSettings.visible + } + Rectangle { + Layout.preferredHeight: planViewCol.height + (_margins * 2) + Layout.preferredWidth: planViewCol.width + (_margins * 2) + color: qgcPal.windowShade + visible: planViewSectionLabel.visible + Layout.fillWidth: true + + ColumnLayout { + id: planViewCol + anchors.margins: _margins + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + spacing: _margins - QGCRadioButton { - text: qsTr("Use Specified Base Position") - visible: rtkGrid.rtkSettings.useFixedBasePosition.visible - checked: rtkGrid.rtkSettings.useFixedBasePosition.value == true - onClicked: rtkGrid.rtkSettings.useFixedBasePosition.value = true - exclusiveGroup: useFixedBasePositionRadioGroup - Layout.columnSpan: 3 - } - - Item { width: rtkGrid.firstColWidth; height: 1 } - QGCLabel { - text: rtkGrid.rtkSettings.fixedBasePositionLatitude.shortDescription - visible: rtkGrid.rtkSettings.fixedBasePositionLatitude.visible - enabled: rtkGrid.useFixedPosition - } - FactTextField { - fact: rtkGrid.rtkSettings.fixedBasePositionLatitude - visible: rtkGrid.rtkSettings.fixedBasePositionLatitude.visible - enabled: rtkGrid.useFixedPosition - Layout.fillWidth: true - } + RowLayout { + spacing: ScreenTools.defaultFontPixelWidth + visible: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude.visible - Item { width: rtkGrid.firstColWidth; height: 1 } - QGCLabel { - text: rtkGrid.rtkSettings.fixedBasePositionLongitude.shortDescription - visible: rtkGrid.rtkSettings.fixedBasePositionLongitude.visible - enabled: rtkGrid.useFixedPosition - } + QGCLabel { text: qsTr("Default Mission Altitude") } FactTextField { - fact: rtkGrid.rtkSettings.fixedBasePositionLongitude - visible: rtkGrid.rtkSettings.fixedBasePositionLongitude.visible - enabled: rtkGrid.useFixedPosition - Layout.fillWidth: true + Layout.preferredWidth: _valueFieldWidth + fact: QGroundControl.settingsManager.appSettings.defaultMissionItemAltitude } + } + } + } + + Item { width: 1; height: _margins } + + QGCLabel { + id: autoConnectSectionLabel + text: qsTr("AutoConnect to the following devices") + visible: QGroundControl.settingsManager.autoConnectSettings.visible + } + Rectangle { + Layout.preferredWidth: autoConnectCol.width + (_margins * 2) + Layout.preferredHeight: autoConnectCol.height + (_margins * 2) + color: qgcPal.windowShade + visible: autoConnectSectionLabel.visible + Layout.fillWidth: true + + ColumnLayout { + id: autoConnectCol + anchors.margins: _margins + anchors.left: parent.left + anchors.top: parent.top + spacing: _margins - Item { width: rtkGrid.firstColWidth; height: 1 } - QGCLabel { - text: rtkGrid.rtkSettings.fixedBasePositionAltitude.shortDescription - visible: rtkGrid.rtkSettings.fixedBasePositionAltitude.visible - enabled: rtkGrid.useFixedPosition - } - FactTextField { - fact: rtkGrid.rtkSettings.fixedBasePositionAltitude - visible: rtkGrid.rtkSettings.fixedBasePositionAltitude.visible - enabled: rtkGrid.useFixedPosition - Layout.fillWidth: true - } + RowLayout { + spacing: _margins - Item { width: rtkGrid.firstColWidth; height: 1 } - QGCLabel { - text: rtkGrid.rtkSettings.fixedBasePositionAccuracy.shortDescription - visible: rtkGrid.rtkSettings.fixedBasePositionAccuracy.visible - enabled: rtkGrid.useFixedPosition - } - FactTextField { - fact: rtkGrid.rtkSettings.fixedBasePositionAccuracy - visible: rtkGrid.rtkSettings.fixedBasePositionAccuracy.visible - enabled: rtkGrid.useFixedPosition - Layout.fillWidth: true - } + Repeater { + id: autoConnectRepeater + model: [ QGroundControl.settingsManager.autoConnectSettings.autoConnectPixhawk, + QGroundControl.settingsManager.autoConnectSettings.autoConnectSiKRadio, + QGroundControl.settingsManager.autoConnectSettings.autoConnectPX4Flow, + QGroundControl.settingsManager.autoConnectSettings.autoConnectLibrePilot, + QGroundControl.settingsManager.autoConnectSettings.autoConnectUDP, + QGroundControl.settingsManager.autoConnectSettings.autoConnectRTKGPS + ] - Item { width: rtkGrid.firstColWidth; height: 1 } - QGCButton { - text: qsTr("Save Current Base Position") - enabled: QGroundControl.gpsRtk && QGroundControl.gpsRtk.valid.value - Layout.columnSpan: 2 + property var names: [ qsTr("Pixhawk"), qsTr("SiK Radio"), qsTr("PX4 Flow"), qsTr("LibrePilot"), qsTr("UDP"), qsTr("RTK GPS") ] - onClicked: { - rtkGrid.rtkSettings.fixedBasePositionLatitude.rawValue = QGroundControl.gpsRtk.currentLatitude.rawValue - rtkGrid.rtkSettings.fixedBasePositionLongitude.rawValue = QGroundControl.gpsRtk.currentLongitude.rawValue - rtkGrid.rtkSettings.fixedBasePositionAltitude.rawValue = QGroundControl.gpsRtk.currentAltitude.rawValue - rtkGrid.rtkSettings.fixedBasePositionAccuracy.rawValue = QGroundControl.gpsRtk.currentAccuracy.rawValue + FactCheckBox { + text: autoConnectRepeater.names[index] + fact: modelData + visible: modelData.visible } } } - } - - Item { width: 1; height: _margins } - - QGCLabel { - id: videoSectionLabel - text: qsTr("Video") - visible: QGroundControl.settingsManager.videoSettings.visible && !QGroundControl.videoManager.autoStreamConfigured - } - Rectangle { - Layout.preferredWidth: videoGrid.width + (_margins * 2) - Layout.preferredHeight: videoGrid.height + (_margins * 2) - Layout.fillWidth: true - color: qgcPal.windowShade - visible: videoSectionLabel.visible GridLayout { - id: videoGrid - anchors.margins: _margins - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - Layout.fillWidth: false - Layout.fillHeight: false - columns: 2 - QGCLabel { - text: qsTr("Video Source") - visible: QGroundControl.settingsManager.videoSettings.videoSource.visible - } - FactComboBox { - id: videoSource - Layout.preferredWidth: _comboFieldWidth - indexModel: false - fact: QGroundControl.settingsManager.videoSettings.videoSource - visible: QGroundControl.settingsManager.videoSettings.videoSource.visible - } + Layout.fillWidth: false + Layout.alignment: Qt.AlignHCenter + columns: 2 + visible: !ScreenTools.isMobile + && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.visible + && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.visible QGCLabel { - text: qsTr("UDP Port") - visible: (_isUDP || _isMPEGTS) && QGroundControl.settingsManager.videoSettings.udpPort.visible + text: qsTr("NMEA GPS Device") } - FactTextField { + QGCComboBox { + id: nmeaPortCombo Layout.preferredWidth: _comboFieldWidth - fact: QGroundControl.settingsManager.videoSettings.udpPort - visible: (_isUDP || _isMPEGTS) && QGroundControl.settingsManager.videoSettings.udpPort.visible - } - QGCLabel { - text: qsTr("RTSP URL") - visible: _isRTSP && QGroundControl.settingsManager.videoSettings.rtspUrl.visible - } - FactTextField { - Layout.preferredWidth: _comboFieldWidth - fact: QGroundControl.settingsManager.videoSettings.rtspUrl - visible: _isRTSP && QGroundControl.settingsManager.videoSettings.rtspUrl.visible - } + model: ListModel { + } - QGCLabel { - text: qsTr("TCP URL") - visible: _isTCP && QGroundControl.settingsManager.videoSettings.tcpUrl.visible - } - FactTextField { - Layout.preferredWidth: _comboFieldWidth - fact: QGroundControl.settingsManager.videoSettings.tcpUrl - visible: _isTCP && QGroundControl.settingsManager.videoSettings.tcpUrl.visible + onActivated: { + if (index != -1) { + QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.value = textAt(index); + } + } + Component.onCompleted: { + model.append({text: gpsDisabled}) + model.append({text: gpsUdpPort}) + + for (var i in QGroundControl.linkManager.serialPorts) { + nmeaPortCombo.model.append({text:QGroundControl.linkManager.serialPorts[i]}) + } + var index = nmeaPortCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.valueString); + nmeaPortCombo.currentIndex = index; + if (QGroundControl.linkManager.serialPorts.length === 0) { + nmeaPortCombo.model.append({text: "Serial "}) + } + } } + QGCLabel { - text: qsTr("Aspect Ratio") - visible: _isGst && QGroundControl.settingsManager.videoSettings.aspectRatio.visible + visible: nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled + text: qsTr("NMEA GPS Baudrate") } - FactTextField { + QGCComboBox { + visible: nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled + id: nmeaBaudCombo Layout.preferredWidth: _comboFieldWidth - fact: QGroundControl.settingsManager.videoSettings.aspectRatio - visible: _isGst && QGroundControl.settingsManager.videoSettings.aspectRatio.visible + model: [4800, 9600, 19200, 38400, 57600, 115200] + + onActivated: { + if (index != -1) { + QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.value = textAt(index); + } + } + Component.onCompleted: { + var index = nmeaBaudCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.valueString); + nmeaBaudCombo.currentIndex = index; + } } QGCLabel { - text: qsTr("Disable When Disarmed") - visible: _isGst && QGroundControl.settingsManager.videoSettings.disableWhenDisarmed.visible + text: qsTr("NMEA stream UDP port") + visible: nmeaPortCombo.currentText === gpsUdpPort } - FactCheckBox { - text: "" - fact: QGroundControl.settingsManager.videoSettings.disableWhenDisarmed - visible: _isGst && QGroundControl.settingsManager.videoSettings.disableWhenDisarmed.visible + FactTextField { + visible: nmeaPortCombo.currentText === gpsUdpPort + Layout.preferredWidth: _valueFieldWidth + fact: QGroundControl.settingsManager.autoConnectSettings.nmeaUdpPort } } } + } + + Item { width: 1; height: _margins } + + QGCLabel { + id: rtkSectionLabel + text: qsTr("RTK GPS") + visible: QGroundControl.settingsManager.rtkSettings.visible + } + Rectangle { + Layout.preferredHeight: rtkGrid.height + (_margins * 2) + Layout.preferredWidth: rtkGrid.width + (_margins * 2) + color: qgcPal.windowShade + visible: rtkSectionLabel.visible + Layout.fillWidth: true + + GridLayout { + id: rtkGrid + anchors.topMargin: _margins + anchors.top: parent.top + Layout.fillWidth: true + anchors.horizontalCenter: parent.horizontalCenter + columns: 3 + + property var rtkSettings: QGroundControl.settingsManager.rtkSettings + property bool useFixedPosition: rtkSettings.useFixedBasePosition.rawValue + property real firstColWidth: ScreenTools.defaultFontPixelWidth * 3 + + ExclusiveGroup { + id: useFixedBasePositionRadioGroup + } - Item { width: 1; height: _margins } + QGCRadioButton { + text: qsTr("Perform Survey-In") + visible: rtkGrid.rtkSettings.useFixedBasePosition.visible + checked: rtkGrid.rtkSettings.useFixedBasePosition.value == false + onClicked: rtkGrid.rtkSettings.useFixedBasePosition.value = false + exclusiveGroup: useFixedBasePositionRadioGroup + Layout.columnSpan: 3 + } - QGCLabel { - id: videoRecSectionLabel - text: qsTr("Video Recording") - visible: (QGroundControl.settingsManager.videoSettings.visible && _isGst) || QGroundControl.videoManager.autoStreamConfigured - } - Rectangle { - Layout.preferredWidth: videoRecCol.width + (_margins * 2) - Layout.preferredHeight: videoRecCol.height + (_margins * 2) - Layout.fillWidth: true - color: qgcPal.windowShade - visible: videoRecSectionLabel.visible + Item { width: rtkGrid.firstColWidth; height: 1 } + QGCLabel { + text: rtkGrid.rtkSettings.surveyInAccuracyLimit.shortDescription + visible: rtkGrid.rtkSettings.surveyInAccuracyLimit.visible + enabled: !rtkGrid.useFixedPosition + } + FactTextField { + fact: rtkGrid.rtkSettings.surveyInAccuracyLimit + visible: rtkGrid.rtkSettings.surveyInAccuracyLimit.visible + enabled: !rtkGrid.useFixedPosition + Layout.preferredWidth: _valueFieldWidth + } - GridLayout { - id: videoRecCol - anchors.margins: _margins - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - Layout.fillWidth: false - columns: 2 + Item { width: rtkGrid.firstColWidth; height: 1 } + QGCLabel { + text: rtkGrid.rtkSettings.surveyInMinObservationDuration.shortDescription + visible: rtkGrid.rtkSettings.surveyInMinObservationDuration.visible + enabled: !rtkGrid.useFixedPosition + } + FactTextField { + fact: rtkGrid.rtkSettings.surveyInMinObservationDuration + visible: rtkGrid.rtkSettings.surveyInMinObservationDuration.visible + enabled: !rtkGrid.useFixedPosition + Layout.preferredWidth: _valueFieldWidth + } - QGCLabel { - text: qsTr("Auto-Delete Files") - visible: QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible - } - FactCheckBox { - text: "" - fact: QGroundControl.settingsManager.videoSettings.enableStorageLimit - visible: QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible - } + QGCRadioButton { + text: qsTr("Use Specified Base Position") + visible: rtkGrid.rtkSettings.useFixedBasePosition.visible + checked: rtkGrid.rtkSettings.useFixedBasePosition.value == true + onClicked: rtkGrid.rtkSettings.useFixedBasePosition.value = true + exclusiveGroup: useFixedBasePositionRadioGroup + Layout.columnSpan: 3 + } - QGCLabel { - text: qsTr("Max Storage Usage") - visible: QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value - } - FactTextField { - Layout.preferredWidth: _comboFieldWidth - fact: QGroundControl.settingsManager.videoSettings.maxVideoSize - visible: QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value - } + Item { width: rtkGrid.firstColWidth; height: 1 } + QGCLabel { + text: rtkGrid.rtkSettings.fixedBasePositionLatitude.shortDescription + visible: rtkGrid.rtkSettings.fixedBasePositionLatitude.visible + enabled: rtkGrid.useFixedPosition + } + FactTextField { + fact: rtkGrid.rtkSettings.fixedBasePositionLatitude + visible: rtkGrid.rtkSettings.fixedBasePositionLatitude.visible + enabled: rtkGrid.useFixedPosition + Layout.fillWidth: true + } - QGCLabel { - text: qsTr("Video File Format") - visible: QGroundControl.settingsManager.videoSettings.recordingFormat.visible - } - FactComboBox { - Layout.preferredWidth: _comboFieldWidth - fact: QGroundControl.settingsManager.videoSettings.recordingFormat - visible: QGroundControl.settingsManager.videoSettings.recordingFormat.visible - } + Item { width: rtkGrid.firstColWidth; height: 1 } + QGCLabel { + text: rtkGrid.rtkSettings.fixedBasePositionLongitude.shortDescription + visible: rtkGrid.rtkSettings.fixedBasePositionLongitude.visible + enabled: rtkGrid.useFixedPosition + } + FactTextField { + fact: rtkGrid.rtkSettings.fixedBasePositionLongitude + visible: rtkGrid.rtkSettings.fixedBasePositionLongitude.visible + enabled: rtkGrid.useFixedPosition + Layout.fillWidth: true } - } - Item { width: 1; height: _margins; visible: videoRecSectionLabel.visible } + Item { width: rtkGrid.firstColWidth; height: 1 } + QGCLabel { + text: rtkGrid.rtkSettings.fixedBasePositionAltitude.shortDescription + visible: rtkGrid.rtkSettings.fixedBasePositionAltitude.visible + enabled: rtkGrid.useFixedPosition + } + FactTextField { + fact: rtkGrid.rtkSettings.fixedBasePositionAltitude + visible: rtkGrid.rtkSettings.fixedBasePositionAltitude.visible + enabled: rtkGrid.useFixedPosition + Layout.fillWidth: true + } - QGCLabel { - id: brandImageSectionLabel - text: qsTr("Brand Image") - visible: QGroundControl.settingsManager.brandImageSettings.visible && !ScreenTools.isMobile - } - Rectangle { - Layout.preferredWidth: brandImageGrid.width + (_margins * 2) - Layout.preferredHeight: brandImageGrid.height + (_margins * 2) - Layout.fillWidth: true - color: qgcPal.windowShade - visible: brandImageSectionLabel.visible + Item { width: rtkGrid.firstColWidth; height: 1 } + QGCLabel { + text: rtkGrid.rtkSettings.fixedBasePositionAccuracy.shortDescription + visible: rtkGrid.rtkSettings.fixedBasePositionAccuracy.visible + enabled: rtkGrid.useFixedPosition + } + FactTextField { + fact: rtkGrid.rtkSettings.fixedBasePositionAccuracy + visible: rtkGrid.rtkSettings.fixedBasePositionAccuracy.visible + enabled: rtkGrid.useFixedPosition + Layout.fillWidth: true + } - GridLayout { - id: brandImageGrid - anchors.margins: _margins - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - columns: 3 + Item { width: rtkGrid.firstColWidth; height: 1 } + QGCButton { + text: qsTr("Save Current Base Position") + enabled: QGroundControl.gpsRtk && QGroundControl.gpsRtk.valid.value + Layout.columnSpan: 2 - QGCLabel { - text: qsTr("Indoor Image") - visible: _userBrandImageIndoor.visible - } - QGCTextField { - readOnly: true - Layout.fillWidth: true - text: _userBrandImageIndoor.valueString.replace("file:///","") - } - QGCButton { - text: qsTr("Browse") - onClicked: userBrandImageIndoorBrowseDialog.openForLoad() - - QGCFileDialog { - id: userBrandImageIndoorBrowseDialog - qgcView: _qgcView - title: qsTr("Choose custom brand image file") - folder: _userBrandImageIndoor.rawValue.replace("file:///","") - selectExisting: true - selectFolder: false - - onAcceptedForLoad: _userBrandImageIndoor.rawValue = "file:///" + file - } + onClicked: { + rtkGrid.rtkSettings.fixedBasePositionLatitude.rawValue = QGroundControl.gpsRtk.currentLatitude.rawValue + rtkGrid.rtkSettings.fixedBasePositionLongitude.rawValue = QGroundControl.gpsRtk.currentLongitude.rawValue + rtkGrid.rtkSettings.fixedBasePositionAltitude.rawValue = QGroundControl.gpsRtk.currentAltitude.rawValue + rtkGrid.rtkSettings.fixedBasePositionAccuracy.rawValue = QGroundControl.gpsRtk.currentAccuracy.rawValue } + } + } + } + + Item { width: 1; height: _margins } + + QGCLabel { + id: videoSectionLabel + text: qsTr("Video") + visible: QGroundControl.settingsManager.videoSettings.visible && !QGroundControl.videoManager.autoStreamConfigured + } + Rectangle { + Layout.preferredWidth: videoGrid.width + (_margins * 2) + Layout.preferredHeight: videoGrid.height + (_margins * 2) + Layout.fillWidth: true + color: qgcPal.windowShade + visible: videoSectionLabel.visible + + GridLayout { + id: videoGrid + anchors.margins: _margins + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + Layout.fillWidth: false + Layout.fillHeight: false + columns: 2 + QGCLabel { + text: qsTr("Video Source") + visible: QGroundControl.settingsManager.videoSettings.videoSource.visible + } + FactComboBox { + id: videoSource + Layout.preferredWidth: _comboFieldWidth + indexModel: false + fact: QGroundControl.settingsManager.videoSettings.videoSource + visible: QGroundControl.settingsManager.videoSettings.videoSource.visible + } - QGCLabel { - text: qsTr("Outdoor Image") - visible: _userBrandImageOutdoor.visible - } - QGCTextField { - readOnly: true - Layout.fillWidth: true - text: _userBrandImageOutdoor.valueString.replace("file:///","") - } - QGCButton { - text: qsTr("Browse") - onClicked: userBrandImageOutdoorBrowseDialog.openForLoad() - - QGCFileDialog { - id: userBrandImageOutdoorBrowseDialog - qgcView: _qgcView - title: qsTr("Choose custom brand image file") - folder: _userBrandImageOutdoor.rawValue.replace("file:///","") - selectExisting: true - selectFolder: false - - onAcceptedForLoad: _userBrandImageOutdoor.rawValue = "file:///" + file - } - } + QGCLabel { + text: qsTr("UDP Port") + visible: (_isUDP || _isMPEGTS) && QGroundControl.settingsManager.videoSettings.udpPort.visible + } + FactTextField { + Layout.preferredWidth: _comboFieldWidth + fact: QGroundControl.settingsManager.videoSettings.udpPort + visible: (_isUDP || _isMPEGTS) && QGroundControl.settingsManager.videoSettings.udpPort.visible + } - QGCButton { - text: qsTr("Reset Default Brand Image") - Layout.columnSpan: 3 - Layout.alignment: Qt.AlignHCenter + QGCLabel { + text: qsTr("RTSP URL") + visible: _isRTSP && QGroundControl.settingsManager.videoSettings.rtspUrl.visible + } + FactTextField { + Layout.preferredWidth: _comboFieldWidth + fact: QGroundControl.settingsManager.videoSettings.rtspUrl + visible: _isRTSP && QGroundControl.settingsManager.videoSettings.rtspUrl.visible + } - onClicked: { - _userBrandImageIndoor.rawValue = "" - _userBrandImageOutdoor.rawValue = "" - } - } + QGCLabel { + text: qsTr("TCP URL") + visible: _isTCP && QGroundControl.settingsManager.videoSettings.tcpUrl.visible + } + FactTextField { + Layout.preferredWidth: _comboFieldWidth + fact: QGroundControl.settingsManager.videoSettings.tcpUrl + visible: _isTCP && QGroundControl.settingsManager.videoSettings.tcpUrl.visible + } + QGCLabel { + text: qsTr("Aspect Ratio") + visible: _isGst && QGroundControl.settingsManager.videoSettings.aspectRatio.visible + } + FactTextField { + Layout.preferredWidth: _comboFieldWidth + fact: QGroundControl.settingsManager.videoSettings.aspectRatio + visible: _isGst && QGroundControl.settingsManager.videoSettings.aspectRatio.visible + } + + QGCLabel { + text: qsTr("Disable When Disarmed") + visible: _isGst && QGroundControl.settingsManager.videoSettings.disableWhenDisarmed.visible + } + FactCheckBox { + text: "" + fact: QGroundControl.settingsManager.videoSettings.disableWhenDisarmed + visible: _isGst && QGroundControl.settingsManager.videoSettings.disableWhenDisarmed.visible } } + } + + Item { width: 1; height: _margins } + + QGCLabel { + id: videoRecSectionLabel + text: qsTr("Video Recording") + visible: (QGroundControl.settingsManager.videoSettings.visible && _isGst) || QGroundControl.videoManager.autoStreamConfigured + } + Rectangle { + Layout.preferredWidth: videoRecCol.width + (_margins * 2) + Layout.preferredHeight: videoRecCol.height + (_margins * 2) + Layout.fillWidth: true + color: qgcPal.windowShade + visible: videoRecSectionLabel.visible + + GridLayout { + id: videoRecCol + anchors.margins: _margins + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + Layout.fillWidth: false + columns: 2 + + QGCLabel { + text: qsTr("Auto-Delete Files") + visible: QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible + } + FactCheckBox { + text: "" + fact: QGroundControl.settingsManager.videoSettings.enableStorageLimit + visible: QGroundControl.settingsManager.videoSettings.enableStorageLimit.visible + } - Item { width: 1; height: _margins } + QGCLabel { + text: qsTr("Max Storage Usage") + visible: QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value + } + FactTextField { + Layout.preferredWidth: _comboFieldWidth + fact: QGroundControl.settingsManager.videoSettings.maxVideoSize + visible: QGroundControl.settingsManager.videoSettings.maxVideoSize.visible && QGroundControl.settingsManager.videoSettings.enableStorageLimit.value + } - QGCLabel { - text: qsTr("%1 Version").arg(QGroundControl.appName) - Layout.alignment: Qt.AlignHCenter + QGCLabel { + text: qsTr("Video File Format") + visible: QGroundControl.settingsManager.videoSettings.recordingFormat.visible + } + FactComboBox { + Layout.preferredWidth: _comboFieldWidth + fact: QGroundControl.settingsManager.videoSettings.recordingFormat + visible: QGroundControl.settingsManager.videoSettings.recordingFormat.visible + } } - QGCLabel { - text: QGroundControl.qgcVersion - Layout.alignment: Qt.AlignHCenter + } + + Item { width: 1; height: _margins; visible: videoRecSectionLabel.visible } + + QGCLabel { + id: brandImageSectionLabel + text: qsTr("Brand Image") + visible: QGroundControl.settingsManager.brandImageSettings.visible && !ScreenTools.isMobile + } + Rectangle { + Layout.preferredWidth: brandImageGrid.width + (_margins * 2) + Layout.preferredHeight: brandImageGrid.height + (_margins * 2) + Layout.fillWidth: true + color: qgcPal.windowShade + visible: brandImageSectionLabel.visible + + GridLayout { + id: brandImageGrid + anchors.margins: _margins + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + columns: 3 + + QGCLabel { + text: qsTr("Indoor Image") + visible: _userBrandImageIndoor.visible + } + QGCTextField { + readOnly: true + Layout.fillWidth: true + text: _userBrandImageIndoor.valueString.replace("file:///","") + } + QGCButton { + text: qsTr("Browse") + onClicked: userBrandImageIndoorBrowseDialog.openForLoad() + QGCFileDialog { + id: userBrandImageIndoorBrowseDialog + title: qsTr("Choose custom brand image file") + folder: _userBrandImageIndoor.rawValue.replace("file:///","") + selectExisting: true + selectFolder: false + onAcceptedForLoad: _userBrandImageIndoor.rawValue = "file:///" + file + } + } + + QGCLabel { + text: qsTr("Outdoor Image") + visible: _userBrandImageOutdoor.visible + } + QGCTextField { + readOnly: true + Layout.fillWidth: true + text: _userBrandImageOutdoor.valueString.replace("file:///","") + } + QGCButton { + text: qsTr("Browse") + onClicked: userBrandImageOutdoorBrowseDialog.openForLoad() + QGCFileDialog { + id: userBrandImageOutdoorBrowseDialog + title: qsTr("Choose custom brand image file") + folder: _userBrandImageOutdoor.rawValue.replace("file:///","") + selectExisting: true + selectFolder: false + onAcceptedForLoad: _userBrandImageOutdoor.rawValue = "file:///" + file + } + } + QGCButton { + text: qsTr("Reset Default Brand Image") + Layout.columnSpan: 3 + Layout.alignment: Qt.AlignHCenter + onClicked: { + _userBrandImageIndoor.rawValue = "" + _userBrandImageOutdoor.rawValue = "" + } + } } - } // settingsColumn - } - } // QGCFlickable - } // QGCViewPanel -} // QGCView + } + + Item { width: 1; height: _margins } + + QGCLabel { + text: qsTr("%1 Version").arg(QGroundControl.appName) + Layout.alignment: Qt.AlignHCenter + } + QGCLabel { + text: QGroundControl.qgcVersion + Layout.alignment: Qt.AlignHCenter + } + } // settingsColumn + } + } +} diff --git a/src/ui/toolbar/BatteryIndicator.qml b/src/ui/toolbar/BatteryIndicator.qml index ab1abdc6aecc66fe1747f2b52bf35fcdd9fc7765..cdbdb50da824821a7157ab4db72b930c52238f2a 100644 --- a/src/ui/toolbar/BatteryIndicator.qml +++ b/src/ui/toolbar/BatteryIndicator.qml @@ -7,10 +7,8 @@ * ****************************************************************************/ - -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.2 +import QtQuick 2.12 +import QtQuick.Layouts 1.12 import QGroundControl 1.0 import QGroundControl.Controls 1.0 @@ -94,12 +92,6 @@ Item { QGCLabel { text: (_activeVehicle && _activeVehicle.battery.mahConsumed.value != -1) ? (_activeVehicle.battery.mahConsumed.valueString + " " + _activeVehicle.battery.mahConsumed.units) : "N/A" } } } - - Component.onCompleted: { - var pos = mapFromItem(toolBar, centerX - (width / 2), toolBar.height) - x = pos.x - y = pos.y + ScreenTools.defaultFontPixelHeight - } } } @@ -126,6 +118,9 @@ Item { } MouseArea { anchors.fill: parent - onClicked: mainWindow.showPopUp(batteryInfo, mapToItem(toolBar, x, y).x + (width / 2)) + onClicked: { + var centerX = mapToGlobal(x + (width / 2), 0).x + mainWindow.showPopUp(batteryInfo, centerX) + } } } diff --git a/src/ui/toolbar/GPSIndicator.qml b/src/ui/toolbar/GPSIndicator.qml index 709a32884a06488e89c39737444f55a201515e83..f6288948d2d9bb0c226dde2dc95c314127865066 100644 --- a/src/ui/toolbar/GPSIndicator.qml +++ b/src/ui/toolbar/GPSIndicator.qml @@ -7,10 +7,8 @@ * ****************************************************************************/ - -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.2 +import QtQuick 2.12 +import QtQuick.Layouts 1.12 import QGroundControl 1.0 import QGroundControl.Controls 1.0 @@ -70,12 +68,6 @@ Item { QGCLabel { text: activeVehicle ? activeVehicle.gps.courseOverGround.valueString : qsTr("--.--", "No data to display") } } } - - Component.onCompleted: { - var pos = mapFromItem(toolBar, centerX - (width / 2), toolBar.height) - x = pos.x - y = pos.y + ScreenTools.defaultFontPixelHeight - } } } @@ -111,11 +103,11 @@ Item { text: activeVehicle ? activeVehicle.gps.hdop.value.toFixed(1) : "" } } - + MouseArea { anchors.fill: parent onClicked: { - var centerX = mapToItem(toolBar, x, y).x + (width / 2) + var centerX = mapToGlobal(x + (width / 2), 0).x mainWindow.showPopUp(gpsInfo, centerX) } } diff --git a/src/ui/toolbar/GPSRTKIndicator.qml b/src/ui/toolbar/GPSRTKIndicator.qml index 767278bd6b574c889195bc2bd42905e67f172c60..056e8ef9df9890228f5845cf06d43bbb6f672dc7 100644 --- a/src/ui/toolbar/GPSRTKIndicator.qml +++ b/src/ui/toolbar/GPSRTKIndicator.qml @@ -7,10 +7,8 @@ * ****************************************************************************/ - -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.2 +import QtQuick 2.12 +import QtQuick.Layouts 1.12 import QGroundControl 1.0 import QGroundControl.Controls 1.0 @@ -79,12 +77,6 @@ Item { QGCLabel { text: QGroundControl.gpsRtk.numSatellites.value } } } - - Component.onCompleted: { - var pos = mapFromItem(toolBar, centerX - (width / 2), toolBar.height) - x = pos.x - y = pos.y + ScreenTools.defaultFontPixelHeight - } } } @@ -112,11 +104,11 @@ Item { text: QGroundControl.gpsRtk.numSatellites.value } } - + MouseArea { anchors.fill: parent onClicked: { - var centerX = mapToItem(toolBar, x, y).x + (width / 2) + var centerX = mapToGlobal(x + (width / 2), 0).x mainWindow.showPopUp(gpsInfo, centerX) } } diff --git a/src/ui/toolbar/JoystickIndicator.qml b/src/ui/toolbar/JoystickIndicator.qml index ecfa8d95dfcbf61f58f840595238efa0a56cf2fc..473db52a9b17badf92bfe0aeb26a8f10f9188c5c 100644 --- a/src/ui/toolbar/JoystickIndicator.qml +++ b/src/ui/toolbar/JoystickIndicator.qml @@ -7,10 +7,8 @@ * ****************************************************************************/ - -import QtQuick 2.5 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.2 +import QtQuick 2.12 +import QtQuick.Layouts 1.12 import QGroundControl 1.0 import QGroundControl.Controls 1.0 @@ -69,12 +67,6 @@ Item { } } } - - Component.onCompleted: { - var pos = mapFromItem(toolBar, centerX - (width / 2), toolBar.height) - x = pos.x - y = pos.y + ScreenTools.defaultFontPixelHeight - } } } @@ -97,6 +89,9 @@ Item { MouseArea { anchors.fill: parent - onClicked: mainWindow.showPopUp(joystickInfo, mapToItem(toolBar, x, y).x + (width / 2)) + onClicked: { + var centerX = mapToGlobal(x + (width / 2), 0).x + mainWindow.showPopUp(joystickInfo, centerX) + } } } diff --git a/src/ui/toolbar/MainToolBarIndicators.qml b/src/ui/toolbar/MainToolBarIndicators.qml index 3657d7473483a1ab6680a7cc1cfed0b4ae153730..c8981ac353e3c01a95138dec65043fc8d93c8ccb 100644 --- a/src/ui/toolbar/MainToolBarIndicators.qml +++ b/src/ui/toolbar/MainToolBarIndicators.qml @@ -7,10 +7,10 @@ * ****************************************************************************/ -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.2 -import QtQuick.Dialogs 1.2 +import QtQuick 2.12 +import QtQuick.Controls 2.4 +import QtQuick.Dialogs 1.3 +import QtQuick.Layouts 1.12 import QGroundControl 1.0 import QGroundControl.Controls 1.0 @@ -19,21 +19,22 @@ import QGroundControl.ScreenTools 1.0 import QGroundControl.Palette 1.0 Item { - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle - property bool _communicationLost: _activeVehicle ? _activeVehicle.connectionLost : false - - QGCPalette { id: qgcPal } + //------------------------------------------------------------------------- // Easter egg mechanism MouseArea { anchors.fill: parent onClicked: { _clickCount++ eggTimer.restart() - if (_clickCount == 5 && !QGroundControl.corePlugin.showAdvancedUI) { - advancedModeConfirmation.visible = true + if (_clickCount == 5) { + if(QGroundControl.corePlugin.showAdvancedUI) { + advancedModeConfirmation.open() + } else { + QGroundControl.corePlugin.showAdvancedUI = false + } } else if (_clickCount == 7) { - QGroundControl.corePlugin.showTouchAreas = true + QGroundControl.corePlugin.showTouchAreas = !QGroundControl.corePlugin.showTouchAreas } } @@ -42,6 +43,7 @@ Item { Timer { id: eggTimer interval: 1000 + repeat: false onTriggered: parent._clickCount = 0 } @@ -50,14 +52,15 @@ Item { title: qsTr("Advanced Mode") text: QGroundControl.corePlugin.showAdvancedUIMessage standardButtons: StandardButton.Yes | StandardButton.No - onYes: { QGroundControl.corePlugin.showAdvancedUI = true - visible = false + advancedModeConfirmation.close() } } } + //------------------------------------------------------------------------- + //-- Waiting for a vehicle QGCLabel { id: waitForVehicle anchors.centerIn: parent @@ -65,31 +68,90 @@ Item { font.pointSize: ScreenTools.mediumFontPointSize font.family: ScreenTools.demiboldFontFamily color: qgcPal.colorRed - visible: !_activeVehicle + visible: !activeVehicle } + //------------------------------------------------------------------------- + //-- Toolbar Indicators Row { id: indicatorRow anchors.top: parent.top anchors.bottom: parent.bottom spacing: ScreenTools.defaultFontPixelWidth * 1.5 - visible: _activeVehicle && !_communicationLost + visible: activeVehicle && !communicationLost + + //--------------------------------------------------------------------- + //-- Vehicle Selector + QGCButton { + id: vehicleSelectorButton + width: visible ? 0 : ScreenTools.defaultFontPixelHeight * 8 + text: "Vehicle " + (activeVehicle ? activeVehicle.id : "None") + visible: QGroundControl.multiVehicleManager.vehicles.count > 1 + Layout.alignment: Qt.AlignVCenter + + onClicked: { + vehicleMenu.popup() + } + + Menu { + id: vehicleMenu + } + + Component { + id: vehicleMenuItemComponent + MenuItem { + onTriggered: QGroundControl.multiVehicleManager.activeVehicle = vehicle + property int vehicleId: Number(text.split(" ")[1]) + property var vehicle: QGroundControl.multiVehicleManager.getVehicleById(vehicleId) + } + } + + property var vehicleMenuItems: [] + + function updateVehicleMenu() { + var i; + // Remove old menu items + for (i = 0; i < vehicleMenuItems.length; i++) { + vehicleMenu.removeItem(vehicleMenuItems[i]) + } + vehicleMenuItems.length = 0 + // Add new items + for (i = 0; i < QGroundControl.multiVehicleManager.vehicles.count; i++) { + var vehicle = QGroundControl.multiVehicleManager.vehicles.get(i) + var menuItem = vehicleMenuItemComponent.createObject(null, { "text": "Vehicle " + vehicle.id }) + vehicleMenuItems.push(menuItem) + vehicleMenu.insertItem(i, menuItem) + } + } + + Component.onCompleted: updateVehicleMenu() + + Connections { + target: QGroundControl.multiVehicleManager.vehicles + onCountChanged: vehicleSelectorButton.updateVehicleMenu() + } + } + //--------------------------------------------------------------------- + //-- Indicators Repeater { - model: _activeVehicle ? _activeVehicle.toolBarIndicators : [] + model: activeVehicle ? activeVehicle.toolBarIndicators : [] Loader { - anchors.top: parent.top - anchors.bottom: parent.bottom - source: modelData; + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.margins: ScreenTools.defaultFontPixelHeight * 0.66 + source: modelData; } } } + //------------------------------------------------------------------------- + //-- Branding Logo Image { anchors.right: parent.right anchors.top: parent.top anchors.bottom: parent.bottom - visible: x > indicatorRow.width && !_communicationLost + visible: !communicationLost fillMode: Image.PreserveAspectFit source: _outdoorPalette ? _brandImageOutdoor : _brandImageIndoor mipmap: true @@ -103,33 +165,35 @@ Item { property string _brandImageIndoor: _userBrandingIndoor ? _userBrandImageIndoor : (_userBrandingOutdoor ? _userBrandImageOutdoor : (_corePluginBranding ? - QGroundControl.corePlugin.brandImageIndoor : (_activeVehicle ? - _activeVehicle.brandImageIndoor : "" + QGroundControl.corePlugin.brandImageIndoor : (activeVehicle ? + activeVehicle.brandImageIndoor : "" ) ) ) property string _brandImageOutdoor: _userBrandingOutdoor ? _userBrandImageOutdoor : (_userBrandingIndoor ? _userBrandImageIndoor : (_corePluginBranding ? - QGroundControl.corePlugin.brandImageOutdoor : (_activeVehicle ? - _activeVehicle.brandImageOutdoor : "" + QGroundControl.corePlugin.brandImageOutdoor : (activeVehicle ? + activeVehicle.brandImageOutdoor : "" ) ) ) } + //------------------------------------------------------------------------- + //-- Connection Status Row { anchors.fill: parent layoutDirection: Qt.RightToLeft spacing: ScreenTools.defaultFontPixelWidth - visible: _communicationLost + visible: communicationLost QGCButton { id: disconnectButton anchors.verticalCenter: parent.verticalCenter text: qsTr("Disconnect") primary: true - onClicked: _activeVehicle.disconnectInactiveVehicle() + onClicked: activeVehicle.disconnectInactiveVehicle() } QGCLabel { diff --git a/src/ui/toolbar/RCRSSIIndicator.qml b/src/ui/toolbar/RCRSSIIndicator.qml index aaed4813b2c0b3ebb2fb7a80ea9cbdcf1cb9bbf9..e86c5a209942507403792e329210d953f3f3313a 100644 --- a/src/ui/toolbar/RCRSSIIndicator.qml +++ b/src/ui/toolbar/RCRSSIIndicator.qml @@ -7,10 +7,8 @@ * ****************************************************************************/ - -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.2 +import QtQuick 2.12 +import QtQuick.Layouts 1.12 import QGroundControl 1.0 import QGroundControl.Controls 1.0 @@ -65,12 +63,6 @@ Item { QGCLabel { text: _activeVehicle ? (_activeVehicle.rcRSSI + "%") : 0 } } } - - Component.onCompleted: { - var pos = mapFromItem(toolBar, centerX - (width / 2), toolBar.height) - x = pos.x - y = pos.y + ScreenTools.defaultFontPixelHeight - } } } @@ -101,7 +93,7 @@ Item { MouseArea { anchors.fill: parent onClicked: { - var centerX = mapToItem(toolBar, x, y).x + (width / 2) + var centerX = mapToGlobal(x + (width / 2), 0).x mainWindow.showPopUp(rcRSSIInfo, centerX) } } diff --git a/src/ui/toolbar/TelemetryRSSIIndicator.qml b/src/ui/toolbar/TelemetryRSSIIndicator.qml index 3de4c8a97d5310feab4a08a10cf286ec3c0a6a6c..c4932acc5e0d2bcc5156ebd62ac2aea77013c006 100644 --- a/src/ui/toolbar/TelemetryRSSIIndicator.qml +++ b/src/ui/toolbar/TelemetryRSSIIndicator.qml @@ -7,10 +7,8 @@ * ****************************************************************************/ - -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.2 +import QtQuick 2.12 +import QtQuick.Layouts 1.12 import QGroundControl 1.0 import QGroundControl.Controls 1.0 @@ -71,11 +69,6 @@ Item { QGCLabel { text: _activeVehicle.telemetryRNoise } } } - Component.onCompleted: { - var pos = mapFromItem(toolBar, centerX - (width / 2), toolBar.height) - x = pos.x - y = pos.y + ScreenTools.defaultFontPixelHeight - } } } QGCColoredImage { @@ -91,7 +84,7 @@ Item { MouseArea { anchors.fill: parent onClicked: { - var centerX = mapToItem(toolBar, x, y).x + (width / 2) + var centerX = mapToGlobal(x + (width / 2), 0).x mainWindow.showPopUp(telemRSSIInfo, centerX) } }