QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCCorePlugin Class Reference

Extension mechanism for generic, non-firmware-specific customization of QGC. More...

#include <QGCCorePlugin.h>

+ Inheritance diagram for QGCCorePlugin:
+ Collaboration diagram for QGCCorePlugin:

Classes

struct  JoystickAction
 

Signals

void showTouchAreasChanged (bool showTouchAreas)
 
void showAdvancedUIChanged (bool showAdvancedUI)
 

Public Member Functions

 QGCCorePlugin (QObject *parent=nullptr)
 
virtual ~QGCCorePlugin ()
 
virtual void init ()
 
virtual void cleanup ()
 
virtual const QVariantList & analyzePages ()
 
virtual int defaultSettings ()
 
virtual QGCOptionsoptions ()
 
virtual bool overrideSettingsGroupVisibility (const QString &name)
 
virtual void adjustSettingMetaData (const QString &settingsGroup, FactMetaData &metaData, bool &userVisible)
 
virtual QString showAdvancedUIMessage () const
 
virtual QGeoPositionInfoSource * createPositionSource (QObject *parent)
 
virtual void paletteOverride (const QString &colorName, QGCPalette::PaletteColorInfo_t &colorInfo)
 Allows a plugin to override the specified color name from the palette.
 
virtual void factValueGridCreateDefaultSettings (FactValueGrid *factValueGrid)
 
virtual QQmlApplicationEngine * createQmlApplicationEngine (QObject *parent)
 
virtual void createRootWindow (QQmlApplicationEngine *qmlEngine)
 Allows the plugin to override the creation of the root (native) window.
 
virtual VideoReceivercreateVideoReceiver (QObject *parent)
 Allows the plugin to override the creation of VideoReceiver.
 
virtual void * createVideoSink (QQuickItem *widget, QObject *parent)
 Allows the plugin to override the creation of VideoSink.
 
virtual void releaseVideoSink (void *sink)
 Allows the plugin to override the release of VideoSink.
 
virtual bool mavlinkMessage (Vehicle *vehicle, LinkInterface *link, const mavlink_message_t &message)
 
virtual const QmlObjectListModelcustomMapItems ()
 Allows custom builds to add custom items to the FlightMap. Objects put into QmlObjectListModel should derive from QmlComponentInfo and set the url property.
 
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 postSaveToJson (PlanMasterController *pController, QJsonObject &json)
 Allows custom builds to add custom items to the plan file after the document is created.
 
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 created.
 
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 created.
 
virtual void preLoadFromJson (PlanMasterController *pController, QJsonObject &json)
 Allows custom builds to load custom items from the plan file before the document is parsed.
 
virtual void postLoadFromJson (PlanMasterController *pController, QJsonObject &json)
 Allows custom builds to load custom items from the plan file after the document is parsed.
 
virtual QString stableVersionCheckFileUrl () const
 
virtual QString stableDownloadLocation () const
 
virtual QVariantList complexMissionItemNames (Vehicle *vehicle)
 
virtual ComplexMissionItemcreateComplexMissionItem (const QString &complexItemType, PlanMasterController *masterController, bool flyView, const QString &kmlOrShpFile=QString())
 
virtual QList< PlanCreator * > planCreators (PlanMasterController *planMasterController)
 
virtual QList< int > firstRunPromptStdIds ()
 
virtual QList< int > firstRunPromptCustomIds ()
 
virtual Q_INVOKABLE QString firstRunPromptResource (int id) const
 Returns the resource which contains the specified first run prompt for display.
 
virtual const QVariantList & toolBarIndicators ()
 
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, to allow definition files to be loaded from resources.
 
virtual QList< JoystickActionjoystickActions ()
 
Q_INVOKABLE QVariantList firstRunPromptsToShow ()
 Returns the list of first run prompt ids which need to be displayed according to current settings.
 
bool showTouchAreas () const
 
bool showAdvancedUI () const
 

Static Public Member Functions

static QGCCorePlugininstance ()
 

Static Public Attributes

static constexpr int kInitialSetupPromptId = 3
 
static constexpr int kFirstRunPromptIdsFirstCustomId = 10000
 

