mirror of
https://github.com/developersu/ns-usbloader.git
synced 2025-05-14 15:15:05 -04:00
Always open tab which had been opened before application was closed last time.
This commit is contained in:
parent
d231a39e0c
commit
4d92e536ae
5 changed files with 45 additions and 8 deletions
|
@ -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); }
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue