Make main tabs rearrangable
This commit is contained in:
parent
74e70074ba
commit
8517b7e8ad
|
@ -1,3 +1,7 @@
|
|||
4.5.1
|
||||
========================
|
||||
* Main tabs can now be rearranged
|
||||
|
||||
4.5.0
|
||||
========================
|
||||
* Added portrait column to Recording tab. The image to show can be selected in
|
||||
|
|
|
@ -81,6 +81,7 @@ import javafx.scene.control.ButtonType;
|
|||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TabPane;
|
||||
import javafx.scene.control.TabPane.TabDragPolicy;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
|
@ -243,7 +244,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);
|
||||
restoreTabOrder();
|
||||
switchToStartTab();
|
||||
writeColorSchemeStyleSheet();
|
||||
var base = Color.web(Config.getInstance().getSettings().colorBase);
|
||||
|
@ -346,10 +348,12 @@ public class CamrecApplication extends Application {
|
|||
shutdownInfo.setTitle("Shutdown");
|
||||
shutdownInfo.setContentText("Shutting down. Please wait while recordings are finished...");
|
||||
shutdownInfo.show();
|
||||
|
||||
final boolean immediately = shutdownNow;
|
||||
new Thread(() -> {
|
||||
List<String> tabOrder = Config.getInstance().getSettings().tabOrder;
|
||||
tabOrder.clear();
|
||||
for (Tab tab : tabPane.getTabs()) {
|
||||
tabOrder.add(tab.getText());
|
||||
if (tab instanceof ShutdownListener) {
|
||||
((ShutdownListener) tab).onShutdown();
|
||||
}
|
||||
|
@ -469,6 +473,23 @@ public class CamrecApplication extends Application {
|
|||
}
|
||||
}
|
||||
|
||||
private void restoreTabOrder() {
|
||||
List<String> tabOrder = Config.getInstance().getSettings().tabOrder;
|
||||
for (int i = 0; i < tabOrder.size(); i++) {
|
||||
Tab matched = null;
|
||||
for (Tab tab : tabPane.getTabs()) {
|
||||
if (Objects.equals(tabOrder.get(i), tab.getText())) {
|
||||
matched = tab;
|
||||
}
|
||||
}
|
||||
if (matched != null) {
|
||||
tabPane.getTabs().remove(matched);
|
||||
int max = tabPane.getTabs().size();
|
||||
tabPane.getTabs().add(Math.min(i, max), matched);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void switchToStartTab() {
|
||||
String startTab = Config.getInstance().getSettings().startTab;
|
||||
if (StringUtil.isNotBlank(startTab)) {
|
||||
|
|
|
@ -172,6 +172,7 @@ public class Settings {
|
|||
public String stripchatUsername = "";
|
||||
public String stripchatPassword = "";
|
||||
public boolean stripchatUseXhamster = false;
|
||||
public List<String> tabOrder = new ArrayList<>();
|
||||
public boolean totalModelCountInTitle = false;
|
||||
public boolean transportLayerSecurity = true;
|
||||
public int thumbWidth = 180;
|
||||
|
|
Loading…
Reference in New Issue