Skip to content

Commit

Permalink
Remove const from all but the simplest methods
Browse files Browse the repository at this point in the history
Adding these was causing all sorts of problem in custom build implemenations
  • Loading branch information
DonLakeFlyer committed Dec 17, 2024
1 parent be57c7f commit af7221f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
20 changes: 10 additions & 10 deletions src/API/QGCCorePlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void QGCCorePlugin::registerQmlTypes()
(void) qmlRegisterUncreatableType<QGCFlyViewOptions>("QGroundControl", 1, 0, "QGCFlyViewOptions", QStringLiteral("Reference only"));
}

const QVariantList &QGCCorePlugin::analyzePages() const
const QVariantList &QGCCorePlugin::analyzePages()
{
static const QVariantList analyzeList = {
QVariant::fromValue(new QmlComponentInfo(
Expand Down Expand Up @@ -116,7 +116,7 @@ const QmlObjectListModel *QGCCorePlugin::customMapItems()
return _emptyCustomMapItems;
}

bool QGCCorePlugin::adjustSettingMetaData(const QString &settingsGroup, FactMetaData &metaData) const
bool QGCCorePlugin::adjustSettingMetaData(const QString &settingsGroup, FactMetaData &metaData)
{
if (settingsGroup == AppSettings::settingsGroup) {
if (metaData.name() == AppSettings::indoorPaletteName) {
Expand Down Expand Up @@ -153,7 +153,7 @@ QString QGCCorePlugin::showAdvancedUIMessage() const
"Are you sure you want to enable Advanced Mode?");
}

void QGCCorePlugin::factValueGridCreateDefaultSettings(const QString &defaultSettingsGroup) const
void QGCCorePlugin::factValueGridCreateDefaultSettings(const QString &defaultSettingsGroup)
{
HorizontalFactValueGrid *const factValueGrid = new HorizontalFactValueGrid(defaultSettingsGroup);

Expand Down Expand Up @@ -232,7 +232,7 @@ void QGCCorePlugin::factValueGridCreateDefaultSettings(const QString &defaultSet
factValueGrid->deleteLater();
}

QQmlApplicationEngine *QGCCorePlugin::createQmlApplicationEngine(QObject *parent) const
QQmlApplicationEngine *QGCCorePlugin::createQmlApplicationEngine(QObject *parent)
{
QQmlApplicationEngine *const qmlEngine = new QQmlApplicationEngine(parent);
qmlEngine->addImportPath(QStringLiteral("qrc:/qml"));
Expand All @@ -242,12 +242,12 @@ QQmlApplicationEngine *QGCCorePlugin::createQmlApplicationEngine(QObject *parent
return qmlEngine;
}

void QGCCorePlugin::createRootWindow(QQmlApplicationEngine *qmlEngine) const
void QGCCorePlugin::createRootWindow(QQmlApplicationEngine *qmlEngine)
{
qmlEngine->load(QUrl(QStringLiteral("qrc:/qml/MainRootWindow.qml")));
}

VideoReceiver *QGCCorePlugin::createVideoReceiver(QObject *parent) const
VideoReceiver *QGCCorePlugin::createVideoReceiver(QObject *parent)
{
#ifdef QGC_GST_STREAMING
return GStreamer::createVideoReceiver(parent);
Expand All @@ -258,7 +258,7 @@ VideoReceiver *QGCCorePlugin::createVideoReceiver(QObject *parent) const
#endif
}

void *QGCCorePlugin::createVideoSink(QObject *parent, QQuickItem *widget) const
void *QGCCorePlugin::createVideoSink(QObject *parent, QQuickItem *widget)
{
#ifdef QGC_GST_STREAMING
return GStreamer::createVideoSink(parent, widget);
Expand All @@ -271,7 +271,7 @@ void *QGCCorePlugin::createVideoSink(QObject *parent, QQuickItem *widget) const
#endif
}

void QGCCorePlugin::releaseVideoSink(void *sink) const
void QGCCorePlugin::releaseVideoSink(void *sink)
{
#ifdef QGC_GST_STREAMING
GStreamer::releaseVideoSink(sink);
Expand All @@ -282,7 +282,7 @@ void QGCCorePlugin::releaseVideoSink(void *sink) const
#endif
}

const QVariantList &QGCCorePlugin::toolBarIndicators() const
const QVariantList &QGCCorePlugin::toolBarIndicators()
{
static const QVariantList toolBarIndicatorList = QVariantList(
{
Expand All @@ -293,7 +293,7 @@ const QVariantList &QGCCorePlugin::toolBarIndicators() const
return toolBarIndicatorList;
}

QVariantList QGCCorePlugin::firstRunPromptsToShow() const
QVariantList QGCCorePlugin::firstRunPromptsToShow()
{
QList<int> rgIdsToShow;

Expand Down
52 changes: 26 additions & 26 deletions src/API/QGCCorePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ class QGCCorePlugin : public QObject

/// The list of pages/buttons under the Analyze Menu
/// @return A list of QmlPageInfo
virtual const QVariantList &analyzePages() const;
virtual const QVariantList &analyzePages();

/// The default settings panel to show
/// @return The settings index
virtual int defaultSettings() const { return 0; }
virtual int defaultSettings() { return 0; }

/// Global options
/// @return An instance of QGCOptions
Expand All @@ -73,13 +73,13 @@ class QGCCorePlugin : public QObject
/// Allows the core plugin to override the visibility for a settings group
/// @param name - SettingsGroup name
/// @return true: Show settings ui, false: Hide settings ui
virtual bool overrideSettingsGroupVisibility(const QString &name) const { Q_UNUSED(name); return true; }
virtual bool overrideSettingsGroupVisibility(const QString &name) { Q_UNUSED(name); return true; }

/// Allows the core plugin to override the setting meta data before the setting fact is created.
/// @param settingsGroup - QSettings group which contains this item
/// @param metaData - MetaData for setting fact
/// @return true: Setting should be visible in ui, false: Setting should not be shown in ui
virtual bool adjustSettingMetaData(const QString &settingsGroup, FactMetaData &metaData) const;
virtual bool adjustSettingMetaData(const QString &settingsGroup, FactMetaData &metaData);

/// Return the resource file which contains the brand image for for Indoor theme.
virtual QString brandImageIndoor() const { return QString(); }
Expand All @@ -91,48 +91,48 @@ class QGCCorePlugin : public QObject
virtual QString showAdvancedUIMessage() const;

/// @return An instance of an alternate position source (or NULL if not available)
virtual QGeoPositionInfoSource *createPositionSource(QObject *parent) const { Q_UNUSED(parent); return nullptr; }
virtual QGeoPositionInfoSource *createPositionSource(QObject *parent) { Q_UNUSED(parent); return nullptr; }

/// Allows a plugin to override the specified color name from the palette
virtual void paletteOverride(const QString &colorName, QGCPalette::PaletteColorInfo_t &colorInfo) const { Q_UNUSED(colorName); Q_UNUSED(colorInfo); };
virtual void paletteOverride(const QString &colorName, QGCPalette::PaletteColorInfo_t &colorInfo) { Q_UNUSED(colorName); Q_UNUSED(colorInfo); };

virtual void factValueGridCreateDefaultSettings(const QString &defaultSettingsGroup) const;
virtual void factValueGridCreateDefaultSettings(const QString &defaultSettingsGroup);

/// 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.
virtual QQmlApplicationEngine *createQmlApplicationEngine(QObject *parent) const;
virtual QQmlApplicationEngine *createQmlApplicationEngine(QObject *parent);

/// Allows the plugin to override the creation of the root (native) window.
virtual void createRootWindow(QQmlApplicationEngine *qmlEngine) const;
virtual void createRootWindow(QQmlApplicationEngine *qmlEngine);

/// Allows the plugin to override the creation of VideoReceiver.
virtual VideoReceiver *createVideoReceiver(QObject *parent) const;
virtual VideoReceiver *createVideoReceiver(QObject *parent);
/// Allows the plugin to override the creation of VideoSink.
virtual void *createVideoSink(QObject *parent, QQuickItem *widget) const;
virtual void *createVideoSink(QObject *parent, QQuickItem *widget);
/// Allows the plugin to override the release of VideoSink.
virtual void releaseVideoSink(void *sink) const;
virtual void releaseVideoSink(void *sink);

/// Allows the plugin to see all mavlink traffic to a vehicle
/// @return true: Allow vehicle to continue processing, false: Vehicle should not process message
virtual bool mavlinkMessage(Vehicle *vehicle, LinkInterface *link, const mavlink_message_t &message) const { Q_UNUSED(vehicle); Q_UNUSED(link); Q_UNUSED(message); return true; }
virtual bool mavlinkMessage(Vehicle *vehicle, LinkInterface *link, const mavlink_message_t &message) { Q_UNUSED(vehicle); Q_UNUSED(link); Q_UNUSED(message); return true; }

/// 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 *customMapItems();

/// Allows custom builds to add custom items to the plan file before the document is created.
virtual void preSaveToJson(PlanMasterController *pController, QJsonObject &json) const { Q_UNUSED(pController); Q_UNUSED(json); }
virtual void preSaveToJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
/// Allows custom builds to add custom items to the plan file after the document is created.
virtual void postSaveToJson(PlanMasterController *pController, QJsonObject &json) const { Q_UNUSED(pController); Q_UNUSED(json); }
virtual void postSaveToJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }

/// Allows custom builds to add custom items to the mission section of the plan file before the item is created.
virtual void preSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) const { Q_UNUSED(pController); Q_UNUSED(missionJson); }
virtual void preSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
/// Allows custom builds to add custom items to the mission section of the plan file after the item is created.
virtual void postSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) const { Q_UNUSED(pController); Q_UNUSED(missionJson); }
virtual void postSaveToMissionJson(PlanMasterController *pController, QJsonObject &missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }

/// Allows custom builds to load custom items from the plan file before the document is parsed.
virtual void preLoadFromJson(PlanMasterController *pController, QJsonObject &json) const { Q_UNUSED(pController); Q_UNUSED(json); }
virtual void preLoadFromJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }
/// Allows custom builds to load custom items from the plan file after the document is parsed.
virtual void postLoadFromJson(PlanMasterController *pController, QJsonObject &json) const { Q_UNUSED(pController); Q_UNUSED(json); }
virtual void postLoadFromJson(PlanMasterController *pController, QJsonObject &json) { Q_UNUSED(pController); Q_UNUSED(json); }

/// 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().
Expand All @@ -153,36 +153,36 @@ class QGCCorePlugin : public QObject
/// Returns the complex mission items to display in the Plan UI
/// @param complexMissionItemNames Default set of complex items
/// @return Complex items to be made available to user
virtual QStringList complexMissionItemNames(Vehicle *vehicle, const QStringList &complexMissionItemNames) const { Q_UNUSED(vehicle); return complexMissionItemNames; }
virtual QStringList complexMissionItemNames(Vehicle *vehicle, const QStringList &complexMissionItemNames) { Q_UNUSED(vehicle); return complexMissionItemNames; }

/// 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.
virtual QList<int> firstRunPromptStdIds() const { return QList<int>({ kUnitsFirstRunPromptId, kOfflineVehicleFirstRunPromptId }); }
virtual QList<int> firstRunPromptStdIds() { return QList<int>({ kUnitsFirstRunPromptId, kOfflineVehicleFirstRunPromptId }); }

/// 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.
virtual QList<int> firstRunPromptCustomIds() const { return QList<int>(); }
virtual QList<int> firstRunPromptCustomIds() { return QList<int>(); }

/// Returns the resource which contains the specified first run prompt for display
Q_INVOKABLE virtual QString firstRunPromptResource(int id) const;

/// Returns the list of toolbar indicators which are not related to a vehicle
/// @return A list of QUrl with the indicators
virtual const QVariantList &toolBarIndicators() const;
virtual const QVariantList &toolBarIndicators();

/// 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 bool getOfflineCameraDefinitionFile(const QString &cameraName, QFile &file) const { Q_UNUSED(cameraName); Q_UNUSED(file); return false; }
virtual bool getOfflineCameraDefinitionFile(const QString &cameraName, QFile &file) { Q_UNUSED(cameraName); Q_UNUSED(file); return false; }

struct JoystickAction {
QString name;
bool canRepeat = false;
};
virtual QList<JoystickAction> joystickActions() const { return {}; }
virtual QList<JoystickAction> joystickActions() { return {}; }

/// Returns the list of first run prompt ids which need to be displayed according to current settings
Q_INVOKABLE QVariantList firstRunPromptsToShow() const;
Q_INVOKABLE QVariantList firstRunPromptsToShow();

bool showTouchAreas() const { return _showTouchAreas; }
bool showAdvancedUI() const { return _showAdvancedUI; }
Expand Down

0 comments on commit af7221f

Please sign in to comment.