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
7d841636
Commit
7d841636
authored
Sep 28, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New FlightMapSettings for map settings
parent
d2eb80af
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
248 additions
and
31 deletions
+248
-31
QGCApplication.pro
QGCApplication.pro
+3
-0
FlightDisplayView.cc
src/FlightDisplay/FlightDisplayView.cc
+0
-16
FlightDisplayView.h
src/FlightDisplay/FlightDisplayView.h
+0
-3
FlightMapSettings.cc
src/FlightMap/FlightMapSettings.cc
+140
-0
FlightMapSettings.h
src/FlightMap/FlightMapSettings.h
+79
-0
HomePositionManager.cc
src/HomePositionManager.cc
+3
-0
QGCApplication.cc
src/QGCApplication.cc
+16
-10
QGroundControlQmlGlobal.cc
src/QmlControls/QGroundControlQmlGlobal.cc
+1
-0
QGroundControlQmlGlobal.h
src/QmlControls/QGroundControlQmlGlobal.h
+6
-2
No files found.
QGCApplication.pro
View file @
7d841636
...
...
@@ -141,6 +141,7 @@ INCLUDEPATH += \
src
/
AutoPilotPlugins
\
src
/
comm
\
src
/
FlightDisplay
\
src
/
FlightMap
\
src
/
input
\
src
/
Joystick
\
src
/
lib
/
qmapcontrol
\
...
...
@@ -239,6 +240,7 @@ HEADERS += \
src
/
comm
/
UDPLink
.
h
\
src
/
FlightDisplay
/
FlightDisplayWidget
.
h
\
src
/
FlightDisplay
/
FlightDisplayView
.
h
\
src
/
FlightMap
/
FlightMapSettings
.
h
\
src
/
GAudioOutput
.
h
\
src
/
HomePositionManager
.
h
\
src
/
Joystick
/
Joystick
.
h
\
...
...
@@ -374,6 +376,7 @@ SOURCES += \
src
/
comm
/
UDPLink
.
cc
\
src
/
FlightDisplay
/
FlightDisplayWidget
.
cc
\
src
/
FlightDisplay
/
FlightDisplayView
.
cc
\
src
/
FlightMap
/
FlightMapSettings
.
cc
\
src
/
GAudioOutput
.
cc
\
src
/
HomePositionManager
.
cc
\
src
/
Joystick
/
Joystick
.
cc
\
...
...
src/FlightDisplay/FlightDisplayView.cc
View file @
7d841636
...
...
@@ -91,19 +91,3 @@ FlightDisplayView::FlightDisplayView(QWidget *parent)
FlightDisplayView
::~
FlightDisplayView
()
{
}
void
FlightDisplayView
::
saveSetting
(
const
QString
&
name
,
const
QString
&
value
)
{
QSettings
settings
;
QString
key
(
kMainFlightDisplayViewGroup
);
key
+=
"/"
+
name
;
settings
.
setValue
(
key
,
value
);
}
QString
FlightDisplayView
::
loadSetting
(
const
QString
&
name
,
const
QString
&
defaultValue
)
{
QSettings
settings
;
QString
key
(
kMainFlightDisplayViewGroup
);
key
+=
"/"
+
name
;
return
settings
.
value
(
key
,
defaultValue
).
toString
();
}
src/FlightDisplay/FlightDisplayView.h
View file @
7d841636
...
...
@@ -38,9 +38,6 @@ public:
Q_PROPERTY
(
bool
hasVideo
READ
hasVideo
CONSTANT
)
Q_INVOKABLE
void
saveSetting
(
const
QString
&
key
,
const
QString
&
value
);
Q_INVOKABLE
QString
loadSetting
(
const
QString
&
key
,
const
QString
&
defaultValue
);
#if defined(QGC_GST_STREAMING)
bool
hasVideo
()
{
return
true
;
}
#else
...
...
src/FlightMap/FlightMapSettings.cc
0 → 100644
View file @
7d841636
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#include "FlightMapSettings.h"
#include <QSettings>
#include <QtQml>
IMPLEMENT_QGC_SINGLETON
(
FlightMapSettings
,
FlightMapSettings
)
const
char
*
FlightMapSettings
::
_defaultMapProvider
=
"Bing"
;
// Bing is default since it support full street/satellite/hybrid set
const
char
*
FlightMapSettings
::
_settingsGroup
=
"FlightMapSettings"
;
const
char
*
FlightMapSettings
::
_mapProviderKey
=
"MapProvider"
;
const
char
*
FlightMapSettings
::
_mapTypeKey
=
"MapType"
;
FlightMapSettings
::
FlightMapSettings
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_mapProvider
(
_defaultMapProvider
)
{
qmlRegisterUncreatableType
<
FlightMapSettings
>
(
"QGroundControl"
,
1
,
0
,
"FlightMapSetting"
,
"Reference only"
);
_supportedMapProviders
<<
"Bing"
<<
"Google"
<<
"Open"
;
_loadSettings
();
}
FlightMapSettings
::~
FlightMapSettings
()
{
}
void
FlightMapSettings
::
_storeSettings
(
void
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
settings
.
setValue
(
_mapProviderKey
,
_supportedMapProviders
.
contains
(
_mapProvider
)
?
_mapProvider
:
_defaultMapProvider
);
}
void
FlightMapSettings
::
_loadSettings
(
void
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
_mapProvider
=
settings
.
value
(
_mapProviderKey
,
_defaultMapProvider
).
toString
();
if
(
!
_supportedMapProviders
.
contains
(
_mapProvider
))
{
_mapProvider
=
_defaultMapProvider
;
}
_setMapTypesForCurrentProvider
();
}
QString
FlightMapSettings
::
mapProvider
(
void
)
{
return
_mapProvider
;
}
void
FlightMapSettings
::
setMapProvider
(
const
QString
&
mapProvider
)
{
if
(
_supportedMapProviders
.
contains
(
mapProvider
))
{
_mapProvider
=
mapProvider
;
_storeSettings
();
_setMapTypesForCurrentProvider
();
emit
mapProviderChanged
(
mapProvider
);
}
}
void
FlightMapSettings
::
_setMapTypesForCurrentProvider
(
void
)
{
_mapTypes
.
clear
();
if
(
_mapProvider
==
"Bing"
)
{
_mapTypes
<<
"Street Map"
<<
"Satellite Map"
<<
"Hybrid Map"
;
}
else
if
(
_mapProvider
==
"Google"
)
{
_mapTypes
<<
"Street Map"
<<
"Satellite Map"
<<
"Terrain Map"
;
}
else
if
(
_mapProvider
==
"Open"
)
{
_mapTypes
<<
"Street Map"
;
}
emit
mapTypesChanged
(
_mapTypes
);
}
QString
FlightMapSettings
::
mapTypeForMapName
(
const
QString
&
mapName
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
settings
.
beginGroup
(
mapName
);
settings
.
beginGroup
(
_mapProvider
);
return
settings
.
value
(
_mapTypeKey
,
"Street Map"
).
toString
();
}
void
FlightMapSettings
::
setMapTypeForMapName
(
const
QString
&
mapName
,
const
QString
&
mapType
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
settings
.
beginGroup
(
mapName
);
settings
.
beginGroup
(
_mapProvider
);
settings
.
setValue
(
_mapTypeKey
,
mapType
);
}
void
FlightMapSettings
::
saveMapSetting
(
const
QString
&
mapName
,
const
QString
&
key
,
const
QString
&
value
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
settings
.
beginGroup
(
mapName
);
settings
.
setValue
(
key
,
value
);
}
QString
FlightMapSettings
::
loadMapSetting
(
const
QString
&
mapName
,
const
QString
&
key
,
const
QString
&
defaultValue
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
settings
.
beginGroup
(
mapName
);
return
settings
.
value
(
key
,
defaultValue
).
toString
();
}
src/FlightMap/FlightMapSettings.h
0 → 100644
View file @
7d841636
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef FlightMapSettings_H
#define FlightMapSettings_H
#include "QGCSingleton.h"
#include <QStringList>
class
FlightMapSettings
:
public
QObject
{
Q_OBJECT
DECLARE_QGC_SINGLETON
(
FlightMapSettings
,
FlightMapSettings
)
public:
/// mapProvider is either Bing, Google or Open to specify to set of maps available
Q_PROPERTY
(
QString
mapProvider
READ
mapProvider
WRITE
setMapProvider
NOTIFY
mapProviderChanged
)
/// Map types associated with current map provider
Q_PROPERTY
(
QStringList
mapTypes
MEMBER
_mapTypes
NOTIFY
mapTypesChanged
)
Q_INVOKABLE
QString
mapTypeForMapName
(
const
QString
&
mapName
);
Q_INVOKABLE
void
setMapTypeForMapName
(
const
QString
&
mapName
,
const
QString
&
mapType
);
Q_INVOKABLE
void
saveMapSetting
(
const
QString
&
mapName
,
const
QString
&
key
,
const
QString
&
value
);
Q_INVOKABLE
QString
loadMapSetting
(
const
QString
&
mapName
,
const
QString
&
key
,
const
QString
&
defaultValue
);
// Property accessors
QString
mapProvider
(
void
);
void
setMapProvider
(
const
QString
&
mapProvider
);
signals:
void
mapProviderChanged
(
const
QString
&
mapProvider
);
void
mapTypesChanged
(
const
QStringList
&
mapTypes
);
private:
/// @brief All access to FlightMapSettings singleton is through FlightMapSettings::instance
FlightMapSettings
(
QObject
*
parent
=
NULL
);
~
FlightMapSettings
();
void
_storeSettings
(
void
);
void
_loadSettings
(
void
);
void
_setMapTypesForCurrentProvider
(
void
);
QString
_mapProvider
;
///< Current map provider
QStringList
_supportedMapProviders
;
QStringList
_mapTypes
;
///< Map types associated with current map provider
static
const
char
*
_defaultMapProvider
;
static
const
char
*
_settingsGroup
;
static
const
char
*
_mapProviderKey
;
static
const
char
*
_mapTypeKey
;
};
#endif
src/HomePositionManager.cc
View file @
7d841636
...
...
@@ -25,6 +25,7 @@
#include <QApplication>
#include <QTimer>
#include <QSettings>
#include <QtQml>
#include "UAS.h"
#include "UASInterface.h"
...
...
@@ -51,6 +52,8 @@ HomePositionManager::HomePositionManager(QObject* parent)
,
homeLon
(
8.549444
)
,
homeAlt
(
470.0
)
{
qmlRegisterUncreatableType
<
HomePositionManager
>
(
"QGroundControl"
,
1
,
0
,
"HomePositionManager"
,
"Reference only"
);
_loadSettings
();
}
...
...
src/QGCApplication.cc
View file @
7d841636
...
...
@@ -83,6 +83,7 @@
#include "MissionManager.h"
#include "QGroundControlQmlGlobal.h"
#include "HomePositionManager.h"
#include "FlightMapSettings.h"
#ifndef __ios__
#include "SerialLink.h"
...
...
@@ -313,7 +314,6 @@ void QGCApplication::_initCommon(void)
qmlRegisterUncreatableType
<
JoystickManager
>
(
"QGroundControl.JoystickManager"
,
1
,
0
,
"JoystickManager"
,
"Reference only"
);
qmlRegisterUncreatableType
<
Joystick
>
(
"QGroundControl.JoystickManager"
,
1
,
0
,
"Joystick"
,
"Reference only"
);
qmlRegisterUncreatableType
<
QmlObjectListModel
>
(
"QGroundControl"
,
1
,
0
,
"QmlObjectListModel"
,
"Reference only"
);
qmlRegisterUncreatableType
<
HomePositionManager
>
(
"QGroundControl"
,
1
,
0
,
"HomePositionManager"
,
"Reference only"
);
qmlRegisterType
<
ViewWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ViewWidgetController"
);
qmlRegisterType
<
ParameterEditorController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ParameterEditorController"
);
...
...
@@ -550,6 +550,16 @@ void QGCApplication::_createSingletons(void)
{
// The order here is important since the singletons reference each other
// No dependencies
FlightMapSettings
*
flightMapSettings
=
FlightMapSettings
::
_createSingleton
();
Q_UNUSED
(
flightMapSettings
);
Q_ASSERT
(
flightMapSettings
);
// No dependencies
HomePositionManager
*
homePositionManager
=
HomePositionManager
::
_createSingleton
();
Q_UNUSED
(
homePositionManager
);
Q_ASSERT
(
homePositionManager
);
// No dependencies
FirmwarePlugin
*
firmwarePlugin
=
GenericFirmwarePlugin
::
_createSingleton
();
Q_UNUSED
(
firmwarePlugin
);
...
...
@@ -584,22 +594,17 @@ void QGCApplication::_createSingletons(void)
Q_UNUSED
(
linkManager
);
Q_ASSERT
(
linkManager
);
// Needs LinkManager
HomePositionManager
*
uasManager
=
HomePositionManager
::
_createSingleton
();
Q_UNUSED
(
uasManager
);
Q_ASSERT
(
uasManager
);
// Need HomePositionManager
// Need MultiVehicleManager
AutoPilotPluginManager
*
pluginManager
=
AutoPilotPluginManager
::
_createSingleton
();
Q_UNUSED
(
pluginManager
);
Q_ASSERT
(
pluginManager
);
// Need
HomePosition
Manager
// Need
MultiVehicle
Manager
UASMessageHandler
*
messageHandler
=
UASMessageHandler
::
_createSingleton
();
Q_UNUSED
(
messageHandler
);
Q_ASSERT
(
messageHandler
);
// Needs
HomePosition
Manager
// Needs
MultiVehicle
Manager
FactSystem
*
factSystem
=
FactSystem
::
_createSingleton
();
Q_UNUSED
(
factSystem
);
Q_ASSERT
(
factSystem
);
...
...
@@ -631,7 +636,6 @@ void QGCApplication::_destroySingletons(void)
FactSystem
::
_deleteSingleton
();
UASMessageHandler
::
_deleteSingleton
();
AutoPilotPluginManager
::
_deleteSingleton
();
HomePositionManager
::
_deleteSingleton
();
LinkManager
::
_deleteSingleton
();
GAudioOutput
::
_deleteSingleton
();
JoystickManager
::
_deleteSingleton
();
...
...
@@ -640,6 +644,8 @@ void QGCApplication::_destroySingletons(void)
GenericFirmwarePlugin
::
_deleteSingleton
();
PX4FirmwarePlugin
::
_deleteSingleton
();
APMFirmwarePlugin
::
_deleteSingleton
();
HomePositionManager
::
_deleteSingleton
();
FlightMapSettings
::
_deleteSingleton
();
}
void
QGCApplication
::
informationMessageBoxOnMainThread
(
const
QString
&
title
,
const
QString
&
msg
)
...
...
src/QmlControls/QGroundControlQmlGlobal.cc
View file @
7d841636
...
...
@@ -29,6 +29,7 @@
QGroundControlQmlGlobal
::
QGroundControlQmlGlobal
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_homePositionManager
(
HomePositionManager
::
instance
())
,
_flightMapSettings
(
FlightMapSettings
::
instance
())
{
}
...
...
src/QmlControls/QGroundControlQmlGlobal.h
View file @
7d841636
...
...
@@ -30,6 +30,7 @@
#include <QObject>
#include "HomePositionManager.h"
#include "FlightMapSettings.h"
class
QGroundControlQmlGlobal
:
public
QObject
{
...
...
@@ -39,14 +40,17 @@ public:
QGroundControlQmlGlobal
(
QObject
*
parent
=
NULL
);
~
QGroundControlQmlGlobal
();
Q_PROPERTY
(
HomePositionManager
*
homePositionManager
READ
homePositionManager
CONSTANT
)
Q_PROPERTY
(
HomePositionManager
*
homePositionManager
READ
homePositionManager
CONSTANT
)
Q_PROPERTY
(
FlightMapSettings
*
flightMapSettings
READ
flightMapSettings
CONSTANT
)
// Property accesors
HomePositionManager
*
homePositionManager
(
void
)
{
return
_homePositionManager
;
}
HomePositionManager
*
homePositionManager
(
void
)
{
return
_homePositionManager
;
}
FlightMapSettings
*
flightMapSettings
(
void
)
{
return
_flightMapSettings
;
}
private:
HomePositionManager
*
_homePositionManager
;
FlightMapSettings
*
_flightMapSettings
;
};
#endif
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