1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 19:57:45 +00:00

Save the last profile selected in the launcher in the config

This commit is contained in:
Joshua Goins 2023-10-08 20:05:37 -04:00
parent 67dcd90058
commit 24f256338d
2 changed files with 9 additions and 0 deletions

View file

@ -22,6 +22,8 @@ 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>
</group> </group>
<group name="Developer"> <group name="Developer">
<entry name="KeepPatches" type="bool"> <entry name="KeepPatches" type="bool">

View file

@ -399,6 +399,11 @@ void LauncherCore::readInitialInformation()
} }
} }
// set default profile, if found
if (auto profile = m_profileManager->getProfileByUUID(m_config->currentProfile()); profile != nullptr) {
setCurrentProfile(profile);
}
m_loadingFinished = true; m_loadingFinished = true;
Q_EMIT loadingFinished(); Q_EMIT loadingFinished();
} }
@ -797,6 +802,8 @@ 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_config->setCurrentProfile(profile->uuid());
m_config->save();
Q_EMIT currentProfileChanged(); Q_EMIT currentProfileChanged();
} }
} }