From 24f256338d1c52e913d9d6813414e645067c82b6 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 8 Oct 2023 20:05:37 -0400 Subject: [PATCH] Save the last profile selected in the launcher in the config --- launcher/config.kcfg | 2 ++ launcher/src/launchercore.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/launcher/config.kcfg b/launcher/config.kcfg index b7c2fd6..55b0399 100644 --- a/launcher/config.kcfg +++ b/launcher/config.kcfg @@ -22,6 +22,8 @@ SPDX-License-Identifier: CC0-1.0 + + diff --git a/launcher/src/launchercore.cpp b/launcher/src/launchercore.cpp index da67a63..1098d76 100755 --- a/launcher/src/launchercore.cpp +++ b/launcher/src/launchercore.cpp @@ -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; Q_EMIT loadingFinished(); } @@ -797,6 +802,8 @@ void LauncherCore::setCurrentProfile(Profile *profile) const int newIndex = m_profileManager->getProfileIndex(profile->uuid()); if (newIndex != m_currentProfileIndex) { m_currentProfileIndex = newIndex; + m_config->setCurrentProfile(profile->uuid()); + m_config->save(); Q_EMIT currentProfileChanged(); } }