refactor: save aliases without restarting the core. remove unknown screens when saving the server config
This commit is contained in:
parent
8010d8a8b2
commit
55b6789728
3 changed files with 21 additions and 0 deletions
|
|
@ -352,3 +352,13 @@ QString Settings::portableSettingsFile()
|
||||||
QStringLiteral("%1/settings/%2.conf").arg(QCoreApplication::applicationDirPath(), kAppName);
|
QStringLiteral("%1/settings/%2.conf").arg(QCoreApplication::applicationDirPath(), kAppName);
|
||||||
return QFileInfo(filename).absoluteFilePath();
|
return QFileInfo(filename).absoluteFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::removeUnknownScreens(const QStringList &knownScreens)
|
||||||
|
{
|
||||||
|
const QStringList knownGroups = instance()->m_settings->childGroups();
|
||||||
|
for (const auto &group : knownGroups) {
|
||||||
|
if (m_validGroup.contains(group) || knownScreens.contains(group))
|
||||||
|
continue;
|
||||||
|
instance()->m_settings->remove(group);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,7 @@ public:
|
||||||
static QStringList validKeys();
|
static QStringList validKeys();
|
||||||
static QStringList validGroups();
|
static QStringList validGroups();
|
||||||
static QString portableSettingsFile();
|
static QString portableSettingsFile();
|
||||||
|
static void removeUnknownScreens(const QStringList &knownScreens);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void settingsChanged(const QString key);
|
void settingsChanged(const QString key);
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,16 @@ void ServerConfigDialog::accept()
|
||||||
Settings::setValue(Settings::Server::RelativeMouseMoves, m_relativeMouseMoves);
|
Settings::setValue(Settings::Server::RelativeMouseMoves, m_relativeMouseMoves);
|
||||||
Settings::setValue(Settings::Server::Win32KeepForeground, m_win32keepForeground);
|
Settings::setValue(Settings::Server::Win32KeepForeground, m_win32keepForeground);
|
||||||
|
|
||||||
|
QStringList screenNames;
|
||||||
|
const auto screenList = m_screenSetupModel.m_Screens;
|
||||||
|
for (const auto &screen : screenList) {
|
||||||
|
const auto &screenName = screen.name();
|
||||||
|
if (screenName.isEmpty())
|
||||||
|
continue;
|
||||||
|
screenNames.append(QStringLiteral("screen_%1").arg(screenName));
|
||||||
|
Settings::setValue(Settings::Screen::Aliases.arg(screenName), screen.aliases());
|
||||||
|
}
|
||||||
|
Settings::removeUnknownScreens(screenNames);
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue