From 716a6545e9f69666d2f555109504bca4b98a11e0 Mon Sep 17 00:00:00 2001
From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com>
Date: Wed, 30 Jan 2019 00:13:58 +0100
Subject: [PATCH] advanced; debug
---
.../main/java/gearth/protocol/HConnection.java | 2 +-
.../src/main/java/gearth/ui/extra/Extra.java | 18 +++++++++++++++---
.../main/resources/gearth/ui/extra/Extra.fxml | 2 +-
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/G-Earth/src/main/java/gearth/protocol/HConnection.java b/G-Earth/src/main/java/gearth/protocol/HConnection.java
index 9fce1b4..e5fa2de 100644
--- a/G-Earth/src/main/java/gearth/protocol/HConnection.java
+++ b/G-Earth/src/main/java/gearth/protocol/HConnection.java
@@ -101,7 +101,7 @@ public class HConnection {
}
- public final static boolean DEBUG = false;
+ public static boolean DEBUG = false;
private static final HostReplacer hostsReplacer = HostReplacerFactory.get();
private volatile boolean hostRedirected = false;
diff --git a/G-Earth/src/main/java/gearth/ui/extra/Extra.java b/G-Earth/src/main/java/gearth/ui/extra/Extra.java
index c978ad7..3e652a2 100644
--- a/G-Earth/src/main/java/gearth/ui/extra/Extra.java
+++ b/G-Earth/src/main/java/gearth/ui/extra/Extra.java
@@ -1,12 +1,11 @@
package gearth.ui.extra;
-import gearth.Main;
import gearth.misc.Cacher;
+import gearth.protocol.HConnection;
import gearth.ui.SubForm;
import gearth.ui.info.Info;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
-import javafx.event.ActionEvent;
import javafx.scene.control.*;
/**
@@ -30,7 +29,7 @@ public class Extra extends SubForm {
public TextField txt_mitmPort;
public CheckBox cbx_disableDecryption;
- public CheckBox txt_debug;
+ public CheckBox cbx_debug;
public void initialize() {
url_troubleshooting.setTooltip(new Tooltip("https://github.com/sirjonasxx/G-Earth/wiki/Troubleshooting"));
@@ -40,16 +39,29 @@ public class Extra extends SubForm {
if (notepadInitValue != null) {
txtarea_notepad.setText(notepadInitValue);
}
+
+ cbx_debug.selectedProperty().addListener(observable -> HConnection.DEBUG = cbx_debug.isSelected());
}
@Override
protected void onParentSet() {
parentController.getStage().setAlwaysOnTop(cbx_alwaysOnTop.isSelected());
cbx_alwaysOnTop.selectedProperty().addListener(observable -> parentController.getStage().setAlwaysOnTop(cbx_alwaysOnTop.isSelected()));
+
+ cbx_advanced.selectedProperty().addListener(observable -> updateAdvancedUI());
+ getHConnection().addStateChangeListener((oldState, newState) -> {
+ if (oldState == HConnection.State.NOT_CONNECTED || newState == HConnection.State.NOT_CONNECTED) {
+ updateAdvancedUI();
+ }
+ });
}
@Override
protected void onExit() {
Cacher.put(NOTEPAD_CACHE_KEY, txtarea_notepad.getText());
}
+
+ private void updateAdvancedUI() {
+
+ }
}
diff --git a/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml b/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml
index e4bf068..0184114 100644
--- a/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml
+++ b/G-Earth/src/main/resources/gearth/ui/extra/Extra.fxml
@@ -109,7 +109,7 @@
-
+