mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-23 04:57:44 +00:00
Move CurrentProfile setting to astrastaterc
This commit is contained in:
parent
9156dd9c45
commit
22a99ecbd8
4 changed files with 17 additions and 4 deletions
|
@ -23,8 +23,6 @@ SPDX-License-Identifier: CC0-1.0
|
||||||
</entry>
|
</entry>
|
||||||
<entry name="AutoLoginProfile" type="String">
|
<entry name="AutoLoginProfile" type="String">
|
||||||
</entry>
|
</entry>
|
||||||
<entry name="CurrentProfile" type="String">
|
|
||||||
</entry>
|
|
||||||
<entry name="ScreenshotDir" type="String">
|
<entry name="ScreenshotDir" type="String">
|
||||||
<default code="true">QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + QDir::separator() + QStringLiteral("FFXIV")</default>
|
<default code="true">QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + QDir::separator() + QStringLiteral("FFXIV")</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
|
@ -63,6 +63,9 @@ public:
|
||||||
[[nodiscard]] bool argumentsEncrypted() const;
|
[[nodiscard]] bool argumentsEncrypted() const;
|
||||||
void setArgumentsEncrypted(bool value);
|
void setArgumentsEncrypted(bool value);
|
||||||
|
|
||||||
|
[[nodiscard]] QString currentProfile() const;
|
||||||
|
void setCurrentProfile(const QString &value);
|
||||||
|
|
||||||
Config *config();
|
Config *config();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
|
|
@ -42,7 +42,7 @@ LauncherCore::LauncherCore()
|
||||||
}
|
}
|
||||||
|
|
||||||
// set default profile, if found
|
// set default profile, if found
|
||||||
if (auto profile = m_profileManager->getProfileByUUID(m_settings->config()->currentProfile()); profile != nullptr) {
|
if (auto profile = m_profileManager->getProfileByUUID(m_settings->currentProfile()); profile != nullptr) {
|
||||||
setCurrentProfile(profile);
|
setCurrentProfile(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ void LauncherCore::setCurrentProfile(Profile *profile)
|
||||||
const int newIndex = m_profileManager->getProfileIndex(profile->uuid());
|
const int newIndex = m_profileManager->getProfileIndex(profile->uuid());
|
||||||
if (newIndex != m_currentProfileIndex) {
|
if (newIndex != m_currentProfileIndex) {
|
||||||
m_currentProfileIndex = newIndex;
|
m_currentProfileIndex = newIndex;
|
||||||
m_settings->config()->setCurrentProfile(profile->uuid());
|
m_settings->setCurrentProfile(profile->uuid());
|
||||||
m_settings->config()->save();
|
m_settings->config()->save();
|
||||||
Q_EMIT currentProfileChanged();
|
Q_EMIT currentProfileChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,6 +163,18 @@ void LauncherSettings::setArgumentsEncrypted(const bool value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString LauncherSettings::currentProfile() const
|
||||||
|
{
|
||||||
|
return KSharedConfig::openStateConfig()->group(QStringLiteral("General")).readEntry(QStringLiteral("CurrentProfile"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void LauncherSettings::setCurrentProfile(const QString &value)
|
||||||
|
{
|
||||||
|
auto stateConfig = KSharedConfig::openStateConfig();
|
||||||
|
stateConfig->group(QStringLiteral("General")).writeEntry(QStringLiteral("CurrentProfile"), value);
|
||||||
|
stateConfig->sync();
|
||||||
|
}
|
||||||
|
|
||||||
Config *LauncherSettings::config()
|
Config *LauncherSettings::config()
|
||||||
{
|
{
|
||||||
return m_config;
|
return m_config;
|
||||||
|
|
Loading…
Add table
Reference in a new issue