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
103 virtual void destroyQmlApplicationEngine(QQmlApplicationEngine *qmlEngine);
104
106 virtual void createRootWindow(QQmlApplicationEngine *qmlEngine);
107
109 virtual VideoReceiver *createVideoReceiver(QObject *parent);
111 virtual void *createVideoSink(QQuickItem *widget, QObject *parent);
113 virtual void releaseVideoSink(void *sink);
114
117 virtual bool mavlinkMessage(Vehicle *vehicle, LinkInterface *link, const mavlink_message_t &message) { Q_UNUSED(vehicle); Q_UNUSED(link); Q_UNUSED(message); return true; }
118
120 virtual const QmlObjectListModel *customMapItems();
121
123 virtual void preSaveToJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
125 virtual void postSaveToJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
126
128 virtual void preSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
130 virtual void postSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
131
133 virtual void preLoadFromJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
135 virtual void postLoadFromJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
136
143#ifdef QGC_CUSTOM_BUILD
144 virtual QString stableVersionCheckFileUrl() const { return QString(); }
145#else
146 virtual QString stableVersionCheckFileUrl() const { return QStringLiteral("https://s3-us-west-2.amazonaws.com/qgroundcontrol/latest/QGC.version.txt"); }
147#endif
148
151 virtual QString stableDownloadLocation() const { return QStringLiteral("qgroundcontrol.com"); }
152
163 virtual QVariantList complexMissionItemNames(Vehicle *vehicle);
164
175 const QString &complexItemType,
176 PlanMasterController *masterController,
177 bool flyView,
178 const QString &kmlOrShpFile = QString());
179
184 virtual QList<PlanCreator*> planCreators(PlanMasterController *planMasterController);
185
189 virtual QList<int> firstRunPromptStdIds() { return QList<int>({ kInitialSetupPromptId }); }
190
194 virtual QList<int> firstRunPromptCustomIds() { return QList<int>(); }
195
197 Q_INVOKABLE virtual QString firstRunPromptResource(int id) const;
198
201 virtual const QVariantList &toolBarIndicators();
202
204 virtual bool getOfflineCameraDefinitionFile(const QString &cameraName, QFile &file) { Q_UNUSED(cameraName); Q_UNUSED(file); return false; }
205
207 QString name;
208 bool canRepeat = false;
209 };
210 virtual QList<JoystickAction> joystickActions() { return {}; }
211
213 Q_INVOKABLE QVariantList firstRunPromptsToShow();
214
215 bool showTouchAreas() const { return _showTouchAreas; }
216 bool showAdvancedUI() const { return _showAdvancedUI; }
217
218 // Standard first run prompt ids
219 static constexpr int kInitialSetupPromptId = 3;
220
221 // Custom builds can start there first run prompt ids from here
222 static constexpr int kFirstRunPromptIdsFirstCustomId = 10000;
223
224signals:
227
228protected:
229 bool _showTouchAreas = false;
230 bool _showAdvancedUI = true;
231
232private:
233 void _setShowTouchAreas(bool show);
234 void _setShowAdvancedUI(bool show);
235
236 QGCOptions *_defaultOptions = nullptr;
237 QmlObjectListModel *_emptyCustomMapItems = nullptr;
238};
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)
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