lolautoaccept/include/config.h

78 lines
1.4 KiB
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"
2023-04-23 19:13:49 +02:00
#include "runepage.h"
2022-07-04 00:30:00 +02:00
2022-04-24 01:27:46 +02:00
class Config {
public:
struct StageConfig {
StageConfig();
StageConfig(const QJsonObject&);
operator QJsonObject() const;
2023-05-31 22:22:23 +02:00
std::vector<QString> 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;
};
2023-04-23 19:13:49 +02:00
struct RunePageConfig {
RunePageConfig();
2023-04-23 23:54:09 +02:00
RunePageConfig(QString name, const RunePage& rp);
2023-04-23 19:13:49 +02:00
RunePageConfig(const QJsonObject&);
operator QJsonObject() const;
QString name;
RunePage runepage;
};
2023-04-30 22:10:21 +02:00
struct GeneralRunePageConfig {
GeneralRunePageConfig();
GeneralRunePageConfig(const QJsonObject&);
operator QJsonObject() const;
bool autoSync;
std::vector<std::shared_ptr<RunePageConfig>> runePages;
};
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;
2023-04-30 22:10:21 +02:00
GeneralRunePageConfig runepagesConfig;
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-09-21 13:47:08 +02:00
bool enabledAutoWrite;
2023-04-23 23:54:09 +02:00
QString autoWriteText;
2022-04-24 01:27:46 +02:00
};
Config();
~Config();
bool load();
void save();
RootConfig& getConfig();
private:
2023-05-31 22:22:23 +02:00
QString configFolderPath;
QString configFilePath;
2022-04-24 01:27:46 +02:00
RootConfig root;
};