Skip to content

Commit

Permalink
Rename group name
Browse files Browse the repository at this point in the history
  • Loading branch information
DonLakeFlyer committed Sep 22, 2024
1 parent 27007c0 commit 98350a1
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/Settings/AutoConnectSettings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,29 @@

#include <QtQml/QQmlEngine>

DECLARE_SETTINGGROUP(AutoConnect, "LinkManager")
DECLARE_SETTINGGROUP(AutoConnect, "AutoConnect")
{
qmlRegisterUncreatableType<AutoConnectSettings>("QGroundControl.SettingsManager", 1, 0, "AutoConnectSettings", "Reference only"); \
qmlRegisterUncreatableType<AutoConnectSettings>("QGroundControl.SettingsManager", 1, 0, "AutoConnectSettings", "Reference only");

// Settings group name was changed from "LinkManager" to "AutoConnect" in v5.0.0
// Copy over an old settings to the new name
QSettings settings;
static const char* deprecatedGroupName = "LinkManager";
if (settings.childGroups().contains(deprecatedGroupName)) {
settings.beginGroup(deprecatedGroupName);
QList<QPair<QString, QVariant>> values;
for (const QString& key: settings.childKeys()) {
values.append(QPair<QString, QVariant>(key, settings.value(key)));
}
settings.endGroup();
settings.remove(deprecatedGroupName);

settings.beginGroup(_name);
for (const QPair<QString, QVariant>& pair: values) {
settings.setValue(pair.first, pair.second);
}
settings.endGroup();
}
}

DECLARE_SETTINGSFACT(AutoConnectSettings, autoConnectUDP)
Expand Down

0 comments on commit 98350a1

Please sign in to comment.