Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
72fd8342
Unverified
Commit
72fd8342
authored
Dec 12, 2019
by
Don Gagne
Committed by
GitHub
Dec 12, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8112 from DonLakeFlyer/PreventViewSwitch
View switch prevention support
parents
236d47b5
c7f840ac
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
39 deletions
+73
-39
QGCToolBarButton.qml
src/QmlControls/QGCToolBarButton.qml
+7
-2
SubMenuButton.qml
src/QmlControls/SubMenuButton.qml
+7
-2
SetupView.qml
src/VehicleSetup/SetupView.qml
+17
-29
AppSettings.qml
src/ui/AppSettings.qml
+4
-1
MainRootWindow.qml
src/ui/MainRootWindow.qml
+6
-1
MainToolBar.qml
src/ui/toolbar/MainToolBar.qml
+32
-4
No files found.
src/QmlControls/QGCToolBarButton.qml
View file @
72fd8342
...
...
@@ -14,20 +14,25 @@ import QGroundControl.Controls 1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
ScreenTools
1.0
// Important Note: Toolbar buttons must manage their checked state manually in order to support
// view switch prevention. This means they can't be checkable or autoExclusive.
Button
{
id
:
button
height
:
ScreenTools
.
defaultFontPixelHeight
*
3
leftPadding
:
_horizontalMargin
rightPadding
:
_horizontalMargin
autoExclusive
:
tru
e
checkable
:
fals
e
property
bool
logo
:
false
property
real
_horizontalMargin
:
ScreenTools
.
defaultFontPixelWidth
onCheckedChanged
:
checkable
=
false
background
:
Rectangle
{
anchors.fill
:
parent
color
:
logo
?
qgcPal
.
brandingPurple
:
(
checked
?
qgcPal
.
buttonHighlight
:
Qt
.
rgba
(
0
,
0
,
0
,
0
))
color
:
logo
?
qgcPal
.
brandingPurple
:
(
button
.
checked
?
qgcPal
.
buttonHighlight
:
Qt
.
rgba
(
0
,
0
,
0
,
0
))
}
contentItem
:
Row
{
...
...
src/QmlControls/SubMenuButton.qml
View file @
72fd8342
...
...
@@ -6,6 +6,9 @@ import QtGraphicalEffects 1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
ScreenTools
1.0
// Important Note: SubMenuButtons must manage their checked state manually in order to support
// view switch prevention. This means they can't be checkable or autoExclusive.
Button
{
id
:
_rootButton
property
bool
setupComplete
:
true
///< true: setup complete indicator shows as completed
...
...
@@ -13,12 +16,14 @@ Button {
property
string
imageResource
:
"
/qmlimages/subMenuButtonImage.png
"
///< Button image
property
size
sourceSize
:
Qt
.
size
(
ScreenTools
.
defaultFontPixelHeight
*
2
,
ScreenTools
.
defaultFontPixelHeight
*
2
)
text
:
"
Button
"
///< Pass in your own button text
text
:
"
Button
"
///< Pass in your own button text
activeFocusOnPress
:
true
checkable
:
true
implicitHeight
:
ScreenTools
.
isTinyScreen
?
ScreenTools
.
defaultFontPixelHeight
*
3.5
:
ScreenTools
.
defaultFontPixelHeight
*
2.5
implicitWidth
:
__panel
.
implicitWidth
onCheckedChanged
:
checkable
=
false
style
:
ButtonStyle
{
id
:
buttonStyle
...
...
src/VehicleSetup/SetupView.qml
View file @
72fd8342
...
...
@@ -41,6 +41,9 @@ Rectangle {
function
showSummaryPanel
()
{
if
(
mainWindow
.
preventViewSwitch
)
{
return
}
if
(
_fullParameterVehicleAvailable
)
{
if
(
QGroundControl
.
multiVehicleManager
.
activeVehicle
.
autopilot
.
vehicleComponents
.
length
===
0
)
{
panelLoader
.
setSourceComponent
(
noComponentsVehicleSummaryComponent
)
...
...
@@ -54,30 +57,19 @@ Rectangle {
}
}
function
showFirmwarePanel
()
{
if
(
!
ScreenTools
.
isMobile
)
{
panelLoader
.
setSource
(
"
FirmwareUpgrade.qml
"
)
function
showPanel
(
button
,
qmlSource
)
{
if
(
mainWindow
.
preventViewSwitch
)
{
return
}
}
function
showJoystickPanel
()
{
panelLoader
.
setSource
(
"
JoystickConfig.qml
"
)
}
function
showParametersPanel
()
{
panelLoader
.
setSource
(
"
SetupParameterEditor.qml
"
)
}
function
showPX4FlowPanel
()
{
panelLoader
.
setSource
(
"
PX4FlowSensor.qml
"
)
button
.
checked
=
true
panelLoader
.
setSource
(
qmlSource
)
}
function
showVehicleComponentPanel
(
vehicleComponent
)
{
if
(
mainWindow
.
preventViewSwitch
)
{
return
}
var
autopilotPlugin
=
QGroundControl
.
multiVehicleManager
.
activeVehicle
.
autopilot
var
prereq
=
autopilotPlugin
.
prerequisiteSetup
(
vehicleComponent
)
if
(
prereq
!==
""
)
{
...
...
@@ -229,7 +221,7 @@ Rectangle {
exclusiveGroup
:
setupButtonGroup
text
:
modelData
.
title
visible
:
_corePlugin
&&
_corePlugin
.
options
.
combineSettingsAndSetup
onClicked
:
panelLoader
.
setSource
(
modelData
.
url
)
onClicked
:
showPanel
(
this
,
modelData
.
url
)
Layout.fillWidth
:
true
}
}
...
...
@@ -255,7 +247,7 @@ Rectangle {
text
:
qsTr
(
"
Firmware
"
)
Layout.fillWidth
:
true
onClicked
:
show
FirmwarePanel
(
)
onClicked
:
show
Panel
(
this
,
"
FirmwareUpgrade.qml
"
)
}
SubMenuButton
{
...
...
@@ -265,8 +257,7 @@ Rectangle {
setupIndicator
:
false
text
:
qsTr
(
"
PX4Flow
"
)
Layout.fillWidth
:
true
onClicked
:
showPX4FlowPanel
()
onClicked
:
showPX4FlowPanel
(
this
,
"
PX4FlowSensor.qml
"
)
}
SubMenuButton
{
...
...
@@ -277,8 +268,7 @@ Rectangle {
visible
:
_fullParameterVehicleAvailable
&&
joystickManager
.
joysticks
.
length
!==
0
text
:
qsTr
(
"
Joystick
"
)
Layout.fillWidth
:
true
onClicked
:
showJoystickPanel
()
onClicked
:
showJoystickPanel
(
this
,
"
JoystickConfig.qml
"
)
}
Repeater
{
...
...
@@ -293,8 +283,7 @@ Rectangle {
text
:
modelData
.
name
visible
:
modelData
.
setupSource
.
toString
()
!==
""
Layout.fillWidth
:
true
onClicked
:
showVehicleComponentPanel
(
modelData
)
onClicked
:
showVehicleComponentPanel
(
modelData
)
}
}
...
...
@@ -306,8 +295,7 @@ Rectangle {
_corePlugin
.
showAdvancedUI
text
:
qsTr
(
"
Parameters
"
)
Layout.fillWidth
:
true
onClicked
:
showParametersPanel
()
onClicked
:
showPanel
(
this
,
"
SetupParameterEditor.qml
"
)
}
}
...
...
src/ui/AppSettings.qml
View file @
72fd8342
...
...
@@ -74,7 +74,10 @@ Rectangle {
Layout.fillWidth
:
true
onClicked
:
{
if
(
__rightPanel
.
source
!==
modelData
.
url
)
{
if
(
mainWindow
.
preventViewSwitch
)
{
return
}
if
(
__rightPanel
.
source
!==
modelData
.
url
)
{
__rightPanel
.
source
=
modelData
.
url
}
checked
=
true
...
...
src/ui/MainRootWindow.qml
View file @
72fd8342
...
...
@@ -49,6 +49,7 @@ ApplicationWindow {
property
bool
communicationLost
:
activeVehicle
?
activeVehicle
.
connectionLost
:
false
property
string
formatedMessage
:
activeVehicle
?
activeVehicle
.
formatedMessage
:
""
property
real
availableHeight
:
mainWindow
.
height
-
mainWindow
.
header
.
height
-
mainWindow
.
footer
.
height
property
bool
preventViewSwitch
:
false
property
var
currentPlanMissionItem
:
planMasterControllerPlan
?
planMasterControllerPlan
.
missionController
.
currentPlanViewItem
:
null
property
var
planMasterControllerPlan
:
null
...
...
@@ -151,8 +152,10 @@ ApplicationWindow {
mainWindowDialog
.
dialogComponent
=
component
mainWindowDialog
.
dialogTitle
=
title
mainWindowDialog
.
dialogButtons
=
buttons
console
.
log
(
"
Prevent view switch
"
)
mainWindow
.
preventViewSwitch
=
true
mainWindowDialog
.
open
()
if
(
buttons
&
StandardButton
.
Cancel
||
buttons
&
StandardButton
.
Close
||
buttons
&
StandardButton
.
Discard
||
buttons
&
StandardButton
.
Abort
||
buttons
&
StandardButton
.
Ignore
)
{
if
(
buttons
&
StandardButton
.
Cancel
||
buttons
&
StandardButton
.
Close
||
buttons
&
StandardButton
.
Discard
||
buttons
&
StandardButton
.
Abort
||
buttons
&
StandardButton
.
Ignore
)
{
mainWindowDialog
.
closePolicy
=
Popup
.
NoAutoClose
;
mainWindowDialog
.
interactive
=
false
;
}
else
{
...
...
@@ -184,6 +187,8 @@ ApplicationWindow {
dlgLoader
.
source
=
"
QGCViewDialogContainer.qml
"
}
onClosed
:
{
console
.
log
(
"
View switch ok
"
)
mainWindow
.
preventViewSwitch
=
false
dlgLoader
.
source
=
""
}
}
...
...
src/ui/toolbar/MainToolBar.qml
View file @
72fd8342
...
...
@@ -98,17 +98,25 @@ Item {
anchors.bottom
:
parent
.
bottom
spacing
:
ScreenTools
.
defaultFontPixelWidth
/
2
ButtonGroup
{
buttons
:
viewRow
.
children
}
// Important Note: Toolbar buttons must manage their checked state manually in order to support
// view switch prevention. There doesn't seem to be a way to make this work if they are in a
// ButtonGroup.
//---------------------------------------------
// Toolbar Row
RowLayout
{
id
:
view
Row
id
:
button
Row
Layout.fillHeight
:
true
spacing
:
0
function
clearAllChecks
()
{
for
(
var
i
=
0
;
i
<
buttonRow
.
children
.
length
;
i
++
)
{
if
(
buttonRow
.
children
[
i
].
toString
().
startsWith
(
"
QGCToolBarButton
"
))
{
buttonRow
.
children
[
i
].
checked
=
false
}
}
}
QGCToolBarButton
{
id
:
settingsButton
Layout.fillHeight
:
true
...
...
@@ -116,6 +124,10 @@ Item {
logo
:
true
visible
:
!
QGroundControl
.
corePlugin
.
options
.
combineSettingsAndSetup
onClicked
:
{
if
(
mainWindow
.
preventViewSwitch
)
{
return
}
buttonRow
.
clearAllChecks
()
checked
=
true
mainWindow
.
showSettingsView
()
}
...
...
@@ -126,6 +138,10 @@ Item {
Layout.fillHeight
:
true
icon.source
:
"
/qmlimages/Gears.svg
"
onClicked
:
{
if
(
mainWindow
.
preventViewSwitch
)
{
return
}
buttonRow
.
clearAllChecks
()
checked
=
true
mainWindow
.
showSetupView
()
}
...
...
@@ -136,6 +152,10 @@ Item {
Layout.fillHeight
:
true
icon.source
:
"
/qmlimages/Plan.svg
"
onClicked
:
{
if
(
mainWindow
.
preventViewSwitch
)
{
return
}
buttonRow
.
clearAllChecks
()
checked
=
true
mainWindow
.
showPlanView
()
}
...
...
@@ -146,6 +166,10 @@ Item {
Layout.fillHeight
:
true
icon.source
:
"
/qmlimages/PaperPlane.svg
"
onClicked
:
{
if
(
mainWindow
.
preventViewSwitch
)
{
return
}
buttonRow
.
clearAllChecks
()
checked
=
true
mainWindow
.
showFlyView
()
}
...
...
@@ -157,6 +181,10 @@ Item {
icon.source
:
"
/qmlimages/Analyze.svg
"
visible
:
QGroundControl
.
corePlugin
.
showAdvancedUI
onClicked
:
{
if
(
mainWindow
.
preventViewSwitch
)
{
return
}
buttonRow
.
clearAllChecks
()
checked
=
true
mainWindow
.
showAnalyzeView
()
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment