Implement profile loading on service shutdown

This commit is contained in:
Adam Honse committed 2026-08-17 19:36:05 -05:00
1 parent 2d32510008
commit cf910d2616
6 files changed
+120 -3

No files matched your search

+19 -1
View File
@@ -60,9 +60,13 @@ ProfileManager::ProfileManager(const filesystem::path& config_dir)
profilemanager_settings_schema["resume_profile"]["type"] = "profile";
profilemanager_settings_schema["resume_profile"]["description"] = QT_TRANSLATE_NOOP("Settings", "Profile to load after system resumes from sleep");
profilemanager_settings_schema["service_shutdown_profile"]["title"] = QT_TRANSLATE_NOOP("Settings", "Load Profile on Service Shutdown");
profilemanager_settings_schema["service_shutdown_profile"]["type"] = "profile";
profilemanager_settings_schema["service_shutdown_profile"]["description"] = QT_TRANSLATE_NOOP("Settings", "Profile to load when the OpenRGB background service shuts down");
profilemanager_settings_schema["service_startup_profile"]["title"] = QT_TRANSLATE_NOOP("Settings", "Load Profile on Service Startup");
profilemanager_settings_schema["service_startup_profile"]["type"] = "profile";
profilemanager_settings_schema["service_startup_profile"]["description"] = QT_TRANSLATE_NOOP("Settings", "Profile to load when the OpenRGB background service starts");
profilemanager_settings_schema["service_startup_profile"]["description"] = QT_TRANSLATE_NOOP("Settings", "Profile to load when the OpenRGB background service starts up");
profilemanager_settings_schema["suspend_profile"]["title"] = QT_TRANSLATE_NOOP("Settings", "Load Profile on Suspend");
profilemanager_settings_schema["suspend_profile"]["type"] = "profile";
@@ -104,6 +108,15 @@ ProfileManager::ProfileManager(const filesystem::path& config_dir)
new_settings_keys = true;
}
if(!profilemanager_settings.contains("service_shutdown_profile"))
{
json profile;
profile["enabled"] = false;
profile["name"] = "";
profilemanager_settings["service_shutdown_profile"] = profile;
new_settings_keys = true;
}
if(!profilemanager_settings.contains("service_startup_profile"))
{
json profile;
@@ -400,6 +413,11 @@ bool ProfileManager::LoadAutoProfileResume()
return(LoadAutoProfile("resume_profile"));
}
bool ProfileManager::LoadAutoProfileServiceShutdown()
{
return(LoadAutoProfile("service_shutdown_profile"));
}
bool ProfileManager::LoadAutoProfileServiceStartup()
{
return(LoadAutoProfile("service_startup_profile"));