Protected Attributes

bool _showTouchAreas = false
 
bool _showAdvancedUI = true
 

Detailed Description

Extension mechanism for generic, non-firmware-specific customization of QGC.

QGCCorePlugin is the extension point for custom builds that need to modify QGC as a whole, rather than for behavior that varies by firmware type (which belongs in FirmwarePlugin). Override its virtual methods to add or replace UI pages, Flight Map items, toolbar indicators, video pipeline components, plan file hooks, and other application-level behavior. The base class provides the standard QGC implementation; custom builds subclass it and register the subclass before QGCApplication starts up.

Definition at line 36 of file QGCCorePlugin.h.

Constructor & Destructor Documentation

◆ QGCCorePlugin()

QGCCorePlugin::QGCCorePlugin ( QObject *  parent = nullptr)
explicit

Definition at line 51 of file QGCCorePlugin.cc.

◆ ~QGCCorePlugin()

QGCCorePlugin::~QGCCorePlugin ( )
virtual

Definition at line 59 of file QGCCorePlugin.cc.

Member Function Documentation

◆ adjustSettingMetaData()

void QGCCorePlugin::adjustSettingMetaData ( const QString &  settingsGroup,
FactMetaData metaData,
bool &  userVisible 
)
virtual

Allows the core plugin to override the meta data before the fact is created.

Parameters
settingsGroup- QSettings group which contains this item
metaData- MetaData for setting fact
userVisible- true: Setting should be visible in ui, false: Setting should not be shown in ui (default value will be used as value) If not overridden, metaData and userVisible are left unchanged.

Definition at line 124 of file QGCCorePlugin.cc.

References FactMetaData::name(), FactMetaData::setRawDefaultValue(), and SettingsGroup::settingsGroup().

Referenced by SettingsManager::adjustSettingMetaData().

◆ analyzePages()

const QVariantList & QGCCorePlugin::analyzePages ( )
virtual

The list of pages/buttons under the Analyze Menu

Returns
A list of QmlPageInfo

Definition at line 73 of file QGCCorePlugin.cc.

◆ cleanup()

virtual void QGCCorePlugin::cleanup ( )
inlinevirtual

Definition at line 59 of file QGCCorePlugin.h.

Referenced by QGCApplication::shutdown().

◆ complexMissionItemNames()

QVariantList QGCCorePlugin::complexMissionItemNames ( Vehicle vehicle)
virtual

Returns the complex mission items to display in the Plan UI. Each entry in the list is a QVariantMap with keys: "canonicalName" - untranslated key used with insertComplexMissionItem() "translatedName" - user-visible display string (already translated) The base class builds and returns the default set. Custom builds should override this method, call the base class to get the defaults, modify as needed, and return the result. When adding a new entry, set both keys and override createComplexMissionItem() to handle the new canonicalName.

Parameters
vehicleVehicle for which the list is being built
Returns
Complex items to be made available to user

Definition at line 382 of file QGCCorePlugin.cc.

References CorridorScanComplexItem::canonicalName, StructureScanComplexItem::canonicalName, SurveyComplexItem::canonicalName, Vehicle::multiRotor(), and Vehicle::vtol().

Referenced by MissionController::complexMissionItems().

◆ createComplexMissionItem()

ComplexMissionItem * QGCCorePlugin::createComplexMissionItem ( const QString &  complexItemType,
PlanMasterController masterController,
bool  flyView,
const QString &  kmlOrShpFile = QString() 
)
virtual

Factory for creating custom complex mission items. Called by MissionController when the canonicalName/complexItemType is not one of the built-in types (Survey, CorridorScan, StructureScan, FixedWingLanding, VTOLLanding). For JSON load, the returned item has load() called on it immediately afterward.

Parameters
complexItemTypeThe canonicalName / jsonComplexItemTypeValue identifying the item
masterControllerPlanMasterController for the item
flyViewtrue if creating for fly view (read-only)
kmlOrShpFileOptional KML/SHP file to initialize from; QString() if none
Returns
New item (caller takes ownership), or nullptr if the type is not handled

