diff --git a/ProfileManager.cpp b/ProfileManager.cpp index 3467c0660..8158a73a6 100644 --- a/ProfileManager.cpp +++ b/ProfileManager.cpp @@ -163,6 +163,21 @@ ProfileManager::~ProfileManager() } +void ProfileManager::ApplyActiveProfilePluginData() +{ + /*-----------------------------------------------------*\ + | The server only sends profile data to the clients | + | connected at the time it loads, and plugins only | + | exist in the GUI, so read it back here | + \*-----------------------------------------------------*/ + if(!active_profile.empty() && ResourceManager::get()->IsLocalClient() && (ResourceManager::get()->GetLocalClient()->GetSupportsProfileManagerAPI())) + { + LOG_DEBUG("[%s] Reading active profile for plugin data: %s", PROFILEMANAGER, active_profile.c_str()); + + OnProfileLoaded(ResourceManager::get()->GetLocalClient()->ProfileManager_DownloadProfile(active_profile)); + } +} + void ProfileManager::ClearActiveProfile() { /*-------------------------------------------------*\ diff --git a/ProfileManager.h b/ProfileManager.h index b34e39d66..2888609d8 100644 --- a/ProfileManager.h +++ b/ProfileManager.h @@ -78,6 +78,8 @@ public: ProfileManager(const filesystem::path& config_dir); ~ProfileManager(); + void ApplyActiveProfilePluginData(); + void ClearActiveProfile(); void DeleteProfile(std::string profile_name); diff --git a/qt/OpenRGBDialog/OpenRGBDialog.cpp b/qt/OpenRGBDialog/OpenRGBDialog.cpp index 8ae25b520..c9cccfdf0 100644 --- a/qt/OpenRGBDialog/OpenRGBDialog.cpp +++ b/qt/OpenRGBDialog/OpenRGBDialog.cpp @@ -1633,10 +1633,13 @@ void OpenRGBDialog::onDetectionEnded() | Load plugins after the first detection (ONLY the | | first) | \*-----------------------------------------------------*/ + bool plugins_just_loaded = false; + if(!plugins_loaded) { plugin_manager->ScanAndLoadPlugins(); plugins_loaded = true; + plugins_just_loaded = true; PluginsPage->RefreshList(); } @@ -1648,7 +1651,16 @@ void OpenRGBDialog::onDetectionEnded() /*-----------------------------------------------------*\ | Load the on open automatic profile | \*-----------------------------------------------------*/ - ResourceManager::get()->GetProfileManager()->LoadAutoProfileOpen(); + bool open_profile_loaded = ResourceManager::get()->GetProfileManager()->LoadAutoProfileOpen(); + + /*-----------------------------------------------------*\ + | With no profile to open, the plugins that were just | + | loaded still need the active profile's plugin data | + \*-----------------------------------------------------*/ + if(plugins_just_loaded && !open_profile_loaded) + { + ResourceManager::get()->GetProfileManager()->ApplyActiveProfilePluginData(); + } } void OpenRGBDialog::MigrateLegacySettings()