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
afc21e9e
Commit
afc21e9e
authored
Jan 13, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default map position support
parent
8b99fc31
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
8 deletions
+33
-8
QGCApplication.cc
src/QGCApplication.cc
+15
-0
QGCApplication.h
src/QGCApplication.h
+13
-6
QGroundControlQmlGlobal.cc
src/QmlControls/QGroundControlQmlGlobal.cc
+0
-1
QGroundControlQmlGlobal.h
src/QmlControls/QGroundControlQmlGlobal.h
+4
-1
Vehicle.cc
src/Vehicle/Vehicle.cc
+1
-0
No files found.
src/QGCApplication.cc
View file @
afc21e9e
...
@@ -121,6 +121,8 @@ const char* QGCApplication::_settingsVersionKey = "SettingsVersion";
...
@@ -121,6 +121,8 @@ const char* QGCApplication::_settingsVersionKey = "SettingsVersion";
const
char
*
QGCApplication
::
_promptFlightDataSave
=
"PromptFLightDataSave"
;
const
char
*
QGCApplication
::
_promptFlightDataSave
=
"PromptFLightDataSave"
;
const
char
*
QGCApplication
::
_promptFlightDataSaveNotArmed
=
"PromptFLightDataSaveNotArmed"
;
const
char
*
QGCApplication
::
_promptFlightDataSaveNotArmed
=
"PromptFLightDataSaveNotArmed"
;
const
char
*
QGCApplication
::
_styleKey
=
"StyleIsDark"
;
const
char
*
QGCApplication
::
_styleKey
=
"StyleIsDark"
;
const
char
*
QGCApplication
::
_defaultMapPositionLatKey
=
"DefaultMapPositionLat"
;
const
char
*
QGCApplication
::
_defaultMapPositionLonKey
=
"DefaultMapPositionLon"
;
const
char
*
QGCApplication
::
_darkStyleFile
=
":/res/styles/style-dark.css"
;
const
char
*
QGCApplication
::
_darkStyleFile
=
":/res/styles/style-dark.css"
;
const
char
*
QGCApplication
::
_lightStyleFile
=
":/res/styles/style-light.css"
;
const
char
*
QGCApplication
::
_lightStyleFile
=
":/res/styles/style-light.css"
;
...
@@ -176,6 +178,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
...
@@ -176,6 +178,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
#endif
#endif
,
_toolbox
(
NULL
)
,
_toolbox
(
NULL
)
,
_bluetoothAvailable
(
false
)
,
_bluetoothAvailable
(
false
)
,
_defaultMapPosition
(
37.803784
,
-
122.462276
)
{
{
Q_ASSERT
(
_app
==
NULL
);
Q_ASSERT
(
_app
==
NULL
);
_app
=
this
;
_app
=
this
;
...
@@ -318,6 +321,9 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
...
@@ -318,6 +321,9 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
settings
.
setValue
(
_settingsVersionKey
,
QGC_SETTINGS_VERSION
);
settings
.
setValue
(
_settingsVersionKey
,
QGC_SETTINGS_VERSION
);
}
}
_defaultMapPosition
.
setLatitude
(
settings
.
value
(
_defaultMapPositionLatKey
,
37.803784
).
toDouble
());
_defaultMapPosition
.
setLongitude
(
settings
.
value
(
_defaultMapPositionLonKey
,
-
122.462276
).
toDouble
());
// Initialize Bluetooth
// Initialize Bluetooth
#ifdef QGC_ENABLE_BLUETOOTH
#ifdef QGC_ENABLE_BLUETOOTH
QBluetoothLocalDevice
localDevice
;
QBluetoothLocalDevice
localDevice
;
...
@@ -711,3 +717,12 @@ void QGCApplication::_showSetupVehicleComponent(VehicleComponent* vehicleCompone
...
@@ -711,3 +717,12 @@ void QGCApplication::_showSetupVehicleComponent(VehicleComponent* vehicleCompone
QMetaObject
::
invokeMethod
(
_rootQmlObject
(),
"showSetupVehicleComponent"
,
Q_RETURN_ARG
(
QVariant
,
varReturn
),
Q_ARG
(
QVariant
,
varComponent
));
QMetaObject
::
invokeMethod
(
_rootQmlObject
(),
"showSetupVehicleComponent"
,
Q_RETURN_ARG
(
QVariant
,
varReturn
),
Q_ARG
(
QVariant
,
varComponent
));
}
}
void
QGCApplication
::
setDefaultMapPosition
(
QGeoCoordinate
&
defaultMapPosition
)
{
QSettings
settings
;
settings
.
setValue
(
_defaultMapPositionLatKey
,
defaultMapPosition
.
latitude
());
settings
.
setValue
(
_defaultMapPositionLonKey
,
defaultMapPosition
.
longitude
());
_defaultMapPosition
=
defaultMapPosition
;
}
src/QGCApplication.h
View file @
afc21e9e
...
@@ -121,6 +121,9 @@ public:
...
@@ -121,6 +121,9 @@ public:
/// Do we have Bluetooth Support?
/// Do we have Bluetooth Support?
bool
isBluetoothAvailable
()
{
return
_bluetoothAvailable
;
}
bool
isBluetoothAvailable
()
{
return
_bluetoothAvailable
;
}
QGeoCoordinate
defaultMapPosition
(
void
)
{
return
_defaultMapPosition
;
}
void
setDefaultMapPosition
(
QGeoCoordinate
&
defaultMapPosition
);
public
slots
:
public
slots
:
/// You can connect to this slot to show an information message box from a different thread.
/// You can connect to this slot to show an information message box from a different thread.
void
informationMessageBoxOnMainThread
(
const
QString
&
title
,
const
QString
&
msg
);
void
informationMessageBoxOnMainThread
(
const
QString
&
title
,
const
QString
&
msg
);
...
@@ -184,12 +187,6 @@ private:
...
@@ -184,12 +187,6 @@ private:
QQmlApplicationEngine
*
_qmlAppEngine
;
QQmlApplicationEngine
*
_qmlAppEngine
;
#endif
#endif
static
const
char
*
_settingsVersionKey
;
///< Settings key which hold settings version
static
const
char
*
_deleteAllSettingsKey
;
///< If this settings key is set on boot, all settings will be deleted
static
const
char
*
_promptFlightDataSave
;
///< Settings key for promptFlightDataSave
static
const
char
*
_promptFlightDataSaveNotArmed
;
///< Settings key for promptFlightDataSaveNotArmed
static
const
char
*
_styleKey
;
///< Settings key for UI style
bool
_runningUnitTests
;
///< true: running unit tests, false: normal app
bool
_runningUnitTests
;
///< true: running unit tests, false: normal app
static
const
char
*
_darkStyleFile
;
static
const
char
*
_darkStyleFile
;
...
@@ -210,6 +207,16 @@ private:
...
@@ -210,6 +207,16 @@ private:
bool
_bluetoothAvailable
;
bool
_bluetoothAvailable
;
QGeoCoordinate
_defaultMapPosition
;
///< Map position when all other sources fail
static
const
char
*
_settingsVersionKey
;
///< Settings key which hold settings version
static
const
char
*
_deleteAllSettingsKey
;
///< If this settings key is set on boot, all settings will be deleted
static
const
char
*
_promptFlightDataSave
;
///< Settings key for promptFlightDataSave
static
const
char
*
_promptFlightDataSaveNotArmed
;
///< Settings key for promptFlightDataSaveNotArmed
static
const
char
*
_styleKey
;
///< Settings key for UI style
static
const
char
*
_defaultMapPositionLatKey
;
///< Settings key for default map location
static
const
char
*
_defaultMapPositionLonKey
;
///< Settings key for default map location
/// Unit Test have access to creating and destroying singletons
/// Unit Test have access to creating and destroying singletons
friend
class
UnitTest
;
friend
class
UnitTest
;
};
};
...
...
src/QmlControls/QGroundControlQmlGlobal.cc
View file @
afc21e9e
...
@@ -42,7 +42,6 @@ QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app)
...
@@ -42,7 +42,6 @@ QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app)
,
_virtualTabletJoystick
(
false
)
,
_virtualTabletJoystick
(
false
)
,
_offlineEditingFirmwareTypeFact
(
QString
(),
"OfflineEditingFirmwareType"
,
FactMetaData
::
valueTypeUint32
,
(
uint32_t
)
MAV_AUTOPILOT_ARDUPILOTMEGA
)
,
_offlineEditingFirmwareTypeFact
(
QString
(),
"OfflineEditingFirmwareType"
,
FactMetaData
::
valueTypeUint32
,
(
uint32_t
)
MAV_AUTOPILOT_ARDUPILOTMEGA
)
,
_offlineEditingFirmwareTypeMetaData
(
FactMetaData
::
valueTypeUint32
)
,
_offlineEditingFirmwareTypeMetaData
(
FactMetaData
::
valueTypeUint32
)
{
{
QSettings
settings
;
QSettings
settings
;
_virtualTabletJoystick
=
settings
.
value
(
_virtualTabletJoystickKey
,
false
).
toBool
();
_virtualTabletJoystick
=
settings
.
value
(
_virtualTabletJoystickKey
,
false
).
toBool
();
...
...
src/QmlControls/QGroundControlQmlGlobal.h
View file @
afc21e9e
...
@@ -76,6 +76,8 @@ public:
...
@@ -76,6 +76,8 @@ public:
Q_PROPERTY
(
Fact
*
offlineEditingFirmwareType
READ
offlineEditingFirmwareType
CONSTANT
)
Q_PROPERTY
(
Fact
*
offlineEditingFirmwareType
READ
offlineEditingFirmwareType
CONSTANT
)
Q_PROPERTY
(
QGeoCoordinate
defaultMapPosition
READ
defaultMapPosition
CONSTANT
)
Q_INVOKABLE
void
saveGlobalSetting
(
const
QString
&
key
,
const
QString
&
value
);
Q_INVOKABLE
void
saveGlobalSetting
(
const
QString
&
key
,
const
QString
&
value
);
Q_INVOKABLE
QString
loadGlobalSetting
(
const
QString
&
key
,
const
QString
&
defaultValue
);
Q_INVOKABLE
QString
loadGlobalSetting
(
const
QString
&
key
,
const
QString
&
defaultValue
);
Q_INVOKABLE
void
saveBoolGlobalSetting
(
const
QString
&
key
,
bool
value
);
Q_INVOKABLE
void
saveBoolGlobalSetting
(
const
QString
&
key
,
bool
value
);
...
@@ -113,6 +115,8 @@ public:
...
@@ -113,6 +115,8 @@ public:
bool
isVersionCheckEnabled
()
{
return
_toolbox
->
mavlinkProtocol
()
->
versionCheckEnabled
();
}
bool
isVersionCheckEnabled
()
{
return
_toolbox
->
mavlinkProtocol
()
->
versionCheckEnabled
();
}
int
mavlinkSystemID
()
{
return
_toolbox
->
mavlinkProtocol
()
->
getSystemId
();
}
int
mavlinkSystemID
()
{
return
_toolbox
->
mavlinkProtocol
()
->
getSystemId
();
}
QGeoCoordinate
defaultMapPosition
()
{
return
qgcApp
()
->
defaultMapPosition
();
}
Fact
*
offlineEditingFirmwareType
()
{
return
&
_offlineEditingFirmwareTypeFact
;
}
Fact
*
offlineEditingFirmwareType
()
{
return
&
_offlineEditingFirmwareTypeFact
;
}
//-- TODO: Make this into an actual preference.
//-- TODO: Make this into an actual preference.
...
@@ -144,7 +148,6 @@ signals:
...
@@ -144,7 +148,6 @@ signals:
void
mavlinkSystemIDChanged
(
int
id
);
void
mavlinkSystemIDChanged
(
int
id
);
private:
private:
FlightMapSettings
*
_flightMapSettings
;
FlightMapSettings
*
_flightMapSettings
;
HomePositionManager
*
_homePositionManager
;
HomePositionManager
*
_homePositionManager
;
LinkManager
*
_linkManager
;
LinkManager
*
_linkManager
;
...
...
src/Vehicle/Vehicle.cc
View file @
afc21e9e
...
@@ -281,6 +281,7 @@ void Vehicle::_handleHomePosition(mavlink_message_t& message)
...
@@ -281,6 +281,7 @@ void Vehicle::_handleHomePosition(mavlink_message_t& message)
if
(
emitHomePositionChanged
)
{
if
(
emitHomePositionChanged
)
{
qCDebug
(
VehicleLog
)
<<
"New home position"
<<
newHomePosition
;
qCDebug
(
VehicleLog
)
<<
"New home position"
<<
newHomePosition
;
qgcApp
()
->
setDefaultMapPosition
(
_homePosition
);
emit
homePositionChanged
(
_homePosition
);
emit
homePositionChanged
(
_homePosition
);
}
}
if
(
emitHomePositionAvailableChanged
)
{
if
(
emitHomePositionAvailableChanged
)
{
...
...
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