From e46de02ee25739b36bd6ffc4e867b067bed0f277 Mon Sep 17 00:00:00 2001 From: Coelacanthus Date: Wed, 11 Nov 2020 19:56:37 +0800 Subject: [PATCH 1/4] refactor: basic read & write --- src/base/LemonConfig.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/base/LemonConfig.hpp b/src/base/LemonConfig.hpp index 142fcbff..77dd3551 100644 --- a/src/base/LemonConfig.hpp +++ b/src/base/LemonConfig.hpp @@ -42,7 +42,9 @@ namespace Lemon::base::config { private: QString language = "en_US"; // Prepare for theme setting - // QString theme = ; + // TODO: Theme support + QString theme = ""; + public: int read(const QJsonObject &json); void write(QJsonObject &json) const; From 0e98de1231a28d016a9b7bfecddd3d300eff8060 Mon Sep 17 00:00:00 2001 From: Coelacanthus Date: Sat, 28 Nov 2020 19:59:51 +0800 Subject: [PATCH 2/4] fix(config): add lost defaultExtraTimeRatio https://github.com/Project-LemonLime/Project_LemonLime/pull/92#discussion_r521367442 --- src/base/LemonConfig.cpp | 13 +++++++++++++ src/base/LemonConfig.hpp | 1 + 2 files changed, 14 insertions(+) diff --git a/src/base/LemonConfig.cpp b/src/base/LemonConfig.cpp index ad0d9c95..d793aaea 100644 --- a/src/base/LemonConfig.cpp +++ b/src/base/LemonConfig.cpp @@ -12,6 +12,7 @@ namespace Lemon::base::config { +<<<<<<< HEAD int LemonConfigJudge::read(const QJsonObject &json) { READ_JSON(json, defaultFullScore); READ_JSON(json, defaultTimeLimit); @@ -20,6 +21,18 @@ namespace Lemon::base::config { READ_JSON(json, specialJudgeTimeLimit); READ_JSON(json, fileSizeLimit); READ_JSON(json, rejudgeTimes); +======= + void LemonConfigJudge::read(const QJsonObject &json) { + READ_JSON_INT(defaultFullScore) + READ_JSON_INT(defaultTimeLimit) + READ_JSON_INT(defaultMemoryLimit) + READ_JSON_INT(compileTimeLimit) + READ_JSON_INT(specialJudgeTimeLimit) + READ_JSON_INT(fileSizeLimit) + READ_JSON_INT(rejudgeTimes) + + READ_JSON_DOUBLE(defaultExtraTimeRatio) +>>>>>>> 4862b98 (fix(config): add lost defaultExtraTimeRatio) READ_JSON(json, defaultInputFileExtension); READ_JSON(json, defaultOutputFileExtension); diff --git a/src/base/LemonConfig.hpp b/src/base/LemonConfig.hpp index 77dd3551..f1caa04d 100644 --- a/src/base/LemonConfig.hpp +++ b/src/base/LemonConfig.hpp @@ -26,6 +26,7 @@ namespace Lemon::base::config { int specialJudgeTimeLimit{}; int fileSizeLimit{}; int rejudgeTimes{}; + double defaultExtraTimeRatio{}; QString defaultInputFileExtension; QString defaultOutputFileExtension; QStringList inputFileExtensions; From 64d446bbebeca370e9c9b133ae3cd31342c4a2d2 Mon Sep 17 00:00:00 2001 From: Coelacanthus Date: Sat, 29 May 2021 00:40:52 +0800 Subject: [PATCH 3/4] fix: left git diff --- makespec/BUILDVERSION | 2 +- src/base/LemonConfig.cpp | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/makespec/BUILDVERSION b/makespec/BUILDVERSION index 897bdc82..dee261df 100644 --- a/makespec/BUILDVERSION +++ b/makespec/BUILDVERSION @@ -1 +1 @@ -139 +140 diff --git a/src/base/LemonConfig.cpp b/src/base/LemonConfig.cpp index d793aaea..ad0d9c95 100644 --- a/src/base/LemonConfig.cpp +++ b/src/base/LemonConfig.cpp @@ -12,7 +12,6 @@ namespace Lemon::base::config { -<<<<<<< HEAD int LemonConfigJudge::read(const QJsonObject &json) { READ_JSON(json, defaultFullScore); READ_JSON(json, defaultTimeLimit); @@ -21,18 +20,6 @@ namespace Lemon::base::config { READ_JSON(json, specialJudgeTimeLimit); READ_JSON(json, fileSizeLimit); READ_JSON(json, rejudgeTimes); -======= - void LemonConfigJudge::read(const QJsonObject &json) { - READ_JSON_INT(defaultFullScore) - READ_JSON_INT(defaultTimeLimit) - READ_JSON_INT(defaultMemoryLimit) - READ_JSON_INT(compileTimeLimit) - READ_JSON_INT(specialJudgeTimeLimit) - READ_JSON_INT(fileSizeLimit) - READ_JSON_INT(rejudgeTimes) - - READ_JSON_DOUBLE(defaultExtraTimeRatio) ->>>>>>> 4862b98 (fix(config): add lost defaultExtraTimeRatio) READ_JSON(json, defaultInputFileExtension); READ_JSON(json, defaultOutputFileExtension); From 58a91f2cc86cb298a8b4cd2c50672b4e86469531 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 28 May 2021 16:42:01 +0000 Subject: [PATCH 4/4] style: format codes --- src/base/LemonApplicationInterface.hpp | 2 +- src/base/LemonBaseApplication.cpp | 3 +-- src/base/LemonBaseApplication.hpp | 22 +++++++++++----------- src/base/LemonConfig.hpp | 2 +- src/base/LemonLog.hpp | 5 +++-- src/base/LemonMacro.hpp | 1 - 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/base/LemonApplicationInterface.hpp b/src/base/LemonApplicationInterface.hpp index a4754782..1552f537 100644 --- a/src/base/LemonApplicationInterface.hpp +++ b/src/base/LemonApplicationInterface.hpp @@ -7,9 +7,9 @@ #pragma once // -#include #include #include +#include namespace Lemon { struct LemonStartupArguments { diff --git a/src/base/LemonBaseApplication.cpp b/src/base/LemonBaseApplication.cpp index b4b9014f..509a233a 100644 --- a/src/base/LemonBaseApplication.cpp +++ b/src/base/LemonBaseApplication.cpp @@ -88,9 +88,8 @@ auto LemonBaseApplication::parseCommandLine(bool *canContinue, QString *errorMes return true; } - #define ProcessExtraStartupOptions(option) \ - DEBUG("Startup Options:" GEN_PAIR(parser.isSet(option##Option))); \ + DEBUG("Startup Options:" GEN_PAIR(parser.isSet(option##Option))); \ StartupArguments.option = parser.isSet(option##Option); ProcessExtraStartupOptions(debugLog); diff --git a/src/base/LemonBaseApplication.hpp b/src/base/LemonBaseApplication.hpp index 2cd83d2b..a4ba8e51 100644 --- a/src/base/LemonBaseApplication.hpp +++ b/src/base/LemonBaseApplication.hpp @@ -12,18 +12,18 @@ #include "base/LemonApplicationInterface.hpp" namespace Lemon { -class LemonBaseApplication : public SingleApplication, public LemonApplicationInterface { - Q_OBJECT + class LemonBaseApplication : public SingleApplication, public LemonApplicationInterface { + Q_OBJECT - public: - LemonBaseApplication(int &argc, char *argv[]) - : SingleApplication(argc, argv, true, User | ExcludeAppPath | ExcludeAppVersion), LemonApplicationInterface(){}; - virtual ~LemonBaseApplication(){}; + public: + LemonBaseApplication(int &argc, char *argv[]) + : SingleApplication(argc, argv, true, User | ExcludeAppPath | ExcludeAppVersion), + LemonApplicationInterface(){}; + virtual ~LemonBaseApplication(){}; - virtual bool Initialize() final; + virtual bool Initialize() final; - private: - bool parseCommandLine(bool *canContinue, QString *errorMessage); -}; + private: + bool parseCommandLine(bool *canContinue, QString *errorMessage); + }; } // namespace Lemon - diff --git a/src/base/LemonConfig.hpp b/src/base/LemonConfig.hpp index f1caa04d..6434b7fd 100644 --- a/src/base/LemonConfig.hpp +++ b/src/base/LemonConfig.hpp @@ -26,7 +26,7 @@ namespace Lemon::base::config { int specialJudgeTimeLimit{}; int fileSizeLimit{}; int rejudgeTimes{}; - double defaultExtraTimeRatio{}; + double defaultExtraTimeRatio{}; QString defaultInputFileExtension; QString defaultOutputFileExtension; QStringList inputFileExtensions; diff --git a/src/base/LemonLog.hpp b/src/base/LemonLog.hpp index 83211524..739c6e25 100644 --- a/src/base/LemonLog.hpp +++ b/src/base/LemonLog.hpp @@ -12,8 +12,8 @@ #include #include // -#include #include +#include #define NEWLINE "\r\n" #define ___LOG_EXPAND(___x) , QPair(std::string(#___x), [&] { return ___x; }()) @@ -56,7 +56,8 @@ namespace Lemon::base { logStream << NEWLINE; #ifndef QT_DEBUG // We only process DEBUG log in Release mode - if (t == LEMON_LOG_DEBUG && LemonCoreApplication && !LemonCoreApplication->StartupArguments.debugLog) { + if (t == LEMON_LOG_DEBUG && LemonCoreApplication && + ! LemonCoreApplication->StartupArguments.debugLog) { // Discard debug log in non-debug Lemon version with // no-debugLog mode. return; diff --git a/src/base/LemonMacro.hpp b/src/base/LemonMacro.hpp index 860ee43e..a27b54ec 100644 --- a/src/base/LemonMacro.hpp +++ b/src/base/LemonMacro.hpp @@ -5,7 +5,6 @@ * */ - #pragma once #define CONCATENATE1(arg1, arg2) CONCATENATE2(arg1, arg2)