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
f5e85363
Commit
f5e85363
authored
Feb 15, 2017
by
Don Gagne
Committed by
GitHub
Feb 15, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4558 from DonLakeFlyer/DefaultMissionItemAlt
Support for default mission item altitude setting
parents
7233dc20
e71a5fcb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
65 additions
and
30 deletions
+65
-30
RallyPointController.cc
src/MissionManager/RallyPointController.cc
+2
-1
SimpleMissionItem.cc
src/MissionManager/SimpleMissionItem.cc
+2
-3
SimpleMissionItem.h
src/MissionManager/SimpleMissionItem.h
+0
-2
SimpleMissionItemTest.cc
src/MissionManager/SimpleMissionItemTest.cc
+3
-2
QGroundControlQmlGlobal.cc
src/QmlControls/QGroundControlQmlGlobal.cc
+10
-0
QGroundControlQmlGlobal.h
src/QmlControls/QGroundControlQmlGlobal.h
+3
-0
QGroundControlQmlGlobal.json
src/QmlControls/QGroundControlQmlGlobal.json
+10
-0
GeneralSettings.qml
src/ui/preferences/GeneralSettings.qml
+35
-22
No files found.
src/MissionManager/RallyPointController.cc
View file @
f5e85363
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "ParameterManager.h"
#include "ParameterManager.h"
#include "JsonHelper.h"
#include "JsonHelper.h"
#include "SimpleMissionItem.h"
#include "SimpleMissionItem.h"
#include "QGroundControlQmlGlobal.h"
#ifndef __mobile__
#ifndef __mobile__
#include "QGCFileDialog.h"
#include "QGCFileDialog.h"
...
@@ -266,7 +267,7 @@ void RallyPointController::addPoint(QGeoCoordinate point)
...
@@ -266,7 +267,7 @@ void RallyPointController::addPoint(QGeoCoordinate point)
if
(
_points
.
count
())
{
if
(
_points
.
count
())
{
defaultAlt
=
qobject_cast
<
RallyPoint
*>
(
_points
[
_points
.
count
()
-
1
])
->
coordinate
().
altitude
();
defaultAlt
=
qobject_cast
<
RallyPoint
*>
(
_points
[
_points
.
count
()
-
1
])
->
coordinate
().
altitude
();
}
else
{
}
else
{
defaultAlt
=
SimpleMissionItem
::
defaultAltitude
;
defaultAlt
=
QGroundControlQmlGlobal
::
defaultMissionItemAltitude
()
->
rawValue
().
toDouble
()
;
}
}
point
.
setAltitude
(
defaultAlt
);
point
.
setAltitude
(
defaultAlt
);
RallyPoint
*
newPoint
=
new
RallyPoint
(
point
,
this
);
RallyPoint
*
newPoint
=
new
RallyPoint
(
point
,
this
);
...
...
src/MissionManager/SimpleMissionItem.cc
View file @
f5e85363
...
@@ -17,8 +17,7 @@
...
@@ -17,8 +17,7 @@
#include "JsonHelper.h"
#include "JsonHelper.h"
#include "MissionCommandTree.h"
#include "MissionCommandTree.h"
#include "MissionCommandUIInfo.h"
#include "MissionCommandUIInfo.h"
#include "QGroundControlQmlGlobal.h"
const
double
SimpleMissionItem
::
defaultAltitude
=
50.0
;
FactMetaData
*
SimpleMissionItem
::
_altitudeMetaData
=
NULL
;
FactMetaData
*
SimpleMissionItem
::
_altitudeMetaData
=
NULL
;
FactMetaData
*
SimpleMissionItem
::
_commandMetaData
=
NULL
;
FactMetaData
*
SimpleMissionItem
::
_commandMetaData
=
NULL
;
...
@@ -528,7 +527,7 @@ void SimpleMissionItem::_syncFrameToAltitudeRelativeToHome(void)
...
@@ -528,7 +527,7 @@ void SimpleMissionItem::_syncFrameToAltitudeRelativeToHome(void)
void
SimpleMissionItem
::
setDefaultsForCommand
(
void
)
void
SimpleMissionItem
::
setDefaultsForCommand
(
void
)
{
{
// We set these global defaults first, then if there are param defaults they will get reset
// We set these global defaults first, then if there are param defaults they will get reset
_missionItem
.
setParam7
(
defaultAltitude
);
_missionItem
.
setParam7
(
QGroundControlQmlGlobal
::
defaultMissionItemAltitude
()
->
rawValue
().
toDouble
()
);
MAV_CMD
command
=
(
MAV_CMD
)
this
->
command
();
MAV_CMD
command
=
(
MAV_CMD
)
this
->
command
();
const
MissionCommandUIInfo
*
uiInfo
=
_commandTree
->
getUIInfo
(
_vehicle
,
command
);
const
MissionCommandUIInfo
*
uiInfo
=
_commandTree
->
getUIInfo
(
_vehicle
,
command
);
...
...
src/MissionManager/SimpleMissionItem.h
View file @
f5e85363
...
@@ -75,8 +75,6 @@ public:
...
@@ -75,8 +75,6 @@ public:
bool
relativeAltitude
(
void
)
{
return
_missionItem
.
frame
()
==
MAV_FRAME_GLOBAL_RELATIVE_ALT
;
}
bool
relativeAltitude
(
void
)
{
return
_missionItem
.
frame
()
==
MAV_FRAME_GLOBAL_RELATIVE_ALT
;
}
static
const
double
defaultAltitude
;
MissionItem
&
missionItem
(
void
)
{
return
_missionItem
;
}
MissionItem
&
missionItem
(
void
)
{
return
_missionItem
;
}
// Overrides from VisualMissionItem
// Overrides from VisualMissionItem
...
...
src/MissionManager/SimpleMissionItemTest.cc
View file @
f5e85363
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include "SimpleMissionItemTest.h"
#include "SimpleMissionItemTest.h"
#include "SimpleMissionItem.h"
#include "SimpleMissionItem.h"
#include "QGCApplication.h"
#include "QGCApplication.h"
#include "QGroundControlQmlGlobal.h"
const
SimpleMissionItemTest
::
ItemInfo_t
SimpleMissionItemTest
::
_rgItemInfo
[]
=
{
const
SimpleMissionItemTest
::
ItemInfo_t
SimpleMissionItemTest
::
_rgItemInfo
[]
=
{
{
MAV_CMD_NAV_WAYPOINT
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
{
MAV_CMD_NAV_WAYPOINT
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
},
...
@@ -139,7 +140,7 @@ void SimpleMissionItemTest::_testDefaultValues(void)
...
@@ -139,7 +140,7 @@ void SimpleMissionItemTest::_testDefaultValues(void)
item
.
missionItem
().
setCommand
(
MAV_CMD_NAV_WAYPOINT
);
item
.
missionItem
().
setCommand
(
MAV_CMD_NAV_WAYPOINT
);
item
.
missionItem
().
setFrame
(
MAV_FRAME_GLOBAL_RELATIVE_ALT
);
item
.
missionItem
().
setFrame
(
MAV_FRAME_GLOBAL_RELATIVE_ALT
);
QCOMPARE
(
item
.
missionItem
().
param7
(),
SimpleMissionItem
::
defaultAltitude
);
QCOMPARE
(
item
.
missionItem
().
param7
(),
QGroundControlQmlGlobal
::
defaultMissionItemAltitude
()
->
rawValue
().
toDouble
()
);
}
}
void
SimpleMissionItemTest
::
_testSignals
(
void
)
void
SimpleMissionItemTest
::
_testSignals
(
void
)
...
@@ -224,7 +225,7 @@ void SimpleMissionItemTest::_testSignals(void)
...
@@ -224,7 +225,7 @@ void SimpleMissionItemTest::_testSignals(void)
// dirtyChanged
// dirtyChanged
// Check that changing to the same coordinate does not signal
// Check that changing to the same coordinate does not signal
simpleMissionItem
.
setCoordinate
(
QGeoCoordinate
(
50.1234567
,
60.1234567
,
SimpleMissionItem
::
defaultAltitude
));
simpleMissionItem
.
setCoordinate
(
QGeoCoordinate
(
50.1234567
,
60.1234567
,
QGroundControlQmlGlobal
::
defaultMissionItemAltitude
()
->
rawValue
().
toDouble
()
));
QVERIFY
(
multiSpy
->
checkNoSignals
());
QVERIFY
(
multiSpy
->
checkNoSignals
());
// Check that actually changing coordinate signals correctly
// Check that actually changing coordinate signals correctly
...
...
src/QmlControls/QGroundControlQmlGlobal.cc
View file @
f5e85363
...
@@ -30,6 +30,7 @@ SettingsFact* QGroundControlQmlGlobal::_offlineEditingVehicleTypeFact =
...
@@ -30,6 +30,7 @@ SettingsFact* QGroundControlQmlGlobal::_offlineEditingVehicleTypeFact =
SettingsFact
*
QGroundControlQmlGlobal
::
_offlineEditingCruiseSpeedFact
=
NULL
;
SettingsFact
*
QGroundControlQmlGlobal
::
_offlineEditingCruiseSpeedFact
=
NULL
;
SettingsFact
*
QGroundControlQmlGlobal
::
_offlineEditingHoverSpeedFact
=
NULL
;
SettingsFact
*
QGroundControlQmlGlobal
::
_offlineEditingHoverSpeedFact
=
NULL
;
SettingsFact
*
QGroundControlQmlGlobal
::
_batteryPercentRemainingAnnounceFact
=
NULL
;
SettingsFact
*
QGroundControlQmlGlobal
::
_batteryPercentRemainingAnnounceFact
=
NULL
;
SettingsFact
*
QGroundControlQmlGlobal
::
_defaultMissionItemAltitudeFact
=
NULL
;
const
char
*
QGroundControlQmlGlobal
::
_virtualTabletJoystickKey
=
"VirtualTabletJoystick"
;
const
char
*
QGroundControlQmlGlobal
::
_virtualTabletJoystickKey
=
"VirtualTabletJoystick"
;
const
char
*
QGroundControlQmlGlobal
::
_baseFontPointSizeKey
=
"BaseDeviceFontPointSize"
;
const
char
*
QGroundControlQmlGlobal
::
_baseFontPointSizeKey
=
"BaseDeviceFontPointSize"
;
...
@@ -339,6 +340,15 @@ Fact* QGroundControlQmlGlobal::batteryPercentRemainingAnnounce(void)
...
@@ -339,6 +340,15 @@ Fact* QGroundControlQmlGlobal::batteryPercentRemainingAnnounce(void)
return
_batteryPercentRemainingAnnounceFact
;
return
_batteryPercentRemainingAnnounceFact
;
}
}
Fact
*
QGroundControlQmlGlobal
::
defaultMissionItemAltitude
(
void
)
{
if
(
!
_defaultMissionItemAltitudeFact
)
{
_defaultMissionItemAltitudeFact
=
_createSettingsFact
(
QStringLiteral
(
"DefaultMissionItemAltitude"
));
}
return
_defaultMissionItemAltitudeFact
;
}
int
QGroundControlQmlGlobal
::
supportedFirmwareCount
()
int
QGroundControlQmlGlobal
::
supportedFirmwareCount
()
{
{
return
_firmwarePluginManager
->
knownFirmwareTypes
().
count
();
return
_firmwarePluginManager
->
knownFirmwareTypes
().
count
();
...
...
src/QmlControls/QGroundControlQmlGlobal.h
View file @
f5e85363
...
@@ -99,6 +99,7 @@ public:
...
@@ -99,6 +99,7 @@ public:
Q_PROPERTY
(
Fact
*
areaUnits
READ
areaUnits
CONSTANT
)
Q_PROPERTY
(
Fact
*
areaUnits
READ
areaUnits
CONSTANT
)
Q_PROPERTY
(
Fact
*
speedUnits
READ
speedUnits
CONSTANT
)
Q_PROPERTY
(
Fact
*
speedUnits
READ
speedUnits
CONSTANT
)
Q_PROPERTY
(
Fact
*
batteryPercentRemainingAnnounce
READ
batteryPercentRemainingAnnounce
CONSTANT
)
Q_PROPERTY
(
Fact
*
batteryPercentRemainingAnnounce
READ
batteryPercentRemainingAnnounce
CONSTANT
)
Q_PROPERTY
(
Fact
*
defaultMissionItemAltitude
READ
defaultMissionItemAltitude
CONSTANT
)
Q_PROPERTY
(
int
supportedFirmwareCount
READ
supportedFirmwareCount
CONSTANT
)
Q_PROPERTY
(
int
supportedFirmwareCount
READ
supportedFirmwareCount
CONSTANT
)
Q_PROPERTY
(
QGeoCoordinate
lastKnownHomePosition
READ
lastKnownHomePosition
CONSTANT
)
Q_PROPERTY
(
QGeoCoordinate
lastKnownHomePosition
READ
lastKnownHomePosition
CONSTANT
)
...
@@ -196,6 +197,7 @@ public:
...
@@ -196,6 +197,7 @@ public:
static
Fact
*
areaUnits
(
void
);
static
Fact
*
areaUnits
(
void
);
static
Fact
*
speedUnits
(
void
);
static
Fact
*
speedUnits
(
void
);
static
Fact
*
batteryPercentRemainingAnnounce
(
void
);
static
Fact
*
batteryPercentRemainingAnnounce
(
void
);
static
Fact
*
defaultMissionItemAltitude
(
void
);
int
supportedFirmwareCount
();
int
supportedFirmwareCount
();
...
@@ -267,6 +269,7 @@ private:
...
@@ -267,6 +269,7 @@ private:
static
SettingsFact
*
_speedUnitsFact
;
static
SettingsFact
*
_speedUnitsFact
;
static
FactMetaData
*
_speedUnitsMetaData
;
static
FactMetaData
*
_speedUnitsMetaData
;
static
SettingsFact
*
_batteryPercentRemainingAnnounceFact
;
static
SettingsFact
*
_batteryPercentRemainingAnnounceFact
;
static
SettingsFact
*
_defaultMissionItemAltitudeFact
;
static
const
char
*
_virtualTabletJoystickKey
;
static
const
char
*
_virtualTabletJoystickKey
;
static
const
char
*
_baseFontPointSizeKey
;
static
const
char
*
_baseFontPointSizeKey
;
...
...
src/QmlControls/QGroundControlQmlGlobal.json
View file @
f5e85363
...
@@ -44,5 +44,15 @@
...
@@ -44,5 +44,15 @@
"units"
:
"%"
,
"units"
:
"%"
,
"min"
:
0
,
"min"
:
0
,
"max"
:
100
"max"
:
100
},
{
"name"
:
"DefaultMissionItemAltitude"
,
"shortDescription"
:
"Default value for altitude"
,
"longDescription"
:
"This value specifies the default altitude for new items added to a mission."
,
"type"
:
"double"
,
"defaultValue"
:
50.0
,
"min"
:
0.0
,
"units"
:
"meters"
,
"decimalPlaces"
:
2
}
}
]
]
src/ui/preferences/GeneralSettings.qml
View file @
f5e85363
...
@@ -206,6 +206,28 @@ QGCView {
...
@@ -206,6 +206,28 @@ QGCView {
}
}
}
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-- Palette Styles
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
anchors.baseline
:
paletteCombo
.
baseline
text
:
qsTr
(
"
UI Style:
"
)
width
:
_labelWidth
}
QGCComboBox
{
id
:
paletteCombo
width
:
_editFieldWidth
model
:
[
qsTr
(
"
Indoor
"
),
qsTr
(
"
Outdoor
"
)
]
currentIndex
:
QGroundControl
.
isDarkStyle
?
0
:
1
onActivated
:
{
if
(
index
!=
-
1
)
{
currentIndex
=
index
QGroundControl
.
isDarkStyle
=
index
===
0
?
true
:
false
}
}
}
}
//-----------------------------------------------------------------
//-- Audio preferences
//-- Audio preferences
QGCCheckBox
{
QGCCheckBox
{
text
:
qsTr
(
"
Mute all audio output
"
)
text
:
qsTr
(
"
Mute all audio output
"
)
...
@@ -295,6 +317,19 @@ QGCView {
...
@@ -295,6 +317,19 @@ QGCView {
visible
:
QGroundControl
.
corePlugin
.
options
.
enableVirtualJoystick
visible
:
QGroundControl
.
corePlugin
.
options
.
enableVirtualJoystick
}
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-- Default mission item altitude
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
anchors.baseline
:
defaultItemAltitudeField
.
baseline
text
:
qsTr
(
"
Default mission item altitude:
"
)
}
FactTextField
{
id
:
defaultItemAltitudeField
fact
:
QGroundControl
.
defaultMissionItemAltitude
}
}
//-----------------------------------------------------------------
//-- AutoLoad
//-- AutoLoad
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
...
@@ -358,28 +393,6 @@ QGCView {
...
@@ -358,28 +393,6 @@ QGCView {
}
}
}
}
}
}
//-----------------------------------------------------------------
//-- Palette Styles
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
anchors.baseline
:
paletteCombo
.
baseline
text
:
qsTr
(
"
UI Style:
"
)
width
:
_labelWidth
}
QGCComboBox
{
id
:
paletteCombo
width
:
_editFieldWidth
model
:
[
qsTr
(
"
Indoor
"
),
qsTr
(
"
Outdoor
"
)
]
currentIndex
:
QGroundControl
.
isDarkStyle
?
0
:
1
onActivated
:
{
if
(
index
!=
-
1
)
{
currentIndex
=
index
QGroundControl
.
isDarkStyle
=
index
===
0
?
true
:
false
}
}
}
}
}
}
}
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
...
...
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