diff --git a/src/main/java/ch/qligier/app/pixeldngfixer/gui/MainController.java b/src/main/java/ch/qligier/app/pixeldngfixer/gui/MainController.java index b66481b..cc30e2d 100644 --- a/src/main/java/ch/qligier/app/pixeldngfixer/gui/MainController.java +++ b/src/main/java/ch/qligier/app/pixeldngfixer/gui/MainController.java @@ -47,6 +47,8 @@ public class MainController implements Initializable { @FXML protected CheckBox createBackupsCheckbox; @FXML + protected CheckBox deleteJpegCheckbox; + @FXML protected Button processButton; /** @@ -59,6 +61,11 @@ public class MainController implements Initializable { */ protected boolean createBackupBeforeFixing = true; + /** + * Whether the JPEG files are deleted after processing or not. + */ + protected boolean deleteJpegsAfterFixing = false; + /** * The parent JavaFX {@link Stage}. A bit hacky. */ @@ -77,6 +84,7 @@ public void initialize(final URL url, final ResourceBundle resourceBundle) { this.appNameLabel.setText(Config.APP_NAME); this.photoDirLabel.setText(this.selectedDir.getAbsolutePath()); this.createBackupsCheckbox.setSelected(this.createBackupBeforeFixing); + this.deleteJpegCheckbox.setSelected(this.deleteJpegsAfterFixing); this.progressBar.setDisable(true); } @@ -107,6 +115,7 @@ protected void onProcessButtonClick() { }; final var createBackupBeforeFixing = this.createBackupBeforeFixing; + final var deleteJpegsAfterFixing = this.deleteJpegsAfterFixing; final var photoDir = this.selectedDir; final Consumer logProxy = this::addLog; // Create a task to process the photos @@ -130,6 +139,10 @@ protected Void call() throws Exception { createBackupBeforeFixing); updateMessage("Processed file " + pair.getRawFile().getName()); updateProgress(i, nbPairs); + + if (deleteJpegsAfterFixing) { + pair.getJpegFile().delete(); + } } return null; } @@ -209,6 +222,11 @@ protected void onCreateBackupsCheckboxClick() { this.createBackupBeforeFixing = this.createBackupsCheckbox.isSelected(); } + @FXML + protected void onDeleteJpegCheckboxClick() { + this.deleteJpegsAfterFixing = this.deleteJpegCheckbox.isSelected(); + } + /** * Adds a message log to the dedicated textarea. * diff --git a/src/main/resources/views/main-view.fxml b/src/main/resources/views/main-view.fxml index 59d569e..9341988 100644 --- a/src/main/resources/views/main-view.fxml +++ b/src/main/resources/views/main-view.fxml @@ -1,26 +1,17 @@ - - - - - - - + + - - - - - + - - @@ -56,10 +47,13 @@ + + +