temp-monitor/include/config_manager.h
2026-01-14 19:48:00 +01:00

51 lines
1.6 KiB
C++

#ifndef CONFIG_MANAGER_H
#define CONFIG_MANAGER_H
#include <string>
#include <map>
class ConfigManager {
public:
ConfigManager();
// Load configuration
void load();
// Save configuration
void save();
// Getters and setters
int getWindowWidth() const { return windowWidth; }
int getWindowHeight() const { return windowHeight; }
int getPollingTime() const { return pollingTime; }
int getHistoryLength() const { return historyLength; }
void setWindowWidth(int w) { windowWidth = w; }
void setWindowHeight(int h) { windowHeight = h; }
void setPollingTime(int t) { pollingTime = t; }
void setHistoryLength(int m) { historyLength = m; }
std::map<std::string, std::string> getSensorColors() const { return sensorColors; }
std::map<std::string, std::string> getSensorNames() const { return sensorNames; }
std::map<std::string, bool> getSensorEnabled() const { return sensorEnabled; }
void setSensorColor(const std::string &id, const std::string &color) { sensorColors[id] = color; }
void setSensorName(const std::string &id, const std::string &name) { sensorNames[id] = name; }
void setSensorEnabled(const std::string &id, bool enabled) { sensorEnabled[id] = enabled; }
private:
std::string getConfigFilePath() const;
mutable std::string cachedConfigPath;
int windowWidth;
int windowHeight;
int pollingTime;
int historyLength;
std::map<std::string, std::string> sensorColors;
std::map<std::string, std::string> sensorNames;
std::map<std::string, bool> sensorEnabled;
};
#endif // CONFIG_MANAGER_H