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
68451354
Commit
68451354
authored
Oct 29, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2159 from DonLakeFlyer/SingletonRemove
Remove as many Singletons as possible
parents
599cd32c
10f43711
Changes
105
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
105 changed files
with
946 additions
and
818 deletions
+946
-818
QGCApplication.pro
QGCApplication.pro
+2
-0
AutoPilotPlugin.cc
src/AutoPilotPlugins/AutoPilotPlugin.cc
+1
-1
AutoPilotPluginManager.cc
src/AutoPilotPlugins/AutoPilotPluginManager.cc
+0
-8
AutoPilotPluginManager.h
src/AutoPilotPlugins/AutoPilotPluginManager.h
+5
-9
AirframeComponentController.cc
src/AutoPilotPlugins/PX4/AirframeComponentController.cc
+2
-2
Fact.cc
src/FactSystem/Fact.cc
+0
-1
FactPanelController.cc
src/FactSystem/FactControls/FactPanelController.cc
+1
-1
FactSystem.cc
src/FactSystem/FactSystem.cc
+7
-8
FactSystem.h
src/FactSystem/FactSystem.h
+8
-10
FactSystemTestBase.cc
src/FactSystem/FactSystemTestBase.cc
+2
-12
ParameterLoader.cc
src/FactSystem/ParameterLoader.cc
+4
-4
APMFirmwarePlugin.cc
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
+1
-2
APMFirmwarePlugin.h
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
+1
-1
ArduCopterFirmwarePlugin.cc
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.cc
+1
-2
ArduCopterFirmwarePlugin.h
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.h
+1
-1
ArduPlaneFirmwarePlugin.cc
src/FirmwarePlugin/APM/ArduPlaneFirmwarePlugin.cc
+1
-2
ArduPlaneFirmwarePlugin.h
src/FirmwarePlugin/APM/ArduPlaneFirmwarePlugin.h
+1
-1
ArduRoverFirmwarePlugin.cc
src/FirmwarePlugin/APM/ArduRoverFirmwarePlugin.cc
+1
-2
ArduRoverFirmwarePlugin.h
src/FirmwarePlugin/APM/ArduRoverFirmwarePlugin.h
+1
-1
FirmwarePlugin.h
src/FirmwarePlugin/FirmwarePlugin.h
+1
-1
FirmwarePluginManager.cc
src/FirmwarePlugin/FirmwarePluginManager.cc
+0
-13
FirmwarePluginManager.h
src/FirmwarePlugin/FirmwarePluginManager.h
+6
-9
GenericFirmwarePlugin.cc
src/FirmwarePlugin/Generic/GenericFirmwarePlugin.cc
+1
-2
GenericFirmwarePlugin.h
src/FirmwarePlugin/Generic/GenericFirmwarePlugin.h
+1
-2
PX4FirmwarePlugin.cc
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
+1
-2
PX4FirmwarePlugin.h
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
+1
-1
FlightMapSettings.cc
src/FlightMap/FlightMapSettings.cc
+9
-10
FlightMapSettings.h
src/FlightMap/FlightMapSettings.h
+8
-8
GAudioOutput.cc
src/GAudioOutput.cc
+3
-5
GAudioOutput.h
src/GAudioOutput.h
+7
-7
HomePositionManager.cc
src/HomePositionManager.cc
+14
-13
HomePositionManager.h
src/HomePositionManager.h
+14
-12
Joystick.cc
src/Joystick/Joystick.cc
+4
-3
Joystick.h
src/Joystick/Joystick.h
+4
-1
JoystickManager.cc
src/Joystick/JoystickManager.cc
+22
-17
JoystickManager.h
src/Joystick/JoystickManager.h
+12
-10
MissionController.cc
src/MissionManager/MissionController.cc
+4
-4
MissionControllerManagerTest.cc
src/MissionManager/MissionControllerManagerTest.cc
+3
-20
MissionControllerManagerTest.h
src/MissionManager/MissionControllerManagerTest.h
+0
-1
MissionManager.cc
src/MissionManager/MissionManager.cc
+8
-7
QGCApplication.cc
src/QGCApplication.cc
+7
-82
QGCApplication.h
src/QGCApplication.h
+19
-2
QGCQuickWidget.cc
src/QGCQuickWidget.cc
+2
-2
QGCSingleton.cc
src/QGCSingleton.cc
+0
-5
QGCSingleton.h
src/QGCSingleton.h
+2
-10
QGCToolbox.cc
src/QGCToolbox.cc
+100
-0
QGCToolbox.h
src/QGCToolbox.h
+91
-0
ParameterEditorController.cc
src/QmlControls/ParameterEditorController.cc
+1
-1
QGroundControlQmlGlobal.cc
src/QmlControls/QGroundControlQmlGlobal.cc
+6
-8
QGroundControlQmlGlobal.h
src/QmlControls/QGroundControlQmlGlobal.h
+3
-2
MultiVehicleManager.cc
src/Vehicle/MultiVehicleManager.cc
+21
-11
MultiVehicleManager.h
src/Vehicle/MultiVehicleManager.h
+18
-8
Vehicle.cc
src/Vehicle/Vehicle.cc
+26
-11
Vehicle.h
src/Vehicle/Vehicle.h
+14
-1
FirmwareUpgradeController.cc
src/VehicleSetup/FirmwareUpgradeController.cc
+2
-2
JoystickConfigController.cc
src/VehicleSetup/JoystickConfigController.cc
+6
-5
JoystickConfigController.h
src/VehicleSetup/JoystickConfigController.h
+3
-0
SetupViewTest.cc
src/VehicleSetup/SetupViewTest.cc
+5
-42
SetupViewTest.h
src/VehicleSetup/SetupViewTest.h
+0
-9
CustomCommandWidgetController.cc
src/ViewWidgets/CustomCommandWidgetController.cc
+2
-1
ViewWidgetController.cc
src/ViewWidgets/ViewWidgetController.cc
+4
-3
LinkManager.cc
src/comm/LinkManager.cc
+23
-19
LinkManager.h
src/comm/LinkManager.h
+10
-9
LogReplayLink.cc
src/comm/LogReplayLink.cc
+6
-5
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+59
-48
MAVLinkProtocol.h
src/comm/MAVLinkProtocol.h
+13
-9
MockLink.cc
src/comm/MockLink.cc
+2
-1
MockLinkMissionItemHandler.cc
src/comm/MockLinkMissionItemHandler.cc
+6
-5
MockLinkMissionItemHandler.h
src/comm/MockLinkMissionItemHandler.h
+7
-5
QGCFlightGearLink.cc
src/comm/QGCFlightGearLink.cc
+4
-3
SerialLink.cc
src/comm/SerialLink.cc
+3
-2
Mouse6dofInput.cpp
src/input/Mouse6dofInput.cpp
+3
-3
FileManagerTest.cc
src/qgcunittest/FileManagerTest.cc
+9
-21
FileManagerTest.h
src/qgcunittest/FileManagerTest.h
+0
-1
LinkManagerTest.cc
src/qgcunittest/LinkManagerTest.cc
+11
-18
MainWindowTest.cc
src/qgcunittest/MainWindowTest.cc
+5
-43
MainWindowTest.h
src/qgcunittest/MainWindowTest.h
+0
-8
MavlinkLogTest.cc
src/qgcunittest/MavlinkLogTest.cc
+6
-18
PX4RCCalibrationTest.cc
src/qgcunittest/PX4RCCalibrationTest.cc
+3
-13
PX4RCCalibrationTest.h
src/qgcunittest/PX4RCCalibrationTest.h
+0
-1
UnitTest.cc
src/qgcunittest/UnitTest.cc
+75
-8
UnitTest.h
src/qgcunittest/UnitTest.h
+19
-2
FileManager.cc
src/uas/FileManager.cc
+2
-1
UAS.cc
src/uas/UAS.cc
+6
-26
UAS.h
src/uas/UAS.h
+4
-2
UASMessageHandler.cc
src/uas/UASMessageHandler.cc
+16
-8
UASMessageHandler.h
src/uas/UASMessageHandler.h
+19
-15
MAVLinkSettingsWidget.cc
src/ui/MAVLinkSettingsWidget.cc
+2
-1
MainWindow.cc
src/ui/MainWindow.cc
+18
-14
MainWindow.h
src/ui/MainWindow.h
+3
-0
MultiVehicleDockWidget.cc
src/ui/MultiVehicleDockWidget.cc
+7
-6
QGCLinkConfiguration.cc
src/ui/QGCLinkConfiguration.cc
+13
-13
QGCMAVLinkInspector.cc
src/ui/QGCMAVLinkInspector.cc
+4
-3
QGCMAVLinkLogPlayer.cc
src/ui/QGCMAVLinkLogPlayer.cc
+2
-2
QGCMapRCToParamDialog.cpp
src/ui/QGCMapRCToParamDialog.cpp
+7
-7
QGCMapRCToParamDialog.h
src/ui/QGCMapRCToParamDialog.h
+4
-2
QGCTabbedInfoView.cpp
src/ui/QGCTabbedInfoView.cpp
+2
-1
QGCUASFileViewMulti.cc
src/ui/QGCUASFileViewMulti.cc
+7
-6
SettingsDialog.cc
src/ui/SettingsDialog.cc
+14
-12
SettingsDialog.h
src/ui/SettingsDialog.h
+6
-1
MainToolBarController.cc
src/ui/toolbar/MainToolBarController.cc
+19
-19
UASInfoWidget.cc
src/ui/uas/UASInfoWidget.cc
+3
-2
UASMessageView.cc
src/ui/uas/UASMessageView.cc
+10
-9
UASMessageView.h
src/ui/uas/UASMessageView.h
+16
-3
UASQuickView.cc
src/ui/uas/UASQuickView.cc
+3
-2
No files found.
QGCApplication.pro
View file @
68451354
...
...
@@ -242,6 +242,7 @@ HEADERS += \
src
/
QGCQuickWidget
.
h
\
src
/
QGCSingleton
.
h
\
src
/
QGCTemporaryFile
.
h
\
src
/
QGCToolbox
.
h
\
src
/
QmlControls
/
CoordinateVector
.
h
\
src
/
QmlControls
/
MavlinkQmlSingleton
.
h
\
src
/
QmlControls
/
ParameterEditorController
.
h
\
...
...
@@ -356,6 +357,7 @@ SOURCES += \
src
/
QGCQuickWidget
.
cc
\
src
/
QGCSingleton
.
cc
\
src
/
QGCTemporaryFile
.
cc
\
src
/
QGCToolbox
.
cc
\
src
/
QGCGeo
.
cc
\
src
/
QmlControls
/
CoordinateVector
.
cc
\
src
/
QmlControls
/
ParameterEditorController
.
cc
\
...
...
src/AutoPilotPlugins/AutoPilotPlugin.cc
View file @
68451354
...
...
@@ -101,7 +101,7 @@ bool AutoPilotPlugin::setupComplete(void)
void
AutoPilotPlugin
::
resetAllParametersToDefaults
(
void
)
{
mavlink_message_t
msg
;
MAVLinkProtocol
*
mavlink
=
MAVLinkProtocol
::
instance
();
MAVLinkProtocol
*
mavlink
=
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
();
mavlink_msg_command_long_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
_vehicle
->
uas
()
->
getUASID
(),
0
,
MAV_CMD_PREFLIGHT_STORAGE
,
0
,
2
,
-
1
,
0
,
0
,
0
,
0
,
0
);
_vehicle
->
sendMessage
(
msg
);
...
...
src/AutoPilotPlugins/AutoPilotPluginManager.cc
View file @
68451354
...
...
@@ -29,14 +29,6 @@
#include "APM/APMAutoPilotPlugin.h"
#include "Generic/GenericAutoPilotPlugin.h"
IMPLEMENT_QGC_SINGLETON
(
AutoPilotPluginManager
,
AutoPilotPluginManager
)
AutoPilotPluginManager
::
AutoPilotPluginManager
(
QObject
*
parent
)
:
QGCSingleton
(
parent
)
{
}
AutoPilotPlugin
*
AutoPilotPluginManager
::
newAutopilotPluginForVehicle
(
Vehicle
*
vehicle
)
{
switch
(
vehicle
->
firmwareType
())
{
...
...
src/AutoPilotPlugins/AutoPilotPluginManager.h
View file @
68451354
...
...
@@ -32,23 +32,19 @@
#include <QString>
#include "AutoPilotPlugin.h"
#include "QGCSingleton.h"
#include "Vehicle.h"
#include "QGCToolbox.h"
/// AutoPilotPlugin manager is a singleton which maintains the list of AutoPilotPlugin objects.
class
QGCApplication
;
class
AutoPilotPluginManager
:
public
QGC
Singleton
class
AutoPilotPluginManager
:
public
QGC
Tool
{
Q_OBJECT
DECLARE_QGC_SINGLETON
(
AutoPilotPluginManager
,
AutoPilotPluginManager
)
public:
AutoPilotPluginManager
(
QGCApplication
*
app
)
:
QGCTool
(
app
)
{
}
AutoPilotPlugin
*
newAutopilotPluginForVehicle
(
Vehicle
*
vehicle
);
private:
/// All access to singleton is through AutoPilotPluginManager::instance
AutoPilotPluginManager
(
QObject
*
parent
=
NULL
);
};
#endif
src/AutoPilotPlugins/PX4/AirframeComponentController.cc
View file @
68451354
...
...
@@ -98,7 +98,7 @@ AirframeComponentController::~AirframeComponentController()
void
AirframeComponentController
::
changeAutostart
(
void
)
{
if
(
MultiVehicleManager
::
instance
()
->
vehicles
().
count
()
>
1
)
{
if
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
vehicles
().
count
()
>
1
)
{
QGCMessageBox
::
warning
(
"Airframe Config"
,
"You cannot change airframe configuration while connected to multiple vehicles."
);
return
;
}
...
...
@@ -139,7 +139,7 @@ void AirframeComponentController::_rebootAfterStackUnwind(void)
QGC
::
SLEEP
::
usleep
(
500
);
qgcApp
()
->
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
}
LinkManager
::
instance
()
->
disconnectAll
();
qgcApp
()
->
toolbox
()
->
linkManager
()
->
disconnectAll
();
qgcApp
()
->
restoreOverrideCursor
();
}
...
...
src/FactSystem/Fact.cc
View file @
68451354
...
...
@@ -135,7 +135,6 @@ QString Fact::valueString(void) const
switch
(
type
())
{
case
FactMetaData
:
:
valueTypeFloat
:
qDebug
()
<<
name
()
<<
value
()
<<
decimalPlaces
();
valueString
=
QString
(
"%1"
).
arg
(
value
().
toFloat
(),
0
,
'g'
,
decimalPlaces
());
break
;
case
FactMetaData
:
:
valueTypeDouble
:
...
...
src/FactSystem/FactControls/FactPanelController.cc
View file @
68451354
...
...
@@ -36,7 +36,7 @@ QGC_LOGGING_CATEGORY(FactPanelControllerLog, "FactPanelControllerLog")
FactPanelController
::
FactPanelController
(
void
)
:
_factPanel
(
NULL
)
{
_vehicle
=
MultiVehicleManager
::
instance
()
->
activeVehicle
();
_vehicle
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
();
Q_ASSERT
(
_vehicle
);
_uas
=
_vehicle
->
uas
();
...
...
src/FactSystem/FactSystem.cc
View file @
68451354
...
...
@@ -29,19 +29,18 @@
#include <QtQml>
IMPLEMENT_QGC_SINGLETON
(
FactSystem
,
FactSystem
)
const
char
*
FactSystem
::
_factSystemQmlUri
=
"QGroundControl.FactSystem"
;
FactSystem
::
FactSystem
(
Q
Object
*
parent
)
:
QGCSingleton
(
parent
)
FactSystem
::
FactSystem
(
Q
GCApplication
*
app
)
:
QGCTool
(
app
)
{
qmlRegisterType
<
Fact
>
(
_factSystemQmlUri
,
1
,
0
,
"Fact"
);
qmlRegisterType
<
FactPanelController
>
(
_factSystemQmlUri
,
1
,
0
,
"FactPanelController"
);
}
FactSystem
::~
FactSystem
(
)
void
FactSystem
::
setToolbox
(
QGCToolbox
*
toolbox
)
{
QGCTool
::
setToolbox
(
toolbox
);
qmlRegisterType
<
Fact
>
(
_factSystemQmlUri
,
1
,
0
,
"Fact"
);
qmlRegisterType
<
FactPanelController
>
(
_factSystemQmlUri
,
1
,
0
,
"FactPanelController"
);
}
src/FactSystem/FactSystem.h
View file @
68451354
...
...
@@ -29,10 +29,8 @@
#include "Fact.h"
#include "FactMetaData.h"
#include "QGC
Singleton
.h"
#include "QGC
Toolbox
.h"
/// FactSystem is a singleton which provides access to the Facts in the system
///
/// The components of the FactSystem are a Fact which holds an individual value. FactMetaData holds
/// additional meta data associated with a Fact such as description, min/max ranges and so forth.
/// The FactValidator object is a QML validator which validates input according to the FactMetaData
...
...
@@ -40,13 +38,17 @@
/// of this is the PX4ParameterMetaData onbject which is part of the PX4 AutoPilot plugin. It exposes
/// the firmware parameters to QML such that you can bind QML ui elements directly to parameters.
class
FactSystem
:
public
QGC
Singleton
class
FactSystem
:
public
QGC
Tool
{
Q_OBJECT
DECLARE_QGC_SINGLETON
(
FactSystem
,
FactSystem
)
public:
/// All access to FactSystem is through FactSystem::instance, so constructor is private
FactSystem
(
QGCApplication
*
app
);
// Override from QGCTool
virtual
void
setToolbox
(
QGCToolbox
*
toolbox
);
typedef
enum
{
ParameterProvider
,
}
Provider_t
;
...
...
@@ -54,10 +56,6 @@ public:
static
const
int
defaultComponentId
=
-
1
;
private:
/// All access to FactSystem is through FactSystem::instance, so constructor is private
FactSystem
(
QObject
*
parent
=
NULL
);
~
FactSystem
();
static
const
char
*
_factSystemQmlUri
;
///< URI for FactSystem QML imports
};
...
...
src/FactSystem/FactSystemTestBase.cc
View file @
68451354
...
...
@@ -44,19 +44,9 @@ void FactSystemTestBase::_init(MAV_AUTOPILOT autopilot)
{
UnitTest
::
init
();
MockLink
*
link
=
new
MockLink
();
link
->
setFirmwareType
(
autopilot
);
LinkManager
::
instance
()
->
_addLink
(
link
);
_connectMockLink
(
autopilot
);
LinkManager
::
instance
()
->
connectLink
(
link
);
// Wait for the Vehicle to get created
QSignalSpy
spyVehicle
(
MultiVehicleManager
::
instance
(),
SIGNAL
(
parameterReadyVehicleAvailableChanged
(
bool
)));
QCOMPARE
(
spyVehicle
.
wait
(
5000
),
true
);
QVERIFY
(
MultiVehicleManager
::
instance
()
->
parameterReadyVehicleAvailable
());
QVERIFY
(
MultiVehicleManager
::
instance
()
->
activeVehicle
());
_plugin
=
MultiVehicleManager
::
instance
()
->
activeVehicle
()
->
autopilotPlugin
();
_plugin
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
()
->
autopilotPlugin
();
Q_ASSERT
(
_plugin
);
}
...
...
src/FactSystem/ParameterLoader.cc
View file @
68451354
...
...
@@ -50,7 +50,7 @@ ParameterLoader::ParameterLoader(AutoPilotPlugin* autopilot, Vehicle* vehicle, Q
QObject
(
parent
),
_autopilot
(
autopilot
),
_vehicle
(
vehicle
),
_mavlink
(
MAVLinkProtocol
::
instance
()),
_mavlink
(
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()),
_parametersReady
(
false
),
_initialLoadComplete
(
false
),
_defaultComponentId
(
FactSystem
::
defaultComponentId
),
...
...
@@ -308,7 +308,7 @@ void ParameterLoader::refreshAllParameters(void)
_dataMutex
.
unlock
();
MAVLinkProtocol
*
mavlink
=
MAVLinkProtocol
::
instance
();
MAVLinkProtocol
*
mavlink
=
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
();
Q_ASSERT
(
mavlink
);
mavlink_message_t
msg
;
...
...
@@ -501,7 +501,7 @@ void ParameterLoader::_tryCacheLookup()
/* Start waiting for 2.5 seconds to get a cache hit and avoid loading all params over the radio */
_cacheTimeoutTimer
.
start
();
MAVLinkProtocol
*
mavlink
=
MAVLinkProtocol
::
instance
();
MAVLinkProtocol
*
mavlink
=
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
();
Q_ASSERT
(
mavlink
);
mavlink_message_t
msg
;
...
...
@@ -825,7 +825,7 @@ void ParameterLoader::_checkInitialLoadComplete(void)
// Check for any errors during vehicle boot
UASMessageHandler
*
msgHandler
=
UASMessageHandler
::
instance
();
UASMessageHandler
*
msgHandler
=
qgcApp
()
->
toolbox
()
->
uasMessageHandler
();
if
(
msgHandler
->
getErrorCountTotal
())
{
QString
errors
;
bool
firstError
=
true
;
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
View file @
68451354
...
...
@@ -139,8 +139,7 @@ QString APMCustomMode::modeString() const
return
mode
;
}
APMFirmwarePlugin
::
APMFirmwarePlugin
(
QObject
*
parent
)
:
FirmwarePlugin
(
parent
)
APMFirmwarePlugin
::
APMFirmwarePlugin
(
void
)
{
_textSeverityAdjustmentNeeded
=
false
;
}
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
View file @
68451354
...
...
@@ -94,7 +94,7 @@ public:
protected:
/// All access to singleton is through stack specific implementation
APMFirmwarePlugin
(
QObject
*
parent
=
NULL
);
APMFirmwarePlugin
(
void
);
void
setSupportedModes
(
QList
<
APMCustomMode
>
supportedModes
);
private:
...
...
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.cc
View file @
68451354
...
...
@@ -53,8 +53,7 @@ APMCopterMode::APMCopterMode(uint32_t mode, bool settable) : APMCustomMode(mode,
setEnumToStringMapping
(
enumToString
);
}
ArduCopterFirmwarePlugin
::
ArduCopterFirmwarePlugin
(
QObject
*
parent
)
:
APMFirmwarePlugin
(
parent
)
ArduCopterFirmwarePlugin
::
ArduCopterFirmwarePlugin
(
void
)
{
QList
<
APMCustomMode
>
supportedFlightModes
;
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
STABILIZE
,
true
);
...
...
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.h
View file @
68451354
...
...
@@ -68,7 +68,7 @@ public:
protected:
/// All access to singleton is through instance()
ArduCopterFirmwarePlugin
(
QObject
*
parent
=
NULL
);
ArduCopterFirmwarePlugin
(
void
);
private:
};
...
...
src/FirmwarePlugin/APM/ArduPlaneFirmwarePlugin.cc
View file @
68451354
...
...
@@ -50,8 +50,7 @@ APMPlaneMode::APMPlaneMode(uint32_t mode, bool settable) : APMCustomMode(mode, s
setEnumToStringMapping
(
enumToString
);
}
ArduPlaneFirmwarePlugin
::
ArduPlaneFirmwarePlugin
(
QObject
*
parent
)
:
APMFirmwarePlugin
(
parent
)
ArduPlaneFirmwarePlugin
::
ArduPlaneFirmwarePlugin
(
void
)
{
QList
<
APMCustomMode
>
supportedFlightModes
;
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
MANUAL
,
true
);
...
...
src/FirmwarePlugin/APM/ArduPlaneFirmwarePlugin.h
View file @
68451354
...
...
@@ -66,7 +66,7 @@ public:
protected:
/// All access to singleton is through instance()
ArduPlaneFirmwarePlugin
(
QObject
*
parent
=
NULL
);
ArduPlaneFirmwarePlugin
(
void
);
private:
};
...
...
src/FirmwarePlugin/APM/ArduRoverFirmwarePlugin.cc
View file @
68451354
...
...
@@ -44,8 +44,7 @@ APMRoverMode::APMRoverMode(uint32_t mode, bool settable) : APMCustomMode(mode, s
setEnumToStringMapping
(
enumToString
);
}
ArduRoverFirmwarePlugin
::
ArduRoverFirmwarePlugin
(
QObject
*
parent
)
:
APMFirmwarePlugin
(
parent
)
ArduRoverFirmwarePlugin
::
ArduRoverFirmwarePlugin
(
void
)
{
QList
<
APMCustomMode
>
supportedFlightModes
;
supportedFlightModes
<<
APMRoverMode
(
APMRoverMode
::
MANUAL
,
true
);
...
...
src/FirmwarePlugin/APM/ArduRoverFirmwarePlugin.h
View file @
68451354
...
...
@@ -66,7 +66,7 @@ public:
protected:
/// All access to singleton is through instance()
ArduRoverFirmwarePlugin
(
QObject
*
parent
=
NULL
);
ArduRoverFirmwarePlugin
(
void
);
private:
};
...
...
src/FirmwarePlugin/FirmwarePlugin.h
View file @
68451354
...
...
@@ -112,7 +112,7 @@ public:
virtual
void
addMetaDataToFact
(
Fact
*
fact
)
=
0
;
protected:
FirmwarePlugin
(
QObject
*
parent
=
NULL
)
:
QGCSingleton
(
parent
)
{
}
FirmwarePlugin
(
void
)
{
};
};
#endif
src/FirmwarePlugin/FirmwarePluginManager.cc
View file @
68451354
...
...
@@ -31,19 +31,6 @@
#include "APM/ArduRoverFirmwarePlugin.h"
#include "PX4/PX4FirmwarePlugin.h"
IMPLEMENT_QGC_SINGLETON
(
FirmwarePluginManager
,
FirmwarePluginManager
)
FirmwarePluginManager
::
FirmwarePluginManager
(
QObject
*
parent
)
:
QGCSingleton
(
parent
)
{
}
FirmwarePluginManager
::~
FirmwarePluginManager
()
{
}
FirmwarePlugin
*
FirmwarePluginManager
::
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
,
MAV_TYPE
vehicleType
)
{
switch
(
autopilotType
)
{
...
...
src/FirmwarePlugin/FirmwarePluginManager.h
View file @
68451354
...
...
@@ -29,29 +29,26 @@
#include <QObject>
#include "QGCSingleton.h"
#include "FirmwarePlugin.h"
#include "QGCMAVLink.h"
#include "QGCToolbox.h"
class
QGCApplication
;
/// FirmwarePluginManager is a singleton which is used to return the correct FirmwarePlugin for a MAV_AUTOPILOT type.
class
FirmwarePluginManager
:
public
QGC
Singleton
class
FirmwarePluginManager
:
public
QGC
Tool
{
Q_OBJECT
DECLARE_QGC_SINGLETON
(
FirmwarePluginManager
,
FirmwarePluginManager
)
public:
FirmwarePluginManager
(
QGCApplication
*
app
)
:
QGCTool
(
app
)
{
}
/// Returns appropriate plugin for autopilot type.
/// @param autopilotType Type of autopilot to return plugin for.
/// @param vehicleType Vehicle type of autopilot to return plugin for.
/// @return Singleton FirmwarePlugin instance for the specified MAV_AUTOPILOT.
FirmwarePlugin
*
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
,
MAV_TYPE
vehicleType
);
private:
/// All access to singleton is through FirmwarePluginManager::instance
FirmwarePluginManager
(
QObject
*
parent
=
NULL
);
~
FirmwarePluginManager
();
};
#endif
src/FirmwarePlugin/Generic/GenericFirmwarePlugin.cc
View file @
68451354
...
...
@@ -31,8 +31,7 @@
IMPLEMENT_QGC_SINGLETON
(
GenericFirmwarePlugin
,
FirmwarePlugin
)
GenericFirmwarePlugin
::
GenericFirmwarePlugin
(
QObject
*
parent
)
:
FirmwarePlugin
(
parent
)
GenericFirmwarePlugin
::
GenericFirmwarePlugin
(
void
)
{
}
...
...
src/FirmwarePlugin/Generic/GenericFirmwarePlugin.h
View file @
68451354
...
...
@@ -51,8 +51,7 @@ public:
virtual
QString
getDefaultComponentIdParam
(
void
)
const
{
return
QString
();
}
private:
/// All access to singleton is through AutoPilotPluginManager::instance
GenericFirmwarePlugin
(
QObject
*
parent
=
NULL
);
GenericFirmwarePlugin
(
void
);
};
#endif
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
View file @
68451354
...
...
@@ -88,8 +88,7 @@ static const struct Modes2Name rgModes2Name[] = {
};
PX4FirmwarePlugin
::
PX4FirmwarePlugin
(
QObject
*
parent
)
:
FirmwarePlugin
(
parent
)
PX4FirmwarePlugin
::
PX4FirmwarePlugin
(
void
)
{
}
...
...
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
View file @
68451354
...
...
@@ -53,7 +53,7 @@ public:
private:
/// All access to singleton is through AutoPilotPluginManager::instance
PX4FirmwarePlugin
(
QObject
*
parent
=
NULL
);
PX4FirmwarePlugin
(
void
);
PX4ParameterMetaData
_parameterMetaData
;
};
...
...
src/FlightMap/FlightMapSettings.cc
View file @
68451354
...
...
@@ -26,27 +26,26 @@
#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
(
Q
Object
*
parent
)
:
Q
Object
(
parent
)
FlightMapSettings
::
FlightMapSettings
(
Q
GCApplication
*
app
)
:
Q
GCTool
(
app
)
,
_mapProvider
(
_defaultMapProvider
)
{
qmlRegisterUncreatableType
<
FlightMapSettings
>
(
"QGroundControl"
,
1
,
0
,
"FlightMapSetting"
,
"Reference only"
);
_supportedMapProviders
<<
"Bing"
<<
"Google"
<<
"Open"
;
_loadSettings
();
}
FlightMapSettings
::~
FlightMapSettings
(
)
void
FlightMapSettings
::
setToolbox
(
QGCToolbox
*
toolbox
)
{
QGCTool
::
setToolbox
(
toolbox
);
qmlRegisterUncreatableType
<
FlightMapSettings
>
(
"QGroundControl"
,
1
,
0
,
"FlightMapSetting"
,
"Reference only"
);
_supportedMapProviders
<<
"Bing"
<<
"Google"
<<
"Open"
;
_loadSettings
();
}
void
FlightMapSettings
::
_storeSettings
(
void
)
...
...
src/FlightMap/FlightMapSettings.h
View file @
68451354
...
...
@@ -24,17 +24,18 @@ This file is part of the QGROUNDCONTROL project
#ifndef FlightMapSettings_H
#define FlightMapSettings_H
#include "QGC
Singleton
.h"
#include "QGC
Toolbox
.h"
#include <QObject>
#include <QStringList>
class
FlightMapSettings
:
public
Q
Object
class
FlightMapSettings
:
public
Q
GCTool
{
Q_OBJECT
DECLARE_QGC_SINGLETON
(
FlightMapSettings
,
FlightMapSettings
)
public:
FlightMapSettings
(
QGCApplication
*
app
);
/// mapProvider is either Bing, Google or Open to specify to set of maps available
Q_PROPERTY
(
QString
mapProvider
READ
mapProvider
WRITE
setMapProvider
NOTIFY
mapProviderChanged
)
...
...
@@ -54,15 +55,14 @@ public:
QString
mapProvider
(
void
);
void
setMapProvider
(
const
QString
&
mapProvider
);
// Override from QGCTool
virtual
void
setToolbox
(
QGCToolbox
*
toolbox
);
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
);
...
...
src/GAudioOutput.cc
View file @
68451354
...
...
@@ -43,12 +43,10 @@ This file is part of the QGROUNDCONTROL project
#include <QtAndroidExtras/QAndroidJniObject>
#endif
IMPLEMENT_QGC_SINGLETON
(
GAudioOutput
,
GAudioOutput
)
const
char
*
GAudioOutput
::
_mutedKey
=
"AudioMuted"
;
GAudioOutput
::
GAudioOutput
(
Q
Object
*
parent
)
:
QGC
Singleton
(
parent
)
GAudioOutput
::
GAudioOutput
(
Q
GCApplication
*
app
)
:
QGC
Tool
(
app
)
,
muted
(
false
)
#ifndef __android__
,
thread
(
new
QThread
())
...
...
@@ -57,7 +55,7 @@ GAudioOutput::GAudioOutput(QObject *parent)
{
QSettings
settings
;
muted
=
settings
.
value
(
_mutedKey
,
false
).
toBool
();
muted
|=
qgcApp
()
->
runningUnitTests
();
muted
|=
app
->
runningUnitTests
();
#ifndef __android__
worker
->
moveToThread
(
thread
);
connect
(
this
,
&
GAudioOutput
::
textToSpeak
,
worker
,
&
QGCAudioWorker
::
say
);
...
...
src/GAudioOutput.h
View file @
68451354
...
...
@@ -38,20 +38,23 @@ This file is part of the PIXHAWK project
#include <QStringList>
#include "QGCAudioWorker.h"
#include "QGCSingleton.h"
#include "QGCToolbox.h"
class
QGCApplication
;
/**
* @brief Audio Output (speech synthesizer and "beep" output)
* This class follows the singleton design pattern
* @see http://en.wikipedia.org/wiki/Singleton_pattern
*/
class
GAudioOutput
:
public
QGC
Singleton
class
GAudioOutput
:
public
QGC
Tool
{
Q_OBJECT
DECLARE_QGC_SINGLETON
(
GAudioOutput
,
GAudioOutput
)
public:
GAudioOutput
(
QGCApplication
*
app
);
~
GAudioOutput
();
/** @brief List available voices */
QStringList
listVoices
(
void
);
enum
...
...
@@ -95,9 +98,6 @@ protected:
#endif
private:
GAudioOutput
(
QObject
*
parent
=
NULL
);
~
GAudioOutput
();
static
const
char
*
_mutedKey
;
};
...
...
src/HomePositionManager.cc
View file @
68451354
...
...
@@ -39,27 +39,27 @@
#define MEAN_EARTH_DIAMETER 12756274.0
#define UMR 0.017453292519943295769236907684886
IMPLEMENT_QGC_SINGLETON
(
HomePositionManager
,
HomePositionManager
)
const
char
*
HomePositionManager
::
_settingsGroup
=
"HomePositionManager"
;
const
char
*
HomePositionManager
::
_latitudeKey
=
"Latitude"
;
const
char
*
HomePositionManager
::
_longitudeKey
=
"Longitude"
;
const
char
*
HomePositionManager
::
_altitudeKey
=
"Altitude"
;
HomePositionManager
::
HomePositionManager
(
Q
Object
*
parent
)
:
Q
Object
(
parent
)
HomePositionManager
::
HomePositionManager
(
Q
GCApplication
*
app
)
:
Q
GCTool
(
app
)
,
homeLat
(
47.3769
)
,
homeLon
(
8.549444
)
,
homeAlt
(
470.0
)
{
qmlRegisterUncreatableType
<
HomePositionManager
>
(
"QGroundControl"
,
1
,
0
,
"HomePositionManager"
,
"Reference only"
);
_loadSettings
();
}
HomePositionManager
::~
HomePositionManager
(
)
void
HomePositionManager
::
setToolbox
(
QGCToolbox
*
toolbox
)
{
QGCTool
::
setToolbox
(
toolbox
);
qmlRegisterUncreatableType
<
HomePositionManager
>
(
"QGroundControl"
,
1
,
0
,
"HomePositionManager"
,
"Reference only"
);
_loadSettings
();
}
void
HomePositionManager
::
_storeSettings
(
void
)
...
...
@@ -116,7 +116,7 @@ void HomePositionManager::_loadSettings(void)
settings
.
endGroup
();
if
(
_homePositions
.
count
()
==
0
)
{
_homePositions
.
append
(
new
HomePosition
(
"ETH Campus"
,
QGeoCoordinate
(
47.3769
,
8.549444
,
470.0
)));
_homePositions
.
append
(
new
HomePosition
(
"ETH Campus"
,
QGeoCoordinate
(
47.3769
,
8.549444
,
470.0
)
,
this
));
}
// Deprecated settings for old editor
...
...
@@ -169,7 +169,7 @@ bool HomePositionManager::setHomePositionAndNotify(double lat, double lon, doubl
bool
changed
=
setHomePosition
(
lat
,
lon
,
alt
);
if
(
changed
)
{
MultiVehicleManager
::
instance
()
->
setHomePositionForAllVehicles
(
homeLat
,
homeLon
,
homeAlt
);
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
setHomePositionForAllVehicles
(
homeLat
,
homeLon
,
homeAlt
);
}
return
changed
;
...
...
@@ -218,9 +218,10 @@ void HomePositionManager::deleteHomePosition(const QString& name)
_storeSettings
();
}
HomePosition
::
HomePosition
(
const
QString
&
name
,
const
QGeoCoordinate
&
coordinate
,
QObject
*
parent
)
HomePosition
::
HomePosition
(
const
QString
&
name
,
const
QGeoCoordinate
&
coordinate
,
HomePositionManager
*
homePositionManager
,
QObject
*
parent
)
:
QObject
(
parent
)
,
_coordinate
(
coordinate
)
,
_homePositionManager
(
homePositionManager
)
{
setObjectName
(
name
);
}
...
...
@@ -238,7 +239,7 @@ QString HomePosition::name(void)
void
HomePosition
::
setName
(
const
QString
&
name
)
{
setObjectName
(
name
);
HomePositionManager
::
instance
()
->
_storeSettings
();
_homePositionManager
->
_storeSettings
();
emit
nameChanged
(
name
);
}
...
...
@@ -250,6 +251,6 @@ QGeoCoordinate HomePosition::coordinate(void)
void
HomePosition
::
setCoordinate
(
const
QGeoCoordinate
&
coordinate
)
{
_coordinate
=
coordinate
;
HomePositionManager
::
instance
()
->
_storeSettings
();
_homePositionManager
->
_storeSettings
();
emit
coordinateChanged
(
coordinate
);
}
src/HomePositionManager.h
View file @
68451354
...
...
@@ -24,17 +24,19 @@ This file is part of the QGROUNDCONTROL project
#ifndef HomePositionManager_H
#define HomePositionManager_H
#include "QGCSingleton.h"
#include "QmlObjectListModel.h"
#include "QGCToolbox.h"
#include <QGeoCoordinate>
class
HomePositionManager
;
class
HomePosition
:
public
QObject
{
Q_OBJECT
public:
HomePosition
(
const
QString
&
name
,
const
QGeoCoordinate
&
coordinate
,
QObject
*
parent
=
NULL
);
HomePosition
(
const
QString
&
name
,
const
QGeoCoordinate
&
coordinate
,
HomePositionManager
*
homePositionManager
,
QObject
*
parent
=
NULL
);
~
HomePosition
();
Q_PROPERTY
(
QString
name
READ
name
WRITE
setName
NOTIFY
nameChanged
)
...
...
@@ -47,22 +49,23 @@ public:
QGeoCoordinate
coordinate
(
void
);
void
setCoordinate
(
const
QGeoCoordinate
&
coordinate
);
signals:
void
nameChanged
(
const
QString
&
name
);
void
coordinateChanged
(
const
QGeoCoordinate
&
coordinate
);
private:
QGeoCoordinate
_coordinate
;
QGeoCoordinate
_coordinate
;