Skip to content

Commit

Permalink
Do not show success alert when saving is cancelled (#129)
Browse files Browse the repository at this point in the history
* Do not show success alert when saving is cancelled

* Add change to changelog
  • Loading branch information
NicEastvillage authored Jul 9, 2024
1 parent 99597a2 commit 960a9b6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Changelog

#### Version 1.8.3 - May 2024
#### Version 1.8.3 - TO BE RELEASED
- Fixed MatchRunner not working for users with spaces in their windows username. - NicEastvillage
- Adjusted logger formatting. - NicEastvillage
- Fixed "succesfully saved"-alert when saving was cancelled. #129 - NicEastvillage

#### Version 1.8.2 - April 2024
- Updated RLBot python path to python 3.11 installation. #117/#127 - CodeRed/NicEastvillage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void onTabSelectionChanged(Event event) {
void onSaveIconClicked(MouseEvent event) {
Stage fxstage = (Stage) saveTournamentBtn.getScene().getWindow();
try {
SaveLoad.saveTournamentWithFileChooser(fxstage);
Alerts.infoNotification("Saved", "Tournament was successfully saved.");
boolean saved = SaveLoad.saveTournamentWithFileChooser(fxstage);
if (saved) Alerts.infoNotification("Saved", "Tournament was successfully saved.");
} catch (IOException e) {
Alerts.errorNotification("Error while saving", "Something went wrong while saving the tournament: " + e.getMessage());
Main.LOGGER.log(System.Logger.Level.ERROR, "Error while saving tournament", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class SaveLoad {
* @param fxstage the JavaFX Stage in control of the FileChooser.
* @throws IOException thrown if something goes wrong during saving.
*/
public static void saveTournamentWithFileChooser(Stage fxstage) throws IOException {
public static boolean saveTournamentWithFileChooser(Stage fxstage) throws IOException {
LatestPaths latestPaths = CleoPetraSettings.getLatestPaths();
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Choose file name and save destination");
Expand All @@ -33,10 +33,10 @@ public static void saveTournamentWithFileChooser(Stage fxstage) throws IOExcepti
fileChooser.setInitialDirectory(latestPaths.getTournamentSaveDirectory());

File file = fileChooser.showSaveDialog(fxstage);
if (file == null) return false;

if (file != null) {
saveTournament(Tournament.get(), file);
}
saveTournament(Tournament.get(), file);
return true;
}

/**
Expand Down

0 comments on commit 960a9b6

Please sign in to comment.