Skip to content

Commit 3f7c981

Browse files
Use up-to-date controller list in profile manager
1 parent 7a305b1 commit 3f7c981

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

ProfileManager.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace fs = std::experimental::filesystem;
1111

12-
ProfileManager::ProfileManager(std::vector<RGBController *>& control, std::string config_dir) : controllers(control)
12+
ProfileManager::ProfileManager(std::string config_dir)
1313
{
1414
configuration_directory = config_dir;
1515
UpdateProfileList();
@@ -22,6 +22,11 @@ ProfileManager::~ProfileManager()
2222

2323
bool ProfileManager::SaveProfile(std::string profile_name)
2424
{
25+
/*---------------------------------------------------------*\
26+
| Get the list of controllers from the resource manager |
27+
\*---------------------------------------------------------*/
28+
std::vector<RGBController *> controllers = ResourceManager::get()->GetRGBControllers();
29+
2530
/*---------------------------------------------------------*\
2631
| If a name was entered, save the profile file |
2732
\*---------------------------------------------------------*/
@@ -269,6 +274,11 @@ bool ProfileManager::LoadProfileWithOptions
269274

270275
std::string filename = configuration_directory + profile_name;
271276

277+
/*---------------------------------------------------------*\
278+
| Get the list of controllers from the resource manager |
279+
\*---------------------------------------------------------*/
280+
std::vector<RGBController *> controllers = ResourceManager::get()->GetRGBControllers();
281+
272282
/*---------------------------------------------------------*\
273283
| Open input file in binary mode |
274284
\*---------------------------------------------------------*/

ProfileManager.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class ProfileManager
66
{
77
public:
8-
ProfileManager(std::vector<RGBController *>& control, std::string config_dir);
8+
ProfileManager(std::string config_dir);
99
~ProfileManager();
1010

1111
bool SaveProfile(std::string profile_name);
@@ -31,9 +31,6 @@ class ProfileManager
3131

3232
void SetConfigurationDirectory(std::string directory);
3333

34-
protected:
35-
std::vector<RGBController *>& controllers;
36-
3734
private:
3835
std::string configuration_directory;
3936

ResourceManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ ResourceManager::ResourceManager()
5050
/*-------------------------------------------------------------------------*\
5151
| Load sizes list from file |
5252
\*-------------------------------------------------------------------------*/
53-
profile_manager = new ProfileManager(rgb_controllers, GetConfigurationDirectory());
53+
profile_manager = new ProfileManager(GetConfigurationDirectory());
5454
rgb_controllers_sizes = profile_manager->LoadProfileToList("sizes.ors");
5555

5656
/*-------------------------------------------------------------------------*\

0 commit comments

Comments
 (0)