diff --git a/src/MissionManager/ComplexMissionItem.cc b/src/MissionManager/ComplexMissionItem.cc index 0d9100b682b1bf3bfbf512cf266bcf4d8fbbbd3e..c525a28b1b5034d633cc35d01a1622717d969e5b 100644 --- a/src/MissionManager/ComplexMissionItem.cc +++ b/src/MissionManager/ComplexMissionItem.cc @@ -9,6 +9,8 @@ #include "ComplexMissionItem.h" #include "QGCApplication.h" +#include "QGCCorePlugin.h" +#include "QGCOptions.h" #include @@ -54,8 +56,12 @@ void ComplexMissionItem::savePreset(const QString& name) void ComplexMissionItem::deletePreset(const QString& name) { - QSettings settings; + if (qgcApp()->toolbox()->corePlugin()->options()->surveyBuiltInPresetNames().contains(name)) { + qgcApp()->showMessage(tr("'%1' is a built-in preset which cannot be deleted.").arg(name)); + return; + } + QSettings settings; settings.beginGroup(presetsSettingsGroup()); settings.beginGroup(_presetSettingsKey); settings.remove(name); diff --git a/src/api/QGCOptions.h b/src/api/QGCOptions.h index ba6c56380ab44f695e218e2ddfc0aa841da30df3..0b1b60db8cee46ba127d790e3e3f87a2fc9717ff 100644 --- a/src/api/QGCOptions.h +++ b/src/api/QGCOptions.h @@ -67,6 +67,7 @@ public: Q_PROPERTY(bool enableMultiVehicleList READ enableMultiVehicleList CONSTANT) Q_PROPERTY(bool enableMapScale READ enableMapScale CONSTANT) Q_PROPERTY(bool enableSaveMainWindowPosition READ enableSaveMainWindowPosition CONSTANT) + Q_PROPERTY(QStringList surveyBuiltInPresetNames READ surveyBuiltInPresetNames CONSTANT) /// Should QGC hide its settings menu and colapse it into one single menu (Settings and Vehicle Setup)? /// @return true if QGC should consolidate both menus into one. @@ -130,6 +131,7 @@ public: virtual bool enableMapScale () const { return true; } /// Desktop builds save the main application size and position on close (and restore it on open) virtual bool enableSaveMainWindowPosition () const { return true; } + virtual QStringList surveyBuiltInPresetNames () const { return QStringList(); } // Built in presets cannot be deleted #if defined(__mobile__) virtual bool useMobileFileDialog () const { return true;}