Warning before overwriting existing animation

This commit is contained in:
Daniel Wolf 2018-02-09 22:29:02 +01:00
parent 5db03da56f
commit a9de5a0a71
1 changed files with 13 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import javafx.beans.property.SimpleBooleanProperty
import javafx.beans.property.SimpleObjectProperty import javafx.beans.property.SimpleObjectProperty
import javafx.beans.property.SimpleStringProperty import javafx.beans.property.SimpleStringProperty
import javafx.scene.control.Alert import javafx.scene.control.Alert
import javafx.scene.control.ButtonType
import tornadofx.getValue import tornadofx.getValue
import tornadofx.setValue import tornadofx.setValue
import java.util.concurrent.ExecutorService import java.util.concurrent.ExecutorService
@ -141,6 +142,17 @@ class AudioFileModel(
fun performAction() { fun performAction() {
if (future == null) { if (future == null) {
if (animated) {
Alert(Alert.AlertType.CONFIRMATION).apply {
headerText = "Animation '$animationName' already exists."
contentText = "Do you want to replace the existing animation?"
val result = showAndWait()
if (result.get() != ButtonType.OK) {
return
}
}
}
startAnimation() startAnimation()
} else { } else {
cancelAnimation() cancelAnimation()
@ -170,7 +182,7 @@ class AudioFileModel(
} catch (e: Exception) { } catch (e: Exception) {
Platform.runLater { Platform.runLater {
Alert(Alert.AlertType.ERROR).apply { Alert(Alert.AlertType.ERROR).apply {
headerText = "Error performing lip-sync for event '$eventName'." headerText = "Error performing lip sync for event '$eventName'."
contentText = e.message contentText = e.message
show() show()
} }