QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCCorePlugin.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QObject>
4#include <QtCore/QVariantList>
5#include <QtQmlIntegration/QtQmlIntegration>
6
7#include "QGCPalette.h"
8
10class FactMetaData;
11class LinkInterface;
12class LinkManager;
13class PlanCreator;
15class QFile;
16class QGCOptions;
17class QGeoPositionInfoSource;
19class QQmlApplicationEngine;
20class SettingsManager;
21class Vehicle;
22class VideoReceiver;
23class FactValueGrid;
24typedef struct __mavlink_message mavlink_message_t;
25
36class QGCCorePlugin : public QObject
37{
38 Q_OBJECT
39 QML_UNCREATABLE("")
40 Q_MOC_INCLUDE("QGCOptions.h")
41 Q_MOC_INCLUDE("QmlObjectListModel.h")
42 Q_PROPERTY(bool showAdvancedUI READ showAdvancedUI WRITE _setShowAdvancedUI NOTIFY showAdvancedUIChanged)
43 Q_PROPERTY(bool showTouchAreas READ showTouchAreas WRITE _setShowTouchAreas NOTIFY showTouchAreasChanged)
46 Q_PROPERTY(int defaultSettings READ defaultSettings CONSTANT)
47 Q_PROPERTY(int initialSetupPromptId MEMBER kInitialSetupPromptId CONSTANT)
48 Q_PROPERTY(const QGCOptions *options READ options CONSTANT)
49 Q_PROPERTY(const QmlObjectListModel *customMapItems READ customMapItems CONSTANT)
50 Q_PROPERTY(const QmlObjectListModel* customGeoMapItems READ customGeoMapItems CONSTANT)
51 Q_PROPERTY(QString showAdvancedUIMessage READ showAdvancedUIMessage CONSTANT)
52 Q_PROPERTY(QString stableDownloadUrl READ stableDownloadUrl CONSTANT)
53 Q_PROPERTY(QVariantList analyzePages READ analyzePages CONSTANT)
54 Q_PROPERTY(QVariantList toolBarIndicators READ toolBarIndicators CONSTANT)
55
56public:
57 explicit QGCCorePlugin(QObject *parent = nullptr);
58 virtual ~QGCCorePlugin();
59
60 static QGCCorePlugin *instance();
61
62 virtual void init() { }
63 virtual void cleanup() { }
64
66 virtual void linkConfigurationsLoaded(LinkManager* linkManager) { Q_UNUSED(linkManager); }
67
70 virtual const QVariantList &analyzePages();
71
74 virtual int defaultSettings() { return 0; }
75
78 virtual QGCOptions *options();
79
83 virtual bool overrideSettingsGroupVisibility(const QString &name) { Q_UNUSED(name); return true; }
84
90 virtual void adjustSettingMetaData(const QString &settingsGroup, FactMetaData &metaData, bool &userVisible);
91
95 virtual void registerCustomSettings(SettingsManager *settingsManager) { Q_UNUSED(settingsManager); }
96
98 virtual QString showAdvancedUIMessage() const;
99
101 virtual bool showInitialSetupVehiclePreferences() const;
102
104 virtual bool showInitialSetupMeasurementUnits() const;
105
107 virtual QGeoPositionInfoSource *createPositionSource(QObject *parent) { Q_UNUSED(parent); return nullptr; }
108
110 virtual void paletteOverride(const QString &colorName, QGCPalette::PaletteColorInfo_t &colorInfo) { Q_UNUSED(colorName); Q_UNUSED(colorInfo); };
111
112 virtual void factValueGridCreateDefaultSettings(FactValueGrid* factValueGrid);
113
116 virtual QQmlApplicationEngine *createQmlApplicationEngine(QObject *parent);
117
121 virtual void destroyQmlApplicationEngine(QQmlApplicationEngine *qmlEngine);
122
124 virtual void createRootWindow(QQmlApplicationEngine *qmlEngine);
125
127 virtual VideoReceiver *createVideoReceiver(QObject *parent);
128
131 virtual bool mavlinkMessage(Vehicle *vehicle, LinkInterface *link, const mavlink_message_t &message) { Q_UNUSED(vehicle); Q_UNUSED(link); Q_UNUSED(message); return true; }
132
134 virtual const QmlObjectListModel *customMapItems();
135
139 virtual const QmlObjectListModel* customGeoMapItems();
140
142 virtual void preSaveToJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
144 virtual void postSaveToJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
145
147 virtual void preSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
149 virtual void postSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
150
152 virtual void preLoadFromJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
154 virtual void postLoadFromJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
155
162#ifdef QGC_CUSTOM_BUILD
163 virtual QString stableVersionCheckFileUrl() const { return QString(); }
164#else
165 virtual QString stableVersionCheckFileUrl() const { return QStringLiteral("https://s3-us-west-2.amazonaws.com/qgroundcontrol/latest/QGC.version.txt"); }
166#endif
167
170 virtual QString stableDownloadUrl() const { return QStringLiteral("https://qgroundcontrol.com"); }
171
182 virtual QVariantList complexMissionItemNames(Vehicle *vehicle);
183
194 const QString &complexItemType,
195 PlanMasterController *masterController,
196 bool flyView,
197 const QString &kmlOrShpFile = QString());
198
203 virtual QList<PlanCreator*> planCreators(PlanMasterController *planMasterController);
204
208 virtual QList<int> firstRunPromptStdIds();
209
213 virtual QList<int> firstRunPromptCustomIds() { return QList<int>(); }
214
216 Q_INVOKABLE virtual QString firstRunPromptResource(int id) const;
217
220 virtual const QVariantList &toolBarIndicators();
221
223 virtual bool getOfflineCameraDefinitionFile(const QString &cameraName, QFile &file) { Q_UNUSED(cameraName); Q_UNUSED(file); return false; }
224
226 QString name;
227 bool canRepeat = false;
228 };
229 virtual QList<JoystickAction> joystickActions() { return {}; }
230
232 Q_INVOKABLE QVariantList firstRunPromptsToShow();
233
234 bool showTouchAreas() const { return _showTouchAreas; }
235 bool showAdvancedUI() const { return _showAdvancedUI; }
236
237 // Standard first run prompt ids
238 static constexpr int kInitialSetupPromptId = 3;
239
240 // Custom builds can start there first run prompt ids from here
241 static constexpr int kFirstRunPromptIdsFirstCustomId = 10000;
242
243signals:
246
247protected:
248 bool _showTouchAreas = false;
249 bool _showAdvancedUI = true;
250
251private:
252 void _setShowTouchAreas(bool show);
253 void _setShowAdvancedUI(bool show);
254
255 QGCOptions *_defaultOptions = nullptr;
256 QmlObjectListModel *_emptyCustomMapItems = nullptr;
257};
struct __mavlink_message mavlink_message_t
Holds the meta data associated with a Fact.
The link interface defines the interface for all links used to communicate with the ground station ap...
Manage communication links The Link Manager organizes the physical Links. It can manage arbitrary lin...
Definition LinkManager.h:31
Base class for PlanCreator objects which are used to create a full plan in a single step.
Definition PlanCreator.h:16
Master controller for mission, fence, rally.
virtual bool getOfflineCameraDefinitionFile(const QString &cameraName, QFile &file)
Returns a true if xml definition file of a providen camera name exists, and loads it to file argument...
virtual void postSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson)
Allows custom builds to add custom items to the mission section of the plan file after the item is cr...
virtual ComplexMissionItem * createComplexMissionItem(const QString &complexItemType, PlanMasterController *masterController, bool flyView, const QString &kmlOrShpFile=QString())
virtual QList< int > firstRunPromptStdIds()
virtual int defaultSettings()
QGCCorePlugin(QObject *parent=nullptr)
virtual void preLoadFromJson(PlanMasterController *pController, QJsonObject &json)
Allows custom builds to load custom items from the plan file before the document is parsed.
virtual bool mavlinkMessage(Vehicle *vehicle, LinkInterface *link, const mavlink_message_t &message)
virtual QVariantList complexMissionItemNames(Vehicle *vehicle)
void showTouchAreasChanged(bool showTouchAreas)
virtual ~QGCCorePlugin()
virtual void paletteOverride(const QString &colorName, QGCPalette::PaletteColorInfo_t &colorInfo)
Allows a plugin to override the specified color name from the palette.
virtual void preSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson)
Allows custom builds to add custom items to the mission section of the plan file before the item is c...
virtual void linkConfigurationsLoaded(LinkManager *linkManager)
Called at boot after saved link configurations are loaded and before auto-connect links are started.
virtual bool overrideSettingsGroupVisibility(const QString &name)
virtual void factValueGridCreateDefaultSettings(FactValueGrid *factValueGrid)
void showAdvancedUIChanged(bool showAdvancedUI)
virtual const QVariantList & toolBarIndicators()
virtual QList< int > firstRunPromptCustomIds()
virtual Q_INVOKABLE QString firstRunPromptResource(int id) const
Returns the resource which contains the specified first run prompt for display.
static constexpr int kInitialSetupPromptId
bool showAdvancedUI() const
virtual QGCOptions * options()
virtual QQmlApplicationEngine * createQmlApplicationEngine(QObject *parent)
virtual QGeoPositionInfoSource * createPositionSource(QObject *parent)
virtual bool showInitialSetupMeasurementUnits() const
virtual const QVariantList & analyzePages()
virtual QList< JoystickAction > joystickActions()
static constexpr int kFirstRunPromptIdsFirstCustomId
bool showTouchAreas() const
virtual bool showInitialSetupVehiclePreferences() const
virtual QString stableDownloadUrl() const
virtual QString showAdvancedUIMessage() const
virtual void preSaveToJson(PlanMasterController *pController, QJsonObject &json)
Allows custom builds to add custom items to the plan file before the document is created.
virtual void createRootWindow(QQmlApplicationEngine *qmlEngine)
Allows the plugin to override the creation of the root (native) window.
virtual void postSaveToJson(PlanMasterController *pController, QJsonObject &json)
Allows custom builds to add custom items to the plan file after the document is created.
virtual VideoReceiver * createVideoReceiver(QObject *parent)
Allows the plugin to override the creation of VideoReceiver.
virtual QString stableVersionCheckFileUrl() const
virtual const QmlObjectListModel * customGeoMapItems()
virtual void init()
Q_INVOKABLE QVariantList firstRunPromptsToShow()
Returns the list of first run prompt ids which need to be displayed according to current settings.
virtual const QmlObjectListModel * customMapItems()
Allows custom builds to add custom items to the FlightMap. Objects put into QmlObjectListModel should...
virtual QList< PlanCreator * > planCreators(PlanMasterController *planMasterController)
virtual void cleanup()
virtual void registerCustomSettings(SettingsManager *settingsManager)
virtual void adjustSettingMetaData(const QString &settingsGroup, FactMetaData &metaData, bool &userVisible)
virtual void destroyQmlApplicationEngine(QQmlApplicationEngine *qmlEngine)
static QGCCorePlugin * instance()
virtual void postLoadFromJson(PlanMasterController *pController, QJsonObject &json)
Allows custom builds to load custom items from the plan file after the document is parsed.
QColor PaletteColorInfo_t[cMaxTheme][cMaxColorGroup]
Definition QGCPalette.h:101
Provides access to all app settings.