diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index d7f24d67cd37218dbdcbe1f33f9154c7ab60fb64..c665e736134ab0ad6ef4e4966a5504c51a819390 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -3,6 +3,7 @@ src/FactSystem/FactSystemTest.qml + src/ui/toolbar/MainToolBar.qml src/ui/toolbar/ArmedIndicator.qml src/ui/toolbar/BatteryIndicator.qml src/ui/toolbar/GPSIndicator.qml @@ -48,7 +49,7 @@ src/ui/preferences/LinkSettings.qml src/AnalyzeView/LogDownloadPage.qml src/ui/preferences/LogReplaySettings.qml - src/ui/MainQmlWindow.qml + src/ui/MainRootWindow.qml src/AnalyzeView/MavlinkConsolePage.qml src/ui/preferences/MavlinkSettings.qml src/PlanView/MissionSettingsEditor.qml @@ -76,8 +77,6 @@ src/PlanView/GeoFenceMapVisuals.qml src/QmlControls/IndicatorButton.qml src/QmlControls/JoystickThumbPad.qml - src/ui/toolbar/MainToolBar.qml - src/ui/toolbar/MainToolBarIndicators.qml src/QmlControls/MissionCommandDialog.qml src/PlanView/MissionItemEditor.qml src/QmlControls/MissionItemIndexLabel.qml diff --git a/src/FactSystem/FactControls/FactPanelController.cc b/src/FactSystem/FactControls/FactPanelController.cc index be0438a55ef16ce6ef226b8683c1f8abcc2ab679..7e90fa3b0296dd106676093ddcbe21104e45fed2 100644 --- a/src/FactSystem/FactControls/FactPanelController.cc +++ b/src/FactSystem/FactControls/FactPanelController.cc @@ -33,10 +33,10 @@ FactPanelController::FactPanelController() void FactPanelController::_notifyPanelMissingParameter(const QString& missingParam) { - if (qgcApp()->mainQmlWindow()) { + if (qgcApp()->mainRootWindow()) { QVariant returnedValue; QMetaObject::invokeMethod( - qgcApp()->mainQmlWindow(), + qgcApp()->mainRootWindow(), "showMissingParameterOverlay", Q_RETURN_ARG(QVariant, returnedValue), Q_ARG(QVariant, missingParam)); @@ -45,10 +45,10 @@ void FactPanelController::_notifyPanelMissingParameter(const QString& missingPar void FactPanelController::_notifyPanelErrorMsg(const QString& errorMsg) { - if(qgcApp()->mainQmlWindow()) { + if(qgcApp()->mainRootWindow()) { QVariant returnedValue; QMetaObject::invokeMethod( - qgcApp()->mainQmlWindow(), + qgcApp()->mainRootWindow(), "showFactError", Q_RETURN_ARG(QVariant, returnedValue), Q_ARG(QVariant, errorMsg)); @@ -67,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 (qgcApp()->mainQmlWindow()) { + if (qgcApp()->mainRootWindow()) { _notifyPanelMissingParameter(missingParam); } else { _delayedMissingParams += missingParam; diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 5024a158245a32fd64f7d003b90edcec185739d2..e503b9162a0dcdfff71ab7b40694a53b51a55eae 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -570,8 +570,8 @@ Item { z: _mapAndVideo.z + 4 title: qsTr("Fly") maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y - buttonVisible: [true, _useChecklist, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, true, true ] - buttonEnabled: [true, _useChecklist && activeVehicle, _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable ] + buttonVisible: [_useChecklist, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, true, true ] + buttonEnabled: [_useChecklist && activeVehicle, _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable ] property bool _anyActionAvailable: _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort property var _actionModel: [ @@ -609,12 +609,8 @@ Item { model: [ { - name: "Plan", - iconSource: "/qmlimages/Plan.svg", - }, - { - name: "Checklist", - iconSource: "/qmlimages/check.svg", + name: "Checklist", + iconSource: "/qmlimages/check.svg", dropPanelComponent: checklistDropPanel }, { @@ -646,18 +642,13 @@ Item { onClicked: { guidedActionsController.closeAll() - if(index === 0) { - mainWindow.showPlanView() + var action = model[index].action + if (action === -1) { + guidedActionList.model = _actionModel + guidedActionList.visible = true } else { - var action = model[index].action - if (action === -1) { - guidedActionList.model = _actionModel - guidedActionList.visible = true - } else { - _guidedController.confirmAction(action) - } + _guidedController.confirmAction(action) } - } } @@ -689,7 +680,6 @@ Item { /// Close all dialogs function closeAll() { - mainWindow.enableToolbar() rootLoader.sourceComponent = null guidedActionConfirm.visible = false guidedActionList.visible = false diff --git a/src/PlanView/PlanToolBar.qml b/src/PlanView/PlanToolBar.qml index bfc8a8b1946c89d94e5428ba7caa7794d1992b5e..327b03bf57ed2fab846510076ff36c9ac6ce407d 100644 --- a/src/PlanView/PlanToolBar.qml +++ b/src/PlanView/PlanToolBar.qml @@ -23,12 +23,12 @@ Rectangle { property real missionMaxTelemetry: _controllerValid ? _planMasterController.missionController.missionMaxTelemetry : NaN property bool missionDirty: _controllerValid ? _planMasterController.missionController.dirty : false - property bool _controllerValid: _planMasterController !== undefined + property bool _controllerValid: _planMasterController !== undefined && _planMasterController !== null property bool _controllerOffline: _controllerValid ? _planMasterController.offline : true property var _controllerDirty: _controllerValid ? _planMasterController.dirty : false property var _controllerSyncInProgress: _controllerValid ? _planMasterController.syncInProgress : false - property bool _statusValid: _currentMissionItem !== undefined + property bool _statusValid: _currentMissionItem !== undefined && _currentMissionItem !== null property bool _missionValid: missionItems !== undefined property real _dataFontSize: ScreenTools.defaultFontPointSize @@ -77,6 +77,28 @@ Rectangle { anchors.fill: parent } + //-- The reason for this Row to be here is so the Logo (Home) button is in the same + // location as the one in the main toolbar. + Row { + id: logoRow + anchors.bottomMargin: 1 + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: parent.bottom + QGCToolBarButton { + id: settingsButton + anchors.top: parent.top + anchors.bottom: parent.bottom + icon.source: "/qmlimages/PaperPlane.svg" + logo: true + checked: false + onClicked: { + checked = false + mainWindow.showFlyView() + } + } + } + // Progress bar on_ControllerProgressPctChanged: { diff --git a/src/PlanView/PlanView.qml b/src/PlanView/PlanView.qml index e834deef7b4cc2426c05908bd057dc73abaa4421..d434b57b5996ab236a36f84498b8c108b4ad94c9 100644 --- a/src/PlanView/PlanView.qml +++ b/src/PlanView/PlanView.qml @@ -551,20 +551,16 @@ Item { color: qgcPal.window title: qsTr("Plan") z: QGroundControl.zOrderWidgets - showAlternateIcon: [ false, _planMasterController.dirty, false, false, false, false, false, false ] - rotateImage: [ false, _planMasterController.syncInProgress, false, false, false, false, false, false ] - animateImage: [ false, _planMasterController.dirty, false, false, false, false, false, false ] - buttonEnabled: [ true, !_planMasterController.syncInProgress, true, true, true, true, true, true ] - buttonVisible: [ true, true, true, _waypointsOnlyMode, true, true, _showZoom, _showZoom ] + showAlternateIcon: [ _planMasterController.dirty, false, false, false, false, false, false ] + rotateImage: [ _planMasterController.syncInProgress, false, false, false, false, false, false ] + animateImage: [ _planMasterController.dirty, false, false, false, false, false, false ] + buttonEnabled: [ !_planMasterController.syncInProgress, true, true, true, true, true, true ] + buttonVisible: [ true, true, _waypointsOnlyMode, true, true, _showZoom, _showZoom ] maxHeight: mapScale.y - toolStrip.y property bool _showZoom: !ScreenTools.isMobile model: [ - { - name: qsTr("Fly"), - iconSource: "/qmlimages/PaperPlane.svg", - }, { name: qsTr("File"), iconSource: "/qmlimages/MapSync.svg", @@ -603,26 +599,23 @@ Item { onClicked: { switch (index) { - case 0: - mainWindow.showFlyView() - break; - case 2: + case 1: _addWaypointOnClick = checked _addROIOnClick = false break - case 3: + case 2: _addROIOnClick = checked _addWaypointOnClick = false break - case 4: + case 3: if (_singleComplexItem) { addComplexItem(_missionController.complexMissionItemNames[0]) } break - case 6: + case 5: editorMap.zoomLevel += 0.5 break - case 7: + case 6: editorMap.zoomLevel -= 0.5 break } diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index 97d7831c7b28e2186b0caef8bda1f5d9a34b1c11..6b672e3e123157cca9188a21a211549e68be6813 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -654,12 +654,12 @@ void QGCApplication::showMessage(const QString& message) } } -QQuickItem* QGCApplication::mainQmlWindow() +QQuickItem* QGCApplication::mainRootWindow() { - if(_mainQmlWindow) { - _mainQmlWindow = reinterpret_cast(_rootQmlObject()); + if(_mainRootWindow) { + _mainRootWindow = reinterpret_cast(_rootQmlObject()); } - return _mainQmlWindow; + return _mainRootWindow; } void QGCApplication::showSetupView() diff --git a/src/QGCApplication.h b/src/QGCApplication.h index 716fad18faa8af65a92d03d086fde25f6e6c9a2d..98771b3276bbe95f5d39bb8fb25fad915a31e8f7 100644 --- a/src/QGCApplication.h +++ b/src/QGCApplication.h @@ -96,7 +96,7 @@ public: static QString cachedAirframeMetaDataFile(void); void setLanguage(); - QQuickItem* mainQmlWindow(); + QQuickItem* mainRootWindow(); public slots: /// You can connect to this slot to show an information message box from a different thread. @@ -180,7 +180,7 @@ private: QGCFileDownload* _currentVersionDownload = nullptr; GPSRTKFactGroup* _gpsRtkFactGroup = nullptr; QGCToolbox* _toolbox = nullptr; - QQuickItem* _mainQmlWindow = nullptr; + QQuickItem* _mainRootWindow = nullptr; bool _bluetoothAvailable = false; QTranslator _QGCTranslator; diff --git a/src/QGCPalette.h b/src/QGCPalette.h index 83f412bf05be8373c6526262feba7463179a3227..368867421c56b80925627b8311f1f41076cc6ee4 100644 --- a/src/QGCPalette.h +++ b/src/QGCPalette.h @@ -104,24 +104,24 @@ public: DEFINE_QGC_COLOR(alertText, setAlertText) DEFINE_QGC_COLOR(missionItemEditor, setMissionItemEditor) - QGCPalette(QObject* parent = NULL); + QGCPalette(QObject* parent = nullptr); ~QGCPalette(); - + bool colorGroupEnabled (void) const { return _colorGroupEnabled; } void setColorGroupEnabled (bool enabled); - + static Theme globalTheme (void) { return _theme; } static void setGlobalTheme (Theme newTheme); signals: void paletteChanged (); - + private: static void _buildMap (void); static void _signalPaletteChangeToAll (void); void _signalPaletteChanged (void); void _themeChanged (void); - + static Theme _theme; ///< There is a single theme for all palettes bool _colorGroupEnabled; ///< Currently selected ColorGroup. true: enabled, false: disabled diff --git a/src/QmlControls/QGCToolBarButton.qml b/src/QmlControls/QGCToolBarButton.qml index 8f5886d110a6c1af134b8675a84dd70606b1ca5a..5f139949e060916ce6d13e5d4c37f39661a7db79 100644 --- a/src/QmlControls/QGCToolBarButton.qml +++ b/src/QmlControls/QGCToolBarButton.qml @@ -20,11 +20,13 @@ Button { height: ScreenTools.defaultFontPixelHeight * 3 autoExclusive: true + property bool logo: false + QGCPalette { id: qgcPal } background: Rectangle { anchors.fill: parent - color: checked ? qgcPal.buttonHighlight : qgcPal.button + color: logo ? qgcPal.brandingPurple : (checked ? qgcPal.buttonHighlight : Qt.rgba(0,0,0,0)) } contentItem: Row { @@ -38,12 +40,13 @@ Button { width: height sourceSize.height: parent.height fillMode: Image.PreserveAspectFit - color: button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText + color: logo ? "white" : (button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText) source: button.icon.source anchors.verticalCenter: parent.verticalCenter } Label { id: _label + visible: text !== "" text: button.text color: button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText anchors.verticalCenter: parent.verticalCenter diff --git a/src/QmlControls/QGroundControl.Controls.qmldir b/src/QmlControls/QGroundControl.Controls.qmldir index ef1bcdf9d97c801a90dc02f815cf0900b0b1f375..86296c5713721575f379cabb57833175a44d66f3 100644 --- a/src/QmlControls/QGroundControl.Controls.qmldir +++ b/src/QmlControls/QGroundControl.Controls.qmldir @@ -20,7 +20,6 @@ GeoFenceMapVisuals 1.0 GeoFenceMapVisuals.qml HackFileDialog 1.0 HackFileDialog.qml IndicatorButton 1.0 IndicatorButton.qml JoystickThumbPad 1.0 JoystickThumbPad.qml -MainToolBar 1.0 MainToolBar.qml MissionCommandDialog 1.0 MissionCommandDialog.qml MissionItemEditor 1.0 MissionItemEditor.qml MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml diff --git a/src/QtLocationPlugin/QMLControl/OfflineMap.qml b/src/QtLocationPlugin/QMLControl/OfflineMap.qml index 0d41263fd22faea3c079cad6cbe31371f5d433e2..0f0c7b9f39d6d5400e93235ad0a773751f70ac50 100644 --- a/src/QtLocationPlugin/QMLControl/OfflineMap.qml +++ b/src/QtLocationPlugin/QMLControl/OfflineMap.qml @@ -230,7 +230,6 @@ Item { onAcceptedForLoad: { if(!QGroundControl.mapEngineManager.importSets(file)) { showList(); - mainWindow.enableToolbar() } close() } @@ -1143,7 +1142,6 @@ Item { visible: !QGroundControl.mapEngineManager.exporting anchors.horizontalCenter: parent.horizontalCenter onClicked: { - mainWindow.enableToolbar() rootLoader.sourceComponent = null } } @@ -1227,7 +1225,6 @@ Item { anchors.horizontalCenter: parent.horizontalCenter onClicked: { showList(); - mainWindow.enableToolbar() rootLoader.sourceComponent = null } } @@ -1250,7 +1247,6 @@ Item { width: _bigButtonSize * 1.25 onClicked: { showList(); - mainWindow.enableToolbar() rootLoader.sourceComponent = null } } diff --git a/src/api/QGCCorePlugin.cc b/src/api/QGCCorePlugin.cc index 2da91e0d74b77017a5ece841e226651caaed01a4..99d50e6013c9315e52fc24e42c502cd089c91f19 100644 --- a/src/api/QGCCorePlugin.cc +++ b/src/api/QGCCorePlugin.cc @@ -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/MainQmlWindow.qml"))); + pEngine->load(QUrl(QStringLiteral("qrc:/qml/MainRootWindow.qml"))); return pEngine; } diff --git a/src/api/QGCOptions.cc b/src/api/QGCOptions.cc index e79d9bc61eda6ec32d2ea4f47362b8198afc4a79..1916713ba284fcd531b1e998e18964a160dfa556 100644 --- a/src/api/QGCOptions.cc +++ b/src/api/QGCOptions.cc @@ -31,9 +31,27 @@ QGCOptions::instrumentWidget() } QUrl -QGCOptions::mainToolbarIndicatorsUrl() const +QGCOptions::mainToolbarUrl() const { - return QUrl(QStringLiteral("qrc:/toolbar/MainToolBarIndicators.qml")); + return QUrl(QStringLiteral("qrc:/toolbar/MainToolBar.qml")); +} + +QUrl +QGCOptions::planToolbarUrl() const +{ + return QUrl(QStringLiteral("qrc:/qml/PlanToolBar.qml")); +} + +QColor +QGCOptions::toolbarBackgroundLight() const +{ + return QColor(255,255,255,204); +} + +QColor +QGCOptions::toolbarBackgroundDark() const +{ + return QColor(0,0,0,192); } QUrl diff --git a/src/api/QGCOptions.h b/src/api/QGCOptions.h index 057233cf8625d41f15aaa45e5618ee57b2f5bd62..ee73c27ddc6d39e578f50c354a40231ceb2f96e1 100644 --- a/src/api/QGCOptions.h +++ b/src/api/QGCOptions.h @@ -12,6 +12,7 @@ #include #include #include +#include /// @file /// @brief Core Plugin Interface for QGroundControl - Application Options @@ -29,7 +30,12 @@ public: 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(QUrl mainToolbarUrl READ mainToolbarUrl CONSTANT) + Q_PROPERTY(QUrl planToolbarUrl READ planToolbarUrl CONSTANT) + Q_PROPERTY(QColor toolbarBackgroundLight READ toolbarBackgroundLight CONSTANT) + Q_PROPERTY(QColor toolbarBackgroundDark READ toolbarBackgroundDark CONSTANT) + Q_PROPERTY(QUrl planToolbarIndicatorsUrl READ planToolbarIndicatorsUrl CONSTANT) Q_PROPERTY(bool showSensorCalibrationCompass READ showSensorCalibrationCompass NOTIFY showSensorCalibrationCompassChanged) Q_PROPERTY(bool showSensorCalibrationGyro READ showSensorCalibrationGyro NOTIFY showSensorCalibrationGyroChanged) @@ -79,8 +85,11 @@ public: /// Allows access to the full fly view window virtual QUrl flyViewOverlay () const { return QUrl(); } - /// Allows replacing the toolbar container - virtual QUrl mainToolbarIndicatorsUrl () const; + /// Allows replacing the toolbar + virtual QUrl mainToolbarUrl () const; + virtual QUrl planToolbarUrl () const; + virtual QColor toolbarBackgroundLight () const; + virtual QColor toolbarBackgroundDark () const; /// Allows replacing the Plan View toolbar container virtual QUrl planToolbarIndicatorsUrl () const; /// By returning false you can hide the following sensor calibration pages @@ -157,7 +166,7 @@ public: POS_BOTTOM_LEFT }; Q_ENUM(Pos) - CustomInstrumentWidget(QObject* parent = NULL); + CustomInstrumentWidget(QObject* parent = nullptr); Q_PROPERTY(QUrl source READ source CONSTANT) Q_PROPERTY(Pos widgetPosition READ widgetPosition NOTIFY widgetPositionChanged) virtual QUrl source () { return QUrl(); } diff --git a/src/ui/MainQmlWindow.qml b/src/ui/MainRootWindow.qml similarity index 75% rename from src/ui/MainQmlWindow.qml rename to src/ui/MainRootWindow.qml index 0da3d2518f73440a5528671c42db35876637d1a2..3ce3aedd5dccd01a28d66c1c99ad515651e20066 100644 --- a/src/ui/MainQmlWindow.qml +++ b/src/ui/MainRootWindow.qml @@ -24,12 +24,12 @@ import QGroundControl.FlightMap 1.0 ApplicationWindow { id: mainWindow width: 1280 - height: 1024 + height: 720 visible: true readonly property real _topBottomMargins: ScreenTools.defaultFontPixelHeight * 0.5 - readonly property string _mainToolbarIndicators: QGroundControl.corePlugin.options.mainToolbarIndicatorsUrl - readonly property string _planToolbarIndicators: QGroundControl.corePlugin.options.planToolbarIndicatorsUrl + readonly property string _mainToolbar: QGroundControl.corePlugin.options.mainToolbarUrl + readonly property string _planToolbar: QGroundControl.corePlugin.options.planToolbarUrl readonly property string _settingsViewSource: "AppSettings.qml" readonly property string _setupViewSource: "SetupView.qml" readonly property string _planViewSource: "PlanView.qml" @@ -64,28 +64,18 @@ ApplicationWindow { //------------------------------------------------------------------------- //-- Global Scope Functions - function disableToolbar() { - drawer.enabled = false - } - - function enableToolbar() { - drawer.enabled = true - } - function viewSwitch(isPlanView) { - enableToolbar() - drawer.close() if(isPlanView) { rootBackground.visible = false planViewLoader.visible = true - if(toolbarIndicators.source !== _planToolbarIndicators) { - toolbarIndicators.source = _planToolbarIndicators + if(toolbar.source !== _planToolbar) { + toolbar.source = _planToolbar } } else { rootBackground.visible = true planViewLoader.visible = false - if(toolbarIndicators.source !== _mainToolbarIndicators) { - toolbarIndicators.source = _mainToolbarIndicators + if(toolbar.source !== _mainToolbar) { + toolbar.source = _mainToolbar } } } @@ -93,9 +83,6 @@ ApplicationWindow { function showFlyView() { viewSwitch(false) mainContentWindow.source = "" - if(toolbarIndicators.source !== _mainToolbarIndicators) { - toolbarIndicators.source = _mainToolbarIndicators - } } function showPlanView() { @@ -297,169 +284,17 @@ ApplicationWindow { } //------------------------------------------------------------------------- - //-- Global Indicator Bar + //-- 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 - spacing: 0 - 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 - source: _mainToolbarIndicators - 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 + color: qgcPal.globalTheme === QGCPalette.Light ? QGroundControl.corePlugin.options.toolbarBackgroundLight : QGroundControl.corePlugin.options.toolbarBackgroundDark } - MouseArea { + Loader { + id: toolbar 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() - } - } + source: _mainToolbar } } @@ -472,7 +307,7 @@ ApplicationWindow { //------------------------------------------------------------------------- //-- Loader helper for any child, no matter how deep can display an element - // in the middle of the main window. + // on top of the main window. Loader { id: rootLoader anchors.centerIn: parent diff --git a/src/ui/MainWindow.ui b/src/ui/MainWindow.ui deleted file mode 100644 index 8464ddce8d4c0fc65d823f75b798e94a3507a213..0000000000000000000000000000000000000000 --- a/src/ui/MainWindow.ui +++ /dev/null @@ -1,106 +0,0 @@ - - - MainWindow - - - - 0 - 0 - 1024 - 600 - - - - - 1100 - 800 - - - - false - - - MGMainWindow - - - - - - - - - 0 - 0 - 1024 - 22 - - - - - File - - - - - - - - - Widgets - - - - - - - - - Exit - - - Ctrl+Q - - - - - Manage Communication Links - - - - - true - - - Advanced Mode - - - - - true - - - Replay Flight Data - - - - - - - - actionExit - triggered() - MainWindow - close() - - - -1 - -1 - - - 299 - 199 - - - - - diff --git a/src/ui/MainWindowHybrid.qml b/src/ui/MainWindowHybrid.qml deleted file mode 100644 index a320d9092132ebd755d0e078aa1358c7cc41ddc4..0000000000000000000000000000000000000000 --- a/src/ui/MainWindowHybrid.qml +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Dialogs 1.2 - -import QGroundControl 1.0 -import QGroundControl.Controls 1.0 - -/// Native QML top level window -Item { - function showSetupView() { - mainWindowInner.item.showSetupView() - } - - function attemptWindowClose() { - if(!mainWindowInner.item) { - controller.reallyClose() - } else { - mainWindowInner.item.attemptWindowClose() - } - } - - function showMessage(message) { - if(mainWindowInner.item) { - mainWindowInner.item.showMessage(message) - } else { - console.log(message) - } - } - - Loader { - id: mainWindowInner - anchors.fill: parent - source: "MainWindowInner.qml" - - Connections { - target: mainWindowInner.item - - onReallyClose: controller.reallyClose() - } - } -} diff --git a/src/ui/MainWindowInner.qml b/src/ui/MainWindowInner.qml deleted file mode 100644 index 4dca8f4fe30f5e8ced15c546be1a10a92b925fd4..0000000000000000000000000000000000000000 --- a/src/ui/MainWindowInner.qml +++ /dev/null @@ -1,603 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - - -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Dialogs 1.2 -import QtPositioning 5.3 - -import QGroundControl 1.0 -import QGroundControl.Palette 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.FlightDisplay 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.MultiVehicleManager 1.0 - -/// Inner common QML for mainWindow -Item { - id: mainWindow - - signal reallyClose - - QGCPalette { id: qgcPal; colorGroupEnabled: true } - - property var currentPopUp: null - property real currentCenterX: 0 - property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle - property string formatedMessage: activeVehicle ? activeVehicle.formatedMessage : "" - - property var _viewList: [ settingsViewLoader, setupViewLoader, planViewLoader, flightView, analyzeViewLoader ] - - 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" - - onHeightChanged: { - //-- We only deal with the available height if within the Fly or Plan view - if(!setupViewLoader.visible) { - ScreenTools.availableHeight = parent.height - toolBar.height - } - } - - function disableToolbar() { - toolbarBlocker.enabled = true - } - - function enableToolbar() { - toolbarBlocker.enabled = false - } - - function hideAllViews() { - for (var i=0; i<_viewList.length; i++) { - _viewList[i].visible = false - } - planToolBar.visible = false - } - - function showSettingsView() { - mainWindow.enableToolbar() - rootLoader.sourceComponent = null - if(currentPopUp) { - currentPopUp.close() - } - //-- In settings view, the full height is available. Set to 0 so it is ignored. - ScreenTools.availableHeight = 0 - hideAllViews() - if (settingsViewLoader.source != _settingsViewSource) { - settingsViewLoader.source = _settingsViewSource - } - settingsViewLoader.visible = true - toolBar.checkSettingsButton() - } - - function showSetupView() { - mainWindow.enableToolbar() - rootLoader.sourceComponent = null - if(currentPopUp) { - currentPopUp.close() - } - //-- In setup view, the full height is available. Set to 0 so it is ignored. - ScreenTools.availableHeight = 0 - hideAllViews() - if (setupViewLoader.source != _setupViewSource) { - setupViewLoader.source = _setupViewSource - } - setupViewLoader.visible = true - toolBar.checkSetupButton() - } - - function showPlanView() { - mainWindow.enableToolbar() - rootLoader.sourceComponent = null - if(currentPopUp) { - currentPopUp.close() - } - if (planViewLoader.source != _planViewSource) { - planViewLoader.source = _planViewSource - } - ScreenTools.availableHeight = parent.height - toolBar.height - hideAllViews() - planViewLoader.visible = true - planToolBar.visible = true - } - - function showFlyView() { - mainWindow.enableToolbar() - rootLoader.sourceComponent = null - if(currentPopUp) { - currentPopUp.close() - } - ScreenTools.availableHeight = parent.height - toolBar.height - hideAllViews() - flightView.visible = true - toolBar.checkFlyButton() - } - - function showAnalyzeView() { - mainWindow.enableToolbar() - rootLoader.sourceComponent = null - if(currentPopUp) { - currentPopUp.close() - } - ScreenTools.availableHeight = 0 - if (analyzeViewLoader.source != _analyzeViewSource) { - analyzeViewLoader.source = _analyzeViewSource - } - hideAllViews() - analyzeViewLoader.visible = true - toolBar.checkAnalyzeButton() - } - - /// Start the process of closing QGroundControl. Prompts the user are needed. - function attemptWindowClose() { - unsavedMissionCloseDialog.check() - } - - 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 { - mainWindow.reallyClose() - } - } - - MessageDialog { - id: unsavedMissionCloseDialog - title: qsTr("%1 close").arg(QGroundControl.appName) - text: qsTr("You have a mission edit in progress which has not been saved/sent. If you close you will lose changes. Are you sure you want to close?") - standardButtons: StandardButton.Yes | StandardButton.No - modality: Qt.ApplicationModal - visible: false - - onYes: activeConnectionsCloseDialog.check() - - function check() { - if (planViewLoader.item && planViewLoader.item.dirty) { - unsavedMissionCloseDialog.open() - } else { - activeConnectionsCloseDialog.check() - } - } - } - - 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() - } - } - } - - Timer { - id: delayedWindowCloseTimer - interval: 1500 - running: false - repeat: false - - onTriggered: { - mainWindow.reallyClose() - } - } - - property var messageQueue: [] - - function showMessage(message) { - if(criticalMmessageArea.visible || QGroundControl.videoManager.fullScreen) { - messageQueue.push(message) - } else { - criticalMessageText.text = message - criticalMmessageArea.visible = true - } - } - - 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; - } - - onFormatedMessageChanged: { - if(messageArea.visible) { - messageText.append(formatMessage(formatedMessage)) - //-- Hack to scroll down - messageFlick.flick(0,-500) - } - } - - function showMessageArea() { - mainWindow.enableToolbar() - rootLoader.sourceComponent = null - var currentlyVisible = messageArea.visible - if(currentPopUp) { - currentPopUp.close() - } - if(!currentlyVisible) { - 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") - } - currentPopUp = messageArea - messageArea.visible = true - } - } - - function showPopUp(dropItem, centerX) { - mainWindow.enableToolbar() - rootLoader.sourceComponent = null - var oldIndicator = indicatorDropdown.sourceComponent - if(currentPopUp) { - currentPopUp.close() - } - if(oldIndicator !== dropItem) { - //console.log(oldIndicator) - //console.log(dropItem) - indicatorDropdown.centerX = centerX - indicatorDropdown.sourceComponent = dropItem - indicatorDropdown.visible = true - currentPopUp = indicatorDropdown - } - } - - //-- Main UI - - MainToolBar { - id: toolBar - height: ScreenTools.toolbarHeight - visible: !QGroundControl.videoManager.fullScreen - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - opacity: planToolBar.visible ? 0 : 1 - z: QGroundControl.zOrderTopMost - - Component.onCompleted: ScreenTools.availableHeight = parent.height - toolBar.height - onShowSettingsView: mainWindow.showSettingsView() - onShowSetupView: mainWindow.showSetupView() - onShowPlanView: mainWindow.showPlanView() - onShowFlyView: mainWindow.showFlyView() - onShowAnalyzeView: mainWindow.showAnalyzeView() - onArmVehicle: flightView.guidedController.confirmAction(flightView.guidedController.actionArm) - onDisarmVehicle: { - if (flightView.guidedController.showEmergenyStop) { - flightView.guidedController.confirmAction(flightView.guidedController.actionEmergencyStop) - } else { - flightView.guidedController.confirmAction(flightView.guidedController.actionDisarm) - } - } - onVtolTransitionToFwdFlight: flightView.guidedController.confirmAction(flightView.guidedController.actionVtolTransitionToFwdFlight) - onVtolTransitionToMRFlight: flightView.guidedController.confirmAction(flightView.guidedController.actionVtolTransitionToMRFlight) - - //-- Entire tool bar area disable on cammand - DeadMouseArea { - id: toolbarBlocker - enabled: false - anchors.fill: parent - } - } - - PlanToolBar { - id: planToolBar - height: ScreenTools.toolbarHeight - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - z: toolBar.z + 1 - - onShowFlyView: { - planToolBar.visible = false - mainWindow.showFlyView() - } - } - - Loader { - id: settingsViewLoader - anchors.left: parent.left - anchors.right: parent.right - anchors.top: toolBar.bottom - anchors.bottom: parent.bottom - visible: false -/* - onVisibleChanged: { - if (!visible) { - // Free up the memory for this when not shown. No need to persist. - source = "" - } - }*/ - } - - Loader { - id: setupViewLoader - anchors.left: parent.left - anchors.right: parent.right - anchors.top: toolBar.bottom - anchors.bottom: parent.bottom - visible: false - - property var planToolBar: planToolBar - } - - Loader { - id: planViewLoader - anchors.fill: parent - visible: false - - property var toolbar: planToolBar - } - - FlightDisplayView { - id: flightView - anchors.fill: parent - visible: true - //------------------------------------------------------------------------- - //-- Loader helper for any child, no matter how deep can display an element - // on top of the video window. - Loader { - id: rootVideoLoader - anchors.centerIn: parent - } - } - - Loader { - id: analyzeViewLoader - anchors.left: parent.left - anchors.right: parent.right - anchors.top: toolBar.bottom - anchors.bottom: parent.bottom - visible: false - } - - //------------------------------------------------------------------------- - //-- Dismiss Pop Up Messages - MouseArea { - visible: currentPopUp != null - enabled: currentPopUp != null - anchors.fill: parent - onClicked: { - currentPopUp.close() - } - } - - //------------------------------------------------------------------------- - //-- Indicator Drop Down Info - Loader { - id: indicatorDropdown - visible: false - property real centerX: 0 - function close() { - sourceComponent = null - mainWindow.currentPopUp = null - } - } - - //------------------------------------------------------------------------- - //-- System Message Area - Rectangle { - id: messageArea - width: mainWindow.width * 0.5 - height: mainWindow.height * 0.5 - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: toolBar.height + ScreenTools.defaultFontPixelHeight - radius: ScreenTools.defaultFontPixelHeight * 0.5 - color: qgcPal.window - border.color: qgcPal.text - visible: false - - function close() { - currentPopUp = null - messageText.text = "" - messageArea.visible = false - } - MouseArea { - // This MouseArea prevents the Map below it from getting Mouse events. Without this - // things like mousewheel will scroll the Flickable and then scroll the map as well. - anchors.fill: parent - preventStealing: true - onWheel: wheel.accepted = true - } - 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 Message Area - Rectangle { - id: criticalMmessageArea - width: mainWindow.width * 0.55 - height: Math.min(criticalMessageText.height + _textMargins * 2, ScreenTools.defaultFontPixelHeight * 6) - color: qgcPal.alertBackground - visible: false - radius: ScreenTools.defaultFontPixelHeight * 0.5 - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: toolBar.height + ScreenTools.defaultFontPixelHeight / 2 - border.color: qgcPal.alertBorder - border.width: 2 - - readonly property real _textMargins: ScreenTools.defaultFontPixelHeight - - function close() { - //-- Are there messages in the waiting queue? - if(mainWindow.messageQueue.length) { - criticalMessageText.text = "" - //-- Show all messages in queue - for (var i = 0; i < mainWindow.messageQueue.length; i++) { - var text = mainWindow.messageQueue[i] - criticalMessageText.append(text) - } - //-- Clear it - mainWindow.messageQueue = [] - } else { - criticalMessageText.text = "" - criticalMmessageArea.visible = false - } - } - - MouseArea { - // This MouseArea prevents the Map below it from getting Mouse events. Without this - // things like mousewheel will scroll the Flickable and then scroll the map as well. - anchors.fill: parent - preventStealing: true - onWheel: wheel.accepted = true - } - - Flickable { - id: criticalMessageFlick - anchors.margins: parent._textMargins - 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) - } - } - } - } - - //------------------------------------------------------------------------- - //-- 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 - } - -} - diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml index db72fd92a178e7c3beea5dac3610e24cf9c1f974..af06428b7cd3da7d4302d71e342f51a477e5a18b 100644 --- a/src/ui/toolbar/MainToolBar.qml +++ b/src/ui/toolbar/MainToolBar.qml @@ -7,9 +7,9 @@ * ****************************************************************************/ -import QtQuick 2.3 -import QtQuick.Layouts 1.2 -import QtQuick.Controls 1.2 +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 import QGroundControl 1.0 import QGroundControl.Controls 1.0 @@ -18,55 +18,14 @@ import QGroundControl.MultiVehicleManager 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.Controllers 1.0 -Rectangle { +Item { id: toolBar - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.8) : Qt.rgba(0,0,0,0.75) - visible: !QGroundControl.videoManager.fullScreen - - QGCPalette { id: qgcPal; colorGroupEnabled: true } - - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle - - signal showSettingsView - signal showSetupView - signal showPlanView - signal showFlyView - signal showAnalyzeView - signal armVehicle - signal disarmVehicle - signal vtolTransitionToFwdFlight - signal vtolTransitionToMRFlight - - function checkSettingsButton() { - settingsButton.checked = true - } - - function checkSetupButton() { - setupButton.checked = true - } - - function checkPlanButton() { - planButton.checked = true - } - - function checkFlyButton() { - flyButton.checked = true - } - - function checkAnalyzeButton() { - analyzeButton.checked = true - } Component.onCompleted: { //-- TODO: Get this from the actual state flyButton.checked = true } - // Prevent all clicks from going through to lower layers - DeadMouseArea { - anchors.fill: parent - } - /// Bottom single pixel divider Rectangle { anchors.left: parent.left @@ -83,6 +42,10 @@ Rectangle { anchors.fill: parent spacing: ScreenTools.defaultFontPixelWidth * 2 + ButtonGroup { + buttons: viewRow.children + } + //--------------------------------------------- // Toolbar Row Row { @@ -90,54 +53,62 @@ Rectangle { Layout.fillHeight: true spacing: ScreenTools.defaultFontPixelWidth / 2 - ExclusiveGroup { id: mainActionGroup } - QGCToolBarButton { id: settingsButton anchors.top: parent.top anchors.bottom: parent.bottom - exclusiveGroup: mainActionGroup - source: "/res/QGCLogoWhite" + icon.source: "/res/QGCLogoWhite" logo: true - onClicked: toolBar.showSettingsView() visible: !QGroundControl.corePlugin.options.combineSettingsAndSetup + onClicked: { + checked = true + mainWindow.showSettingsView() + } } QGCToolBarButton { id: setupButton anchors.top: parent.top anchors.bottom: parent.bottom - exclusiveGroup: mainActionGroup - source: "/qmlimages/Gears.svg" - onClicked: toolBar.showSetupView() + icon.source: "/qmlimages/Gears.svg" + onClicked: { + checked = true + mainWindow.showSetupView() + } } QGCToolBarButton { id: planButton anchors.top: parent.top anchors.bottom: parent.bottom - exclusiveGroup: mainActionGroup - source: "/qmlimages/Plan.svg" - onClicked: toolBar.showPlanView() + icon.source: "/qmlimages/Plan.svg" + onClicked: { + checked = true + mainWindow.showPlanView() + } } QGCToolBarButton { id: flyButton anchors.top: parent.top anchors.bottom: parent.bottom - exclusiveGroup: mainActionGroup - source: "/qmlimages/PaperPlane.svg" - onClicked: toolBar.showFlyView() + icon.source: "/qmlimages/PaperPlane.svg" + onClicked: { + checked = true + mainWindow.showFlyView() + } } QGCToolBarButton { id: analyzeButton anchors.top: parent.top anchors.bottom: parent.bottom - exclusiveGroup: mainActionGroup - source: "/qmlimages/Analyze.svg" + icon.source: "/qmlimages/Analyze.svg" visible: QGroundControl.corePlugin.showAdvancedUI - onClicked: toolBar.showAnalyzeView() + onClicked: { + checked = true + mainWindow.showAnalyzeView() + } } Rectangle { @@ -146,67 +117,15 @@ Rectangle { anchors.bottom: parent.bottom width: 1 color: qgcPal.text - visible: _activeVehicle - } - } - - //------------------------------------------------------------------------- - //-- Vehicle Selector - QGCButton { - id: vehicleSelectorButton - width: ScreenTools.defaultFontPixelHeight * 8 - text: "Vehicle " + (_activeVehicle ? _activeVehicle.id : "None") - visible: QGroundControl.multiVehicleManager.vehicles.count > 1 - Layout.alignment: Qt.AlignVCenter - - menu: vehicleMenu - - 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() + visible: activeVehicle } } - MainToolBarIndicators { + Loader { + id: toolbarIndicators + height: parent.height + source: "/toolbar/MainToolBarIndicators.qml" Layout.fillWidth: true - Layout.fillHeight: true - Layout.margins: ScreenTools.defaultFontPixelHeight * 0.66 } } @@ -214,7 +133,7 @@ Rectangle { Rectangle { anchors.bottom: parent.bottom height: toolBar.height * 0.05 - width: _activeVehicle ? _activeVehicle.parameterManager.loadProgress * parent.width : 0 + width: activeVehicle ? activeVehicle.parameterManager.loadProgress * parent.width : 0 color: qgcPal.colorGreen visible: !largeProgressBar.visible } @@ -229,7 +148,7 @@ Rectangle { color: qgcPal.window visible: _showLargeProgress - property bool _initialDownloadComplete: _activeVehicle ? _activeVehicle.parameterManager.parametersReady : true + property bool _initialDownloadComplete: activeVehicle ? activeVehicle.parameterManager.parametersReady : true property bool _userHide: false property bool _showLargeProgress: !_initialDownloadComplete && !_userHide && qgcPal.globalTheme === QGCPalette.Light @@ -241,7 +160,7 @@ Rectangle { Rectangle { anchors.top: parent.top anchors.bottom: parent.bottom - width: _activeVehicle ? _activeVehicle.parameterManager.loadProgress * parent.width : 0 + width: activeVehicle ? activeVehicle.parameterManager.loadProgress * parent.width : 0 color: qgcPal.colorGreen }