Definition at line 411 of file QGCCorePlugin.cc.

References CorridorScanComplexItem::canonicalName, FixedWingLandingComplexItem::canonicalName, StructureScanComplexItem::canonicalName, SurveyComplexItem::canonicalName, VTOLLandingComplexItem::canonicalName, CorridorScanComplexItem::jsonComplexItemTypeValue, FixedWingLandingComplexItem::jsonComplexItemTypeValue, StructureScanComplexItem::jsonComplexItemTypeValue, SurveyComplexItem::jsonComplexItemTypeValue, and VTOLLandingComplexItem::jsonComplexItemTypeValue.

Referenced by MissionController::insertComplexMissionItem(), and MissionController::insertComplexMissionItemFromKMLOrSHP().

◆ createPositionSource()

virtual QGeoPositionInfoSource * QGCCorePlugin::createPositionSource ( QObject *  parent)
inlinevirtual
Returns
An instance of an alternate position source (or NULL if not available)

Definition at line 89 of file QGCCorePlugin.h.

◆ createQmlApplicationEngine()

QQmlApplicationEngine * QGCCorePlugin::createQmlApplicationEngine ( QObject *  parent)
virtual

Allows the plugin to override or get access to the QmlApplicationEngine to do things like add import path or stuff things into the context prior to window creation.

Definition at line 278 of file QGCCorePlugin.cc.

References JoystickManager::instance().

◆ createRootWindow()

void QGCCorePlugin::createRootWindow ( QQmlApplicationEngine *  qmlEngine)
virtual

Allows the plugin to override the creation of the root (native) window.

Definition at line 286 of file QGCCorePlugin.cc.

◆ createVideoReceiver()

VideoReceiver * QGCCorePlugin::createVideoReceiver ( QObject *  parent)
virtual

Allows the plugin to override the creation of VideoReceiver.

Definition at line 291 of file QGCCorePlugin.cc.

References GStreamer::createVideoReceiver(), and QtMultimediaReceiver::createVideoReceiver().

◆ createVideoSink()

void * QGCCorePlugin::createVideoSink ( QQuickItem *  widget,
QObject *  parent 
)
virtual

Allows the plugin to override the creation of VideoSink.

Definition at line 303 of file QGCCorePlugin.cc.

References GStreamer::createVideoSink(), and QtMultimediaReceiver::createVideoSink().

◆ customMapItems()

const QmlObjectListModel * QGCCorePlugin::customMapItems ( )
virtual

Allows custom builds to add custom items to the FlightMap. Objects put into QmlObjectListModel should derive from QmlComponentInfo and set the url property.

Definition at line 119 of file QGCCorePlugin.cc.

◆ defaultSettings()

virtual int QGCCorePlugin::defaultSettings ( )
inlinevirtual

The default settings panel to show

Returns
The settings index

Definition at line 67 of file QGCCorePlugin.h.

◆ factValueGridCreateDefaultSettings()

◆ firstRunPromptCustomIds()

virtual QList< int > QGCCorePlugin::firstRunPromptCustomIds ( )
inlinevirtual

Returns the custom build list of first run prompt ids for possible display. Actual display is based on the current AppSettings::firstRunPromptIds value. The order of this list also determines the order the prompts will be displayed in.

Definition at line 189 of file QGCCorePlugin.h.

Referenced by firstRunPromptsToShow().

◆ firstRunPromptResource()

QString QGCCorePlugin::firstRunPromptResource ( int  id) const
virtual

Returns the resource which contains the specified first run prompt for display.

Definition at line 356 of file QGCCorePlugin.cc.

References kInitialSetupPromptId.

◆ firstRunPromptStdIds()

virtual QList< int > QGCCorePlugin::firstRunPromptStdIds ( )
inlinevirtual

Returns the standard list of first run prompt ids for possible display. Actual display is based on the current AppSettings::firstRunPromptIds value. The order of this list also determines the order the prompts will be displayed in.

Definition at line 184 of file QGCCorePlugin.h.

References kInitialSetupPromptId.

Referenced by firstRunPromptsToShow().

◆ firstRunPromptsToShow()

