Unverified Commit 8f463d68 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #9050 from DonLakeFlyer/ToolBack

Change tool close to more of a "Back" model
parents 74f878b2 d48576cd
...@@ -125,7 +125,7 @@ ApplicationWindow { ...@@ -125,7 +125,7 @@ ApplicationWindow {
function viewSwitch(currentToolbar) { function viewSwitch(currentToolbar) {
toolDrawer.visible = false toolDrawer.visible = false
toolDrawer.source = "" toolDrawer.toolSource = ""
flightView.visible = false flightView.visible = false
planView.visible = false planView.visible = false
toolbar.currentToolbar = currentToolbar toolbar.currentToolbar = currentToolbar
...@@ -144,22 +144,24 @@ ApplicationWindow { ...@@ -144,22 +144,24 @@ ApplicationWindow {
planView.visible = true planView.visible = true
} }
function showAnalyzeView() { function showTool(toolTitle, toolSource, toolIcon) {
toolDrawer.source = "AnalyzeView.qml" toolDrawer.backIcon = flightView.visible ? "/qmlimages/PaperPlane.svg" : "/qmlimages/Plan.svg"
toolDrawer.title = qsTr("Analyze Tools") toolDrawer.toolTitle = toolTitle
toolDrawer.visible = true toolDrawer.toolSource = toolSource
toolDrawer.toolIcon = toolIcon
toolDrawer.visible = true
} }
function showSetupView() { function showAnalyzeTool() {
toolDrawer.source = "SetupView.qml" showTool(qsTr("Analyze Tools"), "AnalyzeView.qml", "/qmlimages/Analyze.svg")
toolDrawer.title = qsTr("Vehicle Setup")
toolDrawer.visible = true
} }
function showSettingsView() { function showSetupTool() {
toolDrawer.source = "AppSettings.qml" showTool(qsTr("Vehicle Setup"), "SetupView.qml", "/qmlimages/Gears.svg")
toolDrawer.title = qsTr("Application Settings") }
toolDrawer.visible = true
function showSettingsTool() {
showTool(qsTr("Application Settings"), "AppSettings.qml", "/res/QGCLogoWhite")
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
...@@ -367,7 +369,7 @@ ApplicationWindow { ...@@ -367,7 +369,7 @@ ApplicationWindow {
imageResource: "/qmlimages/Gears.svg" imageResource: "/qmlimages/Gears.svg"
onClicked: { onClicked: {
if (!mainWindow.preventViewSwitch()) { if (!mainWindow.preventViewSwitch()) {
mainWindow.showSetupView() mainWindow.showSetupTool()
toolSelectDrawer.visible = false toolSelectDrawer.visible = false
} }
} }
...@@ -383,7 +385,7 @@ ApplicationWindow { ...@@ -383,7 +385,7 @@ ApplicationWindow {
visible: QGroundControl.corePlugin.showAdvancedUI visible: QGroundControl.corePlugin.showAdvancedUI
onClicked: { onClicked: {
if (!mainWindow.preventViewSwitch()) { if (!mainWindow.preventViewSwitch()) {
mainWindow.showAnalyzeView() mainWindow.showAnalyzeTool()
toolSelectDrawer.visible = false toolSelectDrawer.visible = false
} }
} }
...@@ -399,7 +401,7 @@ ApplicationWindow { ...@@ -399,7 +401,7 @@ ApplicationWindow {
visible: !QGroundControl.corePlugin.options.combineSettingsAndSetup visible: !QGroundControl.corePlugin.options.combineSettingsAndSetup
onClicked: { onClicked: {
if (!mainWindow.preventViewSwitch()) { if (!mainWindow.preventViewSwitch()) {
mainWindow.showSettingsView() mainWindow.showSettingsTool()
toolSelectDrawer.visible = false toolSelectDrawer.visible = false
} }
} }
...@@ -485,8 +487,10 @@ ApplicationWindow { ...@@ -485,8 +487,10 @@ ApplicationWindow {
interactive: false interactive: false
visible: false visible: false
property alias title: toolbarDrawerText.text property alias backIcon: backIcon.source
property alias source: toolDrawerLoader.source property alias toolTitle: toolbarDrawerText.text
property alias toolSource: toolDrawerLoader.source
property alias toolIcon: toolIcon.source
Rectangle { Rectangle {
id: toolDrawerToolbar id: toolDrawerToolbar
...@@ -496,23 +500,55 @@ ApplicationWindow { ...@@ -496,23 +500,55 @@ ApplicationWindow {
height: ScreenTools.toolbarHeight height: ScreenTools.toolbarHeight
color: qgcPal.toolbarBackground color: qgcPal.toolbarBackground
QGCLabel { RowLayout {
id: toolbarDrawerText anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.margins: ScreenTools.defaultFontPixelWidth anchors.left: parent.left
anchors.left: parent.left anchors.top: parent.top
anchors.verticalCenter: parent.verticalCenter anchors.bottom: parent.bottom
font.pointSize: ScreenTools.largeFontPointSize spacing: ScreenTools.defaultFontPixelWidth
QGCColoredImage {
id: backIcon
width: ScreenTools.defaultFontPixelHeight * 2
height: ScreenTools.defaultFontPixelHeight * 2
fillMode: Image.PreserveAspectFit
mipmap: true
color: qgcPal.text
}
QGCLabel {
id: backTextLabel
text: qsTr("Back")
}
QGCLabel {
font.pointSize: ScreenTools.largeFontPointSize
text: "<"
}
QGCColoredImage {
id: toolIcon
width: ScreenTools.defaultFontPixelHeight * 2
height: ScreenTools.defaultFontPixelHeight * 2
fillMode: Image.PreserveAspectFit
mipmap: true
color: qgcPal.text
}
QGCLabel {
id: toolbarDrawerText
font.pointSize: ScreenTools.largeFontPointSize
}
} }
QGCButton { QGCMouseArea {
anchors.margins: ScreenTools.defaultFontPixelWidth anchors.top: parent.top
anchors.right: parent.right anchors.bottom: parent.bottom
anchors.verticalCenter: parent.verticalCenter x: parent.mapFromItem(backIcon, backIcon.x, backIcon.y).x
text: qsTr("Close") width: (backTextLabel.x + backTextLabel.width) - backIcon.x
enabled: !mainWindow.preventViewSwitch()
onClicked: { onClicked: {
toolDrawer.visible = false toolDrawer.visible = false
toolDrawer.source = "" toolDrawer.toolSource = ""
} }
} }
} }
......
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