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
80ee708c
Commit
80ee708c
authored
Feb 18, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert mission auto load dir setting to SettingsFact
parent
526e5c53
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
56 deletions
+67
-56
QGroundControlQmlGlobal.cc
src/QmlControls/QGroundControlQmlGlobal.cc
+0
-13
QGroundControlQmlGlobal.h
src/QmlControls/QGroundControlQmlGlobal.h
+2
-6
SettingsManager.cc
src/SettingsManager.cc
+11
-0
SettingsManager.h
src/SettingsManager.h
+23
-25
SettingsManager.json
src/SettingsManager.json
+7
-0
Vehicle.cc
src/Vehicle/Vehicle.cc
+1
-1
GeneralSettings.qml
src/ui/preferences/GeneralSettings.qml
+23
-11
No files found.
src/QmlControls/QGroundControlQmlGlobal.cc
View file @
80ee708c
...
@@ -21,7 +21,6 @@ static const char* kQmlGlobalKeyName = "QGCQml";
...
@@ -21,7 +21,6 @@ static const char* kQmlGlobalKeyName = "QGCQml";
const
char
*
QGroundControlQmlGlobal
::
_virtualTabletJoystickKey
=
"VirtualTabletJoystick"
;
const
char
*
QGroundControlQmlGlobal
::
_virtualTabletJoystickKey
=
"VirtualTabletJoystick"
;
const
char
*
QGroundControlQmlGlobal
::
_baseFontPointSizeKey
=
"BaseDeviceFontPointSize"
;
const
char
*
QGroundControlQmlGlobal
::
_baseFontPointSizeKey
=
"BaseDeviceFontPointSize"
;
const
char
*
QGroundControlQmlGlobal
::
_missionAutoLoadDirKey
=
"MissionAutoLoadDir"
;
QGroundControlQmlGlobal
::
QGroundControlQmlGlobal
(
QGCApplication
*
app
)
QGroundControlQmlGlobal
::
QGroundControlQmlGlobal
(
QGCApplication
*
app
)
:
QGCTool
(
app
)
:
QGCTool
(
app
)
...
@@ -227,15 +226,3 @@ bool QGroundControlQmlGlobal::linesIntersect(QPointF line1A, QPointF line1B, QPo
...
@@ -227,15 +226,3 @@ bool QGroundControlQmlGlobal::linesIntersect(QPointF line1A, QPointF line1B, QPo
return
QLineF
(
line1A
,
line1B
).
intersect
(
QLineF
(
line2A
,
line2B
),
&
intersectPoint
)
==
QLineF
::
BoundedIntersection
&&
return
QLineF
(
line1A
,
line1B
).
intersect
(
QLineF
(
line2A
,
line2B
),
&
intersectPoint
)
==
QLineF
::
BoundedIntersection
&&
intersectPoint
!=
line1A
&&
intersectPoint
!=
line1B
;
intersectPoint
!=
line1A
&&
intersectPoint
!=
line1B
;
}
}
QString
QGroundControlQmlGlobal
::
missionAutoLoadDir
(
void
)
{
QSettings
settings
;
return
settings
.
value
(
_missionAutoLoadDirKey
).
toString
();
}
void
QGroundControlQmlGlobal
::
setMissionAutoLoadDir
(
const
QString
&
missionAutoLoadDir
)
{
QSettings
settings
;
settings
.
setValue
(
_missionAutoLoadDirKey
,
missionAutoLoadDir
);
}
src/QmlControls/QGroundControlQmlGlobal.h
View file @
80ee708c
...
@@ -61,7 +61,6 @@ public:
...
@@ -61,7 +61,6 @@ public:
Q_PROPERTY
(
bool
isSaveLogPromptNotArmed
READ
isSaveLogPromptNotArmed
WRITE
setIsSaveLogPromptNotArmed
NOTIFY
isSaveLogPromptNotArmedChanged
)
Q_PROPERTY
(
bool
isSaveLogPromptNotArmed
READ
isSaveLogPromptNotArmed
WRITE
setIsSaveLogPromptNotArmed
NOTIFY
isSaveLogPromptNotArmedChanged
)
Q_PROPERTY
(
bool
virtualTabletJoystick
READ
virtualTabletJoystick
WRITE
setVirtualTabletJoystick
NOTIFY
virtualTabletJoystickChanged
)
Q_PROPERTY
(
bool
virtualTabletJoystick
READ
virtualTabletJoystick
WRITE
setVirtualTabletJoystick
NOTIFY
virtualTabletJoystickChanged
)
Q_PROPERTY
(
qreal
baseFontPointSize
READ
baseFontPointSize
WRITE
setBaseFontPointSize
NOTIFY
baseFontPointSizeChanged
)
Q_PROPERTY
(
qreal
baseFontPointSize
READ
baseFontPointSize
WRITE
setBaseFontPointSize
NOTIFY
baseFontPointSizeChanged
)
Q_PROPERTY
(
QString
missionAutoLoadDir
READ
missionAutoLoadDir
WRITE
setMissionAutoLoadDir
NOTIFY
missionAutoLoadDirChanged
STORED
false
)
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// MavLink Protocol
// MavLink Protocol
...
@@ -127,6 +126,8 @@ public:
...
@@ -127,6 +126,8 @@ public:
Q_INVOKABLE
bool
linesIntersect
(
QPointF
xLine1
,
QPointF
yLine1
,
QPointF
xLine2
,
QPointF
yLine2
);
Q_INVOKABLE
bool
linesIntersect
(
QPointF
xLine1
,
QPointF
yLine1
,
QPointF
xLine2
,
QPointF
yLine2
);
Q_INVOKABLE
QString
urlToLocalFile
(
QUrl
url
)
{
return
url
.
toLocalFile
();
}
// Property accesors
// Property accesors
FlightMapSettings
*
flightMapSettings
()
{
return
_flightMapSettings
;
}
FlightMapSettings
*
flightMapSettings
()
{
return
_flightMapSettings
;
}
...
@@ -174,9 +175,6 @@ public:
...
@@ -174,9 +175,6 @@ public:
QString
qgcVersion
(
void
)
const
{
return
qgcApp
()
->
applicationVersion
();
}
QString
qgcVersion
(
void
)
const
{
return
qgcApp
()
->
applicationVersion
();
}
static
QString
missionAutoLoadDir
(
void
);
static
void
setMissionAutoLoadDir
(
const
QString
&
missionAutoLoadDir
);
// Overrides from QGCTool
// Overrides from QGCTool
virtual
void
setToolbox
(
QGCToolbox
*
toolbox
);
virtual
void
setToolbox
(
QGCToolbox
*
toolbox
);
...
@@ -192,7 +190,6 @@ signals:
...
@@ -192,7 +190,6 @@ signals:
void
mavlinkSystemIDChanged
(
int
id
);
void
mavlinkSystemIDChanged
(
int
id
);
void
flightMapPositionChanged
(
QGeoCoordinate
flightMapPosition
);
void
flightMapPositionChanged
(
QGeoCoordinate
flightMapPosition
);
void
flightMapZoomChanged
(
double
flightMapZoom
);
void
flightMapZoomChanged
(
double
flightMapZoom
);
void
missionAutoLoadDirChanged
(
QString
missionAutoLoadDir
);
private:
private:
FlightMapSettings
*
_flightMapSettings
;
FlightMapSettings
*
_flightMapSettings
;
...
@@ -214,7 +211,6 @@ private:
...
@@ -214,7 +211,6 @@ private:
static
const
char
*
_virtualTabletJoystickKey
;
static
const
char
*
_virtualTabletJoystickKey
;
static
const
char
*
_baseFontPointSizeKey
;
static
const
char
*
_baseFontPointSizeKey
;
static
const
char
*
_missionAutoLoadDirKey
;
};
};
#endif
#endif
src/SettingsManager.cc
View file @
80ee708c
...
@@ -21,6 +21,7 @@ const char* SettingsManager::areaUnitsSettingsName = "Are
...
@@ -21,6 +21,7 @@ const char* SettingsManager::areaUnitsSettingsName = "Are
const
char
*
SettingsManager
::
speedUnitsSettingsName
=
"SpeedUnits"
;
const
char
*
SettingsManager
::
speedUnitsSettingsName
=
"SpeedUnits"
;
const
char
*
SettingsManager
::
batteryPercentRemainingAnnounceSettingsName
=
"batteryPercentRemainingAnnounce"
;
const
char
*
SettingsManager
::
batteryPercentRemainingAnnounceSettingsName
=
"batteryPercentRemainingAnnounce"
;
const
char
*
SettingsManager
::
defaultMissionItemAltitudeSettingsName
=
"DefaultMissionItemAltitude"
;
const
char
*
SettingsManager
::
defaultMissionItemAltitudeSettingsName
=
"DefaultMissionItemAltitude"
;
const
char
*
SettingsManager
::
missionAutoLoadDirSettingsName
=
"MissionAutoLoadDir"
;
SettingsManager
::
SettingsManager
(
QGCApplication
*
app
)
SettingsManager
::
SettingsManager
(
QGCApplication
*
app
)
:
QGCTool
(
app
)
:
QGCTool
(
app
)
...
@@ -33,6 +34,7 @@ SettingsManager::SettingsManager(QGCApplication* app)
...
@@ -33,6 +34,7 @@ SettingsManager::SettingsManager(QGCApplication* app)
,
_speedUnitsFact
(
NULL
)
,
_speedUnitsFact
(
NULL
)
,
_batteryPercentRemainingAnnounceFact
(
NULL
)
,
_batteryPercentRemainingAnnounceFact
(
NULL
)
,
_defaultMissionItemAltitudeFact
(
NULL
)
,
_defaultMissionItemAltitudeFact
(
NULL
)
,
_missionAutoLoadDirFact
(
NULL
)
{
{
}
}
...
@@ -103,6 +105,15 @@ Fact* SettingsManager::defaultMissionItemAltitude(void)
...
@@ -103,6 +105,15 @@ Fact* SettingsManager::defaultMissionItemAltitude(void)
return
_defaultMissionItemAltitudeFact
;
return
_defaultMissionItemAltitudeFact
;
}
}
Fact
*
SettingsManager
::
missionAutoLoadDir
(
void
)
{
if
(
!
_missionAutoLoadDirFact
)
{
_missionAutoLoadDirFact
=
_createSettingsFact
(
missionAutoLoadDirSettingsName
);
}
return
_missionAutoLoadDirFact
;
}
Fact
*
SettingsManager
::
distanceUnits
(
void
)
Fact
*
SettingsManager
::
distanceUnits
(
void
)
{
{
if
(
!
_distanceUnitsFact
)
{
if
(
!
_distanceUnitsFact
)
{
...
...
src/SettingsManager.h
View file @
80ee708c
...
@@ -63,6 +63,7 @@ public:
...
@@ -63,6 +63,7 @@ public:
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
(
Fact
*
defaultMissionItemAltitude
READ
defaultMissionItemAltitude
CONSTANT
)
Q_PROPERTY
(
Fact
*
missionAutoLoadDir
READ
missionAutoLoadDir
CONSTANT
)
Fact
*
offlineEditingFirmwareType
(
void
);
Fact
*
offlineEditingFirmwareType
(
void
);
Fact
*
offlineEditingVehicleType
(
void
);
Fact
*
offlineEditingVehicleType
(
void
);
...
@@ -71,8 +72,9 @@ public:
...
@@ -71,8 +72,9 @@ public:
Fact
*
distanceUnits
(
void
);
Fact
*
distanceUnits
(
void
);
Fact
*
areaUnits
(
void
);
Fact
*
areaUnits
(
void
);
Fact
*
speedUnits
(
void
);
Fact
*
speedUnits
(
void
);
Fact
*
batteryPercentRemainingAnnounce
(
void
);
Fact
*
batteryPercentRemainingAnnounce
(
void
);
Fact
*
defaultMissionItemAltitude
(
void
);
Fact
*
defaultMissionItemAltitude
(
void
);
Fact
*
missionAutoLoadDir
(
void
);
// Override from QGCTool
// Override from QGCTool
virtual
void
setToolbox
(
QGCToolbox
*
toolbox
);
virtual
void
setToolbox
(
QGCToolbox
*
toolbox
);
...
@@ -86,12 +88,7 @@ public:
...
@@ -86,12 +88,7 @@ public:
static
const
char
*
speedUnitsSettingsName
;
static
const
char
*
speedUnitsSettingsName
;
static
const
char
*
batteryPercentRemainingAnnounceSettingsName
;
static
const
char
*
batteryPercentRemainingAnnounceSettingsName
;
static
const
char
*
defaultMissionItemAltitudeSettingsName
;
static
const
char
*
defaultMissionItemAltitudeSettingsName
;
static
const
char
*
missionAutoLoadDirSettingsName
;
public
slots
:
signals:
private
slots
:
private:
private:
SettingsFact
*
_createSettingsFact
(
const
QString
&
name
);
SettingsFact
*
_createSettingsFact
(
const
QString
&
name
);
...
@@ -107,6 +104,7 @@ private:
...
@@ -107,6 +104,7 @@ private:
SettingsFact
*
_speedUnitsFact
;
SettingsFact
*
_speedUnitsFact
;
SettingsFact
*
_batteryPercentRemainingAnnounceFact
;
SettingsFact
*
_batteryPercentRemainingAnnounceFact
;
SettingsFact
*
_defaultMissionItemAltitudeFact
;
SettingsFact
*
_defaultMissionItemAltitudeFact
;
SettingsFact
*
_missionAutoLoadDirFact
;
};
};
#endif
#endif
src/SettingsManager.json
View file @
80ee708c
...
@@ -54,5 +54,12 @@
...
@@ -54,5 +54,12 @@
"min"
:
0.0
,
"min"
:
0.0
,
"units"
:
"meters"
,
"units"
:
"meters"
,
"decimalPlaces"
:
2
"decimalPlaces"
:
2
},
{
"name"
:
"MissionAutoLoadDir"
,
"shortDescription"
:
"Mission auto load directory"
,
"longDescription"
:
"The directory from which missions will be automaticallu loaded onto a vehicle when it connects."
,
"type"
:
"string"
,
"defaultValue"
:
""
}
}
]
]
src/Vehicle/Vehicle.cc
View file @
80ee708c
...
@@ -1579,7 +1579,7 @@ void Vehicle::_parametersReady(bool parametersReady)
...
@@ -1579,7 +1579,7 @@ void Vehicle::_parametersReady(bool parametersReady)
{
{
if
(
parametersReady
&&
!
_missionManagerInitialRequestSent
)
{
if
(
parametersReady
&&
!
_missionManagerInitialRequestSent
)
{
_missionManagerInitialRequestSent
=
true
;
_missionManagerInitialRequestSent
=
true
;
QString
missionAutoLoadDirPath
=
QGroundControlQmlGlobal
::
missionAutoLoadDir
();
QString
missionAutoLoadDirPath
=
_settingsManager
->
missionAutoLoadDir
()
->
rawValue
().
toString
();
if
(
missionAutoLoadDirPath
.
isEmpty
())
{
if
(
missionAutoLoadDirPath
.
isEmpty
())
{
_missionManager
->
requestMissionItems
();
_missionManager
->
requestMissionItems
();
}
else
{
}
else
{
...
...
src/ui/preferences/GeneralSettings.qml
View file @
80ee708c
...
@@ -33,6 +33,7 @@ QGCView {
...
@@ -33,6 +33,7 @@ QGCView {
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
property
Fact
_percentRemainingAnnounce
:
QGroundControl
.
settingsManager
.
batteryPercentRemainingAnnounce
property
Fact
_percentRemainingAnnounce
:
QGroundControl
.
settingsManager
.
batteryPercentRemainingAnnounce
property
Fact
_autoLoadDir
:
QGroundControl
.
settingsManager
.
missionAutoLoadDir
property
real
_labelWidth
:
ScreenTools
.
defaultFontPixelWidth
*
15
property
real
_labelWidth
:
ScreenTools
.
defaultFontPixelWidth
*
15
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
...
@@ -331,30 +332,41 @@ QGCView {
...
@@ -331,30 +332,41 @@ QGCView {
}
}
}
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-- AutoLoad
//--
Mission
AutoLoad
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCCheckBox
{
QGCCheckBox
{
id
:
autoLoadCheckbox
id
:
autoLoadCheckbox
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
text
:
qsTr
(
"
AutoLoad mission directory:
"
)
text
:
qsTr
(
"
AutoLoad mission directory:
"
)
checked
:
QGroundControl
.
missionAutoLoadDir
!=
""
checked
:
_autoLoadDir
.
valueString
onClicked
:
{
onClicked
:
{
autoLoadDir
.
enabled
=
checked
if
(
checked
)
{
if
(
!
checked
)
{
_autoLoadDir
.
rawValue
=
QGroundControl
.
urlToLocalFile
(
autoloadDirPicker
.
shortcuts
.
home
)
QGroundControl
.
missionAutoLoadDir
=
""
}
else
{
autoLoadDir
.
text
=
""
_autoLoadDir
.
rawValue
=
""
}
}
}
}
}
}
QGC
TextField
{
Fact
TextField
{
id
:
autoLoadDir
id
:
autoLoadDir
Field
width
:
_editFieldWidth
width
:
_editFieldWidth
enabled
:
autoLoadCheckbox
.
checked
enabled
:
autoLoadCheckbox
.
checked
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
text
:
QGroundControl
.
missionAutoLoadDir
fact
:
_autoLoadDir
onEditingFinished
:
QGroundControl
.
missionAutoLoadDir
=
text
}
QGCButton
{
text
:
qsTr
(
"
Browse
"
)
onClicked
:
autoloadDirPicker
.
visible
=
true
FileDialog
{
id
:
autoloadDirPicker
title
:
qsTr
(
"
Choose the location of mission file.
"
)
folder
:
shortcuts
.
home
selectFolder
:
true
onAccepted
:
_autoLoadDir
.
rawValue
=
QGroundControl
.
urlToLocalFile
(
autoloadDirPicker
.
fileUrl
)
}
}
}
}
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
...
@@ -561,7 +573,7 @@ QGCView {
...
@@ -561,7 +573,7 @@ QGCView {
readOnly
:
true
readOnly
:
true
text
:
QGroundControl
.
videoManager
.
videoSavePath
text
:
QGroundControl
.
videoManager
.
videoSavePath
}
}
Button
{
QGC
Button
{
text
:
"
Browse
"
text
:
"
Browse
"
onClicked
:
fileDialog
.
visible
=
true
onClicked
:
fileDialog
.
visible
=
true
}
}
...
...
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