diff --git a/pom.xml b/pom.xml index ac9c186..120c316 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ NS-USBloader ns-usbloader - 5.0-SNAPSHOT + 5.1-SNAPSHOT https://github.com/developersu/ns-usbloader/ diff --git a/src/main/java/nsusbloader/AppPreferences.java b/src/main/java/nsusbloader/AppPreferences.java index 0a7119a..b5caac3 100644 --- a/src/main/java/nsusbloader/AppPreferences.java +++ b/src/main/java/nsusbloader/AppPreferences.java @@ -135,4 +135,7 @@ public class AppPreferences { // NXDT // public String getNXDTSaveToLocation(){ return FilesHelper.getRealFolder(preferences.get("nxdt_saveto", System.getProperty("user.home"))); } public void setNXDTSaveToLocation(String value){ preferences.put("nxdt_saveto", value); } + + public String getLastOpenedTab(){ return preferences.get("recent_tab", ""); } + public void setLastOpenedTab(String tabId){ preferences.put("recent_tab", tabId); } } diff --git a/src/main/java/nsusbloader/Controllers/NSLMainController.java b/src/main/java/nsusbloader/Controllers/NSLMainController.java index 21dc530..152af1d 100644 --- a/src/main/java/nsusbloader/Controllers/NSLMainController.java +++ b/src/main/java/nsusbloader/Controllers/NSLMainController.java @@ -40,6 +40,11 @@ public class NSLMainController implements Initializable { @FXML public ProgressBar progressBar; // Accessible from Mediator + @FXML + private TabPane mainTabPane; + @FXML + private Tab GamesTabHolder, RCMTabHolder, SMTabHolder; + @FXML private GamesController GamesTabController; // Accessible from Mediator | todo: incapsulate @FXML @@ -70,16 +75,22 @@ public class NSLMainController implements Initializable { if (result != null){ if (!result.get(0).isEmpty()) { SettingsTabController.getGenericSettings().setNewVersionLink(result.get(0)); - ServiceWindow.getInfoNotification(resourceBundle.getString("windowTitleNewVersionAval"), resourceBundle.getString("windowTitleNewVersionAval") + ": " + result.get(0) + "\n\n" + result.get(1)); + ServiceWindow.getInfoNotification( + resourceBundle.getString("windowTitleNewVersionAval"), + resourceBundle.getString("windowTitleNewVersionAval") + ": " + result.get(0) + "\n\n" + result.get(1)); } } else - ServiceWindow.getInfoNotification(resourceBundle.getString("windowTitleNewVersionUnknown"), resourceBundle.getString("windowBodyNewVersionUnknown")); + ServiceWindow.getInfoNotification( + resourceBundle.getString("windowTitleNewVersionUnknown"), + resourceBundle.getString("windowBodyNewVersionUnknown")); }); Thread updates = new Thread(updTask); updates.setDaemon(true); updates.start(); } + + openLastOpenedTab(); } /** @@ -123,5 +134,28 @@ public class NSLMainController implements Initializable { SplitMergeTabController.updatePreferencesOnExit(); // NOTE: This shit above should be re-written to similar pattern RcmTabController.updatePreferencesOnExit(); NXDTabController.updatePreferencesOnExit(); + + saveLastOpenedTab(); + } + + private void openLastOpenedTab(){ + String tabId = AppPreferences.getInstance().getLastOpenedTab(); + switch (tabId){ + case "GamesTabHolder": + mainTabPane.getSelectionModel().select(GamesTabHolder); + break; + case "RCMTabHolder": + mainTabPane.getSelectionModel().select(RCMTabHolder); + break; + case "SMTabHolder": + mainTabPane.getSelectionModel().select(SMTabHolder); + break; + } + } + private void saveLastOpenedTab(){ + String tabId = mainTabPane.getSelectionModel().getSelectedItem().getId(); + if (tabId == null || tabId.isEmpty()) + return; + AppPreferences.getInstance().setLastOpenedTab(tabId); } } diff --git a/src/main/java/nsusbloader/NSLMain.java b/src/main/java/nsusbloader/NSLMain.java index f3c9d98..6c26e1d 100644 --- a/src/main/java/nsusbloader/NSLMain.java +++ b/src/main/java/nsusbloader/NSLMain.java @@ -32,7 +32,7 @@ import java.util.ResourceBundle; public class NSLMain extends Application { - public static final String appVersion = "v5.0"; + public static final String appVersion = "v5.1"; public static boolean isCli; @Override diff --git a/src/main/resources/NSLMain.fxml b/src/main/resources/NSLMain.fxml index 635902f..398e4b7 100644 --- a/src/main/resources/NSLMain.fxml +++ b/src/main/resources/NSLMain.fxml @@ -19,9 +19,9 @@ Steps to roll NXDT functionality back: - + - + @@ -29,7 +29,7 @@ Steps to roll NXDT functionality back: - + @@ -37,7 +37,7 @@ Steps to roll NXDT functionality back: - +