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 SimpleIntegerProperty playlistRequestTimeout;
private SimpleBooleanProperty minimizeToTray;
private SimpleBooleanProperty showGridLinesInTables;
public SettingsTab(List<Site> 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),

View File

@ -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) {

View File

@ -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) {

View File

@ -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<JavaFxRecording, ModelName> name = new TableColumn<>("Model");
name.setId("name");
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.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<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 {
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<JavaFxModel> 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 -> {

View File

@ -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 = "";