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 void linkConfigurationsLoaded (LinkManager *linkManager)
 Called at boot after saved link configurations are loaded and before auto-connect links are started.
virtual const QVariantList & analyzePages ()
virtual int defaultSettings ()
virtual QGCOptions * options ()
virtual bool overrideSettingsGroupVisibility (const QString &name)
virtual void adjustSettingMetaData (const QString &settingsGroup, FactMetaData &metaData, bool &userVisible)
virtual void registerCustomSettings (SettingsManager *settingsManager)
virtual QString showAdvancedUIMessage () const
virtual bool showInitialSetupVehiclePreferences () const
virtual bool showInitialSetupMeasurementUnits () 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 destroyQmlApplicationEngine (QQmlApplicationEngine *qmlEngine)
virtual void createRootWindow (QQmlApplicationEngine *qmlEngine)
 Allows the plugin to override the creation of the root (native) window.
virtual VideoReceiver * createVideoReceiver (QObject *parent)
 Allows the plugin to override the creation of VideoReceiver.
virtual bool mavlinkMessage (Vehicle *vehicle, LinkInterface *link, const mavlink_message_t &message)
virtual const QmlObjectListModel * customMapItems ()
 Allows custom builds to add custom items to the FlightMap. Objects put into QmlObjectListModel should derive from QmlComponentInfo and set the url property.
