QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SettingsManager.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QLoggingCategory>
4#include <QtCore/QObject>
5#include <QtQmlIntegration/QtQmlIntegration>
6#include <QtCore/QJsonObject>
7#include <QtCore/QMap>
8
11class AppSettings;
19class FlyViewSettings;
21class MapsSettings;
25class RTKSettings;
26class UnitsSettings;
27class NTRIPSettings;
28class VideoSettings;
30class MavlinkSettings;
31class FactMetaData;
33
34Q_DECLARE_LOGGING_CATEGORY(SettingsManagerLog)
35
36
37class SettingsManager : public QObject
38{
39 Q_OBJECT
40 QML_ELEMENT
41 QML_UNCREATABLE("")
42 Q_MOC_INCLUDE("ADSBVehicleManagerSettings.h")
43#ifndef QGC_NO_ARDUPILOT_DIALECT
44 Q_MOC_INCLUDE("APMMavlinkStreamRateSettings.h")
45#endif
46 Q_MOC_INCLUDE("AppSettings.h")
47 Q_MOC_INCLUDE("AutoConnectSettings.h")
48 Q_MOC_INCLUDE("BatteryIndicatorSettings.h")
49 Q_MOC_INCLUDE("BrandImageSettings.h")
50 Q_MOC_INCLUDE("MavlinkActionsSettings.h")
51 Q_MOC_INCLUDE("FirmwareUpgradeSettings.h")
52 Q_MOC_INCLUDE("FlightMapSettings.h")
53 Q_MOC_INCLUDE("FlightModeSettings.h")
54 Q_MOC_INCLUDE("FlyViewSettings.h")
55 Q_MOC_INCLUDE("GimbalControllerSettings.h")
56 Q_MOC_INCLUDE("MapsSettings.h")
57 Q_MOC_INCLUDE("OfflineMapsSettings.h")
58 Q_MOC_INCLUDE("PlanViewSettings.h")
59 Q_MOC_INCLUDE("RemoteIDSettings.h")
60 Q_MOC_INCLUDE("RTKSettings.h")
61 Q_MOC_INCLUDE("UnitsSettings.h")
62 Q_MOC_INCLUDE("NTRIPSettings.h")
63 Q_MOC_INCLUDE("VideoSettings.h")
64 Q_MOC_INCLUDE("MavlinkSettings.h")
65 Q_MOC_INCLUDE("JoystickManagerSettings.h")
66 Q_MOC_INCLUDE("Viewer3DSettings.h")
67 Q_PROPERTY(QObject *adsbVehicleManagerSettings READ adsbVehicleManagerSettings CONSTANT)
68#ifndef QGC_NO_ARDUPILOT_DIALECT
69 Q_PROPERTY(QObject *apmMavlinkStreamRateSettings READ apmMavlinkStreamRateSettings CONSTANT)
70#endif
71 Q_PROPERTY(QObject *appSettings READ appSettings CONSTANT)
72 Q_PROPERTY(QObject *autoConnectSettings READ autoConnectSettings CONSTANT)
73 Q_PROPERTY(QObject *batteryIndicatorSettings READ batteryIndicatorSettings CONSTANT)
74 Q_PROPERTY(QObject *brandImageSettings READ brandImageSettings CONSTANT)
75 Q_PROPERTY(QObject *mavlinkActionsSettings READ mavlinkActionsSettings CONSTANT)
76 Q_PROPERTY(QObject *firmwareUpgradeSettings READ firmwareUpgradeSettings CONSTANT)
77 Q_PROPERTY(QObject *flightMapSettings READ flightMapSettings CONSTANT)
78 Q_PROPERTY(QObject *flightModeSettings READ flightModeSettings CONSTANT)
79 Q_PROPERTY(QObject *flyViewSettings READ flyViewSettings CONSTANT)
80 Q_PROPERTY(QObject *gimbalControllerSettings READ gimbalControllerSettings CONSTANT)
81 Q_PROPERTY(QObject *mapsSettings READ mapsSettings CONSTANT)
82 Q_PROPERTY(QObject *offlineMapsSettings READ offlineMapsSettings CONSTANT)
83 Q_PROPERTY(QObject *planViewSettings READ planViewSettings CONSTANT)
84 Q_PROPERTY(QObject *remoteIDSettings READ remoteIDSettings CONSTANT)
85 Q_PROPERTY(QObject *rtkSettings READ rtkSettings CONSTANT)
86 Q_PROPERTY(QObject *unitsSettings READ unitsSettings CONSTANT)
87 Q_PROPERTY(QObject *ntripSettings READ ntripSettings CONSTANT)
88 Q_PROPERTY(QObject *videoSettings READ videoSettings CONSTANT)
89 Q_PROPERTY(QObject *mavlinkSettings READ mavlinkSettings CONSTANT)
90 Q_PROPERTY(QObject *joystickManagerSettings READ joystickManagerSettings CONSTANT)
91 Q_PROPERTY(QObject *viewer3DSettings READ viewer3DSettings CONSTANT)
92public:
93 SettingsManager(QObject *parent = nullptr);
95
96 static SettingsManager *instance();
97 static void registerQmlTypes();
98
99 void init();
100
105 static void adjustSettingMetaData(const QString &settingsGroup, FactMetaData &metaData, bool &visible);
106
107 ADSBVehicleManagerSettings *adsbVehicleManagerSettings() const;
108#ifndef QGC_NO_ARDUPILOT_DIALECT
109 APMMavlinkStreamRateSettings *apmMavlinkStreamRateSettings() const;
110#endif
111 AppSettings *appSettings() const;
112 AutoConnectSettings *autoConnectSettings() const;
113 BatteryIndicatorSettings *batteryIndicatorSettings() const;
114 BrandImageSettings *brandImageSettings() const;
115 MavlinkActionsSettings *mavlinkActionsSettings() const;
116 FirmwareUpgradeSettings *firmwareUpgradeSettings() const;
117 FlightMapSettings *flightMapSettings() const;
118 FlightModeSettings *flightModeSettings() const;
119 FlyViewSettings *flyViewSettings() const;
120 GimbalControllerSettings *gimbalControllerSettings() const;
121 MapsSettings *mapsSettings() const;
122 OfflineMapsSettings *offlineMapsSettings() const;
123 PlanViewSettings *planViewSettings() const;
124 RemoteIDSettings *remoteIDSettings() const;
125 RTKSettings *rtkSettings() const;
126 UnitsSettings *unitsSettings() const;
127 NTRIPSettings *ntripSettings() const;
128 VideoSettings *videoSettings() const;
129 MavlinkSettings *mavlinkSettings() const;
130 JoystickManagerSettings *joystickManagerSettings() const;
131 Viewer3DSettings *viewer3DSettings() const;
132
133private:
134 void _loadSettingsFiles();
135
136 ADSBVehicleManagerSettings *_adsbVehicleManagerSettings = nullptr;
137#ifndef QGC_NO_ARDUPILOT_DIALECT
138 APMMavlinkStreamRateSettings *_apmMavlinkStreamRateSettings = nullptr;
139#endif
140 AppSettings *_appSettings = nullptr;
141 AutoConnectSettings *_autoConnectSettings = nullptr;
142 BatteryIndicatorSettings *_batteryIndicatorSettings = nullptr;
143 BrandImageSettings *_brandImageSettings = nullptr;
144 MavlinkActionsSettings *_mavlinkActionsSettings = nullptr;
145 FirmwareUpgradeSettings *_firmwareUpgradeSettings = nullptr;
146 FlightMapSettings *_flightMapSettings = nullptr;
147 FlightModeSettings *_flightModeSettings = nullptr;
148 FlyViewSettings *_flyViewSettings = nullptr;
149 GimbalControllerSettings *_gimbalControllerSettings = nullptr;
150 MapsSettings *_mapsSettings = nullptr;
151 OfflineMapsSettings *_offlineMapsSettings = nullptr;
152 PlanViewSettings *_planViewSettings = nullptr;
153 RemoteIDSettings *_remoteIDSettings = nullptr;
154 RTKSettings *_rtkSettings = nullptr;
155 UnitsSettings *_unitsSettings = nullptr;
156 NTRIPSettings *_ntripSettings = nullptr;
157 VideoSettings *_videoSettings = nullptr;
158 MavlinkSettings *_mavlinkSettings = nullptr;
159 JoystickManagerSettings *_joystickManagerSettings = nullptr;
160 Viewer3DSettings *_viewer3DSettings = nullptr;
161
162 QMap<QString, QMap<QString, QJsonObject>> _settingsFileOverrides; // groupName:settingName:metaDataObject
163
164 static constexpr int kSettingsFileVersion = 1;
165 static constexpr const char* kSettingsFileType = "Settings";
166 static constexpr const char* kJsonGroupsObjectKey = "groups";
167 static constexpr const char* kJsonVisibleKey = "visible";
168 static constexpr const char* kJsonForceRawValueKey = "forceRawValue";
169};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
Application Settings.
Definition AppSettings.h:9
Simple branding. Allows to define icon to use on main toolbar.
static const char * settingsGroup
Application Settings.
bool visible READ visible WRITE setVisible NOTIFY virtual visibleChanged bool visible()
Provides access to all app settings.