diff --git a/build.gradle b/build.gradle index f4e9585..bd53eaf 100644 --- a/build.gradle +++ b/build.gradle @@ -97,13 +97,8 @@ dependencies { compile group: 'junit', name: 'junit', version: '4.12' compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.6' -// testCompile group: "org.loadui", name: "testFx", version: "3.1.2" -// testCompile 'org.testfx:testfx-core:4.0.1-alpha' -// testRuntime 'org.testfx:openjfx-monocle:1.8.0_20' testCompile group: 'org.loadui', name: 'testFx', version: '3.1.2' - testCompile group: 'org.testfx', name: 'testfx-core', version: '4.0.8-alpha' - } test { testLogging.showStandardStreams = true diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 04837ac..4dc15b6 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -17,7 +17,7 @@ public void start(Stage stage) throws Exception FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("Views/main.fxml")); Parent root = loader.load(); stage.setTitle("VideoText Extractor"); - stage.setScene(new Scene(root, 680, 450)); + stage.setScene(new Scene(root, 680, 390)); stage.setResizable(false); stage.show(); stage.setOnCloseRequest(e -> Platform.exit()); diff --git a/src/main/java/Processors/FileProcessor.java b/src/main/java/Processors/FileProcessor.java index 44cc5ab..25422f0 100644 --- a/src/main/java/Processors/FileProcessor.java +++ b/src/main/java/Processors/FileProcessor.java @@ -8,6 +8,8 @@ import javafx.scene.Node; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; +import javafx.scene.text.Font; +import javafx.scene.text.FontWeight; import javafx.stage.FileChooser; import javafx.stage.Stage; import org.apache.commons.io.FileUtils; @@ -39,6 +41,7 @@ public class FileProcessor */ public static void validateVideoFile(File videoFile) { + if (videoFile == null) return; Alert alert; if (!FileProcessor.validateVideoFileName(videoFile)){ alert = new Alert(Alert.AlertType.WARNING, "ERROR on loading file\n"+ diff --git a/src/main/java/Processors/VideoProcessor.java b/src/main/java/Processors/VideoProcessor.java index 5480c20..e8c3ab2 100644 --- a/src/main/java/Processors/VideoProcessor.java +++ b/src/main/java/Processors/VideoProcessor.java @@ -8,6 +8,8 @@ import javafx.concurrent.Task; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; +import javafx.scene.text.Font; +import javafx.scene.text.FontWeight; import org.bytedeco.javacpp.BytePointer; import org.bytedeco.javacpp.lept; import org.bytedeco.javacpp.tesseract; diff --git a/src/main/java/ViewControllers/MainController.java b/src/main/java/ViewControllers/MainController.java index 1da9c7f..acb8269 100644 --- a/src/main/java/ViewControllers/MainController.java +++ b/src/main/java/ViewControllers/MainController.java @@ -16,12 +16,15 @@ import javafx.scene.input.TransferMode; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.Pane; +import javafx.scene.text.Font; +import javafx.scene.text.FontWeight; import javafx.stage.Stage; import org.apache.commons.io.FilenameUtils; import org.jetbrains.annotations.Contract; import java.io.File; import java.io.IOException; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.Timer; import java.util.TimerTask; @@ -41,6 +44,8 @@ public class MainController public MenuItem settingsMenuItem; public ProgressBar progressBar; public MenuItem logMenuItem; + public Button increaseFont_button; + public Button decreaseFont_button; private static File currentVideoFile; private static Stage mainStage; @@ -57,6 +62,14 @@ public void initialize() videoIcon.setCursor(Cursor.HAND); extractButton.setCursor(Cursor.HAND); + increaseFont_button.setOnMouseClicked(event -> { + textArea.setFont(Font.font("Verdana", FontWeight.NORMAL, textArea.getFont().getSize()+2)); + }); + + decreaseFont_button.setOnMouseClicked(event -> { + textArea.setFont(Font.font("Verdana", FontWeight.NORMAL, textArea.getFont().getSize()-2)); + }); + // When dragging something, allow it to be copied/moved only if it's a mp4 file videoPane.setOnDragOver(event -> { if (event.getDragboard().getFiles().get(0).isFile()){ @@ -149,12 +162,19 @@ public void initialize() }); playDetected.setOnAction(event -> { - File videoFile = Paths.get(ApplicationPaths.RESOURCES_OUTPUTS, ApplicationPaths.UNIQUE_FOLDER_NAME, - "Video", "video.mp4").toFile(); - if (videoFile.exists()){ + String videoFilePath = null; + try { + videoFilePath = Paths.get(ApplicationPaths.RESOURCES_OUTPUTS, ApplicationPaths.UNIQUE_FOLDER_NAME, + "Video", "video.mp4").toAbsolutePath().toString(); + } catch (Exception e) { + return; + } + File videoFile = new File(videoFilePath); + if (videoFile.exists() && videoFile.isFile()){ Player.playVideo(videoFile); } }); + } /** diff --git a/src/main/resources/Views/main.fxml b/src/main/resources/Views/main.fxml index e498522..911e5a2 100644 --- a/src/main/resources/Views/main.fxml +++ b/src/main/resources/Views/main.fxml @@ -12,7 +12,7 @@ - + @@ -45,9 +45,11 @@ -