Change option name to upper camel case style

This commit is contained in:
Calcitem 2021-02-28 10:55:30 +08:00
parent 6a5ff653e1
commit 7172e9bdb2
4 changed files with 82 additions and 82 deletions

View File

@ -167,17 +167,17 @@ void init(OptionsMap &o)
o["Shuffling"] << Option(true, on_random_move); o["Shuffling"] << Option(true, on_random_move);
// Rules // Rules
o["piecesCount"] << Option(12, 6, 12, on_piecesCount); o["PiecesCount"] << Option(12, 6, 12, on_piecesCount);
o["piecesAtLeastCount"] << Option(3, 3, 5, on_piecesAtLeastCount); o["PiecesAtLeastCount"] << Option(3, 3, 5, on_piecesAtLeastCount);
o["hasObliqueLines"] << Option(true, on_hasObliqueLines); o["HasObliqueLines"] << Option(true, on_hasObliqueLines);
o["hasBannedLocations"] << Option(true, on_hasBannedLocations); o["HasBannedLocations"] << Option(true, on_hasBannedLocations);
o["isDefenderMoveFirst"] << Option(true, on_isDefenderMoveFirst); o["IsDefenderMoveFirst"] << Option(true, on_isDefenderMoveFirst);
o["mayRemoveMultiple"] << Option(false, on_mayRemoveMultiple); o["MayRemoveMultiple"] << Option(false, on_mayRemoveMultiple);
o["mayRemoveFromMillsAlways"] << Option(true, on_mayRemoveFromMillsAlways); o["MayRemoveFromMillsAlways"] << Option(true, on_mayRemoveFromMillsAlways);
o["isBlackLoseButNotDrawWhenBoardFull"] << Option(true, on_isBlackLoseButNotDrawWhenBoardFull); o["IsBlackLoseButNotDrawWhenBoardFull"] << Option(true, on_isBlackLoseButNotDrawWhenBoardFull);
o["isLoseButNotChangeSideWhenNoWay"] << Option(true, on_isLoseButNotChangeSideWhenNoWay); o["IsLoseButNotChangeSideWhenNoWay"] << Option(true, on_isLoseButNotChangeSideWhenNoWay);
o["mayFly"] << Option(false, on_mayFly); o["MayFly"] << Option(false, on_mayFly);
o["maxStepsLedToDraw"] << Option(50, 30, 50, on_maxStepsLedToDraw); o["MaxStepsLedToDraw"] << Option(50, 30, 50, on_maxStepsLedToDraw);
} }

View File

