Commit e2d9e4bc authored by dogmaphobic's avatar dogmaphobic

Promoting preferences to top level panel.

parent a6e25ea9
......@@ -40,8 +40,9 @@ Item {
signal reallyClose
readonly property string _planViewSource: "MissionEditor.qml"
readonly property string _setupViewSource: "SetupView.qml"
readonly property string _planViewSource: "MissionEditor.qml"
readonly property string _setupViewSource: "SetupView.qml"
readonly property string _preferencesSource: "MainWindowLeftPanel.qml"
QGCPalette { id: qgcPal; colorGroupEnabled: true }
......@@ -68,6 +69,7 @@ Item {
currentPopUp.close()
}
ScreenTools.availableHeight = parent.height - toolBar.height
preferencesPanel.visible = false
flightView.visible = true
setupViewLoader.visible = false
planViewLoader.visible = false
......@@ -82,6 +84,7 @@ Item {
planViewLoader.source = _planViewSource
}
ScreenTools.availableHeight = parent.height - toolBar.height
preferencesPanel.visible = false
flightView.visible = false
setupViewLoader.visible = false
planViewLoader.visible = true
......@@ -97,12 +100,28 @@ Item {
if (setupViewLoader.source != _setupViewSource) {
setupViewLoader.source = _setupViewSource
}
preferencesPanel.visible = false
flightView.visible = false
setupViewLoader.visible = true
planViewLoader.visible = false
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
function showSetupFirmware() {
......@@ -182,11 +201,9 @@ Item {
}
}
//-- Detect tablet position
Connections {
target: QGroundControl.qgcPositionManger
onLastPositionUpdated: {
if(valid) {
if(lastPosition.latitude) {
......@@ -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) {
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;");
......@@ -273,12 +274,17 @@ Item {
//-- Left Settings Menu
Loader {
id: leftPanel
id: preferencesPanel
anchors.fill: parent
visible: false
z: QGroundControl.zOrderTopMost + 100
active: visible
source: "MainWindowLeftPanel.qml"
onVisibleChanged: {
console.log("Visible: " + visible)
if(!visible) {
source = ""
}
}
}
//-- Main UI
......@@ -290,12 +296,13 @@ Item {
anchors.right: parent.right
anchors.top: parent.top
mainWindow: mainWindow
opaqueBackground: leftPanel.visible
opaqueBackground: preferencesPanel.visible
isBackgroundDark: flightView.isBackgroundDark
z: QGroundControl.zOrderTopMost
onShowSetupView: mainWindow.showSetupView()
onShowPlanView: mainWindow.showPlanView()
onShowFlyView: mainWindow.showFlyView()
onShowPreferences: mainWindow.showPreferences()
Component.onCompleted: {
ScreenTools.availableHeight = parent.height - toolBar.height
}
......
......@@ -37,69 +37,17 @@ Item {
id: settingsMenu
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 _margins: ScreenTools.defaultFontPixelHeight * 0.5
readonly property real _buttonHeight: ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 3 : ScreenTools.defaultFontPixelHeight * 2
QGCPalette { id: qgcPal }
onVisibleChanged: {
//-- Unselect any selected button
panelActionGroup.current = null
//-- Destroy panel contents if not visible
if(!visible) {
__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
}
}
Component.onCompleted: {
//-- Default to General Settings
__rightPanel.source = "GeneralSettings.qml"
_generalButton.checked = true
panelActionGroup.current = _generalButton
}
// This covers the screen with a transparent section
......@@ -111,14 +59,6 @@ Item {
opacity: 0.0
color: qgcPal.window
visible: __rightPanel.source == ""
// Dismiss if clicked outside menu area
MouseArea {
anchors.fill: parent
onClicked: {
if (!__animateShowDialog.running)
mainWindow.hideLeftMenu()
}
}
}
//-- Top Separator
......@@ -164,6 +104,7 @@ Item {
}
QGCButton {
id: _generalButton
height: _buttonHeight
anchors.left: parent.left
anchors.right: parent.right
......@@ -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
Rectangle {
id: __verticalSeparator
......@@ -302,34 +231,5 @@ Item {
id: __rightPanel
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 {
enabled: _currentSelection && !_currentSelection.link
onClicked: {
QGroundControl.linkManager.createConnectedLink(_currentSelection)
settingsMenu.closeSettings()
}
}
QGCButton {
......
......@@ -58,6 +58,7 @@ Rectangle {
readonly property var colorBlue: "#636efe"
readonly property var colorWhite: "#ffffff"
signal showPreferences()
signal showSetupView()
signal showPlanView()
signal showFlyView()
......@@ -347,8 +348,8 @@ Rectangle {
}
*/
MouseArea {
anchors.fill: parent
onClicked: mainWindow.showLeftMenu()
anchors.fill: parent
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