Fixes FXSetupBridge, fixes reset subtitles, fixes work status for export hard
This commit is contained in:
@@ -273,6 +273,11 @@ public class FXSetupController extends AbstractFXController implements SetupCont
|
||||
} finally {
|
||||
manager.removeListener(this);
|
||||
}
|
||||
}).handle((v, t) -> {
|
||||
if (t != null) {
|
||||
logger.error("Error", t);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@ public class FXSubtitlesController extends AbstractFXController implements Subti
|
||||
|
||||
private void loadCollection(final SubtitleCollection<?> collection) {
|
||||
final var observableCollection = new ObservableSubtitleCollectionImpl(collection);
|
||||
model.originalCollections().put(observableCollection.language(), observableCollection);
|
||||
model.originalCollections().put(observableCollection.language(), new ObservableSubtitleCollectionImpl(observableCollection));
|
||||
model.collections().put(observableCollection.language(), observableCollection);
|
||||
}
|
||||
|
||||
|
||||
@@ -202,6 +202,7 @@ public class FXWorkController extends AbstractFXController implements WorkContro
|
||||
filePicker.setSelectedExtensionFilter(extensionFilter);
|
||||
final var file = filePicker.showSaveDialog(window());
|
||||
if (file != null) {
|
||||
model.setStatus(WorkStatus.EXPORTING);
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
videoConverter.addHardSubtitles(model.video(), model.collections().get(model.videoLanguageProperty().get()), file.toPath());
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.github.gtache.autosubtitle.setup.gui.fx;
|
||||
|
||||
import com.github.gtache.autosubtitle.gui.fx.FXMainController;
|
||||
import com.github.gtache.autosubtitle.setup.SetupUserBridge;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.ChoiceDialog;
|
||||
@@ -10,6 +11,7 @@ import javafx.scene.control.TextInputDialog;
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* FX implementation of {@link SetupUserBridge}
|
||||
@@ -39,26 +41,33 @@ public class FXSetupUserBridge implements SetupUserBridge {
|
||||
}
|
||||
|
||||
private <T> T showChoiceDialog(final String title, final String message, final List<T> choices) {
|
||||
final var dialog = new ChoiceDialog<>(choices.getFirst(), choices);
|
||||
dialog.initOwner(controller.window());
|
||||
dialog.setHeaderText(message);
|
||||
dialog.setTitle(title);
|
||||
return dialog.showAndWait().orElse(null);
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
final var dialog = new ChoiceDialog<>(choices.getFirst(), choices);
|
||||
dialog.initOwner(controller.window());
|
||||
dialog.setHeaderText(message);
|
||||
dialog.setTitle(title);
|
||||
return dialog.showAndWait().orElse(null);
|
||||
}, Platform::runLater).join();
|
||||
}
|
||||
|
||||
private String showInputDialog(final String title, final String message) {
|
||||
final var dialog = new TextInputDialog();
|
||||
dialog.initOwner(controller.window());
|
||||
dialog.setHeaderText(message);
|
||||
dialog.setTitle(title);
|
||||
return dialog.showAndWait().orElse(null);
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
final var dialog = new TextInputDialog();
|
||||
dialog.initOwner(controller.window());
|
||||
dialog.setHeaderText(message);
|
||||
dialog.setTitle(title);
|
||||
return dialog.showAndWait().orElse(null);
|
||||
}, Platform::runLater).join();
|
||||
|
||||
}
|
||||
|
||||
private boolean showConfirmationDialog(final String title, final String message) {
|
||||
final var alert = new Alert(Alert.AlertType.CONFIRMATION, message, ButtonType.YES, ButtonType.NO);
|
||||
alert.initOwner(controller.window());
|
||||
alert.setHeaderText(null);
|
||||
alert.setTitle(title);
|
||||
return alert.showAndWait().map(bt -> bt == ButtonType.YES).orElse(false);
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
final var alert = new Alert(Alert.AlertType.CONFIRMATION, message, ButtonType.YES, ButtonType.NO);
|
||||
alert.initOwner(controller.window());
|
||||
alert.setHeaderText(null);
|
||||
alert.setTitle(title);
|
||||
return alert.showAndWait().map(bt -> bt == ButtonType.YES).orElse(false);
|
||||
}, Platform::runLater).join();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user