virtual const QmlObjectListModel * customGeoMapItems ()
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 stableDownloadUrl () const
virtual QVariantList complexMissionItemNames (Vehicle *vehicle)
virtual ComplexMissionItem * createComplexMissionItem (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< JoystickAction > joystickActions ()
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 QGCCorePlugin * instance ()

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.

Referenced by instance().

◆ ~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 139 of file QGCCorePlugin.cc.

References AndroidSerialAccess::hasPosixSerialPorts(), 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 63 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 401 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 430 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 107 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 312 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 325 of file QGCCorePlugin.cc.

◆ createVideoReceiver()

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

Allows the plugin to override the creation of VideoReceiver.

Definition at line 330 of file QGCCorePlugin.cc.

References VideoBackend::createReceiver(), and VideoBackend::instance().

◆ customGeoMapItems()

const QmlObjectListModel * QGCCorePlugin::customGeoMapItems ( )
virtual

GeoMap counterpart of customMapItems, shown when the Fly View uses the GeoMap engine. Same QmlComponentInfo/url contract; each component is created in the map with its customMapObject, scene and surfaceModel properties set, so its root should be a GeoMapItem (or declare those properties and pass scene/surfaceModel on to GeoMap items).

Definition at line 134 of file QGCCorePlugin.cc.

◆ 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 129 of file QGCCorePlugin.cc.

◆ defaultSettings()

virtual int QGCCorePlugin::defaultSettings ( )
inlinevirtual

The default settings panel to show

Returns
The settings index

Definition at line 74 of file QGCCorePlugin.h.

◆ destroyQmlApplicationEngine()

void QGCCorePlugin::destroyQmlApplicationEngine ( QQmlApplicationEngine * qmlEngine)
virtual

Symmetric counterpart to createQmlApplicationEngine. Engines obtained from the create hook must be destroyed through this hook so the plugin can release any per-engine state it attached at creation (url interceptors, etc) before the engine goes away.

Definition at line 320 of file QGCCorePlugin.cc.

Referenced by QGCApplication::shutdown().

◆ 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 213 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 375 of file QGCCorePlugin.cc.

References kInitialSetupPromptId.

◆ firstRunPromptStdIds()

QList< int > QGCCorePlugin::firstRunPromptStdIds ( )
virtual

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 346 of file QGCCorePlugin.cc.

References kInitialSetupPromptId, showInitialSetupMeasurementUnits(), and showInitialSetupVehiclePreferences().

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 355 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 223 of file QGCCorePlugin.h.

◆ init()

virtual void QGCCorePlugin::init ( )
inlinevirtual

Definition at line 62 of file QGCCorePlugin.h.

◆ instance()

◆ joystickActions()

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

Definition at line 229 of file QGCCorePlugin.h.

◆ linkConfigurationsLoaded()

virtual void QGCCorePlugin::linkConfigurationsLoaded ( LinkManager * linkManager)
inlinevirtual

Called at boot after saved link configurations are loaded and before auto-connect links are started.

Definition at line 66 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 131 of file QGCCorePlugin.h.

◆ options()

QGCOptions * QGCCorePlugin::options ( )
virtual

Global options

Returns
An instance of QGCOptions

Definition at line 124 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 83 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 110 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 420 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 154 of file QGCCorePlugin.h.

◆ 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 144 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 149 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 152 of file QGCCorePlugin.h.

◆ 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 142 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 147 of file QGCCorePlugin.h.

Referenced by PlanMasterController::saveToJson().

◆ registerCustomSettings()

virtual void QGCCorePlugin::registerCustomSettings ( SettingsManager * settingsManager)
inlinevirtual

Called at the end of SettingsManager::init. Override to register custom build settings groups via SettingsManager::registerCustomSettingsGroup so generated settings pages can reference them as QGroundControl.settingsManager.<accessor>.

Definition at line 95 of file QGCCorePlugin.h.

Referenced by SettingsManager::init().

◆ showAdvancedUI()

bool QGCCorePlugin::showAdvancedUI ( ) const
inline

Definition at line 235 of file QGCCorePlugin.h.

References _showAdvancedUI.

Referenced by showAdvancedUIChanged().

◆ showAdvancedUIChanged

void QGCCorePlugin::showAdvancedUIChanged ( bool showAdvancedUI)
signal

References showAdvancedUI().

◆ 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 180 of file QGCCorePlugin.cc.

◆ showInitialSetupMeasurementUnits()

bool QGCCorePlugin::showInitialSetupMeasurementUnits ( ) const
virtual
Returns
true if the initial setup prompt should show measurement units.

Definition at line 193 of file QGCCorePlugin.cc.

Referenced by firstRunPromptStdIds().

◆ showInitialSetupVehiclePreferences()

bool QGCCorePlugin::showInitialSetupVehiclePreferences ( ) const
virtual
Returns
true if the initial setup prompt should show vehicle preferences.

Definition at line 188 of file QGCCorePlugin.cc.

References FirmwarePluginManager::instance(), and FirmwarePluginManager::singleVehicleSupport().

Referenced by firstRunPromptStdIds().

◆ showTouchAreas()

bool QGCCorePlugin::showTouchAreas ( ) const
inline

Definition at line 234 of file QGCCorePlugin.h.

References _showTouchAreas.

Referenced by showTouchAreasChanged().

◆ showTouchAreasChanged

void QGCCorePlugin::showTouchAreasChanged ( bool showTouchAreas)
signal

References showTouchAreas().

◆ stableDownloadUrl()

virtual QString QGCCorePlugin::stableDownloadUrl ( ) const
inlinevirtual

Returns the full URL (including scheme) opened by the Update button and the new version dialog link. Custom builds must override to provide their own location.

Definition at line 170 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 165 of file QGCCorePlugin.h.

Referenced by QGCVersionCheck::start().

◆ 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 335 of file QGCCorePlugin.cc.

Member Data Documentation

◆ _showAdvancedUI

bool QGCCorePlugin::_showAdvancedUI = true
protected

Definition at line 249 of file QGCCorePlugin.h.

Referenced by showAdvancedUI().

◆ _showTouchAreas

bool QGCCorePlugin::_showTouchAreas = false
protected

Definition at line 248 of file QGCCorePlugin.h.

Referenced by showTouchAreas().

◆ kFirstRunPromptIdsFirstCustomId

int QGCCorePlugin::kFirstRunPromptIdsFirstCustomId = 10000
staticconstexpr

Definition at line 241 of file QGCCorePlugin.h.

◆ kInitialSetupPromptId

int QGCCorePlugin::kInitialSetupPromptId = 3
staticconstexpr

Definition at line 238 of file QGCCorePlugin.h.

Referenced by firstRunPromptResource(), and firstRunPromptStdIds().


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