From 2e78eb9b37d2d3ae2ad4c4f037614df6774b72ba Mon Sep 17 00:00:00 2001 From: 0xb00bface <0xboobface@gmail.com> Date: Fri, 27 Aug 2021 15:54:07 +0200 Subject: [PATCH] Add setting to hide the table grid --- .../java/ctbrec/ui/settings/SettingsTab.java | 45 +++++++++++-------- .../sites/myfreecams/MyFreeCamsTableTab.java | 4 ++ .../ctbrec/ui/tabs/RecentlyWatchedTab.java | 4 ++ .../java/ctbrec/ui/tabs/RecordingsTab.java | 4 ++ .../ctbrec/ui/tabs/logging/LoggingTab.java | 5 +++ .../recorded/AbstractRecordedModelsTab.java | 7 ++- common/src/main/java/ctbrec/Settings.java | 1 + 7 files changed, 49 insertions(+), 21 deletions(-) diff --git a/client/src/main/java/ctbrec/ui/settings/SettingsTab.java b/client/src/main/java/ctbrec/ui/settings/SettingsTab.java index 65ad2871..9d928066 100644 --- a/client/src/main/java/ctbrec/ui/settings/SettingsTab.java +++ b/client/src/main/java/ctbrec/ui/settings/SettingsTab.java @@ -137,6 +137,7 @@ public class SettingsTab extends Tab implements TabSelectionListener { private Label restartNotification; private SimpleIntegerProperty playlistRequestTimeout; private SimpleBooleanProperty minimizeToTray; + private SimpleBooleanProperty showGridLinesInTables; public SettingsTab(List sites, Recorder recorder) { this.sites = sites; @@ -201,6 +202,7 @@ public class SettingsTab extends Tab implements TabSelectionListener { recentlyWatched = new SimpleBooleanProperty(null, "recentlyWatched", settings.recentlyWatched); playlistRequestTimeout = new SimpleIntegerProperty(null, "playlistRequestTimeout", settings.playlistRequestTimeout); minimizeToTray = new SimpleBooleanProperty(null, "minimizeToTray", settings.minimizeToTray); + showGridLinesInTables = new SimpleBooleanProperty(null, "showGridLinesInTables", settings.showGridLinesInTables); } private void createGui() { @@ -214,25 +216,30 @@ public class SettingsTab extends Tab implements TabSelectionListener { } var storage = new CtbrecPreferencesStorage(config); - var prefs = Preferences.of(storage, Category.of("General", Group.of("General", Setting.of("User-Agent", httpUserAgent), - Setting.of("User-Agent mobile", httpUserAgentMobile), - Setting.of("Update overview interval (seconds)", overviewUpdateIntervalInSecs, "Update the thumbnail overviews every x seconds").needsRestart(), - Setting.of("Update thumbnails", updateThumbnails, - "The overviews will still be updated, but the thumbnails won't be changed. This is useful for less powerful systems."), - Setting.of("Display stream resolution in overview", determineResolution), - Setting.of("Manually select stream quality", chooseStreamQuality, "Opens a dialog to select the video resolution before recording"), - Setting.of("Enable live previews (experimental)", livePreviews), Setting.of("Enable recently watched tab", recentlyWatched).needsRestart(), - Setting.of("Add models from clipboard", monitorClipboard, "Monitor clipboard for model URLs and automatically add them to the recorder") - .needsRestart(), - Setting.of("Minimize to tray", minimizeToTray, "Removes the app from the task bar, if minimized"), - Setting.of("Fast scroll speed", fastScrollSpeed, "Makes the thumbnail overviews scroll faster with the mouse wheel").needsRestart(), - Setting.of("Show confirmation dialogs", confirmationDialogs, "Show confirmation dialogs for irreversible actions"), - Setting.of("Total model count in title", totalModelCountInTitle, "Show the total number of models in the title bar"), - Setting.of("Start Tab", startTab), Setting.of("Colors (Base / Accent)", new ColorSettingsPane(Config.getInstance())).needsRestart(), - Setting.of("Font", new FontSettingsPane(this, config)).needsRestart()), - Group.of("Player", Setting.of("Player", mediaPlayer), Setting.of("Start parameters", mediaPlayerParams), - Setting.of("Maximum resolution (0 = unlimited)", maximumResolutionPlayer, "video height, e.g. 720 or 1080"), - Setting.of("Show \"Player Starting\" Message", showPlayerStarting), Setting.of("Start only one player at a time", singlePlayer))), + var prefs = Preferences.of(storage, + Category.of("General", + Group.of("General", Setting.of("User-Agent", httpUserAgent), + Setting.of("User-Agent mobile", httpUserAgentMobile), + Setting.of("Update overview interval (seconds)", overviewUpdateIntervalInSecs, "Update the thumbnail overviews every x seconds").needsRestart(), + Setting.of("Update thumbnails", updateThumbnails, + "The overviews will still be updated, but the thumbnails won't be changed. This is useful for less powerful systems."), + Setting.of("Manually select stream quality", chooseStreamQuality, "Opens a dialog to select the video resolution before recording"), + Setting.of("Enable live previews (experimental)", livePreviews), Setting.of("Enable recently watched tab", recentlyWatched).needsRestart(), + Setting.of("Minimize to tray", minimizeToTray, "Removes the app from the task bar, if minimized"), + Setting.of("Add models from clipboard", monitorClipboard, "Monitor clipboard for model URLs and automatically add them to the recorder").needsRestart(), + Setting.of("Show confirmation dialogs", confirmationDialogs, "Show confirmation dialogs for irreversible actions"), + Setting.of("Start Tab", startTab)), + Group.of("Player", Setting.of("Player", mediaPlayer), Setting.of("Start parameters", mediaPlayerParams), + Setting.of("Maximum resolution (0 = unlimited)", maximumResolutionPlayer, "video height, e.g. 720 or 1080"), + Setting.of("Show \"Player Starting\" Message", showPlayerStarting), Setting.of("Start only one player at a time", singlePlayer))), + Category.of("Look & Feel", + Group.of("Look & Feel", + Setting.of("Colors (Base / Accent)", new ColorSettingsPane(Config.getInstance())).needsRestart(), + Setting.of("Font", new FontSettingsPane(this, config)).needsRestart(), + Setting.of("Display stream resolution in overview", determineResolution), + Setting.of("Total model count in title", totalModelCountInTitle, "Show the total number of models in the title bar"), + Setting.of("Show grid lines in tables", showGridLinesInTables, "Show grid lines in tables").needsRestart(), + Setting.of("Fast scroll speed", fastScrollSpeed, "Makes the thumbnail overviews scroll faster with the mouse wheel").needsRestart())), Category.of("Recorder", Group.of("Settings", Setting.of("Recordings Directory", recordingsDir), Setting.of("Directory Structure", directoryStructure), Setting.of("Split recordings after", splitAfter).converter(SplitAfterOption.converter()).onChange(this::splitValuesChanged), diff --git a/client/src/main/java/ctbrec/ui/sites/myfreecams/MyFreeCamsTableTab.java b/client/src/main/java/ctbrec/ui/sites/myfreecams/MyFreeCamsTableTab.java index e4c6d784..ca4d7c60 100644 --- a/client/src/main/java/ctbrec/ui/sites/myfreecams/MyFreeCamsTableTab.java +++ b/client/src/main/java/ctbrec/ui/sites/myfreecams/MyFreeCamsTableTab.java @@ -168,6 +168,7 @@ public class MyFreeCamsTableTab extends Tab implements TabSelectionListener { } private void createGui() { + Config config = Config.getInstance(); var layout = new BorderPane(); layout.setPadding(new Insets(5, 10, 10, 10)); @@ -202,6 +203,9 @@ public class MyFreeCamsTableTab extends Tab implements TabSelectionListener { table.setItems(observableModels); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); table.getSortOrder().addListener(createSortOrderChangedListener()); + if (!config.getSettings().showGridLinesInTables) { + table.setStyle("-fx-table-cell-border-color: transparent;"); + } table.addEventHandler(ContextMenuEvent.CONTEXT_MENU_REQUESTED, event -> { popup = createContextMenu(); if (popup != null) { diff --git a/client/src/main/java/ctbrec/ui/tabs/RecentlyWatchedTab.java b/client/src/main/java/ctbrec/ui/tabs/RecentlyWatchedTab.java index b320aa15..d8164ad9 100644 --- a/client/src/main/java/ctbrec/ui/tabs/RecentlyWatchedTab.java +++ b/client/src/main/java/ctbrec/ui/tabs/RecentlyWatchedTab.java @@ -85,6 +85,7 @@ public class RecentlyWatchedTab extends Tab implements ShutdownListener { } private void createGui() { + Config config = Config.getInstance(); var layout = new BorderPane(); layout.setPadding(new Insets(5, 10, 10, 10)); @@ -108,6 +109,9 @@ public class RecentlyWatchedTab extends Tab implements ShutdownListener { table.setItems(observableModels); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); + if (!config.getSettings().showGridLinesInTables) { + table.setStyle("-fx-table-cell-border-color: transparent;"); + } table.addEventHandler(ContextMenuEvent.CONTEXT_MENU_REQUESTED, event -> { popup = createContextMenu(); if (popup != null) { diff --git a/client/src/main/java/ctbrec/ui/tabs/RecordingsTab.java b/client/src/main/java/ctbrec/ui/tabs/RecordingsTab.java index 367c3f2b..53e183b2 100644 --- a/client/src/main/java/ctbrec/ui/tabs/RecordingsTab.java +++ b/client/src/main/java/ctbrec/ui/tabs/RecordingsTab.java @@ -137,6 +137,10 @@ public class RecordingsTab extends Tab implements TabSelectionListener, Shutdown table.setEditable(false); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); + if (!config.getSettings().showGridLinesInTables) { + table.setStyle("-fx-table-cell-border-color: transparent;"); + } + TableColumn name = new TableColumn<>("Model"); name.setId("name"); name.setPrefWidth(200); diff --git a/client/src/main/java/ctbrec/ui/tabs/logging/LoggingTab.java b/client/src/main/java/ctbrec/ui/tabs/logging/LoggingTab.java index 60639fbf..c672cd32 100644 --- a/client/src/main/java/ctbrec/ui/tabs/logging/LoggingTab.java +++ b/client/src/main/java/ctbrec/ui/tabs/logging/LoggingTab.java @@ -17,6 +17,7 @@ import ch.qos.logback.classic.encoder.PatternLayoutEncoder; import ch.qos.logback.classic.spi.IThrowableProxy; import ch.qos.logback.classic.spi.LoggingEvent; import ch.qos.logback.classic.spi.StackTraceElementProxy; +import ctbrec.Config; import ctbrec.event.EventBusHolder; import ctbrec.ui.controls.CustomMouseBehaviorContextMenu; import ctbrec.ui.controls.SearchBox; @@ -85,7 +86,11 @@ public class LoggingTab extends Tab implements TabSelectionListener { setText("Logging"); subscribeToEventBus(); + Config config = Config.getInstance(); table = new TableView<>(filteredEvents); + if (!config.getSettings().showGridLinesInTables) { + table.setStyle("-fx-table-cell-border-color: transparent;"); + } var idx = 0; TableColumn level = createTableColumn("Level", 65, idx++); diff --git a/client/src/main/java/ctbrec/ui/tabs/recorded/AbstractRecordedModelsTab.java b/client/src/main/java/ctbrec/ui/tabs/recorded/AbstractRecordedModelsTab.java index 4698c853..28f5b64b 100644 --- a/client/src/main/java/ctbrec/ui/tabs/recorded/AbstractRecordedModelsTab.java +++ b/client/src/main/java/ctbrec/ui/tabs/recorded/AbstractRecordedModelsTab.java @@ -81,7 +81,7 @@ import javafx.util.Callback; public abstract class AbstractRecordedModelsTab extends Tab implements TabSelectionListener { private static final Logger LOG = LoggerFactory.getLogger(AbstractRecordedModelsTab.class); - private static Image SILHOUETTE = new Image(AbstractRecordedModelsTab.class.getResourceAsStream("/silhouette_256.png")); + private static final Image SILHOUETTE = new Image(AbstractRecordedModelsTab.class.getResourceAsStream("/silhouette_256.png")); protected ReentrantLock lock = new ReentrantLock(); protected ObservableList observableModels = FXCollections.observableArrayList(); @@ -128,6 +128,7 @@ public abstract class AbstractRecordedModelsTab extends Tab implements TabSelect } protected void createGui() { + Config config = Config.getInstance(); grid.setPadding(new Insets(5)); grid.setHgap(5); grid.setVgap(5); @@ -138,7 +139,9 @@ public abstract class AbstractRecordedModelsTab extends Tab implements TabSelect BorderPane.setMargin(scrollPane, new Insets(5)); table.setEditable(true); - //table.setStyle("-fx-table-cell-border-color: transparent;"); + if (!config.getSettings().showGridLinesInTables) { + table.setStyle("-fx-table-cell-border-color: transparent;"); + } table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); var previewPopupHandler = new PreviewPopupHandler(table); table.setRowFactory(tableview -> { diff --git a/common/src/main/java/ctbrec/Settings.java b/common/src/main/java/ctbrec/Settings.java index cd261877..09c3ba27 100644 --- a/common/src/main/java/ctbrec/Settings.java +++ b/common/src/main/java/ctbrec/Settings.java @@ -159,6 +159,7 @@ public class Settings { public boolean removeRecordingAfterPostProcessing = false; public boolean requireAuthentication = false; public String servletContext = ""; + public boolean showGridLinesInTables = true; public boolean showPlayerStarting = false; public String showupUsername = ""; public String showupPassword = "";