QVariantList QGCCorePlugin::firstRunPromptsToShow ( )

Returns the list of first run prompt ids which need to be displayed according to current settings.

Definition at line 336 of file QGCCorePlugin.cc.

References firstRunPromptCustomIds(), AppSettings::firstRunPromptsIdsVariantToList(), firstRunPromptStdIds(), and SettingsManager::instance().

◆ getOfflineCameraDefinitionFile()

virtual bool QGCCorePlugin::getOfflineCameraDefinitionFile ( const QString &  cameraName,
QFile &  file 
)
inlinevirtual

Returns a true if xml definition file of a providen camera name exists, and loads it to file argument, to allow definition files to be loaded from resources.

Definition at line 199 of file QGCCorePlugin.h.

◆ init()

virtual void QGCCorePlugin::init ( )
inlinevirtual

Definition at line 58 of file QGCCorePlugin.h.

◆ instance()

◆ joystickActions()

virtual QList< JoystickAction > QGCCorePlugin::joystickActions ( )
inlinevirtual

Definition at line 205 of file QGCCorePlugin.h.

◆ mavlinkMessage()

virtual bool QGCCorePlugin::mavlinkMessage ( Vehicle vehicle,
LinkInterface link,
const mavlink_message_t message 
)
inlinevirtual

Allows the plugin to see all mavlink traffic to a vehicle

Returns
true: Allow vehicle to continue processing, false: Vehicle should not process message

Definition at line 112 of file QGCCorePlugin.h.

◆ options()

QGCOptions * QGCCorePlugin::options ( )
virtual

Global options

Returns
An instance of QGCOptions

Definition at line 114 of file QGCCorePlugin.cc.

◆ overrideSettingsGroupVisibility()

virtual bool QGCCorePlugin::overrideSettingsGroupVisibility ( const QString &  name)
inlinevirtual

Allows the core plugin to override the visibility for a settings group

Parameters
name- SettingsGroup name
Returns
true: Show settings ui, false: Hide settings ui

Definition at line 76 of file QGCCorePlugin.h.

◆ paletteOverride()

virtual void QGCCorePlugin::paletteOverride ( const QString &  colorName,
QGCPalette::PaletteColorInfo_t colorInfo 
)
inlinevirtual

Allows a plugin to override the specified color name from the palette.

Definition at line 92 of file QGCCorePlugin.h.

◆ planCreators()

QList< PlanCreator * > QGCCorePlugin::planCreators ( PlanMasterController planMasterController)
virtual

Returns the list of plan creators to show when creating a new plan. Custom builds can override to provide their own set of plan creators.

Parameters
planMasterControllerThe plan master controller for the plan being created
Returns
Plan creators to show. Caller takes ownership.

Definition at line 401 of file QGCCorePlugin.cc.

◆ postLoadFromJson()

virtual void QGCCorePlugin::postLoadFromJson ( PlanMasterController pController,
QJsonObject &  json 
)
inlinevirtual

Allows custom builds to load custom items from the plan file after the document is parsed.

Definition at line 130 of file QGCCorePlugin.h.

Referenced by PlanMasterController::loadFromFile().

◆ postSaveToJson()

virtual void QGCCorePlugin::postSaveToJson ( PlanMasterController pController,
QJsonObject &  json 
)
inlinevirtual

Allows custom builds to add custom items to the plan file after the document is created.

Definition at line 120 of file QGCCorePlugin.h.

Referenced by PlanMasterController::saveToJson().

◆ postSaveToMissionJson()

virtual void QGCCorePlugin::postSaveToMissionJson ( PlanMasterController pController,
QJsonObject &  missionJson 
)
inlinevirtual

Allows custom builds to add custom items to the mission section of the plan file after the item is created.

Definition at line 125 of file QGCCorePlugin.h.

Referenced by PlanMasterController::saveToJson().

◆ preLoadFromJson()

virtual void QGCCorePlugin::preLoadFromJson ( PlanMasterController pController,
QJsonObject &  json 
)
inlinevirtual

Allows custom builds to load custom items from the plan file before the document is parsed.

Definition at line 128 of file QGCCorePlugin.h.

