Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore all checks in View > Panel at startup for #777 #778

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions src/main/java/featurecat/lizzie/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,28 +322,28 @@ public void toggleShowBranch() {
}

public void toggleShowCaptured() {
this.showCaptured = !this.showCaptured;
this.showCaptured = toggleUIConfig("show-captured");
}

public void toggleShowWinrate() {
this.showWinrate = !this.showWinrate;
this.showWinrate = toggleUIConfig("show-winrate");
}

public void toggleLargeWinrate() {
this.largeSubBoard = false;
this.largeWinrate = !this.largeWinrate;
this.largeSubBoard = setUIConfigBoolean("large-subboard", false);
this.largeWinrate = toggleUIConfig("large-winrate");
}

public void toggleShowLcbWinrate() {
this.showLcbWinrate = !this.showLcbWinrate;
}

public void toggleShowVariationGraph() {
this.showVariationGraph = !this.showVariationGraph;
this.showVariationGraph = toggleUIConfig("show-variation-graph");
}

public void toggleShowComment() {
this.showComment = !this.showComment;
this.showComment = toggleUIConfig("show-comment");
}

public void toggleShowCommentNodeColor() {
Expand All @@ -363,8 +363,8 @@ public void toggleHandicapInsteadOfWinrate() {
}

public void toggleLargeSubBoard() {
this.largeWinrate = false;
this.largeSubBoard = !this.largeSubBoard;
this.largeWinrate = setUIConfigBoolean("large-winrate", false);
this.largeSubBoard = toggleUIConfig("large-subboard");
}

public void toggleCoordinates() {
Expand All @@ -376,7 +376,7 @@ public void toggleEvaluationColoring() {
}

public void toggleShowSubBoard() {
showSubBoard = !showSubBoard;
showSubBoard = toggleUIConfig("show-subboard");
}

public void toggleShowPolicy() {
Expand Down Expand Up @@ -424,13 +424,16 @@ public void toggleKataGoEstimateBlend() {
}

public void toggleShowStatus() {
this.showStatus = !this.showStatus;
Lizzie.config.uiConfig.put("show-status", showStatus);
try {
Lizzie.config.save();
} catch (IOException e) {
e.printStackTrace();
}
this.showStatus = toggleUIConfig("show-status");
}

private boolean toggleUIConfig(String key) {
return setUIConfigBoolean(key, !uiConfig.getBoolean(key));
}

private boolean setUIConfigBoolean(String key, boolean value) {
uiConfig.put(key, value);
return value;
}

public boolean showLargeSubBoard() {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/featurecat/lizzie/Lizzie.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void main(String[] args) throws IOException {
config = new Config();
frame = config.panelUI ? new LizzieMain() : new LizzieFrame();
gtpConsole = new GtpConsolePane(frame);
gtpConsole.setVisible(config.leelazConfig.optBoolean("print-comms", false));
gtpConsole.setVisible(config.persistedUi.optBoolean("gtp-console-opened", false));
initializeEngineManager();
}

Expand Down Expand Up @@ -89,6 +89,7 @@ public static void shutdown() {
board.autosaveToMemory();

try {
config.save();
config.persist();
} catch (IOException e) {
e.printStackTrace(); // Failed to save config
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/featurecat/lizzie/util/WindowPosition.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static JSONObject create(JSONObject ui) {

ui.put("window-maximized", false);
ui.put("toolbar-position", "South");
ui.put("gtp-console-opened", false);

return ui;
}
Expand All @@ -52,6 +53,7 @@ public static JSONObject save(JSONObject ui) {
ui.put("window-maximized", windowIsMaximized);
ui.put("toolbar-position", Lizzie.config.toolbarPosition);
ui.put("board-position-proportion", Lizzie.frame.boardPositionProportion);
ui.put("gtp-console-opened", Lizzie.gtpConsole.isVisible());

JSONArray mainPos = new JSONArray();
if (!windowIsMaximized) {
Expand Down