Browse Source

Change Tool Drawer to Dialog

QGC4.4
DonLakeFlyer 4 years ago committed by Don Gagne
parent
commit
8cc9037088
  1. 155
      src/ui/MainRootWindow.qml
  2. 2
      src/ui/toolbar/MainToolBar.qml

155
src/ui/MainRootWindow.qml

@ -329,55 +329,50 @@ ApplicationWindow {
visible: QGroundControl.settingsManager.flyViewSettings.showLogReplayStatusBar.rawValue visible: QGroundControl.settingsManager.flyViewSettings.showLogReplayStatusBar.rawValue
} }
Drawer { function showToolSelectDialog() {
id: toolSelectDrawer if (!mainWindow.preventViewSwitch()) {
height: mainWindow.height showPopupDialogFromComponent(toolSelectDialogComponent)
edge: Qt.LeftEdge }
interactive: true }
dragMargin: 0
visible: false Component {
id: toolSelectDialogComponent
property var _mainWindow: mainWindow QGCPopupDialog {
property real _toolButtonHeight: ScreenTools.defaultFontPixelHeight * 3 id: toolSelectDialog
title: qsTr("Select Tool")
buttons: StandardButton.Close
Rectangle { property real _toolButtonHeight: ScreenTools.defaultFontPixelHeight * 3
width: mainLayout.width + (mainLayout.anchors.margins * 2) property real _margins: ScreenTools.defaultFontPixelWidth
height: parent.height
color: qgcPal.window
QGCFlickable { ColumnLayout {
anchors.top: parent.top width: innerLayout.width + (_margins * 2)
anchors.bottom: qgcVersionLayout.top height: innerLayout.height + (_margins * 2)
anchors.left: parent.left
anchors.right: parent.right
contentHeight: mainLayout.height + (mainLayout.anchors.margins * 2)
flickableDirection: QGCFlickable.VerticalFlick
ColumnLayout { ColumnLayout {
id: mainLayout id: innerLayout
anchors.margins: ScreenTools.defaultFontPixelWidth Layout.margins: _margins
anchors.left: parent.left spacing: ScreenTools.defaultFontPixelWidth
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
SubMenuButton { SubMenuButton {
id: setupButton id: setupButton
height: toolSelectDrawer._toolButtonHeight height: _toolButtonHeight
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Vehicle Setup") text: qsTr("Vehicle Setup")
imageColor: qgcPal.text imageColor: qgcPal.text
imageResource: "/qmlimages/Gears.svg" imageResource: "/qmlimages/Gears.svg"
onClicked: { onClicked: {
if (!mainWindow.preventViewSwitch()) { if (!mainWindow.preventViewSwitch()) {
toolSelectDialog.hideDialog()
mainWindow.showSetupTool() mainWindow.showSetupTool()
toolSelectDrawer.visible = false
} }
} }
} }
SubMenuButton { SubMenuButton {
id: analyzeButton id: analyzeButton
height: toolSelectDrawer._toolButtonHeight height: _toolButtonHeight
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Analyze Tools") text: qsTr("Analyze Tools")
imageResource: "/qmlimages/Analyze.svg" imageResource: "/qmlimages/Analyze.svg"
@ -385,15 +380,15 @@ ApplicationWindow {
visible: QGroundControl.corePlugin.showAdvancedUI visible: QGroundControl.corePlugin.showAdvancedUI
onClicked: { onClicked: {
if (!mainWindow.preventViewSwitch()) { if (!mainWindow.preventViewSwitch()) {
toolSelectDialog.hideDialog()
mainWindow.showAnalyzeTool() mainWindow.showAnalyzeTool()
toolSelectDrawer.visible = false
} }
} }
} }
SubMenuButton { SubMenuButton {
id: settingsButton id: settingsButton
height: toolSelectDrawer._toolButtonHeight height: _toolButtonHeight
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Application Settings") text: qsTr("Application Settings")
imageResource: "/res/QGCLogoFull" imageResource: "/res/QGCLogoFull"
@ -401,65 +396,61 @@ ApplicationWindow {
visible: !QGroundControl.corePlugin.options.combineSettingsAndSetup visible: !QGroundControl.corePlugin.options.combineSettingsAndSetup
onClicked: { onClicked: {
if (!mainWindow.preventViewSwitch()) { if (!mainWindow.preventViewSwitch()) {
toolSelectDialog.hideDialog()
mainWindow.showSettingsTool() mainWindow.showSettingsTool()
toolSelectDrawer.visible = false
} }
} }
} }
}
}
ColumnLayout {
id: qgcVersionLayout
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing: 0
QGCLabel {
text: qsTr("%1 Version").arg(QGroundControl.appName)
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: QGCLabel.WordWrap
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignHCenter
}
QGCLabel {
text: QGroundControl.qgcVersion
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: QGCLabel.WrapAnywhere
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignHCenter
}
}
DeadMouseArea {
anchors.fill: easterEggMouseArea
}
QGCMouseArea {
id: easterEggMouseArea
anchors.fill: qgcVersionLayout
onClicked: { ColumnLayout {
if (mouse.modifiers & Qt.ControlModifier) { width: innerLayout.width
QGroundControl.corePlugin.showTouchAreas = !QGroundControl.corePlugin.showTouchAreas spacing: 0
} else if (mouse.modifiers & Qt.ShiftModifier) {
if(!QGroundControl.corePlugin.showAdvancedUI) { QGCLabel {
advancedModeConfirmation.open() id: versionLabel
} else { text: qsTr("%1 Version").arg(QGroundControl.appName)
QGroundControl.corePlugin.showAdvancedUI = false font.pointSize: ScreenTools.smallFontPointSize
wrapMode: QGCLabel.WordWrap
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignHCenter
} }
}
}
MessageDialog { QGCLabel {
id: advancedModeConfirmation text: QGroundControl.qgcVersion
title: qsTr("Advanced Mode") font.pointSize: ScreenTools.smallFontPointSize
text: QGroundControl.corePlugin.showAdvancedUIMessage wrapMode: QGCLabel.WrapAnywhere
standardButtons: StandardButton.Yes | StandardButton.No Layout.maximumWidth: parent.width
onYes: { Layout.alignment: Qt.AlignHCenter
QGroundControl.corePlugin.showAdvancedUI = true
advancedModeConfirmation.close() QGCMouseArea {
id: easterEggMouseArea
anchors.topMargin: -versionLabel.height
anchors.fill: parent
onClicked: {
if (mouse.modifiers & Qt.ControlModifier) {
QGroundControl.corePlugin.showTouchAreas = !QGroundControl.corePlugin.showTouchAreas
} else if (mouse.modifiers & Qt.ShiftModifier) {
if(!QGroundControl.corePlugin.showAdvancedUI) {
advancedModeConfirmation.open()
} else {
QGroundControl.corePlugin.showAdvancedUI = false
}
}
}
MessageDialog {
id: advancedModeConfirmation
title: qsTr("Advanced Mode")
text: QGroundControl.corePlugin.showAdvancedUIMessage
standardButtons: StandardButton.Yes | StandardButton.No
onYes: {
QGroundControl.corePlugin.showAdvancedUI = true
advancedModeConfirmation.close()
}
}
}
}
} }
} }
} }

2
src/ui/toolbar/MainToolBar.qml

@ -69,7 +69,7 @@ Rectangle {
Layout.preferredHeight: viewButtonRow.height Layout.preferredHeight: viewButtonRow.height
icon.source: "/res/QGCLogoFull" icon.source: "/res/QGCLogoFull"
logo: true logo: true
onClicked: toolSelectDrawer.visible = true onClicked: mainWindow.showToolSelectDialog()
} }
MainStatusIndicator { MainStatusIndicator {

Loading…
Cancel
Save