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
ad48fda2
Commit
ad48fda2
authored
Mar 27, 2018
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Power components allow setup while armed but not flying
parent
e8c6509d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
34 deletions
+37
-34
APMPowerComponent.h
src/AutoPilotPlugins/APM/APMPowerComponent.h
+11
-10
SetupPage.qml
src/AutoPilotPlugins/Common/SetupPage.qml
+9
-6
PowerComponent.h
src/AutoPilotPlugins/PX4/PowerComponent.h
+11
-10
VehicleComponent.cc
src/VehicleSetup/VehicleComponent.cc
+0
-6
VehicleComponent.h
src/VehicleSetup/VehicleComponent.h
+6
-2
No files found.
src/AutoPilotPlugins/APM/APMPowerComponent.h
View file @
ad48fda2
...
...
@@ -20,18 +20,19 @@ class APMPowerComponent : public VehicleComponent
public:
APMPowerComponent
(
Vehicle
*
vehicle
,
AutoPilotPlugin
*
autopilot
,
QObject
*
parent
=
NULL
);
//
Virtual
s from VehicleComponent
QStringList
setupCompleteChangedTriggerList
(
void
)
const
final
;
//
Override
s from VehicleComponent
QStringList
setupCompleteChangedTriggerList
(
void
)
const
override
;
// Virtuals from VehicleComponent
QString
name
(
void
)
const
final
;
QString
description
(
void
)
const
final
;
QString
iconResource
(
void
)
const
final
;
bool
requiresSetup
(
void
)
const
final
;
bool
setupComplete
(
void
)
const
final
;
QUrl
setupSource
(
void
)
const
final
;
QUrl
summaryQmlSource
(
void
)
const
final
;
QString
name
(
void
)
const
override
;
QString
description
(
void
)
const
override
;
QString
iconResource
(
void
)
const
override
;
bool
requiresSetup
(
void
)
const
override
;
bool
setupComplete
(
void
)
const
override
;
QUrl
setupSource
(
void
)
const
override
;
QUrl
summaryQmlSource
(
void
)
const
override
;
bool
allowSetupWhileArmed
(
void
)
const
override
{
return
true
;
}
private:
const
QString
_name
;
QVariantList
_summaryItems
;
...
...
src/AutoPilotPlugins/Common/SetupPage.qml
View file @
ad48fda2
...
...
@@ -23,7 +23,7 @@ import QGroundControl.Controllers 1.0
QGCView
{
id
:
setupView
viewPanel
:
setupPanel
enabled
:
!
_
shouldDisableWhenArmed
enabled
:
!
_
disableDueToArmed
&&
!
_disableDueToFlying
property
alias
pageComponent
:
pageLoader
.
sourceComponent
property
string
pageName
:
vehicleComponent
?
vehicleComponent
.
name
:
""
...
...
@@ -31,13 +31,16 @@ QGCView {
property
real
availableWidth
:
width
-
pageLoader
.
x
property
real
availableHeight
:
height
-
pageLoader
.
y
property
bool
_vehicleArmed
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
?
QGroundControl
.
multiVehicleManager
.
activeVehicle
.
armed
:
false
property
bool
_shouldDisableWhenArmed
:
_vehicleArmed
?
(
vehicleComponent
?
!
vehicleComponent
.
allowSetupWhileArmed
:
false
)
:
false
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
property
bool
_vehicleArmed
:
_activeVehicle
?
_activeVehicle
.
armed
:
false
property
bool
_vehicleFlying
:
_activeVehicle
?
_activeVehicle
.
flying
:
false
property
bool
_disableDueToArmed
:
vehicleComponent
?
(
!
vehicleComponent
.
allowSetupWhileArmed
&&
_vehicleArmed
)
:
false
property
bool
_disableDueToFlying
:
vehicleComponent
?
(
!
vehicleComponent
.
allowSetupWhileFlying
&&
_vehicleFlying
)
:
false
property
string
_disableReason
:
_disableDueToArmed
?
qsTr
(
"
armed
"
)
:
qsTr
(
"
flying
"
)
property
real
_margins
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
property
string
_pageTitle
:
qsTr
(
"
%1 Setup
"
).
arg
(
pageName
)
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
setupPanel
.
enabled
}
QGCViewPanel
{
...
...
@@ -57,7 +60,7 @@ QGCView {
QGCLabel
{
font.pointSize
:
ScreenTools
.
largeFontPointSize
text
:
_shouldDisableWhenArmed
?
_pageTitle
+
"
<font color=
\"
red
\"
>
"
+
qsTr
(
"
(Disabled while the vehicle is armed)
"
)
+
"
</font>
"
:
_pageTitle
text
:
!
setupView
.
enabled
?
_pageTitle
+
"
<font color=
\"
red
\"
>
"
+
qsTr
(
"
(Disabled while the vehicle is %1)
"
).
arg
(
_disableReason
)
+
"
</font>
"
:
_pageTitle
visible
:
!
ScreenTools
.
isShortScreen
}
...
...
@@ -78,7 +81,7 @@ QGCView {
// Overlay to display when vehicle is armed and this setup page needs
// to be disabled
Rectangle
{
visible
:
_shouldDisableWhenArm
ed
visible
:
!
setupView
.
enabl
ed
anchors.fill
:
pageLoader
color
:
"
black
"
opacity
:
0.5
...
...
src/AutoPilotPlugins/PX4/PowerComponent.h
View file @
ad48fda2
...
...
@@ -24,18 +24,19 @@ class PowerComponent : public VehicleComponent
public:
PowerComponent
(
Vehicle
*
vehicle
,
AutoPilotPlugin
*
autopilot
,
QObject
*
parent
=
NULL
);
//
Virtual
s from VehicleComponent
//
Override
s from VehicleComponent
virtual
QStringList
setupCompleteChangedTriggerList
(
void
)
const
;
// Virtuals from VehicleComponent
virtual
QString
name
(
void
)
const
;
virtual
QString
description
(
void
)
const
;
virtual
QString
iconResource
(
void
)
const
;
virtual
bool
requiresSetup
(
void
)
const
;
virtual
bool
setupComplete
(
void
)
const
;
virtual
QUrl
setupSource
(
void
)
const
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
// Overrides from VehicleComponent
QString
name
(
void
)
const
override
;
QString
description
(
void
)
const
override
;
QString
iconResource
(
void
)
const
override
;
bool
requiresSetup
(
void
)
const
override
;
bool
setupComplete
(
void
)
const
override
;
QUrl
setupSource
(
void
)
const
override
;
QUrl
summaryQmlSource
(
void
)
const
override
;
bool
allowSetupWhileArmed
(
void
)
const
override
{
return
true
;
}
private:
const
QString
_name
;
QVariantList
_summaryItems
;
...
...
src/VehicleSetup/VehicleComponent.cc
View file @
ad48fda2
...
...
@@ -66,9 +66,3 @@ void VehicleComponent::_triggerUpdated(QVariant /*value*/)
{
emit
setupCompleteChanged
(
setupComplete
());
}
bool
VehicleComponent
::
allowSetupWhileArmed
(
void
)
const
{
// Default is to not allow setup while armed
return
false
;
}
src/VehicleSetup/VehicleComponent.h
View file @
ad48fda2
...
...
@@ -37,7 +37,8 @@ class VehicleComponent : public QObject
Q_PROPERTY
(
QUrl
setupSource
READ
setupSource
NOTIFY
setupSourceChanged
)
Q_PROPERTY
(
QUrl
summaryQmlSource
READ
summaryQmlSource
CONSTANT
)
Q_PROPERTY
(
bool
allowSetupWhileArmed
READ
allowSetupWhileArmed
CONSTANT
)
Q_PROPERTY
(
bool
allowSetupWhileFlying
READ
allowSetupWhileFlying
CONSTANT
)
public:
VehicleComponent
(
Vehicle
*
vehicle
,
AutoPilotPlugin
*
autopilot
,
QObject
*
parent
=
NULL
);
~
VehicleComponent
();
...
...
@@ -51,8 +52,11 @@ public:
virtual
QUrl
summaryQmlSource
(
void
)
const
=
0
;
// @return true: Setup panel can be shown while vehicle is armed
virtual
bool
allowSetupWhileArmed
(
void
)
const
;
virtual
bool
allowSetupWhileArmed
(
void
)
const
{
return
false
;
}
// Defaults to false
// @return true: Setup panel can be shown while vehicle is flying (and armed)
virtual
bool
allowSetupWhileFlying
(
void
)
const
{
return
false
;
}
// Defaults to false
virtual
void
addSummaryQmlComponent
(
QQmlContext
*
context
,
QQuickItem
*
parent
);
/// @brief Returns an list of parameter names for which a change should cause the setupCompleteChanged
...
...
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