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 Vehicle;
21class VideoReceiver;
22class VideoSink;
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)
44 Q_PROPERTY(int defaultSettings READ defaultSettings CONSTANT)
45 Q_PROPERTY(int initialSetupPromptId MEMBER kInitialSetupPromptId CONSTANT)
46 Q_PROPERTY(const QGCOptions *options READ options CONSTANT)
47 Q_PROPERTY(const QmlObjectListModel *customMapItems READ customMapItems CONSTANT)
48 Q_PROPERTY(QString showAdvancedUIMessage READ showAdvancedUIMessage CONSTANT)
49 Q_PROPERTY(QVariantList analyzePages READ analyzePages CONSTANT)
50 Q_PROPERTY(QVariantList toolBarIndicators READ toolBarIndicators CONSTANT)
51
52public:
53 explicit QGCCorePlugin(QObject *parent = nullptr);
54 virtual ~QGCCorePlugin();
55
56 static QGCCorePlugin *instance();
57
58 virtual void init() { }
59 virtual void cleanup() { }
60
63 virtual const QVariantList &analyzePages();
64
67 virtual int defaultSettings() { return 0; }
68
71 virtual QGCOptions *options();
72
76 virtual bool overrideSettingsGroupVisibility(const QString &name) { Q_UNUSED(name); return true; }
77
83 virtual void adjustSettingMetaData(const QString &settingsGroup, FactMetaData &metaData, bool &userVisible);
84
86 virtual QString showAdvancedUIMessage() const;
87
89 virtual QGeoPositionInfoSource *createPositionSource(QObject *parent) { Q_UNUSED(parent); return nullptr; }
90
92 virtual void paletteOverride(const QString &colorName, QGCPalette::PaletteColorInfo_t &colorInfo) { Q_UNUSED(colorName); Q_UNUSED(colorInfo); };
93
94 virtual void factValueGridCreateDefaultSettings(FactValueGrid* factValueGrid);
95
98 virtual QQmlApplicationEngine *createQmlApplicationEngine(QObject *parent);
99
101 virtual void createRootWindow(QQmlApplicationEngine *qmlEngine);
102
104 virtual VideoReceiver *createVideoReceiver(QObject *parent);
106 virtual void *createVideoSink(QQuickItem *widget, QObject *parent);
108 virtual void releaseVideoSink(void *sink);
109
112 virtual bool mavlinkMessage(Vehicle *vehicle, LinkInterface *link, const mavlink_message_t &message) { Q_UNUSED(vehicle); Q_UNUSED(link); Q_UNUSED(message); return true; }
113
115 virtual const QmlObjectListModel *customMapItems();
116
118 virtual void preSaveToJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
120 virtual void postSaveToJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
121
123 virtual void preSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
125 virtual void postSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
126
128 virtual void preLoadFromJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
130 virtual void postLoadFromJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
131
138#ifdef QGC_CUSTOM_BUILD
139 virtual QString stableVersionCheckFileUrl() const { return QString(); }
140#else
141 virtual QString stableVersionCheckFileUrl() const { return QStringLiteral("https://s3-us-west-2.amazonaws.com/qgroundcontrol/latest/QGC.version.txt"); }
142#endif
143
146 virtual QString stableDownloadLocation() const { return QStringLiteral("qgroundcontrol.com"); }
147
158 virtual QVariantList complexMissionItemNames(Vehicle *vehicle);
159
170 const QString &complexItemType,
171 PlanMasterController *masterController,
172 bool flyView,
173 const QString &kmlOrShpFile = QString());
174
179 virtual QList<PlanCreator*> planCreators(PlanMasterController *planMasterController);
180
184 virtual QList<int> firstRunPromptStdIds() { return QList<int>({ kInitialSetupPromptId }); }
185
189 virtual QList<int> firstRunPromptCustomIds() { return QList<int>(); }
190
192 Q_INVOKABLE virtual QString firstRunPromptResource(int id) const;
193
196 virtual const QVariantList &toolBarIndicators();
197
199 virtual bool getOfflineCameraDefinitionFile(const QString &cameraName, QFile &file) { Q_UNUSED(cameraName); Q_UNUSED(file); return false; }
200
202 QString name;
203 bool canRepeat = false;
204 };
205 virtual QList<JoystickAction> joystickActions() { return {}; }
206
208 Q_INVOKABLE QVariantList firstRunPromptsToShow();
209
210 bool showTouchAreas() const { return _showTouchAreas; }
211 bool showAdvancedUI() const { return _showAdvancedUI; }
212
213 // Standard first run prompt ids
214 static constexpr int kInitialSetupPromptId = 3;
215
216 // Custom builds can start there first run prompt ids from here
217 static constexpr int kFirstRunPromptIdsFirstCustomId = 10000;
218
219signals:
222
223protected:
224 bool _showTouchAreas = false;
225 bool _showAdvancedUI = true;
226
227private:
228 void _setShowTouchAreas(bool show);
229 void _setShowAdvancedUI(bool show);
230
231 QGCOptions *_defaultOptions = nullptr;
232 QmlObjectListModel *_emptyCustomMapItems = nullptr;
233};
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 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 QList< int > firstRunPromptStdIds()
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 const QVariantList & analyzePages()
virtual QList< JoystickAction > joystickActions()
static constexpr int kFirstRunPromptIdsFirstCustomId
bool showTouchAreas() 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 adjustSettingMetaData(const QString &settingsGroup, FactMetaData &metaData, bool &userVisible)
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