-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathLemonConfig.hpp
More file actions
68 lines (57 loc) · 1.39 KB
/
LemonConfig.hpp
File metadata and controls
68 lines (57 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* SPDX-FileCopyrightText: 2020-2021 Project LemonLime
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#pragma once
//
#include <base/LemonBase.hpp>
//
#include <QJsonObject>
class Compiler;
namespace Lemon::base::config {
class LemonConfigJudge {
private:
QList<Compiler *> compilerList;
int defaultFullScore{};
int defaultTimeLimit{};
int defaultMemoryLimit{};
int compileTimeLimit{};
int specialJudgeTimeLimit{};
int fileSizeLimit{};
int rejudgeTimes{};
double defaultExtraTimeRatio{};
QString defaultInputFileExtension;
QString defaultOutputFileExtension;
QStringList inputFileExtensions;
QStringList outputFileExtensions;
QStringList recentContest;
QString diffPath;
public:
int read(const QJsonObject &json);
void write(QJsonObject &json) const;
};
class LemonConfigUI {
private:
QString language = "en_US";
// Prepare for theme setting
// TODO: Theme support
QString theme = "";
public:
int read(const QJsonObject &json);
void write(QJsonObject &json) const;
};
class LemonConfig {
private:
LemonConfigJudge judgeConfig;
LemonConfigUI uiConfig;
int splashTime{};
public:
enum SaveFormat { Json, Binary, Yaml };
void read(const QJsonObject &json);
void write(QJsonObject &json) const;
bool loadConfig(SaveFormat saveFormat);
bool saveConfig(SaveFormat saveFormat) const;
};
} // namespace Lemon::base::config