diff --git a/CHANGELOG.md b/CHANGELOG.md index 282a797a..f90a1c92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ======================== * Fix minimize to tray * Save coonfig in a sub-directory for each version. +* Add setting to disable tab dragging, because that might be the cause for tab + freezes +* Fix thumbnails for Stripchat 4.7.5 ======================== diff --git a/client/src/main/java/ctbrec/ui/CamrecApplication.java b/client/src/main/java/ctbrec/ui/CamrecApplication.java index bd7b1ce4..80f7df95 100644 --- a/client/src/main/java/ctbrec/ui/CamrecApplication.java +++ b/client/src/main/java/ctbrec/ui/CamrecApplication.java @@ -51,7 +51,6 @@ import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.*; -import javafx.scene.control.TabPane.TabDragPolicy; import javafx.scene.image.Image; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; @@ -78,6 +77,8 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import static ctbrec.event.Event.Type.*; +import static javafx.scene.control.TabPane.TabDragPolicy.FIXED; +import static javafx.scene.control.TabPane.TabDragPolicy.REORDER; public class CamrecApplication extends Application { @@ -145,8 +146,8 @@ public class CamrecApplication extends Application { if (Objects.equals("stage_restored", evt.get("event"))) { LOG.debug("Main stage restored"); Platform.runLater(() -> { - if (tabPane.getSelectionModel().getSelectedItem() instanceof TabSelectionListener) { - ((TabSelectionListener) tabPane.getSelectionModel().getSelectedItem()).selected(); + if (tabPane.getSelectionModel().getSelectedItem() instanceof TabSelectionListener listener) { + listener.selected(); } }); } @@ -240,7 +241,8 @@ public class CamrecApplication extends Application { tabPane.getTabs().add(new DonateTabFx()); tabPane.getTabs().add(new HelpTab()); tabPane.getTabs().add(new LoggingTab()); - tabPane.setTabDragPolicy(TabDragPolicy.REORDER); + tabPane.setTabDragPolicy(config.getSettings().tabsSortable ? REORDER : FIXED); + restoreTabOrder(); switchToStartTab(); writeColorSchemeStyleSheet(); @@ -289,7 +291,7 @@ public class CamrecApplication extends Application { private void setWindowMinimizeListener(Stage primaryStage) { primaryStage.iconifiedProperty().addListener((obs, oldV, newV) -> { - if (newV.booleanValue() && Config.getInstance().getSettings().minimizeToTray && primaryStage.isShowing()) { + if (Boolean.TRUE.equals(newV) && Config.getInstance().getSettings().minimizeToTray && primaryStage.isShowing()) { DesktopIntegration.minimizeToTray(primaryStage); suspendTabUpdates(); } @@ -299,11 +301,11 @@ public class CamrecApplication extends Application { private void tabChanged(ObservableValue ov, Tab from, Tab to) { try { - if (from instanceof TabSelectionListener) { - ((TabSelectionListener) from).deselected(); + if (from instanceof TabSelectionListener l) { + l.deselected(); } - if (to instanceof TabSelectionListener) { - ((TabSelectionListener) to).selected(); + if (to instanceof TabSelectionListener l) { + l.selected(); } } catch (Exception e) { LOG.error("Error switching tabs", e); @@ -359,8 +361,8 @@ public class CamrecApplication extends Application { tabOrder.clear(); for (Tab tab : tabPane.getTabs()) { tabOrder.add(tab.getText()); - if (tab instanceof ShutdownListener) { - ((ShutdownListener) tab).onShutdown(); + if (tab instanceof ShutdownListener l) { + l.onShutdown(); } } onlineMonitor.shutdown(); @@ -506,8 +508,8 @@ public class CamrecApplication extends Application { } } } - if (tabPane.getSelectionModel().getSelectedItem() instanceof TabSelectionListener) { - ((TabSelectionListener) tabPane.getSelectionModel().getSelectedItem()).selected(); + if (tabPane.getSelectionModel().getSelectedItem() instanceof TabSelectionListener l) { + l.selected(); } } @@ -611,6 +613,7 @@ public class CamrecApplication extends Application { return html_url; } + @SuppressWarnings("unused") public void setHtmlUrl(String htmlUrl) { this.html_url = htmlUrl; } diff --git a/client/src/main/java/ctbrec/ui/settings/SettingsTab.java b/client/src/main/java/ctbrec/ui/settings/SettingsTab.java index c739a14a..0b296235 100644 --- a/client/src/main/java/ctbrec/ui/settings/SettingsTab.java +++ b/client/src/main/java/ctbrec/ui/settings/SettingsTab.java @@ -116,6 +116,7 @@ public class SettingsTab extends Tab implements TabSelectionListener { private SimpleIntegerProperty playlistRequestTimeout; private SimpleBooleanProperty minimizeToTray; private SimpleBooleanProperty showGridLinesInTables; + private SimpleBooleanProperty tabsSortable; private SimpleIntegerProperty defaultPriority; private LocalTimeProperty timeoutRecordingStartingAt; private LocalTimeProperty timeoutRecordingEndingAt; @@ -193,6 +194,7 @@ public class SettingsTab extends Tab implements TabSelectionListener { timeoutRecordingEndingAt = new LocalTimeProperty(null, "timeoutRecordingEndingAt", settings.timeoutRecordingEndingAt); recordUntilDefaultDurationInMinutes = new SimpleLongProperty(null, "recordUntilDefaultDurationInMinutes", settings.recordUntilDefaultDurationInMinutes); dateTimeFormat = new SimpleStringProperty(null, "dateTimeFormat", settings.dateTimeFormat); + tabsSortable = new SimpleBooleanProperty(null, "tabsSortable", settings.tabsSortable); } private void createGui() { @@ -238,7 +240,8 @@ public class SettingsTab extends Tab implements TabSelectionListener { Setting.of("Total model count in title", totalModelCountInTitle, "Show the total number of models in the title bar"), Setting.of("Show active recordings counter in tray", showActiveRecordingsInTray, "Show the number of running recorings in the tray icon"), 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())), + Setting.of("Fast scroll speed", fastScrollSpeed, "Makes the thumbnail overviews scroll faster with the mouse wheel").needsRestart(), + Setting.of("Draggable tabs", tabsSortable, "Main tabs can be reordered").needsRestart())), Category.of("Recorder", Group.of("Recorder", Setting.of("Recordings Directory", recordingsDir), diff --git a/common/src/main/java/ctbrec/Settings.java b/common/src/main/java/ctbrec/Settings.java index 1a2b6c56..c3ab4f2e 100644 --- a/common/src/main/java/ctbrec/Settings.java +++ b/common/src/main/java/ctbrec/Settings.java @@ -185,6 +185,7 @@ public class Settings { public String stripchatPassword = ""; public boolean stripchatUseXhamster = false; public List tabOrder = new ArrayList<>(); + public boolean tabsSortable = true; public LocalTime timeoutRecordingStartingAt = LocalTime.of(0, 0); public LocalTime timeoutRecordingEndingAt = LocalTime.of(0, 0); public boolean totalModelCountInTitle = false;