diff --git a/src/ui/toolbar/ArmedIndicator.qml b/src/ui/toolbar/ArmedIndicator.qml index 2a970eedae4653f840bc7c73a39b532114462502..0a29c1aeed4ea0022c52595dc5b230f125fc00f6 100644 --- a/src/ui/toolbar/ArmedIndicator.qml +++ b/src/ui/toolbar/ArmedIndicator.qml @@ -20,13 +20,12 @@ import QGroundControl.Palette 1.0 //------------------------------------------------------------------------- //-- Armed Indicator QGCComboBox { - anchors.top: parent.top - anchors.bottom: parent.bottom - alternateText: _armed ? qsTr("Armed") : qsTr("Disarmed") - model: [ qsTr("Arm"), qsTr("Disarm") ] - font.pointSize: ScreenTools.mediumFontPointSize - currentIndex: -1 - sizeToContents: true + anchors.verticalCenter: parent.verticalCenter + alternateText: _armed ? qsTr("Armed") : qsTr("Disarmed") + model: [ qsTr("Arm"), qsTr("Disarm") ] + font.pointSize: ScreenTools.mediumFontPointSize + currentIndex: -1 + sizeToContents: true property bool showIndicator: true diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml index 3560ae320e195dfa72c6289edcca6e3155eed465..cefa4caf0ac8f9a69aa9968d031dc79ff4d4062e 100644 --- a/src/ui/toolbar/MainToolBar.qml +++ b/src/ui/toolbar/MainToolBar.qml @@ -10,6 +10,7 @@ import QtQuick 2.11 import QtQuick.Controls 2.4 import QtQuick.Layouts 1.11 +import QtQuick.Dialogs 1.3 import QGroundControl 1.0 import QGroundControl.Controls 1.0 @@ -19,7 +20,7 @@ import QGroundControl.ScreenTools 1.0 import QGroundControl.Controllers 1.0 Item { - id: toolBar + id: toolBar Component.onCompleted: { //-- TODO: Get this from the actual state @@ -36,6 +37,45 @@ Item { visible: qgcPal.globalTheme === QGCPalette.Light } + //------------------------------------------------------------------------- + // Easter egg mechanism + MouseArea { + anchors.fill: parent + onClicked: { + _clickCount++ + eggTimer.restart() + if (_clickCount == 5) { + if(!QGroundControl.corePlugin.showAdvancedUI) { + advancedModeConfirmation.open() + } else { + QGroundControl.corePlugin.showAdvancedUI = false + } + } else if (_clickCount == 7) { + QGroundControl.corePlugin.showTouchAreas = !QGroundControl.corePlugin.showTouchAreas + } + } + + property int _clickCount: 0 + + Timer { + id: eggTimer + interval: 1000 + repeat: false + onTriggered: parent._clickCount = 0 + } + + MessageDialog { + id: advancedModeConfirmation + title: qsTr("Advanced Mode") + text: QGroundControl.corePlugin.showAdvancedUIMessage + standardButtons: StandardButton.Yes | StandardButton.No + onYes: { + QGroundControl.corePlugin.showAdvancedUI = true + advancedModeConfirmation.close() + } + } + } + //-- Setup can be invoked from c++ side Connections { target: setupWindow @@ -46,97 +86,146 @@ Item { } } - RowLayout { - anchors.bottomMargin: 1 - anchors.rightMargin: ScreenTools.defaultFontPixelWidth / 2 - anchors.fill: parent - spacing: ScreenTools.defaultFontPixelWidth / 2 + QGCFlickable { + anchors.fill: parent + contentWidth: toolbarRow.width + flickableDirection: Flickable.HorizontalFlick - ButtonGroup { - buttons: viewRow.children - } + RowLayout { + id: toolbarRow + anchors.bottomMargin: 1 + anchors.top: parent.top + anchors.bottom: parent.bottom + spacing: ScreenTools.defaultFontPixelWidth / 2 - //--------------------------------------------- - // Toolbar Row - Row { - id: viewRow - Layout.fillHeight: true - spacing: ScreenTools.defaultFontPixelWidth / 2 - - QGCToolBarButton { - id: settingsButton - anchors.top: parent.top - anchors.bottom: parent.bottom - icon.source: "/res/QGCLogoWhite" - logo: true - visible: !QGroundControl.corePlugin.options.combineSettingsAndSetup - onClicked: { - checked = true - mainWindow.showSettingsView() - } + ButtonGroup { + buttons: viewRow.children } - QGCToolBarButton { - id: setupButton - anchors.top: parent.top - anchors.bottom: parent.bottom - icon.source: "/qmlimages/Gears.svg" - onClicked: { - checked = true - mainWindow.showSetupView() + //--------------------------------------------- + // Toolbar Row + RowLayout { + id: viewRow + Layout.fillHeight: true + spacing: 0 + + QGCToolBarButton { + id: settingsButton + Layout.fillHeight: true + icon.source: "/res/QGCLogoWhite" + logo: true + visible: !QGroundControl.corePlugin.options.combineSettingsAndSetup + onClicked: { + checked = true + mainWindow.showSettingsView() + } } - } - QGCToolBarButton { - id: planButton - anchors.top: parent.top - anchors.bottom: parent.bottom - icon.source: "/qmlimages/Plan.svg" - onClicked: { - checked = true - mainWindow.showPlanView() + QGCToolBarButton { + id: setupButton + Layout.fillHeight: true + icon.source: "/qmlimages/Gears.svg" + onClicked: { + checked = true + mainWindow.showSetupView() + } } - } - QGCToolBarButton { - id: flyButton - anchors.top: parent.top - anchors.bottom: parent.bottom - icon.source: "/qmlimages/PaperPlane.svg" - onClicked: { - checked = true - mainWindow.showFlyView() + QGCToolBarButton { + id: planButton + Layout.fillHeight: true + icon.source: "/qmlimages/Plan.svg" + onClicked: { + checked = true + mainWindow.showPlanView() + } } - } - QGCToolBarButton { - id: analyzeButton - anchors.top: parent.top - anchors.bottom: parent.bottom - icon.source: "/qmlimages/Analyze.svg" - visible: QGroundControl.corePlugin.showAdvancedUI - onClicked: { - checked = true - mainWindow.showAnalyzeView() + QGCToolBarButton { + id: flyButton + Layout.fillHeight: true + icon.source: "/qmlimages/PaperPlane.svg" + onClicked: { + checked = true + mainWindow.showFlyView() + } + } + + QGCToolBarButton { + id: analyzeButton + Layout.fillHeight: true + icon.source: "/qmlimages/Analyze.svg" + visible: QGroundControl.corePlugin.showAdvancedUI + onClicked: { + checked = true + mainWindow.showAnalyzeView() + } + } + + Item { + Layout.fillHeight: true + width: ScreenTools.defaultFontPixelWidth / 2 + visible: activeVehicle + } + + Rectangle { + Layout.margins: ScreenTools.defaultFontPixelHeight / 2 + Layout.fillHeight: true + width: 1 + color: qgcPal.text + visible: activeVehicle + } + + Item { + Layout.fillHeight: true + width: ScreenTools.defaultFontPixelWidth / 2 + visible: activeVehicle } } - Rectangle { - anchors.margins: ScreenTools.defaultFontPixelHeight / 2 - anchors.top: parent.top - anchors.bottom: parent.bottom - width: 1 - color: qgcPal.text - visible: activeVehicle + Loader { + id: toolbarIndicators + Layout.fillHeight: true + source: "/toolbar/MainToolBarIndicators.qml" + visible: activeVehicle && !communicationLost } } + } - Loader { - id: toolbarIndicators - height: parent.height - source: "/toolbar/MainToolBarIndicators.qml" - Layout.fillWidth: true - } + //------------------------------------------------------------------------- + //-- Branding Logo + Image { + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.margins: ScreenTools.defaultFontPixelHeight * 0.66 + visible: activeVehicle && !communicationLost && x > (toolbarRow.x + toolbarRow.width + ScreenTools.defaultFontPixelWidth) + fillMode: Image.PreserveAspectFit + source: _outdoorPalette ? _brandImageOutdoor : _brandImageIndoor + mipmap: true + + property bool _outdoorPalette: qgcPal.globalTheme === QGCPalette.Light + property bool _corePluginBranding: QGroundControl.corePlugin.brandImageIndoor.length != 0 + property string _userBrandImageIndoor: QGroundControl.settingsManager.brandImageSettings.userBrandImageIndoor.value + property string _userBrandImageOutdoor: QGroundControl.settingsManager.brandImageSettings.userBrandImageOutdoor.value + property bool _userBrandingIndoor: _userBrandImageIndoor.length != 0 + property bool _userBrandingOutdoor: _userBrandImageOutdoor.length != 0 + property string _brandImageIndoor: _userBrandingIndoor ? + _userBrandImageIndoor : (_userBrandingOutdoor ? + _userBrandImageOutdoor : (_corePluginBranding ? + QGroundControl.corePlugin.brandImageIndoor : (activeVehicle ? + activeVehicle.brandImageIndoor : "" + ) + ) + ) + property string _brandImageOutdoor: _userBrandingOutdoor ? + _userBrandImageOutdoor : (_userBrandingIndoor ? + _userBrandImageIndoor : (_corePluginBranding ? + QGroundControl.corePlugin.brandImageOutdoor : (activeVehicle ? + activeVehicle.brandImageOutdoor : "" + ) + ) + ) } // Small parameter download progress bar @@ -194,4 +283,48 @@ Item { onClicked: largeProgressBar._userHide = true } } + + + //------------------------------------------------------------------------- + //-- Waiting for a vehicle + QGCLabel { + anchors.rightMargin: ScreenTools.defaultFontPixelWidth + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + text: qsTr("Waiting For Vehicle Connection") + font.pointSize: ScreenTools.mediumFontPointSize + font.family: ScreenTools.demiboldFontFamily + color: qgcPal.colorRed + visible: !activeVehicle + } + + //------------------------------------------------------------------------- + //-- Connection Status + Row { + anchors.rightMargin: ScreenTools.defaultFontPixelWidth + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: parent.right + layoutDirection: Qt.RightToLeft + spacing: ScreenTools.defaultFontPixelWidth + visible: activeVehicle && communicationLost + + QGCButton { + id: disconnectButton + anchors.verticalCenter: parent.verticalCenter + text: qsTr("Disconnect") + primary: true + onClicked: activeVehicle.disconnectInactiveVehicle() + } + + QGCLabel { + id: connectionLost + anchors.verticalCenter: parent.verticalCenter + text: qsTr("COMMUNICATION LOST") + font.pointSize: ScreenTools.largeFontPointSize + font.family: ScreenTools.demiboldFontFamily + color: qgcPal.colorRed + } + } + } diff --git a/src/ui/toolbar/MainToolBarIndicators.qml b/src/ui/toolbar/MainToolBarIndicators.qml index cf1a12145c36213a62ba605c140306ee7b673e94..8048b3c3d3daec948a97fcd86f49ec8b5580e5a8 100644 --- a/src/ui/toolbar/MainToolBarIndicators.qml +++ b/src/ui/toolbar/MainToolBarIndicators.qml @@ -9,7 +9,6 @@ import QtQuick 2.11 import QtQuick.Controls 2.4 -import QtQuick.Dialogs 1.3 import QtQuick.Layouts 1.11 import QGroundControl 1.0 @@ -18,141 +17,23 @@ import QGroundControl.MultiVehicleManager 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.Palette 1.0 -Item { - - //------------------------------------------------------------------------- - // Easter egg mechanism - MouseArea { - anchors.fill: parent - onClicked: { - _clickCount++ - eggTimer.restart() - if (_clickCount == 5) { - if(!QGroundControl.corePlugin.showAdvancedUI) { - advancedModeConfirmation.open() - } else { - QGroundControl.corePlugin.showAdvancedUI = false - } - } else if (_clickCount == 7) { - QGroundControl.corePlugin.showTouchAreas = !QGroundControl.corePlugin.showTouchAreas - } - } - - property int _clickCount: 0 - - Timer { - id: eggTimer - interval: 1000 - repeat: false - onTriggered: parent._clickCount = 0 - } - - MessageDialog { - id: advancedModeConfirmation - title: qsTr("Advanced Mode") - text: QGroundControl.corePlugin.showAdvancedUIMessage - standardButtons: StandardButton.Yes | StandardButton.No - onYes: { - QGroundControl.corePlugin.showAdvancedUI = true - advancedModeConfirmation.close() - } - } - } - - //------------------------------------------------------------------------- - //-- Waiting for a vehicle - QGCLabel { - id: waitForVehicle - anchors.centerIn: parent - text: qsTr("Waiting For Vehicle Connection") - font.pointSize: ScreenTools.mediumFontPointSize - font.family: ScreenTools.demiboldFontFamily - color: qgcPal.colorRed - visible: !activeVehicle - } - - //------------------------------------------------------------------------- - //-- Toolbar Indicators - Row { - id: indicatorRow - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2 - spacing: ScreenTools.defaultFontPixelWidth * 1.5 - visible: activeVehicle && !communicationLost - Repeater { - model: activeVehicle ? activeVehicle.toolBarIndicators : [] - Loader { - id: indicatorLoader - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: ScreenTools.defaultFontPixelHeight * 0.66 - source: modelData - visible: item.showIndicator - } - } - } - - //------------------------------------------------------------------------- - //-- Branding Logo - Image { - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: ScreenTools.defaultFontPixelHeight * 0.66 - visible: activeVehicle && !communicationLost && x > (indicatorRow.x + indicatorRow.width + ScreenTools.defaultFontPixelWidth) - fillMode: Image.PreserveAspectFit - source: _outdoorPalette ? _brandImageOutdoor : _brandImageIndoor - mipmap: true - - property bool _outdoorPalette: qgcPal.globalTheme === QGCPalette.Light - property bool _corePluginBranding: QGroundControl.corePlugin.brandImageIndoor.length != 0 - property string _userBrandImageIndoor: QGroundControl.settingsManager.brandImageSettings.userBrandImageIndoor.value - property string _userBrandImageOutdoor: QGroundControl.settingsManager.brandImageSettings.userBrandImageOutdoor.value - property bool _userBrandingIndoor: _userBrandImageIndoor.length != 0 - property bool _userBrandingOutdoor: _userBrandImageOutdoor.length != 0 - property string _brandImageIndoor: _userBrandingIndoor ? - _userBrandImageIndoor : (_userBrandingOutdoor ? - _userBrandImageOutdoor : (_corePluginBranding ? - QGroundControl.corePlugin.brandImageIndoor : (activeVehicle ? - activeVehicle.brandImageIndoor : "" - ) - ) - ) - property string _brandImageOutdoor: _userBrandingOutdoor ? - _userBrandImageOutdoor : (_userBrandingIndoor ? - _userBrandImageIndoor : (_corePluginBranding ? - QGroundControl.corePlugin.brandImageOutdoor : (activeVehicle ? - activeVehicle.brandImageOutdoor : "" - ) - ) - ) - } - - //------------------------------------------------------------------------- - //-- Connection Status - Row { - anchors.fill: parent - layoutDirection: Qt.RightToLeft - spacing: ScreenTools.defaultFontPixelWidth - visible: activeVehicle && communicationLost - - QGCButton { - id: disconnectButton - anchors.verticalCenter: parent.verticalCenter - text: qsTr("Disconnect") - primary: true - onClicked: activeVehicle.disconnectInactiveVehicle() - } - - QGCLabel { - id: connectionLost - anchors.verticalCenter: parent.verticalCenter - text: qsTr("COMMUNICATION LOST") - font.pointSize: ScreenTools.largeFontPointSize - font.family: ScreenTools.demiboldFontFamily - color: qgcPal.colorRed +//------------------------------------------------------------------------- +//-- Toolbar Indicators +Row { + id: indicatorRow + anchors.top: parent.top + anchors.bottom: parent.bottom + spacing: ScreenTools.defaultFontPixelWidth * 1.5 + + Repeater { + model: activeVehicle ? activeVehicle.toolBarIndicators : [] + Loader { + id: indicatorLoader + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.margins: ScreenTools.defaultFontPixelHeight * 0.66 + source: modelData + visible: item.showIndicator } } } diff --git a/src/ui/toolbar/ModeIndicator.qml b/src/ui/toolbar/ModeIndicator.qml index 7371c94e6c0a75a57d2c02a0a7a0b267124985e4..0279df26dee188285816bc172d34e1b379c0bb30 100644 --- a/src/ui/toolbar/ModeIndicator.qml +++ b/src/ui/toolbar/ModeIndicator.qml @@ -20,13 +20,12 @@ import QGroundControl.Palette 1.0 //------------------------------------------------------------------------- //-- Mode Indicator QGCComboBox { - anchors.top: parent.top - anchors.bottom: parent.bottom - alternateText: _activeVehicle ? _activeVehicle.flightMode : "" - model: _flightModes - font.pointSize: ScreenTools.mediumFontPointSize - currentIndex: -1 - sizeToContents: true + anchors.verticalCenter: parent.verticalCenter + alternateText: _activeVehicle ? _activeVehicle.flightMode : "" + model: _flightModes + font.pointSize: ScreenTools.mediumFontPointSize + currentIndex: -1 + sizeToContents: true property bool showIndicator: true diff --git a/src/ui/toolbar/MultiVehicleSelector.qml b/src/ui/toolbar/MultiVehicleSelector.qml index 26eb6264f130e637ccd75e9a120929ea94c6a140..6fc3c81dfac438fa4c042bc1663442adaa9f65ea 100644 --- a/src/ui/toolbar/MultiVehicleSelector.qml +++ b/src/ui/toolbar/MultiVehicleSelector.qml @@ -20,12 +20,11 @@ import QGroundControl.Palette 1.0 //------------------------------------------------------------------------- //-- Multiple Vehicle Selector QGCComboBox { - anchors.top: parent.top - anchors.bottom: parent.bottom - font.pointSize: ScreenTools.mediumFontPointSize - currentIndex: -1 - sizeToContents: true - model: _vehicleModel + anchors.verticalCenter: parent.verticalCenter + font.pointSize: ScreenTools.mediumFontPointSize + currentIndex: -1 + sizeToContents: true + model: _vehicleModel property bool showIndicator: _multipleVehicles diff --git a/src/ui/toolbar/VTOLModeIndicator.qml b/src/ui/toolbar/VTOLModeIndicator.qml index 3c32b055b2ceebea549be06362b3c96cdfefda0d..a0e87cf427e60c5efbb236b4ec617bf719d62f59 100644 --- a/src/ui/toolbar/VTOLModeIndicator.qml +++ b/src/ui/toolbar/VTOLModeIndicator.qml @@ -20,13 +20,12 @@ import QGroundControl.Palette 1.0 //------------------------------------------------------------------------- //-- VTOL Mode Indicator QGCLabel { - anchors.top: parent.top - anchors.bottom: parent.bottom - verticalAlignment: Text.AlignVCenter - text: _fwdFlight ? qsTr("VTOL: Fixed Wing") : qsTr("VTOL: Multi-Rotor") - font.pointSize: ScreenTools.mediumFontPointSize - color: qgcPal.buttonText - width: implicitWidth + anchors.verticalCenter: parent.verticalCenter + verticalAlignment: Text.AlignVCenter + text: _fwdFlight ? qsTr("VTOL: Fixed Wing") : qsTr("VTOL: Multi-Rotor") + font.pointSize: ScreenTools.mediumFontPointSize + color: qgcPal.buttonText + width: implicitWidth property bool showIndicator: _activeVehicle.vtol && _activeVehicle.px4Firmware