Add setting to hide the table grid

This commit is contained in:
0xb00bface 2021-08-27 15:54:07 +02:00
parent 6b66cc963a
commit 2e78eb9b37
7 changed files with 49 additions and 21 deletions

View File

@ -137,6 +137,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
private Label restartNotification; private Label restartNotification;
private SimpleIntegerProperty playlistRequestTimeout; private SimpleIntegerProperty playlistRequestTimeout;
private SimpleBooleanProperty minimizeToTray; private SimpleBooleanProperty minimizeToTray;
private SimpleBooleanProperty showGridLinesInTables;
public SettingsTab(List<Site> sites, Recorder recorder) { public SettingsTab(List<Site> sites, Recorder recorder) {
this.sites = sites; this.sites = sites;
@ -201,6 +202,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
recentlyWatched = new SimpleBooleanProperty(null, "recentlyWatched", settings.recentlyWatched); recentlyWatched = new SimpleBooleanProperty(null, "recentlyWatched", settings.recentlyWatched);
playlistRequestTimeout = new SimpleIntegerProperty(null, "playlistRequestTimeout", settings.playlistRequestTimeout); playlistRequestTimeout = new SimpleIntegerProperty(null, "playlistRequestTimeout", settings.playlistRequestTimeout);
minimizeToTray = new SimpleBooleanProperty(null, "minimizeToTray", settings.minimizeToTray); minimizeToTray = new SimpleBooleanProperty(null, "minimizeToTray", settings.minimizeToTray);
showGridLinesInTables = new SimpleBooleanProperty(null, "showGridLinesInTables", settings.showGridLinesInTables);
} }
private void createGui() { private void createGui() {
@ -214,25 +216,30 @@ public class SettingsTab extends Tab implements TabSelectionListener {
} }
var storage = new CtbrecPreferencesStorage(config); var storage = new CtbrecPreferencesStorage(config);
var prefs = Preferences.of(storage, Category.of("General", Group.of("General", Setting.of("User-Agent", httpUserAgent), var prefs = Preferences.of(storage,
Setting.of("User-Agent mobile", httpUserAgentMobile), Category.of("General",
Setting.of("Update overview interval (seconds)", overviewUpdateIntervalInSecs, "Update the thumbnail overviews every x seconds").needsRestart(), Group.of("General", Setting.of("User-Agent", httpUserAgent),
Setting.of("Update thumbnails", updateThumbnails, Setting.of("User-Agent mobile", httpUserAgentMobile),
"The overviews will still be updated, but the thumbnails won't be changed. This is useful for less powerful systems."), Setting.of("Update overview interval (seconds)", overviewUpdateIntervalInSecs, "Update the thumbnail overviews every x seconds").needsRestart(),
Setting.of("Display stream resolution in overview", determineResolution), Setting.of("Update thumbnails", updateThumbnails,
Setting.of("Manually select stream quality", chooseStreamQuality, "Opens a dialog to select the video resolution before recording"), "The overviews will still be updated, but the thumbnails won't be changed. This is useful for less powerful systems."),
Setting.of("Enable live previews (experimental)", livePreviews), Setting.of("Enable recently watched tab", recentlyWatched).needsRestart(), Setting.of("Manually select stream quality", chooseStreamQuality, "Opens a dialog to select the video resolution before recording"),
Setting.of("Add models from clipboard", monitorClipboard, "Monitor clipboard for model URLs and automatically add them to the recorder") Setting.of("Enable live previews (experimental)", livePreviews), Setting.of("Enable recently watched tab", recentlyWatched).needsRestart(),
.needsRestart(), Setting.of("Minimize to tray", minimizeToTray, "Removes the app from the task bar, if minimized"),
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("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("Show confirmation dialogs", confirmationDialogs, "Show confirmation dialogs for irreversible actions"), Setting.of("Start Tab", startTab)),
Setting.of("Total model count in title", totalModelCountInTitle, "Show the total number of models in the title bar"), Group.of("Player", Setting.of("Player", mediaPlayer), Setting.of("Start parameters", mediaPlayerParams),
Setting.of("Start Tab", startTab), Setting.of("Colors (Base / Accent)", new ColorSettingsPane(Config.getInstance())).needsRestart(), Setting.of("Maximum resolution (0 = unlimited)", maximumResolutionPlayer, "video height, e.g. 720 or 1080"),
Setting.of("Font", new FontSettingsPane(this, config)).needsRestart()), Setting.of("Show \"Player Starting\" Message", showPlayerStarting), Setting.of("Start only one player at a time", singlePlayer))),
Group.of("Player", Setting.of("Player", mediaPlayer), Setting.of("Start parameters", mediaPlayerParams), Category.of("Look & Feel",
Setting.of("Maximum resolution (0 = unlimited)", maximumResolutionPlayer, "video height, e.g. 720 or 1080"), Group.of("Look & Feel",
Setting.of("Show \"Player Starting\" Message", showPlayerStarting), Setting.of("Start only one player at a time", singlePlayer))), 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", Category.of("Recorder",
Group.of("Settings", Setting.of("Recordings Directory", recordingsDir), Setting.of("Directory Structure", directoryStructure), 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), Setting.of("Split recordings after", splitAfter).converter(SplitAfterOption.converter()).onChange(this::splitValuesChanged),

View File

@ -168,6 +168,7 @@ public class MyFreeCamsTableTab extends Tab implements TabSelectionListener {
} }
private void createGui() { private void createGui() {
Config config = Config.getInstance();
var layout = new BorderPane(); var layout = new BorderPane();
layout.setPadding(new Insets(5, 10, 10, 10)); layout.setPadding(new Insets(5, 10, 10, 10));
@ -202,6 +203,9 @@ public class MyFreeCamsTableTab extends Tab implements TabSelectionListener {
table.setItems(observableModels); table.setItems(observableModels);
table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
table.getSortOrder().addListener(createSortOrderChangedListener()); table.getSortOrder().addListener(createSortOrderChangedListener());
if (!config.getSettings().showGridLinesInTables) {
table.setStyle("-fx-table-cell-border-color: transparent;");
}
table.addEventHandler(ContextMenuEvent.CONTEXT_MENU_REQUESTED, event -> { table.addEventHandler(ContextMenuEvent.CONTEXT_MENU_REQUESTED, event -> {
popup = createContextMenu(); popup = createContextMenu();
if (popup != null) { if (popup != null) {

View File

@ -85,6 +85,7 @@ public class RecentlyWatchedTab extends Tab implements ShutdownListener {
} }
private void createGui() { private void createGui() {
Config config = Config.getInstance();
var layout = new BorderPane(); var layout = new BorderPane();
layout.setPadding(new Insets(5, 10, 10, 10)); layout.setPadding(new Insets(5, 10, 10, 10));
@ -108,6 +109,9 @@ public class RecentlyWatchedTab extends Tab implements ShutdownListener {
table.setItems(observableModels); table.setItems(observableModels);
table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
if (!config.getSettings().showGridLinesInTables) {
table.setStyle("-fx-table-cell-border-color: transparent;");
}
table.addEventHandler(ContextMenuEvent.CONTEXT_MENU_REQUESTED, event -> { table.addEventHandler(ContextMenuEvent.CONTEXT_MENU_REQUESTED, event -> {
popup = createContextMenu(); popup = createContextMenu();
if (popup != null) { if (popup != null) {

View File

@ -137,6 +137,10 @@ public class RecordingsTab extends Tab implements TabSelectionListener, Shutdown
table.setEditable(false); table.setEditable(false);
table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
if (!config.getSettings().showGridLinesInTables) {
table.setStyle("-fx-table-cell-border-color: transparent;");
}
TableColumn<JavaFxRecording, ModelName> name = new TableColumn<>("Model"); TableColumn<JavaFxRecording, ModelName> name = new TableColumn<>("Model");
name.setId("name"); name.setId("name");
name.setPrefWidth(200); name.setPrefWidth(200);

View File

@ -17,6 +17,7 @@ import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.classic.spi.IThrowableProxy; import ch.qos.logback.classic.spi.IThrowableProxy;
import ch.qos.logback.classic.spi.LoggingEvent; import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.classic.spi.StackTraceElementProxy; import ch.qos.logback.classic.spi.StackTraceElementProxy;
import ctbrec.Config;
import ctbrec.event.EventBusHolder; import ctbrec.event.EventBusHolder;
import ctbrec.ui.controls.CustomMouseBehaviorContextMenu; import ctbrec.ui.controls.CustomMouseBehaviorContextMenu;
import ctbrec.ui.controls.SearchBox; import ctbrec.ui.controls.SearchBox;
@ -85,7 +86,11 @@ public class LoggingTab extends Tab implements TabSelectionListener {
setText("Logging"); setText("Logging");
subscribeToEventBus(); subscribeToEventBus();
Config config = Config.getInstance();
table = new TableView<>(filteredEvents); table = new TableView<>(filteredEvents);
if (!config.getSettings().showGridLinesInTables) {
table.setStyle("-fx-table-cell-border-color: transparent;");
}
var idx = 0; var idx = 0;
TableColumn<LoggingEvent, String> level = createTableColumn("Level", 65, idx++); TableColumn<LoggingEvent, String> level = createTableColumn("Level", 65, idx++);

View File

@ -81,7 +81,7 @@ import javafx.util.Callback;
public abstract class AbstractRecordedModelsTab extends Tab implements TabSelectionListener { public abstract class AbstractRecordedModelsTab extends Tab implements TabSelectionListener {
private static final Logger LOG = LoggerFactory.getLogger(AbstractRecordedModelsTab.class); 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 ReentrantLock lock = new ReentrantLock();
protected ObservableList<JavaFxModel> observableModels = FXCollections.observableArrayList(); protected ObservableList<JavaFxModel> observableModels = FXCollections.observableArrayList();
@ -128,6 +128,7 @@ public abstract class AbstractRecordedModelsTab extends Tab implements TabSelect
} }
protected void createGui() { protected void createGui() {
Config config = Config.getInstance();
grid.setPadding(new Insets(5)); grid.setPadding(new Insets(5));
grid.setHgap(5); grid.setHgap(5);
grid.setVgap(5); grid.setVgap(5);
@ -138,7 +139,9 @@ public abstract class AbstractRecordedModelsTab extends Tab implements TabSelect
BorderPane.setMargin(scrollPane, new Insets(5)); BorderPane.setMargin(scrollPane, new Insets(5));
table.setEditable(true); 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); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
var previewPopupHandler = new PreviewPopupHandler(table); var previewPopupHandler = new PreviewPopupHandler(table);
table.setRowFactory(tableview -> { table.setRowFactory(tableview -> {

View File

@ -159,6 +159,7 @@ public class Settings {
public boolean removeRecordingAfterPostProcessing = false; public boolean removeRecordingAfterPostProcessing = false;
public boolean requireAuthentication = false; public boolean requireAuthentication = false;
public String servletContext = ""; public String servletContext = "";
public boolean showGridLinesInTables = true;
public boolean showPlayerStarting = false; public boolean showPlayerStarting = false;
public String showupUsername = ""; public String showupUsername = "";
public String showupPassword = ""; public String showupPassword = "";