Commit e2d9e4bc authored by dogmaphobic's avatar dogmaphobic

Promoting preferences to top level panel.

parent a6e25ea9
...@@ -40,8 +40,9 @@ Item { ...@@ -40,8 +40,9 @@ Item {
signal reallyClose signal reallyClose
readonly property string _planViewSource: "MissionEditor.qml" readonly property string _planViewSource: "MissionEditor.qml"
readonly property string _setupViewSource: "SetupView.qml" readonly property string _setupViewSource: "SetupView.qml"
readonly property string _preferencesSource: "MainWindowLeftPanel.qml"
QGCPalette { id: qgcPal; colorGroupEnabled: true } QGCPalette { id: qgcPal; colorGroupEnabled: true }
...@@ -68,6 +69,7 @@ Item { ...@@ -68,6 +69,7 @@ Item {
currentPopUp.close() currentPopUp.close()
} }
ScreenTools.availableHeight = parent.height - toolBar.height ScreenTools.availableHeight = parent.height - toolBar.height
preferencesPanel.visible = false
flightView.visible = true flightView.visible = true
setupViewLoader.visible = false setupViewLoader.visible = false
planViewLoader.visible = false planViewLoader.visible = false
...@@ -82,6 +84,7 @@ Item { ...@@ -82,6 +84,7 @@ Item {
planViewLoader.source = _planViewSource planViewLoader.source = _planViewSource
} }
ScreenTools.availableHeight = parent.height - toolBar.height ScreenTools.availableHeight = parent.height - toolBar.height
preferencesPanel.visible = false
flightView.visible = false flightView.visible = false
setupViewLoader.visible = false setupViewLoader.visible = false
planViewLoader.visible = true planViewLoader.visible = true
...@@ -97,12 +100,28 @@ Item { ...@@ -97,12 +100,28 @@ Item {
if (setupViewLoader.source != _setupViewSource) { if (setupViewLoader.source != _setupViewSource) {
setupViewLoader.source = _setupViewSource setupViewLoader.source = _setupViewSource
} }
preferencesPanel.visible = false
flightView.visible = false flightView.visible = false
setupViewLoader.visible = true setupViewLoader.visible = true
planViewLoader.visible = false planViewLoader.visible = false
toolBar.checkSetupButton() toolBar.checkSetupButton()
} }
function showPreferences() {
if(currentPopUp) {
currentPopUp.close()
}
//-- In preferences view, the full height is available. Set to 0 so it is ignored.
ScreenTools.availableHeight = 0
if (preferencesPanel.source != _preferencesSource) {
preferencesPanel.source = _preferencesSource
}
flightView.visible = false
setupViewLoader.visible = false
planViewLoader.visible = false
preferencesPanel.visible = true
}
// The following are use for unit testing only // The following are use for unit testing only
function showSetupFirmware() { function showSetupFirmware() {
...@@ -182,11 +201,9 @@ Item { ...@@ -182,11 +201,9 @@ Item {
} }
} }
//-- Detect tablet position //-- Detect tablet position
Connections { Connections {
target: QGroundControl.qgcPositionManger target: QGroundControl.qgcPositionManger
onLastPositionUpdated: { onLastPositionUpdated: {
if(valid) { if(valid) {
if(lastPosition.latitude) { if(lastPosition.latitude) {
...@@ -213,22 +230,6 @@ Item { ...@@ -213,22 +230,6 @@ Item {
} }
} }
function showLeftMenu() {
if(!leftPanel.visible) {
leftPanel.visible = true
leftPanel.item.animateShowDialog.start()
} else if(leftPanel.visible && !leftPanel.item.animateShowDialog.running) {
//-- If open, toggle it closed
hideLeftMenu()
}
}
function hideLeftMenu() {
if(leftPanel.visible && !leftPanel.item.animateHideDialog.running) {
leftPanel.item.animateHideDialog.start()
}
}
function formatMessage(message) { function formatMessage(message) {
message = message.replace(new RegExp("<#E>", "g"), "color: #f95e5e; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;"); message = message.replace(new RegExp("<#E>", "g"), "color: #f95e5e; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;");
message = message.replace(new RegExp("<#I>", "g"), "color: #f9b55e; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;"); message = message.replace(new RegExp("<#I>", "g"), "color: #f9b55e; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;");
...@@ -273,12 +274,17 @@ Item { ...@@ -273,12 +274,17 @@ Item {
//-- Left Settings Menu //-- Left Settings Menu
Loader { Loader {
id: leftPanel id: preferencesPanel
anchors.fill: parent anchors.fill: parent
visible: false visible: false
z: QGroundControl.zOrderTopMost + 100 z: QGroundControl.zOrderTopMost + 100
active: visible active: visible
source: "MainWindowLeftPanel.qml" onVisibleChanged: {
console.log("Visible: " + visible)
if(!visible) {
source = ""
}
}
} }
//-- Main UI //-- Main UI
...@@ -290,12 +296,13 @@ Item { ...@@ -290,12 +296,13 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
mainWindow: mainWindow mainWindow: mainWindow
opaqueBackground: leftPanel.visible opaqueBackground: preferencesPanel.visible
isBackgroundDark: flightView.isBackgroundDark isBackgroundDark: flightView.isBackgroundDark
z: QGroundControl.zOrderTopMost z: QGroundControl.zOrderTopMost
onShowSetupView: mainWindow.showSetupView() onShowSetupView: mainWindow.showSetupView()
onShowPlanView: mainWindow.showPlanView() onShowPlanView: mainWindow.showPlanView()
onShowFlyView: mainWindow.showFlyView() onShowFlyView: mainWindow.showFlyView()
onShowPreferences: mainWindow.showPreferences()
Component.onCompleted: { Component.onCompleted: {
ScreenTools.availableHeight = parent.height - toolBar.height ScreenTools.availableHeight = parent.height - toolBar.height
} }
......
...@@ -37,69 +37,17 @@ Item { ...@@ -37,69 +37,17 @@ Item {
id: settingsMenu id: settingsMenu
anchors.fill: parent anchors.fill: parent
property alias animateShowDialog: __animateShowDialog
property alias animateHideDialog: __animateHideDialog
readonly property int __animationDuration: 100
readonly property real __closeButtonSize: ScreenTools.defaultFontPixelHeight * 1.5 readonly property real __closeButtonSize: ScreenTools.defaultFontPixelHeight * 1.5
readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5 readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5
readonly property real _buttonHeight: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 3 : ScreenTools.defaultFontPixelHeight * 2 readonly property real _buttonHeight: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 3 : ScreenTools.defaultFontPixelHeight * 2
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
onVisibleChanged: { Component.onCompleted: {
//-- Unselect any selected button //-- Default to General Settings
panelActionGroup.current = null __rightPanel.source = "GeneralSettings.qml"
//-- Destroy panel contents if not visible _generalButton.checked = true
if(!visible) { panelActionGroup.current = _generalButton
__rightPanel.source = ""
}
}
function closeSettings() {
__rightPanel.source = ""
mainWindow.hideLeftMenu()
}
ParallelAnimation {
id: __animateShowDialog
NumberAnimation {
target: __transparentSection
properties: "opacity"
from: 0.0
to: 0.8
duration: settingsMenu.__animationDuration
}
NumberAnimation {
target: __transparentSection
properties: "width"
from: 1
to: mainWindow.width
duration: settingsMenu.__animationDuration
}
}
ParallelAnimation {
id: __animateHideDialog
NumberAnimation {
target: __transparentSection
properties: "opacity"
from: 0.8
to: 0.0
duration: settingsMenu.__animationDuration
}
NumberAnimation {
target: __transparentSection
properties: "width"
from: mainWindow.width
to: 1
duration: settingsMenu.__animationDuration
}
onRunningChanged: {
if (!running) {
parent.visible = false
}
}
} }
// This covers the screen with a transparent section // This covers the screen with a transparent section
...@@ -111,14 +59,6 @@ Item { ...@@ -111,14 +59,6 @@ Item {
opacity: 0.0 opacity: 0.0
color: qgcPal.window color: qgcPal.window
visible: __rightPanel.source == "" visible: __rightPanel.source == ""
// Dismiss if clicked outside menu area
MouseArea {
anchors.fill: parent
onClicked: {
if (!__animateShowDialog.running)
mainWindow.hideLeftMenu()
}
}
} }
//-- Top Separator //-- Top Separator
...@@ -164,6 +104,7 @@ Item { ...@@ -164,6 +104,7 @@ Item {
} }
QGCButton { QGCButton {
id: _generalButton
height: _buttonHeight height: _buttonHeight
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
...@@ -266,18 +207,6 @@ Item { ...@@ -266,18 +207,6 @@ Item {
} }
} }
//-- Clicking in tool bar area dismiss it all
MouseArea {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: toolBar.height
onClicked: {
if (!__animateShowDialog.running)
mainWindow.hideLeftMenu()
}
}
//-- Vertical Separator //-- Vertical Separator
Rectangle { Rectangle {
id: __verticalSeparator id: __verticalSeparator
...@@ -302,34 +231,5 @@ Item { ...@@ -302,34 +231,5 @@ Item {
id: __rightPanel id: __rightPanel
anchors.fill: parent anchors.fill: parent
} }
//-- Dismiss it all
Item {
id: closeButton
width: __closeButtonSize
height: __closeButtonSize
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
QGCColoredImage {
source: "/res/XDelete.svg"
mipmap: true
fillMode: Image.PreserveAspectFit
color: qgcPal.text
width: parent.width * 0.75
height: parent.height * 0.75
sourceSize.height: height
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: {
if (!__animateShowDialog.running) {
__rightPanel.source = ""
mainWindow.hideLeftMenu()
}
}
}
}
} }
} }
...@@ -151,7 +151,6 @@ Rectangle { ...@@ -151,7 +151,6 @@ Rectangle {
enabled: _currentSelection && !_currentSelection.link enabled: _currentSelection && !_currentSelection.link
onClicked: { onClicked: {
QGroundControl.linkManager.createConnectedLink(_currentSelection) QGroundControl.linkManager.createConnectedLink(_currentSelection)
settingsMenu.closeSettings()
} }
} }
QGCButton { QGCButton {
......
...@@ -58,6 +58,7 @@ Rectangle { ...@@ -58,6 +58,7 @@ Rectangle {
readonly property var colorBlue: "#636efe" readonly property var colorBlue: "#636efe"
readonly property var colorWhite: "#ffffff" readonly property var colorWhite: "#ffffff"
signal showPreferences()
signal showSetupView() signal showSetupView()
signal showPlanView() signal showPlanView()
signal showFlyView() signal showFlyView()
...@@ -347,8 +348,8 @@ Rectangle { ...@@ -347,8 +348,8 @@ Rectangle {
} }
*/ */
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: mainWindow.showLeftMenu() onClicked: toolBar.showPreferences()
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment