2026-07-09 09:17:30 +00:00
|
|
|
#pragma once
|
2026-07-10 00:38:23 -07:00
|
|
|
#include <QJsonObject>
|
2026-07-09 09:17:30 +00:00
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
|
|
class ConfigHelper
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
static ConfigHelper& instance();
|
|
|
|
|
QString getValue(const QString& section, const QString& key) const;
|
|
|
|
|
bool setValue(const QString& section, const QString& key, const QString& value);
|
|
|
|
|
QString configPath() const;
|
2026-07-10 00:38:23 -07:00
|
|
|
QString productConfigPath() const;
|
|
|
|
|
QString stateLocation() const;
|
2026-07-09 09:17:30 +00:00
|
|
|
QString installRoot() const;
|
|
|
|
|
QString runtimeRoot() const;
|
|
|
|
|
QString updateRoot() const;
|
|
|
|
|
QString runtimeRelativePath() const;
|
|
|
|
|
QString lastError() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
ConfigHelper();
|
2026-07-10 00:38:23 -07:00
|
|
|
bool loadProductConfig();
|
|
|
|
|
bool migrateLegacyStateIfNeeded();
|
|
|
|
|
bool initializeStateDefaults();
|
|
|
|
|
QString stateStorageKey(const QString& key) const;
|
|
|
|
|
QString stateValue(const QString& key) const;
|
|
|
|
|
bool writeStateValue(const QString& key, const QString& value);
|
|
|
|
|
static bool isMutableKey(const QString& key);
|
|
|
|
|
|
|
|
|
|
QString m_productConfigPath;
|
|
|
|
|
QString m_statePrefix;
|
|
|
|
|
QJsonObject m_productConfig;
|
|
|
|
|
QJsonObject m_initialState;
|
2026-07-09 09:17:30 +00:00
|
|
|
QString m_error;
|
|
|
|
|
};
|