temp-monitor/include/config_manager.h
Radek Davidek b03ba089f0 added GPU
2026-03-13 13:13:50 +01:00

67 lines
2.4 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 getWindowX() const { return windowX; }
int getWindowY() const { return windowY; }
bool hasWindowPosition() const { return hasSavedWindowPosition; }
int getPollingTime() const { return pollingTime; }
int getHistoryLength() const { return historyLength; }
bool getShowPerCoreMonitoring() const { return showPerCoreMonitoring; }
void setWindowWidth(int w) { windowWidth = w; }
void setWindowHeight(int h) { windowHeight = h; }
void setWindowX(int x) { windowX = x; hasSavedWindowPosition = true; }
void setWindowY(int y) { windowY = y; hasSavedWindowPosition = true; }
void clearWindowPosition() { hasSavedWindowPosition = false; }
void setPollingTime(int t) { pollingTime = t; }
void setHistoryLength(int m) { historyLength = m; }
void setShowPerCoreMonitoring(bool show) { showPerCoreMonitoring = show; }
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; }
// Get a configuration value by key (for general configuration options)
std::string getConfigValue(const std::string &key) const;
bool isGpuMonitoringEnabled() const;
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 windowX;
int windowY;
bool hasSavedWindowPosition;
int pollingTime;
int historyLength;
bool showPerCoreMonitoring;
std::map<std::string, std::string> sensorColors;
std::map<std::string, std::string> sensorNames;
std::map<std::string, bool> sensorEnabled;
};
#endif // CONFIG_MANAGER_H