Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/API/QGCCorePlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#endif
#endif
#include "FactMetaData.h"
#include "FirmwarePluginManager.h"
#include "QGCMAVLink.h"
#include "HorizontalFactValueGrid.h"
#include "InstrumentValueData.h"
Expand Down Expand Up @@ -181,6 +182,18 @@ QString QGCCorePlugin::showAdvancedUIMessage() const
"Are you sure you want to enable Advanced Mode?");
}

bool QGCCorePlugin::showInitialSetupVehiclePreferences() const
{
const QList<QGCMAVLink::FirmwareClass_t> 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)
Expand Down Expand Up @@ -339,6 +352,15 @@ const QVariantList &QGCCorePlugin::toolBarIndicators()
return toolBarIndicatorList;
}

QList<int> QGCCorePlugin::firstRunPromptStdIds()
{
if (showInitialSetupVehiclePreferences() || showInitialSetupMeasurementUnits()) {
return { kInitialSetupPromptId };
}

return {};
}

QVariantList QGCCorePlugin::firstRunPromptsToShow()
{
QList<int> rgIdsToShow;
Expand Down
10 changes: 9 additions & 1 deletion src/API/QGCCorePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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; }

Expand Down Expand Up @@ -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<int> firstRunPromptStdIds() { return QList<int>({ kInitialSetupPromptId }); }
virtual QList<int> 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
Expand Down
2 changes: 2 additions & 0 deletions src/FirstRunPromptDialogs/InitialSetupPrompt.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand All @@ -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.")

Expand Down
Loading