From af7221fda00a38772c9660403bfff52946c82cd5 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Tue, 17 Dec 2024 12:13:24 -0800 Subject: [PATCH] Remove const from all but the simplest methods Adding these was causing all sorts of problem in custom build implemenations --- src/API/QGCCorePlugin.cc | 20 ++++++++-------- src/API/QGCCorePlugin.h | 52 ++++++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/API/QGCCorePlugin.cc b/src/API/QGCCorePlugin.cc index 43f68048601..856be40102e 100644 --- a/src/API/QGCCorePlugin.cc +++ b/src/API/QGCCorePlugin.cc @@ -74,7 +74,7 @@ void QGCCorePlugin::registerQmlTypes() (void) qmlRegisterUncreatableType("QGroundControl", 1, 0, "QGCFlyViewOptions", QStringLiteral("Reference only")); } -const QVariantList &QGCCorePlugin::analyzePages() const +const QVariantList &QGCCorePlugin::analyzePages() { static const QVariantList analyzeList = { QVariant::fromValue(new QmlComponentInfo( @@ -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) { @@ -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); @@ -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")); @@ -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); @@ -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); @@ -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); @@ -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( { @@ -293,7 +293,7 @@ const QVariantList &QGCCorePlugin::toolBarIndicators() const return toolBarIndicatorList; } -QVariantList QGCCorePlugin::firstRunPromptsToShow() const +QVariantList QGCCorePlugin::firstRunPromptsToShow() { QList rgIdsToShow; diff --git a/src/API/QGCCorePlugin.h b/src/API/QGCCorePlugin.h index 5b8a6e252c2..8c97fb4625f 100644 --- a/src/API/QGCCorePlugin.h +++ b/src/API/QGCCorePlugin.h @@ -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 @@ -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(); } @@ -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(). @@ -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 firstRunPromptStdIds() const { return QList({ kUnitsFirstRunPromptId, kOfflineVehicleFirstRunPromptId }); } + virtual QList firstRunPromptStdIds() { return QList({ 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 firstRunPromptCustomIds() const { return QList(); } + virtual QList firstRunPromptCustomIds() { return QList(); } /// 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 joystickActions() const { return {}; } + virtual QList 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; }