diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..afc5305
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..4b661a5
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..3905b0e
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,74 @@
+
+
+ 4.0.0
+
+ com.mauville.sorth
+ sortH
+ 1.9-SNAPSHOT
+
+ sortH
+ jar
+
+
+ 1.8
+
+
+
+
+ GNU GPLV3
+
+
+
+
+ commons-io
+ commons-io
+ 2.6
+
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.6.1
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.6.1
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+
+ ${jdk.version}
+ UTF-8
+
+
+
+ com.jolira
+ onejar-maven-plugin
+ 1.4.4
+
+
+
+ sample.Main
+ 0.97
+ true
+
+
+ one-jar
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/sample/Controller.java b/src/main/java/sample/Controller.java
new file mode 100644
index 0000000..91ddc0f
--- /dev/null
+++ b/src/main/java/sample/Controller.java
@@ -0,0 +1,188 @@
+package sample;
+
+import javafx.fxml.FXML;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+import javafx.scene.input.KeyCode;
+import javafx.scene.input.KeyCodeCombination;
+import javafx.scene.input.KeyCombination;
+import javafx.scene.layout.GridPane;
+import javafx.scene.text.Text;
+import javafx.stage.DirectoryChooser;
+import javafx.stage.Stage;
+import org.apache.commons.io.FileUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.List;
+
+public class Controller {
+
+ private static final Logger LOGGER = LogManager.getLogger(Controller.class);
+
+ @FXML
+ Button button = new Button();
+ @FXML
+ Label P = new Label();
+ @FXML
+ Label threedee = new Label();
+ @FXML
+ Label T = new Label();
+ @FXML
+ Label NP = new Label();
+ @FXML
+ Label FD = new Label();
+ @FXML
+ Label EC = new Label();
+ @FXML
+ Label A = new Label();
+ @FXML
+ Label O = new Label();
+ private final Label SKIP = new Label();
+ @FXML
+ ImageView imageholder = new ImageView();
+ @FXML
+ Text logField = new Text();
+ @FXML
+ GridPane nonum = new GridPane();
+ @FXML
+ GridPane num = new GridPane();
+
+ //Keyboard shortcuts
+ private final KeyCombination PCode = new KeyCodeCombination(KeyCode.DIGIT8);
+ private final KeyCombination threedeeCode = new KeyCodeCombination(KeyCode.DIGIT4);
+ private final KeyCombination TCode = new KeyCodeCombination(KeyCode.DIGIT2);
+ private final KeyCombination NPCode = new KeyCodeCombination(KeyCode.DIGIT6);
+ private final KeyCombination FDCode = new KeyCodeCombination(KeyCode.DIGIT8, KeyCombination.CONTROL_DOWN);
+ private final KeyCombination ECCode = new KeyCodeCombination(KeyCode.DIGIT4, KeyCombination.CONTROL_DOWN);
+ private final KeyCombination ACode = new KeyCodeCombination(KeyCode.DIGIT2, KeyCombination.CONTROL_DOWN);
+ private final KeyCombination OCode = new KeyCodeCombination(KeyCode.DIGIT6, KeyCombination.CONTROL_DOWN);
+ private final KeyCombination SkipCode = new KeyCodeCombination(KeyCode.DIGIT0, KeyCombination.CONTROL_DOWN);
+ private final KeyCombination SkipCode2 = new KeyCodeCombination(KeyCode.DIGIT0);
+
+ private List imageFiles;
+ private File cwd;
+ private int currentImage = 0;
+ private File currentFile;
+ private final Runnable rnP = () -> processImage(P);
+ private final Runnable rnthreedee = () -> processImage(threedee);
+ private final Runnable rnT = () -> processImage(T);
+ private final Runnable rnNP = () -> processImage(NP);
+ private final Runnable rnFD = () -> processImage(FD);
+ private final Runnable rnEC = () -> processImage(EC);
+ private final Runnable rnA = () -> processImage(A);
+ private final Runnable rnO = () -> processImage(O);
+ private final Runnable rnSKIP = () -> processImage(SKIP);
+
+ public void setAccel() {
+ Scene scn = FD.getScene();
+ scn.getAccelerators().put(PCode, rnP);
+ scn.getAccelerators().put(threedeeCode, rnthreedee);
+ scn.getAccelerators().put(TCode, rnT);
+ scn.getAccelerators().put(NPCode, rnNP);
+ scn.getAccelerators().put(FDCode, rnFD);
+ scn.getAccelerators().put(ECCode, rnEC);
+ scn.getAccelerators().put(ACode, rnA);
+ scn.getAccelerators().put(OCode, rnO);
+ scn.getAccelerators().put(SkipCode, rnSKIP);
+ scn.getAccelerators().put(SkipCode2, rnSKIP);
+ LOGGER.info("Set accelerators");
+
+ button.setVisible(false);
+
+
+ }
+
+ @FXML
+ public void initialize() {
+ boot();
+ SKIP.setText("SKIP");
+ }
+
+
+ private void processImage(Label dir) {
+ LOGGER.info(dir.getText());
+ if (!(dir.getText().equals("SKIP"))) {
+ File directory2Move2 = null;
+ try {
+ directory2Move2 = new File(cwd.getCanonicalPath() + "\\" + dir.getText());
+ LOGGER.info("Moving to : " + directory2Move2);
+ } catch (IOException e) {
+ LOGGER.error("Failed to convert to Canonical Path");
+ }
+ try {
+ FileUtils.moveFileToDirectory(currentFile, directory2Move2, true);
+ LOGGER.info(currentFile + " " + directory2Move2);
+ } catch (IOException e) {
+ LOGGER.error("Failed to move file");
+ e.printStackTrace();
+ }
+ }
+ logField.setText(dir.getText());
+ currentImage++;
+ try {
+ displayNext();
+ } catch (FileNotFoundException e) {
+ LOGGER.error("No further images found");
+ }
+ }
+
+ private void displayNext() throws FileNotFoundException {
+ try {
+ currentFile = imageFiles.get(currentImage);
+ FileInputStream inputstream;
+ inputstream = new FileInputStream(currentFile);
+ Image image = new Image(inputstream);
+ imageholder.setFitHeight(500);
+ imageholder.setPreserveRatio(true);
+ imageholder.setSmooth(true);
+ imageholder.setImage(image);
+ inputstream.close();
+ } catch (IndexOutOfBoundsException e) {
+ LOGGER.warn("End of Images");
+ System.exit(0);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ private void boot() {
+ cwd = openFileChooser();
+ try {
+ imageFiles = ImageHandler.getImages(cwd);
+ } catch (IOException e) {
+ LOGGER.error("No such directory");
+ e.printStackTrace();
+ }
+ try {
+ LOGGER.info("Loading Images");
+ imageFiles = ImageHandler.getImages("C:\\Users\\X220\\Desktop\\images");
+ cwd = new File("C:\\Users\\X220\\Desktop\\images");
+ displayNext();
+ LOGGER.info("Loaded Images");
+ } catch (IOException e) {
+ LOGGER.error("No such directory");
+ }
+ }
+
+ private File openFileChooser() {
+ Stage filer = new Stage();
+ DirectoryChooser chooser = new DirectoryChooser();
+ chooser.setTitle("Choose Directory");
+ String userWindows = System.getenv("USERPROFILE");
+ File defaultDirectory = new File(userWindows);
+ chooser.setInitialDirectory(defaultDirectory);
+ File mark = chooser.showDialog(filer);
+ LOGGER.info("Current path" + mark);
+ return mark;
+ }
+
+}
diff --git a/src/main/java/sample/ImageHandler.java b/src/main/java/sample/ImageHandler.java
new file mode 100644
index 0000000..1fc794b
--- /dev/null
+++ b/src/main/java/sample/ImageHandler.java
@@ -0,0 +1,24 @@
+package sample;
+
+import org.apache.commons.io.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+class ImageHandler {
+
+ public static List getImages(File dir) throws IOException {
+ String[] extensions = new String[] { "jpg", "png", "gif" };
+ System.out.println("Getting all images " + dir.getCanonicalPath()
+ + " including those in subdirectories");
+ return (List) FileUtils.listFiles(dir, extensions,false);
+ }
+ public static List getImages(String dir) throws IOException {
+ String[] extensions = new String[] { "jpg", "png", "gif" };
+ System.out.println("Getting all images " + dir
+ + " including those in subdirectories");
+ return (List) FileUtils.listFiles(new File (dir), extensions,false);
+ }
+
+}
diff --git a/src/main/java/sample/Main.java b/src/main/java/sample/Main.java
new file mode 100644
index 0000000..4832b67
--- /dev/null
+++ b/src/main/java/sample/Main.java
@@ -0,0 +1,31 @@
+package sample;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+import java.awt.*;
+
+public class Main extends Application {
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+
+ @Override
+ public void start(Stage primaryStage) throws Exception {
+ Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("fxml/sample.fxml"));
+ primaryStage.setTitle("SortH");
+ GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
+ int width = gd.getDisplayMode().getWidth();
+ int height = gd.getDisplayMode().getHeight();
+ Scene scene = new Scene(root, width - width * .2, height - height * .1);
+ //Listen for scene changes
+
+
+ primaryStage.setScene(scene);
+ primaryStage.show();
+ }
+}
diff --git a/src/main/resources/fxml/noImage.jpg b/src/main/resources/fxml/noImage.jpg
new file mode 100644
index 0000000..ba4e2cb
Binary files /dev/null and b/src/main/resources/fxml/noImage.jpg differ
diff --git a/src/main/resources/fxml/sample.css b/src/main/resources/fxml/sample.css
new file mode 100644
index 0000000..2507aff
--- /dev/null
+++ b/src/main/resources/fxml/sample.css
@@ -0,0 +1,11 @@
+.root {
+ -fx-font-size: 14px;
+ -fx-font-family: sans-serif;
+ -fx-background-color: #bbbbbb;
+}
+.grid{
+ -fx-font-size: 19px;
+}
+.imageview{
+ -fx-margin: 0,auto;
+}
diff --git a/src/main/resources/fxml/sample.fxml b/src/main/resources/fxml/sample.fxml
new file mode 100644
index 0000000..f813c8a
--- /dev/null
+++ b/src/main/resources/fxml/sample.fxml
@@ -0,0 +1,147 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..5e042d3
--- /dev/null
+++ b/src/main/resources/log4j2.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+