Browse Source

fixed first startup issue

pull/12/head
Jannik 4 years ago
parent
commit
a23b87fcb8
  1. 8
      src/main/java/kellerkinder/HomeFlix/application/Main.java
  2. 26
      src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java

8
src/main/java/kellerkinder/HomeFlix/application/Main.java

@ -108,9 +108,12 @@ public class Main extends Application {
primaryStage.setScene(scene); // append scene to stage
primaryStage.show(); // show stage
System.out.println("test");
// startup checks TODO move to mwc
if (!configFile.exists()) {
directory.mkdir();
System.out.println("config not found");
addFirstSource();
mainWindowController.setColor("ee3523");
@ -123,6 +126,8 @@ public class Main extends Application {
if (!posterCache.exists()) {
posterCache.mkdir();
}
mainWindowController.init();
} catch (IOException e) {
LOGGER.error(e);
}
@ -156,7 +161,7 @@ public class Main extends Application {
* we need to get the path for the first source from the user and add it to
* sources.json, if the user ends the file-/directory-chooser the program will exit
*/
private void addFirstSource() {
void addFirstSource() {
switch (local) {
case "en_US":
bundle = ResourceBundle.getBundle("locals.HomeFlix-Local", Locale.US); // us_english
@ -208,6 +213,7 @@ public class Main extends Application {
}
}
};
selectFirstSource.setBtn1Action(btn1Action);
selectFirstSource.setBtn2Action(btn2Action);
selectFirstSource.showAndWait();

26
src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java

@ -200,9 +200,11 @@ public class MainWindowController {
dbController = new DBController(this.main, this);
}
@FXML
public void initialize() {
public void init() {
LOGGER.info("Initializing Project-HomeFlix build " + buildNumber);
// startupCheck();
main.loadSettings(); // load settings
checkAutoUpdate();
@ -215,6 +217,26 @@ public class MainWindowController {
checkAllPosters(); // TODO testing
}
private void startupCheck() {
if (!main.getConfigFile().exists()) {
main.getDirectory().mkdir();
System.out.println("config not found");
main.addFirstSource(); // need to get local
System.out.println("source finished");
mainWindowController.setColor("ee3523");
mainWindowController.setFontSize(17.0);
mainWindowController.setAutoUpdate(false);
mainWindowController.setLocal(local); // local dosen't exist here
main.saveSettings();
}
if (!main.getPosterCache().exists()) {
main.getPosterCache().mkdir();
}
}
// Initialize general UI elements
private void initUI() {
versionLbl.setText("Version: " + version + " (Build: " + buildNumber + ")");

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close