From 3f7c981ba2c1339b2eb5d0d957d4e3bdfad32094 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Wed, 2 Dec 2020 21:53:14 -0600 Subject: [PATCH] Use up-to-date controller list in profile manager --- ProfileManager.cpp | 12 +++++++++++- ProfileManager.h | 5 +---- ResourceManager.cpp | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ProfileManager.cpp b/ProfileManager.cpp index 64c6e413..5267f38d 100644 --- a/ProfileManager.cpp +++ b/ProfileManager.cpp @@ -9,7 +9,7 @@ namespace fs = std::experimental::filesystem; -ProfileManager::ProfileManager(std::vector& control, std::string config_dir) : controllers(control) +ProfileManager::ProfileManager(std::string config_dir) { configuration_directory = config_dir; UpdateProfileList(); @@ -22,6 +22,11 @@ ProfileManager::~ProfileManager() bool ProfileManager::SaveProfile(std::string profile_name) { + /*---------------------------------------------------------*\ + | Get the list of controllers from the resource manager | + \*---------------------------------------------------------*/ + std::vector controllers = ResourceManager::get()->GetRGBControllers(); + /*---------------------------------------------------------*\ | If a name was entered, save the profile file | \*---------------------------------------------------------*/ @@ -269,6 +274,11 @@ bool ProfileManager::LoadProfileWithOptions std::string filename = configuration_directory + profile_name; + /*---------------------------------------------------------*\ + | Get the list of controllers from the resource manager | + \*---------------------------------------------------------*/ + std::vector controllers = ResourceManager::get()->GetRGBControllers(); + /*---------------------------------------------------------*\ | Open input file in binary mode | \*---------------------------------------------------------*/ diff --git a/ProfileManager.h b/ProfileManager.h index e1dcea5c..c4202c27 100644 --- a/ProfileManager.h +++ b/ProfileManager.h @@ -5,7 +5,7 @@ class ProfileManager { public: - ProfileManager(std::vector& control, std::string config_dir); + ProfileManager(std::string config_dir); ~ProfileManager(); bool SaveProfile(std::string profile_name); @@ -31,9 +31,6 @@ public: void SetConfigurationDirectory(std::string directory); -protected: - std::vector& controllers; - private: std::string configuration_directory; diff --git a/ResourceManager.cpp b/ResourceManager.cpp index dcc8de23..1fce230b 100644 --- a/ResourceManager.cpp +++ b/ResourceManager.cpp @@ -50,7 +50,7 @@ ResourceManager::ResourceManager() /*-------------------------------------------------------------------------*\ | Load sizes list from file | \*-------------------------------------------------------------------------*/ - profile_manager = new ProfileManager(rgb_controllers, GetConfigurationDirectory()); + profile_manager = new ProfileManager(GetConfigurationDirectory()); rgb_controllers_sizes = profile_manager->LoadProfileToList("sizes.ors"); /*-------------------------------------------------------------------------*\