lolautoaccept/include/config.h

55 lines
951 B
C
Raw Normal View History

2022-04-24 01:27:46 +02:00
#pragma once
#include <memory>
2022-04-24 01:27:46 +02:00
#include <QJsonObject>
2022-07-04 00:30:00 +02:00
#include "position.h"
2022-04-24 01:27:46 +02:00
class Config {
public:
struct StageConfig {
StageConfig();
StageConfig(const QJsonObject&);
operator QJsonObject() const;
std::vector<std::string> champs;
2022-07-04 17:50:18 +02:00
bool enabled = false;
2022-04-24 01:27:46 +02:00
};
2022-07-04 00:30:00 +02:00
struct PositionConfig {
PositionConfig();
PositionConfig(const QJsonObject&);
operator QJsonObject() const;
Position position; // top, bot, sup,...
StageConfig ban;
StageConfig pick;
};
2022-04-24 01:27:46 +02:00
struct RootConfig {
RootConfig();
RootConfig(const QJsonObject&);
operator QJsonObject() const;
std::shared_ptr<Config::PositionConfig> getPositionConfig(Position position);
2022-07-04 00:30:00 +02:00
std::vector<std::shared_ptr<PositionConfig>> positionConfigs;
2022-07-04 00:30:00 +02:00
2022-04-24 01:27:46 +02:00
bool enabledAutoAccept;
2022-08-26 13:47:21 +02:00
bool enabledSmiteWarn;
2022-04-24 01:27:46 +02:00
};
Config();
~Config();
bool load();
void save();
RootConfig& getConfig();
private:
std::string configFolderPath;
std::string configFilePath;
RootConfig root;
};