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 PlanCreator;
14class QFile;
15class QGCOptions;
16class QGeoPositionInfoSource;
18class QQmlApplicationEngine;
19class QQuickItem;
20class SettingsManager;
21class Vehicle;
22class VideoReceiver;
23class VideoSink;
24class FactValueGrid;
25typedef struct __mavlink_message mavlink_message_t;
26
37class QGCCorePlugin : public QObject
38{
39 Q_OBJECT
40 QML_UNCREATABLE("")
41 Q_MOC_INCLUDE("QGCOptions.h")
42 Q_MOC_INCLUDE("QmlObjectListModel.h")
43 Q_PROPERTY(bool showAdvancedUI READ showAdvancedUI WRITE _setShowAdvancedUI NOTIFY showAdvancedUIChanged)
44 Q_PROPERTY(bool showTouchAreas READ showTouchAreas WRITE _setShowTouchAreas NOTIFY showTouchAreasChanged)
47 Q_PROPERTY(int defaultSettings READ defaultSettings CONSTANT)
48 Q_PROPERTY(int initialSetupPromptId MEMBER kInitialSetupPromptId CONSTANT)
49 Q_PROPERTY(const QGCOptions *options READ options CONSTANT)
50 Q_PROPERTY(const QmlObjectListModel *customMapItems READ customMapItems CONSTANT)
51 Q_PROPERTY(QString showAdvancedUIMessage READ showAdvancedUIMessage CONSTANT)
52 Q_PROPERTY(QVariantList analyzePages READ analyzePages CONSTANT)
53 Q_PROPERTY(QVariantList toolBarIndicators READ toolBarIndicators CONSTANT)
54
55public:
56 explicit QGCCorePlugin(QObject *parent = nullptr);
57 virtual ~QGCCorePlugin();
58
59 static QGCCorePlugin *instance();
60
61 virtual void init() { }
62 virtual void cleanup() { }
63
66 virtual const QVariantList &analyzePages();
67
70 virtual int defaultSettings() { return 0; }
71
74 virtual QGCOptions *options();
75
79 virtual bool overrideSettingsGroupVisibility(const QString &name) { Q_UNUSED(name); return true; }
80
86 virtual void adjustSettingMetaData(const QString &settingsGroup, FactMetaData &metaData, bool &userVisible);
87
91 virtual void registerCustomSettings(SettingsManager *settingsManager) { Q_UNUSED(settingsManager); }
92
94 virtual QString showAdvancedUIMessage() const;
95
97 virtual bool showInitialSetupVehiclePreferences() const;
98
100 virtual bool showInitialSetupMeasurementUnits() const;
101
103 virtual QGeoPositionInfoSource *createPositionSource(QObject *parent) { Q_UNUSED(parent); return nullptr; }
104
106 virtual void paletteOverride(const QString &colorName, QGCPalette::PaletteColorInfo_t &colorInfo) { Q_UNUSED(colorName); Q_UNUSED(colorInfo); };
107
108 virtual void factValueGridCreateDefaultSettings(FactValueGrid* factValueGrid);
109
112 virtual QQmlApplicationEngine *createQmlApplicationEngine(QObject *parent);
113
117 virtual void destroyQmlApplicationEngine(QQmlApplicationEngine *qmlEngine);
118
120 virtual void createRootWindow(QQmlApplicationEngine *qmlEngine);
121
123 virtual VideoReceiver *createVideoReceiver(QObject *parent);
125 virtual void *createVideoSink(QQuickItem *widget, QObject *parent);
127 virtual void releaseVideoSink(void *sink);
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
137 virtual void preSaveToJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
139 virtual void postSaveToJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
140
142 virtual void preSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
144 virtual void postSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
145
147 virtual void preLoadFromJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
149 virtual void postLoadFromJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
150
157#ifdef QGC_CUSTOM_BUILD
158 virtual QString stableVersionCheckFileUrl() const { return QString(); }
159#else
160 virtual QString stableVersionCheckFileUrl() const { return QStringLiteral("https://s3-us-west-2.amazonaws.com/qgroundcontrol/latest/QGC.version.txt"); }
161#endif
162
165 virtual QString stableDownloadLocation() const { return QStringLiteral("qgroundcontrol.com"); }
166
177 virtual QVariantList complexMissionItemNames(Vehicle *vehicle);
178
189 const QString &complexItemType,
190 PlanMasterController *masterController,
191 bool flyView,
192 const QString &kmlOrShpFile = QString());
193
198 virtual QList<PlanCreator*> planCreators(PlanMasterController *planMasterController);
199
203 virtual QList<int> firstRunPromptStdIds();
204
208 virtual QList<int> firstRunPromptCustomIds() { return QList<int>(); }
209
211 Q_INVOKABLE virtual QString firstRunPromptResource(int id) const;
212
215 virtual const QVariantList &toolBarIndicators();
216
218 virtual bool getOfflineCameraDefinitionFile(const QString &cameraName, QFile &file) { Q_UNUSED(cameraName); Q_UNUSED(file); return false; }
219
221 QString name;
222 bool canRepeat = false;
223 };
224 virtual QList<JoystickAction> joystickActions() { return {}; }
225
227 Q_INVOKABLE QVariantList firstRunPromptsToShow();
228
229 bool showTouchAreas() const { return _showTouchAreas; }
230 bool showAdvancedUI() const { return _showAdvancedUI; }
231
232 // Standard first run prompt ids
233 static constexpr int kInitialSetupPromptId = 3;
234
235 // Custom builds can start there first run prompt ids from here
236 static constexpr int kFirstRunPromptIdsFirstCustomId = 10000;
237
238signals:
241
242protected:
243 bool _showTouchAreas = false;
244 bool _showAdvancedUI = true;
245
246private:
247 void _setShowTouchAreas(bool show);
248 void _setShowAdvancedUI(bool show);
249
250 QGCOptions *_defaultOptions = nullptr;
251 QmlObjectListModel *_emptyCustomMapItems = nullptr;
252};
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...
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.
Extension mechanism for generic, non-firmware-specific customization of QGC.
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()
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 * createVideoSink(QQuickItem *widget, QObject *parent)
Allows the plugin to override the creation of VideoSink.
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 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 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 void releaseVideoSink(void *sink)
Allows the plugin to override the release of VideoSink.
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 QString stableDownloadLocation() const
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.