Referenced by PlanMasterController::loadFromFile().

◆ preSaveToJson()

virtual void QGCCorePlugin::preSaveToJson ( PlanMasterController pController,
QJsonObject &  json 
)
inlinevirtual

Allows custom builds to add custom items to the plan file before the document is created.

Definition at line 118 of file QGCCorePlugin.h.

Referenced by PlanMasterController::saveToJson().

◆ preSaveToMissionJson()

virtual void QGCCorePlugin::preSaveToMissionJson ( PlanMasterController pController,
QJsonObject &  missionJson 
)
inlinevirtual

Allows custom builds to add custom items to the mission section of the plan file before the item is created.

Definition at line 123 of file QGCCorePlugin.h.

Referenced by PlanMasterController::saveToJson().

◆ releaseVideoSink()

void QGCCorePlugin::releaseVideoSink ( void *  sink)
virtual

Allows the plugin to override the release of VideoSink.

Definition at line 314 of file QGCCorePlugin.cc.

References GStreamer::releaseVideoSink(), and QtMultimediaReceiver::releaseVideoSink().

Referenced by VideoManager::cleanup().

◆ showAdvancedUI()

bool QGCCorePlugin::showAdvancedUI ( ) const
inline

Definition at line 211 of file QGCCorePlugin.h.

References _showAdvancedUI.

◆ showAdvancedUIChanged

void QGCCorePlugin::showAdvancedUIChanged ( bool  showAdvancedUI)
signal

◆ showAdvancedUIMessage()

QString QGCCorePlugin::showAdvancedUIMessage ( ) const
virtual
Returns
The message to show to the user when they are prompted to confirm turning on advanced ui.

Definition at line 156 of file QGCCorePlugin.cc.

◆ showTouchAreas()

bool QGCCorePlugin::showTouchAreas ( ) const
inline

Definition at line 210 of file QGCCorePlugin.h.

References _showTouchAreas.

◆ showTouchAreasChanged

void QGCCorePlugin::showTouchAreasChanged ( bool  showTouchAreas)
signal

◆ stableDownloadLocation()

virtual QString QGCCorePlugin::stableDownloadLocation ( ) const
inlinevirtual

Returns the user visible url to show user where to download new stable builds from. Custom builds must override to provide their own location.

Definition at line 146 of file QGCCorePlugin.h.

◆ stableVersionCheckFileUrl()

virtual QString QGCCorePlugin::stableVersionCheckFileUrl ( ) const
inlinevirtual

Returns the url to download the stable version check file. Return QString() to indicate no version check should be performed. Default QGC mainline implemenentation returns QGC Stable file location. Default QGC custom build code returns QString(). Custom builds can override to turn on and provide their own location. The contents of this file should be a single line in the form: v3.4.4 This indicates the latest stable version number.

Definition at line 141 of file QGCCorePlugin.h.

◆ toolBarIndicators()

const QVariantList & QGCCorePlugin::toolBarIndicators ( )
virtual

Returns the list of toolbar indicators which are not related to a vehicle

Returns
A list of QUrl with the indicators

Definition at line 325 of file QGCCorePlugin.cc.

Member Data Documentation

◆ _showAdvancedUI

bool QGCCorePlugin::_showAdvancedUI = true
protected

Definition at line 225 of file QGCCorePlugin.h.

Referenced by showAdvancedUI().

◆ _showTouchAreas

bool QGCCorePlugin::_showTouchAreas = false
protected

Definition at line 224 of file QGCCorePlugin.h.

Referenced by showTouchAreas().

◆ kFirstRunPromptIdsFirstCustomId

constexpr int QGCCorePlugin::kFirstRunPromptIdsFirstCustomId = 10000
staticconstexpr

Definition at line 217 of file QGCCorePlugin.h.

◆ kInitialSetupPromptId

constexpr int QGCCorePlugin::kInitialSetupPromptId = 3
staticconstexpr

Definition at line 214 of file QGCCorePlugin.h.

Referenced by firstRunPromptResource(), and firstRunPromptStdIds().


The documentation for this class was generated from the following files: