-
-
Notifications
You must be signed in to change notification settings - Fork 188
/
ProfileManager.h
95 lines (80 loc) · 3.26 KB
/
ProfileManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*---------------------------------------------------------*\
| ProfileManager.h |
| |
| OpenRGB profile manager |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "filesystem.h"
class ProfileManagerInterface
{
public:
virtual bool SaveProfile
(
std::string profile_name,
bool sizes = false
) = 0;
virtual bool LoadProfile(std::string profile_name) = 0;
virtual bool LoadSizeFromProfile(std::string profile_name) = 0;
virtual void DeleteProfile(std::string profile_name) = 0;
virtual unsigned char * GetProfileListDescription() = 0;
std::vector<std::string> profile_list;
virtual bool LoadDeviceFromListWithOptions
(
std::vector<RGBController*>& temp_controllers,
std::vector<bool>& temp_controller_used,
RGBController* load_controller,
bool load_size,
bool load_settings
) = 0;
virtual std::vector<RGBController*> LoadProfileToList
(
std::string profile_name,
bool sizes = false
) = 0;
virtual void SetConfigurationDirectory(const filesystem::path& directory) = 0;
protected:
virtual ~ProfileManagerInterface() {};
};
class ProfileManager: public ProfileManagerInterface
{
public:
ProfileManager(const filesystem::path& config_dir);
~ProfileManager();
bool SaveProfile
(
std::string profile_name,
bool sizes = false
);
bool LoadProfile(std::string profile_name);
bool LoadSizeFromProfile(std::string profile_name);
void DeleteProfile(std::string profile_name);
unsigned char * GetProfileListDescription();
std::vector<std::string> profile_list;
bool LoadDeviceFromListWithOptions
(
std::vector<RGBController*>& temp_controllers,
std::vector<bool>& temp_controller_used,
RGBController* load_controller,
bool load_size,
bool load_settings
);
std::vector<RGBController*> LoadProfileToList
(
std::string profile_name,
bool sizes = false
);
void SetConfigurationDirectory(const filesystem::path& directory);
private:
filesystem::path configuration_directory;
void UpdateProfileList();
bool LoadProfileWithOptions
(
std::string profile_name,
bool load_size,
bool load_settings
);
};