From 1655ce1d01184392907926a5323ce3d35799ac9c Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Mon, 5 Nov 2018 20:30:57 +0100 Subject: [PATCH] hide logger tab when using UI logger, update uilogger, update packetloggerfactory --- .../src/main/java/gearth/ui/GEarthController.java | 5 +++++ .../logger/loggerdisplays/PacketLoggerFactory.java | 13 ++++++++++--- G-Earth/src/main/resources/gearth/ui/UiLogger.fxml | 6 +++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/G-Earth/src/main/java/gearth/ui/GEarthController.java b/G-Earth/src/main/java/gearth/ui/GEarthController.java index 00b9e7c..878523e 100644 --- a/G-Earth/src/main/java/gearth/ui/GEarthController.java +++ b/G-Earth/src/main/java/gearth/ui/GEarthController.java @@ -1,5 +1,6 @@ package gearth.ui; +import gearth.ui.logger.loggerdisplays.PacketLoggerFactory; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; import javafx.scene.layout.Pane; @@ -48,6 +49,10 @@ public class GEarthController { tabBar.getTabs().remove(tab_Settings); + if (PacketLoggerFactory.usesUIlogger()) { + tabBar.getTabs().remove(loggerController); + } + //custom header bar // final Point[] startpos = {null}; diff --git a/G-Earth/src/main/java/gearth/ui/logger/loggerdisplays/PacketLoggerFactory.java b/G-Earth/src/main/java/gearth/ui/logger/loggerdisplays/PacketLoggerFactory.java index bee5cda..2cd44d1 100644 --- a/G-Earth/src/main/java/gearth/ui/logger/loggerdisplays/PacketLoggerFactory.java +++ b/G-Earth/src/main/java/gearth/ui/logger/loggerdisplays/PacketLoggerFactory.java @@ -8,12 +8,19 @@ import gearth.misc.OSValidator; */ public class PacketLoggerFactory { + public static boolean usesUIlogger() { + return (!Main.hasFlag("-t")); + } + public static PacketLogger get() { - if (OSValidator.isUnix() && Main.hasFlag("-t")) { - return new LinuxTerminalLogger(); + if (usesUIlogger()) { + return new UiLogger(); } - return new UiLogger(); + if (OSValidator.isUnix()) { + return new LinuxTerminalLogger(); + } + return new SimpleTerminalLogger(); } } diff --git a/G-Earth/src/main/resources/gearth/ui/UiLogger.fxml b/G-Earth/src/main/resources/gearth/ui/UiLogger.fxml index 94b77a2..4fb5b4c 100644 --- a/G-Earth/src/main/resources/gearth/ui/UiLogger.fxml +++ b/G-Earth/src/main/resources/gearth/ui/UiLogger.fxml @@ -8,7 +8,7 @@ - + @@ -23,9 +23,9 @@ - + - +