78 lines
1.4 KiB
C++
78 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <QJsonObject>
|
|
|
|
#include "position.h"
|
|
#include "runepage.h"
|
|
|
|
class Config {
|
|
public:
|
|
struct StageConfig {
|
|
StageConfig();
|
|
StageConfig(const QJsonObject&);
|
|
operator QJsonObject() const;
|
|
|
|
std::vector<QString> champs;
|
|
bool enabled = false;
|
|
};
|
|
|
|
struct PositionConfig {
|
|
PositionConfig();
|
|
PositionConfig(const QJsonObject&);
|
|
operator QJsonObject() const;
|
|
|
|
Position position; // top, bot, sup,...
|
|
|
|
StageConfig ban;
|
|
StageConfig pick;
|
|
};
|
|
|
|
struct RunePageConfig {
|
|
RunePageConfig();
|
|
RunePageConfig(QString name, const RunePage& rp);
|
|
RunePageConfig(const QJsonObject&);
|
|
operator QJsonObject() const;
|
|
|
|
QString name;
|
|
RunePage runepage;
|
|
};
|
|
|
|
struct GeneralRunePageConfig {
|
|
GeneralRunePageConfig();
|
|
GeneralRunePageConfig(const QJsonObject&);
|
|
operator QJsonObject() const;
|
|
|
|
bool autoSync;
|
|
std::vector<std::shared_ptr<RunePageConfig>> runePages;
|
|
};
|
|
|
|
struct RootConfig {
|
|
RootConfig();
|
|
RootConfig(const QJsonObject&);
|
|
operator QJsonObject() const;
|
|
|
|
std::shared_ptr<Config::PositionConfig> getPositionConfig(Position position);
|
|
|
|
std::vector<std::shared_ptr<PositionConfig>> positionConfigs;
|
|
GeneralRunePageConfig runepagesConfig;
|
|
|
|
bool enabledAutoAccept;
|
|
bool enabledSmiteWarn;
|
|
bool enabledAutoWrite;
|
|
QString autoWriteText;
|
|
};
|
|
|
|
Config();
|
|
~Config();
|
|
|
|
bool load();
|
|
void save();
|
|
|
|
RootConfig& getConfig();
|
|
private:
|
|
QString configFolderPath;
|
|
QString configFilePath;
|
|
RootConfig root;
|
|
};
|