@ -57,51 +57,51 @@ class Config {
static Future<void> loadProfile() async { static Future<void> loadProfile() async {
final profile = await Profile.shared(); final profile = await Profile.shared();
Config.toneEnabled = profile['toneEnabled'] ?? true; Config.toneEnabled = profile['ToneEnabled'] ?? true;
Config.thinkingTime = profile['thinkingTime'] ?? 5000; Config.thinkingTime = profile['ThinkingTime'] ?? 5000;
Config.aiMovesFirst = profile['aiMovesFirst'] ?? false; Config.aiMovesFirst = profile['AiMovesFirst'] ?? false;
Config.aiIsLazy = profile['aiIsLazy'] ?? false; Config.aiIsLazy = profile['AiIsLazy'] ?? false;
Config.skillLevel = profile['skillLevel'] ?? 20; Config.skillLevel = profile['SkillLevel'] ?? 20;
Config.isAutoRestart = profile['isAutoRestart'] ?? false; Config.isAutoRestart = profile['IsAutoRestart'] ?? false;
Config.isAutoChangeFirstMove = profile['isAutoChangeFirstMove'] ?? false; Config.isAutoChangeFirstMove = profile['IsAutoChangeFirstMove'] ?? false;
Config.resignIfMostLose = profile['resignIfMostLose'] ?? false; Config.resignIfMostLose = profile['ResignIfMostLose'] ?? false;
Config.shufflingEnabled = profile['shufflingEnabled'] ?? true; Config.shufflingEnabled = profile['ShufflingEnabled'] ?? true;
Config.learnEndgame = profile['learnEndgame'] ?? false; Config.learnEndgame = profile['LearnEndgame'] ?? false;
Config.idsEnabled = profile['idsEnabled'] ?? false; Config.idsEnabled = profile['IdsEnabled'] ?? false;
Config.depthExtension = profile['depthExtension'] ?? false; Config.depthExtension = profile['DepthExtension'] ?? false;
Config.openingBook = profile['openingBook'] ?? false; Config.openingBook = profile['OpeningBook'] ?? false;
// Color // Color
Config.boardLineColor = Config.boardLineColor =
profile['boardLineColor'] ?? UIColors.boardLineColor.value; profile['BoardLineColor'] ?? UIColors.boardLineColor.value;
Config.darkBackgroundColor = Config.darkBackgroundColor =
profile['darkBackgroundColor'] ?? UIColors.darkBackgroundColor.value; profile['DarkBackgroundColor'] ?? UIColors.darkBackgroundColor.value;
Config.boardBackgroundColor = Config.boardBackgroundColor =
profile['boardBackgroundColor'] ?? UIColors.boardBackgroundColor.value; profile['BoardBackgroundColor'] ?? UIColors.boardBackgroundColor.value;
// Rules // Rules
rule.piecesCount = Config.piecesCount = profile['piecesCount'] ?? 12; rule.piecesCount = Config.piecesCount = profile['PiecesCount'] ?? 12;
rule.piecesAtLeastCount = rule.piecesAtLeastCount =
Config.piecesAtLeastCount = profile['piecesAtLeastCount'] ?? 3; Config.piecesAtLeastCount = profile['PiecesAtLeastCount'] ?? 3;
rule.hasObliqueLines = rule.hasObliqueLines =
Config.hasObliqueLines = profile['hasObliqueLines'] ?? true; Config.hasObliqueLines = profile['HasObliqueLines'] ?? true;
rule.hasBannedLocations = rule.hasBannedLocations =
Config.hasBannedLocations = profile['hasBannedLocations'] ?? true; Config.hasBannedLocations = profile['HasBannedLocations'] ?? true;
rule.isDefenderMoveFirst = rule.isDefenderMoveFirst =
Config.isDefenderMoveFirst = profile['isDefenderMoveFirst'] ?? true; Config.isDefenderMoveFirst = profile['IsDefenderMoveFirst'] ?? true;
rule.mayRemoveMultiple = rule.mayRemoveMultiple =
Config.mayRemoveMultiple = profile['mayRemoveMultiple'] ?? false; Config.mayRemoveMultiple = profile['MayRemoveMultiple'] ?? false;
rule.mayRemoveFromMillsAlways = Config.mayRemoveFromMillsAlways = rule.mayRemoveFromMillsAlways = Config.mayRemoveFromMillsAlways =
profile['mayRemoveFromMillsAlways'] ?? true; profile['MayRemoveFromMillsAlways'] ?? true;
rule.isBlackLoseButNotDrawWhenBoardFull = rule.isBlackLoseButNotDrawWhenBoardFull =
Config.isBlackLoseButNotDrawWhenBoardFull = Config.isBlackLoseButNotDrawWhenBoardFull =
profile['isBlackLoseButNotDrawWhenBoardFull'] ?? true; profile['IsBlackLoseButNotDrawWhenBoardFull'] ?? true;
rule.isLoseButNotChangeSideWhenNoWay = rule.isLoseButNotChangeSideWhenNoWay =
Config.isLoseButNotChangeSideWhenNoWay = Config.isLoseButNotChangeSideWhenNoWay =
profile['isLoseButNotChangeSideWhenNoWay'] ?? true; profile['IsLoseButNotChangeSideWhenNoWay'] ?? true;
rule.mayFly = Config.mayFly = profile['mayFly'] ?? false; rule.mayFly = Config.mayFly = profile['MayFly'] ?? false;
rule.maxStepsLedToDraw = rule.maxStepsLedToDraw =
Config.maxStepsLedToDraw = profile['maxStepsLedToDraw'] ?? 50; Config.maxStepsLedToDraw = profile['MaxStepsLedToDraw'] ?? 50;
return true; return true;
} }
@ -109,39 +109,39 @@ class Config {
static Future<bool> save() async { static Future<bool> save() async {
final profile = await Profile.shared(); final profile = await Profile.shared();
profile['toneEnabled'] = Config.toneEnabled; profile['ToneEnabled'] = Config.toneEnabled;
profile['thinkingTime'] = Config.thinkingTime; profile['ThinkingTime'] = Config.thinkingTime;
profile['aiMovesFirst'] = Config.aiMovesFirst; profile['AiMovesFirst'] = Config.aiMovesFirst;
profile['aiIsLazy'] = Config.aiIsLazy; profile['AiIsLazy'] = Config.aiIsLazy;
profile['skillLevel'] = Config.skillLevel; profile['SkillLevel'] = Config.skillLevel;
profile['isAutoRestart'] = Config.isAutoRestart; profile['IsAutoRestart'] = Config.isAutoRestart;
profile['isAutoChangeFirstMove'] = Config.isAutoChangeFirstMove; profile['IsAutoChangeFirstMove'] = Config.isAutoChangeFirstMove;
profile['resignIfMostLose'] = Config.resignIfMostLose; profile['ResignIfMostLose'] = Config.resignIfMostLose;
profile['shufflingEnabled'] = Config.shufflingEnabled; profile['ShufflingEnabled'] = Config.shufflingEnabled;
profile['learnEndgame'] = Config.learnEndgame; profile['LearnEndgame'] = Config.learnEndgame;
profile['idsEnabled'] = Config.idsEnabled; profile['IdsEnabled'] = Config.idsEnabled;
profile['depthExtension'] = Config.depthExtension; profile['DepthExtension'] = Config.depthExtension;
profile['openingBook'] = Config.openingBook; profile['OpeningBook'] = Config.openingBook;
// Color // Color
profile['boardLineColor'] = Config.boardLineColor; profile['BoardLineColor'] = Config.boardLineColor;
profile['darkBackgroundColor'] = Config.darkBackgroundColor; profile['DarkBackgroundColor'] = Config.darkBackgroundColor;
profile['boardBackgroundColor'] = Config.boardBackgroundColor; profile['BoardBackgroundColor'] = Config.boardBackgroundColor;
// Rules // Rules
profile['piecesCount'] = Config.piecesCount; profile['PiecesCount'] = Config.piecesCount;
profile['piecesAtLeastCount'] = Config.piecesAtLeastCount; profile['PiecesAtLeastCount'] = Config.piecesAtLeastCount;
profile['hasObliqueLines'] = Config.hasObliqueLines; profile['HasObliqueLines'] = Config.hasObliqueLines;
profile['hasBannedLocations'] = Config.hasBannedLocations; profile['HasBannedLocations'] = Config.hasBannedLocations;
profile['isDefenderMoveFirst'] = Config.isDefenderMoveFirst; profile['IsDefenderMoveFirst'] = Config.isDefenderMoveFirst;
profile['mayRemoveMultiple'] = Config.mayRemoveMultiple; profile['MayRemoveMultiple'] = Config.mayRemoveMultiple;
profile['mayRemoveFromMillsAlways'] = Config.mayRemoveFromMillsAlways; profile['MayRemoveFromMillsAlways'] = Config.mayRemoveFromMillsAlways;
profile['isBlackLoseButNotDrawWhenBoardFull'] = profile['IsBlackLoseButNotDrawWhenBoardFull'] =
Config.isBlackLoseButNotDrawWhenBoardFull; Config.isBlackLoseButNotDrawWhenBoardFull;
profile['isLoseButNotChangeSideWhenNoWay'] = profile['IsLoseButNotChangeSideWhenNoWay'] =
Config.isLoseButNotChangeSideWhenNoWay; Config.isLoseButNotChangeSideWhenNoWay;
profile['mayFly'] = Config.mayFly; profile['MayFly'] = Config.mayFly;
profile['maxStepsLedToDraw'] = Config.maxStepsLedToDraw; profile['MaxStepsLedToDraw'] = Config.maxStepsLedToDraw;
profile.commit(); profile.commit();

View File

@ -105,26 +105,26 @@ class NativeEngine extends AiEngine {
await send('setoption name SkillLevel value ${Config.skillLevel}'); await send('setoption name SkillLevel value ${Config.skillLevel}');
await send('setoption name AiIsLazy value ${Config.aiIsLazy}'); await send('setoption name AiIsLazy value ${Config.aiIsLazy}');
await send('setoption name Shuffling value ${Config.shufflingEnabled}'); await send('setoption name Shuffling value ${Config.shufflingEnabled}');
await send('setoption name piecesCount value ${Config.piecesCount}'); await send('setoption name PiecesCount value ${Config.piecesCount}');
await send( await send(
'setoption name piecesAtLeastCount value ${Config.piecesAtLeastCount}'); 'setoption name PiecesAtLeastCount value ${Config.piecesAtLeastCount}');
await send( await send(
'setoption name hasObliqueLines value ${Config.hasObliqueLines}'); 'setoption name HasObliqueLines value ${Config.hasObliqueLines}');
await send( await send(
'setoption name hasBannedLocations value ${Config.hasBannedLocations}'); 'setoption name HasBannedLocations value ${Config.hasBannedLocations}');
await send( await send(
'setoption name isDefenderMoveFirst value ${Config.isDefenderMoveFirst}'); 'setoption name IsDefenderMoveFirst value ${Config.isDefenderMoveFirst}');
await send( await send(
'setoption name mayRemoveMultiple value ${Config.mayRemoveMultiple}'); 'setoption name MayRemoveMultiple value ${Config.mayRemoveMultiple}');
await send( await send(
'setoption name mayRemoveFromMillsAlways value ${Config.mayRemoveFromMillsAlways}'); 'setoption name MayRemoveFromMillsAlways value ${Config.mayRemoveFromMillsAlways}');
await send( await send(
'setoption name isBlackLoseButNotDrawWhenBoardFull value ${Config.isBlackLoseButNotDrawWhenBoardFull}'); 'setoption name IsBlackLoseButNotDrawWhenBoardFull value ${Config.isBlackLoseButNotDrawWhenBoardFull}');
await send( await send(
'setoption name isLoseButNotChangeSideWhenNoWay value ${Config.isLoseButNotChangeSideWhenNoWay}'); 'setoption name IsLoseButNotChangeSideWhenNoWay value ${Config.isLoseButNotChangeSideWhenNoWay}');
await send('setoption name mayFly value ${Config.mayFly}'); await send('setoption name MayFly value ${Config.mayFly}');
await send( await send(
'setoption name maxStepsLedToDraw value ${Config.maxStepsLedToDraw}'); 'setoption name MaxStepsLedToDraw value ${Config.maxStepsLedToDraw}');
} }
String getPositionFen(Position position) { String getPositionFen(Position position) {

View File

@ -128,8 +128,8 @@ void Game::loadSettings()
settings = new QSettings(SETTINGS_FILE, QSettings::IniFormat); settings = new QSettings(SETTINGS_FILE, QSettings::IniFormat);
setEngineBlack(empty? false : settings->value("Options/blackIsAiPlayer").toBool()); setEngineBlack(empty? false : settings->value("Options/BlackIsAiPlayer").toBool());
setEngineWhite(empty ? true : settings->value("Options/whiteIsAiPlayer").toBool()); setEngineWhite(empty ? true : settings->value("Options/WhiteIsAiPlayer").toBool());
setFixWindowSize(empty ? false : settings->value("Options/FixWindowSize").toBool()); setFixWindowSize(empty ? false : settings->value("Options/FixWindowSize").toBool());
setSound(empty ? true : settings->value("Options/Sound").toBool()); setSound(empty ? true : settings->value("Options/Sound").toBool());
setAnimation(empty ? true : settings->value("Options/Animation").toBool()); setAnimation(empty ? true : settings->value("Options/Animation").toBool());
@ -145,7 +145,7 @@ void Game::loadSettings()
setAutoRestart(empty ? false : settings->value("Options/AutoRestart").toBool()); setAutoRestart(empty ? false : settings->value("Options/AutoRestart").toBool());
setAutoChangeFirstMove(empty ? false : settings->value("Options/AutoChangeFirstMove").toBool()); setAutoChangeFirstMove(empty ? false : settings->value("Options/AutoChangeFirstMove").toBool());
setRule(empty ? DEFAULT_RULE_NUMBER : settings->value("Options/ruleNo").toInt()); setRule(empty ? DEFAULT_RULE_NUMBER : settings->value("Options/RuleNo").toInt());
} }
Game::~Game() Game::~Game()
@ -397,7 +397,7 @@ void Game::setRule(int ruleNo, int stepLimited /*= -1*/, int timeLimited /*= -1*
// Reset game // Reset game
gameReset(); gameReset();
settings->setValue("Options/ruleNo", ruleNo); settings->setValue("Options/RuleNo", ruleNo);
} }
void Game::setEngine(Color color, bool enabled) void Game::setEngine(Color color, bool enabled)
@ -416,13 +416,13 @@ void Game::setEngine(Color color, bool enabled)
void Game::setEngineBlack(bool enabled) void Game::setEngineBlack(bool enabled)
{ {
setEngine(BLACK, enabled); setEngine(BLACK, enabled);
settings->setValue("Options/blackIsAiPlayer", enabled); settings->setValue("Options/BlackIsAiPlayer", enabled);
} }
void Game::setEngineWhite(bool enabled) void Game::setEngineWhite(bool enabled)
{ {
setEngine(WHITE, enabled); setEngine(WHITE, enabled);
settings->setValue("Options/whiteIsAiPlayer", enabled); settings->setValue("Options/WhiteIsAiPlayer", enabled);
} }
void Game::setAiDepthTime(int time1, int time2) void Game::setAiDepthTime(int time1, int time2)