code clean up
* cleaned up the playBtn code * added language section in settings
This commit is contained in:
parent
595bfbe07d
commit
fc0be39455
|
@ -51,13 +51,11 @@ import javafx.scene.layout.AnchorPane;
|
||||||
|
|
||||||
public class Main extends Application {
|
public class Main extends Application {
|
||||||
|
|
||||||
private Stage primaryStage; // TODO same as #Test01
|
private Stage primaryStage;
|
||||||
private MainWindowController mainWindowController; // TODO Needs more testing: if cemu_UI will work as
|
private MainWindowController mainWindowController;
|
||||||
//normally expected this waring can be removed #Test01
|
private CloudController cloudController;
|
||||||
// if not working correctly remove private!
|
private AnchorPane pane;
|
||||||
private CloudController cloudController; // TODO same as #Test01
|
private Scene scene;
|
||||||
private AnchorPane pane; // TODO same as #Test01
|
|
||||||
private Scene scene; // TODO same as #Test01
|
|
||||||
private static String userHome = System.getProperty("user.home");
|
private static String userHome = System.getProperty("user.home");
|
||||||
private static String userName = System.getProperty("user.name");
|
private static String userName = System.getProperty("user.name");
|
||||||
private static String osName = System.getProperty("os.name");
|
private static String osName = System.getProperty("os.name");
|
||||||
|
@ -234,8 +232,6 @@ public class Main extends Application {
|
||||||
@Override
|
@Override
|
||||||
public void changed(ObservableValue<? extends Number> observable, Number oldValue, final Number newValue) {
|
public void changed(ObservableValue<? extends Number> observable, Number oldValue, final Number newValue) {
|
||||||
int xPosHelperMax = (int) Math.floor((mainWindowController.getMainAnchorPane().getWidth() - 36) / 217);
|
int xPosHelperMax = (int) Math.floor((mainWindowController.getMainAnchorPane().getWidth() - 36) / 217);
|
||||||
|
|
||||||
mainWindowController.refreshplayBtnPosition();
|
|
||||||
|
|
||||||
// call only if there is enough space for a new row
|
// call only if there is enough space for a new row
|
||||||
if (mainWindowController.getOldXPosHelper() != xPosHelperMax) {
|
if (mainWindowController.getOldXPosHelper() != xPosHelperMax) {
|
||||||
|
|
|
@ -170,6 +170,9 @@ public class MainWindowController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private JFXToggleButton fullscreenToggleBtn;
|
private JFXToggleButton fullscreenToggleBtn;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ChoiceBox<String> languageChoisBox;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private ChoiceBox<String> branchChoisBox;
|
private ChoiceBox<String> branchChoisBox;
|
||||||
|
@ -203,6 +206,9 @@ public class MainWindowController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private HBox topHBox;
|
private HBox topHBox;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private HBox bottomHBox;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private ImageView smmdbImageView;
|
private ImageView smmdbImageView;
|
||||||
|
@ -221,6 +227,9 @@ public class MainWindowController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Label mainColorLbl;
|
private Label mainColorLbl;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Label languageLbl;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Label updateLbl;
|
private Label updateLbl;
|
||||||
|
@ -276,7 +285,7 @@ public class MainWindowController {
|
||||||
private String selectedGameTitle;
|
private String selectedGameTitle;
|
||||||
private String id;
|
private String id;
|
||||||
private String version = "0.2.2";
|
private String version = "0.2.2";
|
||||||
private String buildNumber = "065";
|
private String buildNumber = "067";
|
||||||
private String versionName = "Puzzle Plank Galaxy";
|
private String versionName = "Puzzle Plank Galaxy";
|
||||||
private int xPos = -200;
|
private int xPos = -200;
|
||||||
private int yPos = 17;
|
private int yPos = 17;
|
||||||
|
@ -295,6 +304,7 @@ public class MainWindowController {
|
||||||
private File pictureCacheWin = new File(dirWin + "/picture_cache");
|
private File pictureCacheWin = new File(dirWin + "/picture_cache");
|
||||||
private File pictureCacheLinux = new File(dirLinux + "/picture_cache");
|
private File pictureCacheLinux = new File(dirLinux + "/picture_cache");
|
||||||
private ObservableList<String> branches = FXCollections.observableArrayList("stable", "beta");
|
private ObservableList<String> branches = FXCollections.observableArrayList("stable", "beta");
|
||||||
|
private ObservableList<String> languages = FXCollections.observableArrayList("english", "deutsch");
|
||||||
private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); // TODO add more IDs
|
private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); // TODO add more IDs
|
||||||
private ObservableList<UIROMDataType> games = FXCollections.observableArrayList();
|
private ObservableList<UIROMDataType> games = FXCollections.observableArrayList();
|
||||||
ObservableList<SmmdbApiDataType> courses = FXCollections.observableArrayList();
|
ObservableList<SmmdbApiDataType> courses = FXCollections.observableArrayList();
|
||||||
|
@ -350,7 +360,6 @@ public class MainWindowController {
|
||||||
if (getWindowWidth() > 100 && getWindowHeight() > 100) {
|
if (getWindowWidth() > 100 && getWindowHeight() > 100) {
|
||||||
mainAnchorPane.setPrefSize(getWindowWidth(), getWindowHeight());
|
mainAnchorPane.setPrefSize(getWindowWidth(), getWindowHeight());
|
||||||
}
|
}
|
||||||
refreshplayBtnPosition();
|
|
||||||
|
|
||||||
cemuTextField.setText(cemuPath);
|
cemuTextField.setText(cemuPath);
|
||||||
romTextField.setText(romPath);
|
romTextField.setText(romPath);
|
||||||
|
@ -359,6 +368,8 @@ public class MainWindowController {
|
||||||
cloudSyncToggleBtn.setSelected(isCloudSync());
|
cloudSyncToggleBtn.setSelected(isCloudSync());
|
||||||
autoUpdateToggleBtn.setSelected(isAutoUpdate());
|
autoUpdateToggleBtn.setSelected(isAutoUpdate());
|
||||||
branchChoisBox.setItems(branches);
|
branchChoisBox.setItems(branches);
|
||||||
|
languageChoisBox.setItems(languages);
|
||||||
|
bottomHBox.setPickOnBounds(false);
|
||||||
|
|
||||||
if (isUseBeta()) {
|
if (isUseBeta()) {
|
||||||
branchChoisBox.getSelectionModel().select(1);
|
branchChoisBox.getSelectionModel().select(1);
|
||||||
|
@ -1293,19 +1304,6 @@ public class MainWindowController {
|
||||||
gamesAnchorPane.getChildren().add(games.get(i).getVBox());
|
gamesAnchorPane.getChildren().add(games.get(i).getVBox());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void refreshplayBtnPosition() {
|
|
||||||
double width;
|
|
||||||
|
|
||||||
if (mainAnchorPane.getWidth() < 10) {
|
|
||||||
width = mainAnchorPane.getPrefWidth();
|
|
||||||
} else {
|
|
||||||
width = mainAnchorPane.getWidth();
|
|
||||||
}
|
|
||||||
playBtn.setLayoutX((width / 2) - 50);
|
|
||||||
totalPlaytimeBtn.setLayoutX((width / 2) - 50 - 20.5 - 100);
|
|
||||||
lastTimePlayedBtn.setLayoutX((width / 2) + 50 + 20.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkAutoUpdate() {
|
private void checkAutoUpdate() {
|
||||||
|
|
||||||
|
@ -1696,43 +1694,21 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playBtnSlideIn(){
|
private void playBtnSlideIn(){
|
||||||
playBtn.setVisible(true);
|
bottomHBox.setVisible(true);
|
||||||
lastTimePlayedBtn.setVisible(true);
|
|
||||||
totalPlaytimeBtn.setVisible(true);
|
|
||||||
playTrue = true;
|
playTrue = true;
|
||||||
|
|
||||||
TranslateTransition playBtnTransition = new TranslateTransition(Duration.millis(300), playBtn);
|
TranslateTransition playBtnTransition = new TranslateTransition(Duration.millis(300), bottomHBox);
|
||||||
playBtnTransition.setFromY(56);
|
playBtnTransition.setFromY(56);
|
||||||
playBtnTransition.setToY(0);
|
playBtnTransition.setToY(0);
|
||||||
playBtnTransition.play();
|
playBtnTransition.play();
|
||||||
|
|
||||||
TranslateTransition lastTimePlayedBtnTransition = new TranslateTransition(Duration.millis(300), lastTimePlayedBtn);
|
|
||||||
lastTimePlayedBtnTransition.setFromY(56);
|
|
||||||
lastTimePlayedBtnTransition.setToY(0);
|
|
||||||
lastTimePlayedBtnTransition.play();
|
|
||||||
|
|
||||||
TranslateTransition timePlayedBtnTransition = new TranslateTransition(Duration.millis(300), totalPlaytimeBtn);
|
|
||||||
timePlayedBtnTransition.setFromY(56);
|
|
||||||
timePlayedBtnTransition.setToY(0);
|
|
||||||
timePlayedBtnTransition.play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playBtnSlideOut(){
|
private void playBtnSlideOut(){
|
||||||
playTrue = false;
|
playTrue = false;
|
||||||
TranslateTransition playBtnTransition = new TranslateTransition(Duration.millis(300), playBtn);
|
TranslateTransition playBtnTransition = new TranslateTransition(Duration.millis(300), bottomHBox);
|
||||||
playBtnTransition.setFromY(0);
|
playBtnTransition.setFromY(0);
|
||||||
playBtnTransition.setToY(56);
|
playBtnTransition.setToY(56);
|
||||||
playBtnTransition.play();
|
playBtnTransition.play();
|
||||||
|
|
||||||
TranslateTransition lastTimePlayedBtnTransition = new TranslateTransition(Duration.millis(300), lastTimePlayedBtn);
|
|
||||||
lastTimePlayedBtnTransition.setFromY(0);
|
|
||||||
lastTimePlayedBtnTransition.setToY(56);
|
|
||||||
lastTimePlayedBtnTransition.play();
|
|
||||||
|
|
||||||
TranslateTransition timePlayedBtnTransition = new TranslateTransition(Duration.millis(300), totalPlaytimeBtn);
|
|
||||||
timePlayedBtnTransition.setFromY(0);
|
|
||||||
timePlayedBtnTransition.setToY(56);
|
|
||||||
timePlayedBtnTransition.play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editColor(String input){
|
private void editColor(String input){
|
||||||
|
|
|
@ -118,10 +118,16 @@
|
||||||
</VBox>
|
</VBox>
|
||||||
<HBox spacing="10.0">
|
<HBox spacing="10.0">
|
||||||
<children>
|
<children>
|
||||||
<Label fx:id="mainColorLbl" prefHeight="25.0" text="main Color" />
|
<Label fx:id="mainColorLbl" minHeight="25.0" text="main Color" />
|
||||||
<JFXColorPicker fx:id="colorPicker" onAction="#colorPickerAction" />
|
<JFXColorPicker fx:id="colorPicker" onAction="#colorPickerAction" />
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
|
<HBox prefHeight="100.0" prefWidth="200.0" spacing="10.0">
|
||||||
|
<children>
|
||||||
|
<Label fx:id="languageLbl" prefHeight="25.0" text="language" />
|
||||||
|
<ChoiceBox fx:id="languageChoisBox" prefWidth="150.0" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
<JFXToggleButton fx:id="cloudSyncToggleBtn" onAction="#cloudSyncToggleBtnAction" text="cloud savegames (Google Drive)" />
|
<JFXToggleButton fx:id="cloudSyncToggleBtn" onAction="#cloudSyncToggleBtnAction" text="cloud savegames (Google Drive)" />
|
||||||
<VBox spacing="10.0">
|
<VBox spacing="10.0">
|
||||||
<children>
|
<children>
|
||||||
|
@ -205,13 +211,17 @@
|
||||||
</ScrollPane>
|
</ScrollPane>
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
<JFXButton fx:id="playBtn" buttonType="RAISED" layoutX="396.0" maxHeight="28.0" minWidth="100.0" onAction="#playBtnAction" ripplerFill="#00aacc" text="play" textAlignment="CENTER" visible="false" AnchorPane.bottomAnchor="12.0">
|
<HBox fx:id="bottomHBox" alignment="CENTER" layoutX="326.0" layoutY="602.0" prefHeight="48.0" prefWidth="200.0" spacing="10.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||||
<font>
|
<children>
|
||||||
<Font name="System Bold" size="14.0" />
|
<JFXButton fx:id="totalPlaytimeBtn" buttonType="RAISED" maxHeight="32.0" maxWidth="125.0" minWidth="125.0" onAction="#totalPlaytimeBtnAction" prefHeight="32.0" prefWidth="125.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" text="0 h 0 min">
|
||||||
</font>
|
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
<JFXButton fx:id="totalPlaytimeBtn" buttonType="RAISED" layoutX="275.5" maxHeight="32.0" minWidth="100.0" onAction="#totalPlaytimeBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" text="0 h 0 min" visible="false" AnchorPane.bottomAnchor="10.0">
|
<JFXButton fx:id="playBtn" buttonType="RAISED" maxHeight="28.0" minWidth="100.0" onAction="#playBtnAction" ripplerFill="#00aacc" text="play" textAlignment="CENTER">
|
||||||
</JFXButton>
|
<font>
|
||||||
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" layoutX="516.5" maxHeight="32.0" minWidth="100.0" onAction="#lastTimePlayedBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" text="Last played, never" visible="false" AnchorPane.bottomAnchor="10.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
|
</font>
|
||||||
|
</JFXButton>
|
||||||
|
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" maxHeight="32.0" maxWidth="125.0" minWidth="125.0" onAction="#lastTimePlayedBtnAction" prefHeight="32.0" prefWidth="125.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" text="Last played, never" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|
Loading…
Reference in New Issue