mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-22 20:47:45 +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 name="AutoLoginProfile" type="String">
|
||||
</entry>
|
||||
<entry name="CurrentProfile" type="String">
|
||||
</entry>
|
||||
<entry name="ScreenshotDir" type="String">
|
||||
<default code="true">QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + QDir::separator() + QStringLiteral("FFXIV")</default>
|
||||
</entry>
|
||||
|
|
|
@ -63,6 +63,9 @@ public:
|
|||
[[nodiscard]] bool argumentsEncrypted() const;
|
||||
void setArgumentsEncrypted(bool value);
|
||||
|
||||
[[nodiscard]] QString currentProfile() const;
|
||||
void setCurrentProfile(const QString &value);
|
||||
|
||||
Config *config();
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -42,7 +42,7 @@ LauncherCore::LauncherCore()
|
|||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ void LauncherCore::setCurrentProfile(Profile *profile)
|
|||
const int newIndex = m_profileManager->getProfileIndex(profile->uuid());
|
||||
if (newIndex != m_currentProfileIndex) {
|
||||
m_currentProfileIndex = newIndex;
|
||||
m_settings->config()->setCurrentProfile(profile->uuid());
|
||||
m_settings->setCurrentProfile(profile->uuid());
|
||||
m_settings->config()->save();
|
||||
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()
|
||||
{
|
||||
return m_config;
|
||||
|
|
Loading…
Add table
Reference in a new issue