diff --git a/src/API/QGCCorePlugin.cc b/src/API/QGCCorePlugin.cc index f1c4d4332605..d3b4fc6903f4 100644 --- a/src/API/QGCCorePlugin.cc +++ b/src/API/QGCCorePlugin.cc @@ -10,6 +10,7 @@ #endif #endif #include "FactMetaData.h" +#include "FirmwarePluginManager.h" #include "QGCMAVLink.h" #include "HorizontalFactValueGrid.h" #include "InstrumentValueData.h" @@ -181,6 +182,18 @@ QString QGCCorePlugin::showAdvancedUIMessage() const "Are you sure you want to enable Advanced Mode?"); } +bool QGCCorePlugin::showInitialSetupVehiclePreferences() const +{ + const QList supportedFirmwareClasses = FirmwarePluginManager::instance()->supportedFirmwareClasses(); + return supportedFirmwareClasses.count() != 1 || + FirmwarePluginManager::instance()->supportedVehicleClasses(supportedFirmwareClasses[0]).count() != 1; +} + +bool QGCCorePlugin::showInitialSetupMeasurementUnits() const +{ + return true; +} + void QGCCorePlugin::factValueGridCreateDefaultSettings(FactValueGrid* factValueGrid) { #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) @@ -339,6 +352,15 @@ const QVariantList &QGCCorePlugin::toolBarIndicators() return toolBarIndicatorList; } +QList QGCCorePlugin::firstRunPromptStdIds() +{ + if (showInitialSetupVehiclePreferences() || showInitialSetupMeasurementUnits()) { + return { kInitialSetupPromptId }; + } + + return {}; +} + QVariantList QGCCorePlugin::firstRunPromptsToShow() { QList rgIdsToShow; diff --git a/src/API/QGCCorePlugin.h b/src/API/QGCCorePlugin.h index d3d46d84212d..4804cced5b2b 100644 --- a/src/API/QGCCorePlugin.h +++ b/src/API/QGCCorePlugin.h @@ -41,6 +41,8 @@ class QGCCorePlugin : public QObject Q_MOC_INCLUDE("QmlObjectListModel.h") Q_PROPERTY(bool showAdvancedUI READ showAdvancedUI WRITE _setShowAdvancedUI NOTIFY showAdvancedUIChanged) Q_PROPERTY(bool showTouchAreas READ showTouchAreas WRITE _setShowTouchAreas NOTIFY showTouchAreasChanged) + Q_PROPERTY(bool showInitialSetupVehiclePreferences READ showInitialSetupVehiclePreferences CONSTANT) + Q_PROPERTY(bool showInitialSetupMeasurementUnits READ showInitialSetupMeasurementUnits CONSTANT) Q_PROPERTY(int defaultSettings READ defaultSettings CONSTANT) Q_PROPERTY(int initialSetupPromptId MEMBER kInitialSetupPromptId CONSTANT) Q_PROPERTY(const QGCOptions *options READ options CONSTANT) @@ -85,6 +87,12 @@ class QGCCorePlugin : public QObject /// @return The message to show to the user when they are prompted to confirm turning on advanced ui. virtual QString showAdvancedUIMessage() const; + /// @return true if the initial setup prompt should show vehicle preferences. + virtual bool showInitialSetupVehiclePreferences() const; + + /// @return true if the initial setup prompt should show measurement units. + virtual bool showInitialSetupMeasurementUnits() const; + /// @return An instance of an alternate position source (or NULL if not available) virtual QGeoPositionInfoSource *createPositionSource(QObject *parent) { Q_UNUSED(parent); return nullptr; } @@ -186,7 +194,7 @@ class QGCCorePlugin : public QObject /// 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() { return QList({ kInitialSetupPromptId }); } + virtual QList firstRunPromptStdIds(); /// 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 diff --git a/src/FirstRunPromptDialogs/InitialSetupPrompt.qml b/src/FirstRunPromptDialogs/InitialSetupPrompt.qml index af6912964cb7..94783eee6a17 100644 --- a/src/FirstRunPromptDialogs/InitialSetupPrompt.qml +++ b/src/FirstRunPromptDialogs/InitialSetupPrompt.qml @@ -53,6 +53,7 @@ FirstRunPrompt { SettingsGroupLayout { Layout.fillWidth: true Layout.maximumWidth: _descriptionWidth + visible: QGroundControl.corePlugin.showInitialSetupVehiclePreferences heading: qsTr("Vehicle Preferences") headingDescription: qsTr("Select the firmware and vehicle type you typically use.") @@ -76,6 +77,7 @@ FirstRunPrompt { SettingsGroupLayout { Layout.fillWidth: true Layout.maximumWidth: _descriptionWidth + visible: QGroundControl.corePlugin.showInitialSetupMeasurementUnits heading: qsTr("Measurement Units") headingDescription: qsTr("Choose the measurement units you want to use. You can also change it later in General Settings.")