forked from j62/ctbrec
Save and restore window size, location and maximized state
Save and restore window size, location and maximized state so that the window opens in the exact same state as when it has been closed.
This commit is contained in:
parent
7d36586b04
commit
9ba0fd624f
|
@ -2,6 +2,7 @@
|
||||||
========================
|
========================
|
||||||
* Added possibility to switch the video resolution for a recording
|
* Added possibility to switch the video resolution for a recording
|
||||||
* Added selection box below the overview pages to change the thumbnail size
|
* Added selection box below the overview pages to change the thumbnail size
|
||||||
|
* Save and restore window size, location and maximized state
|
||||||
|
|
||||||
1.4.2
|
1.4.2
|
||||||
========================
|
========================
|
||||||
|
|
|
@ -38,5 +38,9 @@ public class Settings {
|
||||||
public String proxyUser;
|
public String proxyUser;
|
||||||
public String proxyPassword;
|
public String proxyPassword;
|
||||||
public int thumbWidth = 180;
|
public int thumbWidth = 180;
|
||||||
|
public int windowWidth = 1340;
|
||||||
|
public int windowHeight = 800;
|
||||||
|
public boolean windowMaximized = false;
|
||||||
|
public int windowX;
|
||||||
|
public int windowY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class Launcher extends Application {
|
||||||
primaryStage.setTitle("CTB Recorder " + getVersion());
|
primaryStage.setTitle("CTB Recorder " + getVersion());
|
||||||
InputStream icon = getClass().getResourceAsStream("/icon.png");
|
InputStream icon = getClass().getResourceAsStream("/icon.png");
|
||||||
primaryStage.getIcons().add(new Image(icon));
|
primaryStage.getIcons().add(new Image(icon));
|
||||||
|
|
||||||
tabPane = new TabPane();
|
tabPane = new TabPane();
|
||||||
tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {
|
tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -93,7 +94,17 @@ public class Launcher extends Application {
|
||||||
tabPane.getTabs().add(settingsTab);
|
tabPane.getTabs().add(settingsTab);
|
||||||
tabPane.getTabs().add(new DonateTabFx());
|
tabPane.getTabs().add(new DonateTabFx());
|
||||||
|
|
||||||
primaryStage.setScene(new Scene(tabPane, 1340, 800));
|
int windowWidth = Config.getInstance().getSettings().windowWidth;
|
||||||
|
int windowHeight = Config.getInstance().getSettings().windowHeight;
|
||||||
|
primaryStage.setScene(new Scene(tabPane, windowWidth, windowHeight));
|
||||||
|
primaryStage.getScene().widthProperty().addListener((observable, oldVal, newVal) -> Config.getInstance().getSettings().windowWidth = newVal.intValue());
|
||||||
|
primaryStage.getScene().heightProperty().addListener((observable, oldVal, newVal) -> Config.getInstance().getSettings().windowHeight = newVal.intValue());
|
||||||
|
primaryStage.setMaximized(Config.getInstance().getSettings().windowMaximized);
|
||||||
|
primaryStage.maximizedProperty().addListener((observable, oldVal, newVal) -> Config.getInstance().getSettings().windowMaximized = newVal.booleanValue());
|
||||||
|
primaryStage.setX(Config.getInstance().getSettings().windowX);
|
||||||
|
primaryStage.setY(Config.getInstance().getSettings().windowY);
|
||||||
|
primaryStage.xProperty().addListener((observable, oldVal, newVal) -> Config.getInstance().getSettings().windowX = newVal.intValue());
|
||||||
|
primaryStage.yProperty().addListener((observable, oldVal, newVal) -> Config.getInstance().getSettings().windowY = newVal.intValue());
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
primaryStage.setOnCloseRequest((e) -> {
|
primaryStage.setOnCloseRequest((e) -> {
|
||||||
e.consume();
|
e.consume();
|
||||||
|
|
Loading…
Reference in New Issue