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 QQuickItem;
21class SettingsManager;
22class Vehicle;
23class VideoReceiver;
24class VideoSink;
25class FactValueGrid;
26typedef struct __mavlink_message mavlink_message_t;
27
38class QGCCorePlugin : public QObject
39{
40 Q_OBJECT
41 QML_UNCREATABLE("")
42 Q_MOC_INCLUDE("QGCOptions.h")
43 Q_MOC_INCLUDE("QmlObjectListModel.h")
44 Q_PROPERTY(bool showAdvancedUI READ showAdvancedUI WRITE _setShowAdvancedUI NOTIFY showAdvancedUIChanged)
45 Q_PROPERTY(bool showTouchAreas READ showTouchAreas WRITE _setShowTouchAreas NOTIFY showTouchAreasChanged)
48 Q_PROPERTY(int defaultSettings READ defaultSettings CONSTANT)
49 Q_PROPERTY(int initialSetupPromptId MEMBER kInitialSetupPromptId CONSTANT)
50 Q_PROPERTY(const QGCOptions *options READ options CONSTANT)
51 Q_PROPERTY(const QmlObjectListModel *customMapItems READ customMapItems CONSTANT)
52 Q_PROPERTY(const QmlObjectListModel* customGeoMapItems READ customGeoMapItems CONSTANT)
53 Q_PROPERTY(QString showAdvancedUIMessage READ showAdvancedUIMessage CONSTANT)
54 Q_PROPERTY(QString stableDownloadUrl READ stableDownloadUrl CONSTANT)
55 Q_PROPERTY(QVariantList analyzePages READ analyzePages CONSTANT)
56 Q_PROPERTY(QVariantList toolBarIndicators READ toolBarIndicators CONSTANT)
57
58public:
59 explicit QGCCorePlugin(QObject *parent = nullptr);
60 virtual ~QGCCorePlugin();
61
62 static QGCCorePlugin *instance();
63
64 virtual void init() { }
65 virtual void cleanup() { }
66
68 virtual void linkConfigurationsLoaded(LinkManager* linkManager) { Q_UNUSED(linkManager); }
69
72 virtual const QVariantList &analyzePages();
73
76 virtual int defaultSettings() { return 0; }
77
80 virtual QGCOptions *options();
81
85 virtual bool overrideSettingsGroupVisibility(const QString &name) { Q_UNUSED(name); return true; }
86
92 virtual void adjustSettingMetaData(const QString &settingsGroup, FactMetaData &metaData, bool &userVisible);
93
97 virtual void registerCustomSettings(SettingsManager *settingsManager) { Q_UNUSED(settingsManager); }
98
100 virtual QString showAdvancedUIMessage() const;
101
103 virtual bool showInitialSetupVehiclePreferences() const;
104
106 virtual bool showInitialSetupMeasurementUnits() const;
107
109 virtual QGeoPositionInfoSource *createPositionSource(QObject *parent) { Q_UNUSED(parent); return nullptr; }
110
112 virtual void paletteOverride(const QString &colorName, QGCPalette::PaletteColorInfo_t &colorInfo) { Q_UNUSED(colorName); Q_UNUSED(colorInfo); };
113
114 virtual void factValueGridCreateDefaultSettings(FactValueGrid* factValueGrid);
115
118 virtual QQmlApplicationEngine *createQmlApplicationEngine(QObject *parent);
119
123 virtual void destroyQmlApplicationEngine(QQmlApplicationEngine *qmlEngine);
124
126 virtual void createRootWindow(QQmlApplicationEngine *qmlEngine);
127
129 virtual VideoReceiver *createVideoReceiver(QObject *parent);
131 virtual void *createVideoSink(QQuickItem *widget, QObject *parent);
133 virtual void releaseVideoSink(void *sink);
134
137 virtual bool mavlinkMessage(Vehicle *vehicle, LinkInterface *link, const mavlink_message_t &message) { Q_UNUSED(vehicle); Q_UNUSED(link); Q_UNUSED(message); return true; }
138
140 virtual const QmlObjectListModel *customMapItems();
141
145 virtual const QmlObjectListModel* customGeoMapItems();
146
148 virtual void preSaveToJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
150 virtual void postSaveToJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
151
153 virtual void preSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
155 virtual void postSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
156
158 virtual void preLoadFromJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
160 virtual void postLoadFromJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
161
168#ifdef QGC_CUSTOM_BUILD
169 virtual QString stableVersionCheckFileUrl() const { return QString(); }
170#else
171 virtual QString stableVersionCheckFileUrl() const { return QStringLiteral("https://s3-us-west-2.amazonaws.com/qgroundcontrol/latest/QGC.version.txt"); }
172#endif
173
176 virtual QString stableDownloadUrl() const { return QStringLiteral("https://qgroundcontrol.com"); }
177
188 virtual QVariantList complexMissionItemNames(Vehicle *vehicle);
189
200 const QString &complexItemType,
201 PlanMasterController *masterController,
202 bool flyView,
203 const QString &kmlOrShpFile = QString());
204
209 virtual QList<PlanCreator*> planCreators(PlanMasterController *planMasterController);
210
214 virtual QList<int> firstRunPromptStdIds();
215
219 virtual QList<int> firstRunPromptCustomIds() { return QList<int>(); }
220
222 Q_INVOKABLE virtual QString firstRunPromptResource(int id) const;
223
226 virtual const QVariantList &toolBarIndicators();
227
229 virtual bool getOfflineCameraDefinitionFile(const QString &cameraName, QFile &file) { Q_UNUSED(cameraName); Q_UNUSED(file); return false; }
230
232 QString name;
233 bool canRepeat = false;
234 };
235 virtual QList<JoystickAction> joystickActions() { return {}; }
236
238 Q_INVOKABLE QVariantList firstRunPromptsToShow();
239
240 bool showTouchAreas() const { return _showTouchAreas; }
241 bool showAdvancedUI() const { return _showAdvancedUI; }
242
243 // Standard first run prompt ids
244 static constexpr int kInitialSetupPromptId = 3;
245
246 // Custom builds can start there first run prompt ids from here
247 static constexpr int kFirstRunPromptIdsFirstCustomId = 10000;
248
249signals:
252
253protected:
254 bool _showTouchAreas = false;
255 bool _showAdvancedUI = true;
256
257private:
258 void _setShowTouchAreas(bool show);
259 void _setShowAdvancedUI(bool show);
260
261 QGCOptions *_defaultOptions = nullptr;
262 QmlObjectListModel *_emptyCustomMapItems = nullptr;
263};
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:30
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 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 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 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.