Browse Source

Optimized the imports across the project. Abstracted some of the file opening logic out in the event that different flavors of linux don't want to work with the file opening

master
Drew Short 10 years ago
parent
commit
76a7f46229
  1. 2
      engine/src/main/scala/com/sothr/imagetools/engine/Engine.scala
  2. 2
      engine/src/main/scala/com/sothr/imagetools/engine/util/PropertiesService.scala
  3. 1
      gui/src/main/java/com/sothr/imagetools/ui/App.java
  4. 4
      gui/src/main/resources/fxml/mainapp/MainApp.fxml
  5. 11
      gui/src/main/scala/com/sothr/imagetools/ui/component/ImageTile.scala
  6. 9
      gui/src/main/scala/com/sothr/imagetools/ui/component/ImageTilePane.scala
  7. 4
      gui/src/main/scala/com/sothr/imagetools/ui/controller/AppController.scala
  8. 12
      gui/src/main/scala/com/sothr/imagetools/ui/util/FileUtil.scala

2
engine/src/main/scala/com/sothr/imagetools/engine/Engine.scala

@ -3,7 +3,7 @@ package com.sothr.imagetools.engine
import java.io.File
import akka.actor._
import com.sothr.imagetools.engine.image.{ImageService, Image, ImageFilter, SimilarImages}
import com.sothr.imagetools.engine.image.{Image, ImageFilter, ImageService, SimilarImages}
import com.sothr.imagetools.engine.util.DirectoryFilter
import grizzled.slf4j.Logging

2
engine/src/main/scala/com/sothr/imagetools/engine/util/PropertiesService.scala

@ -3,7 +3,7 @@ package com.sothr.imagetools.engine.util
import java.io.{File, FileOutputStream, PrintStream}
import java.util.Properties
import com.typesafe.config.{ConfigRenderOptions, Config, ConfigFactory}
import com.typesafe.config.{Config, ConfigFactory, ConfigRenderOptions}
import grizzled.slf4j.Logging
/*

1
gui/src/main/java/com/sothr/imagetools/ui/App.java

@ -3,7 +3,6 @@ package com.sothr.imagetools.ui;
import com.sothr.imagetools.engine.AppConfig;
import com.sothr.imagetools.engine.errors.ImageToolsException;
import com.sothr.imagetools.engine.util.ResourceLoader;
import com.sothr.imagetools.ui.controller.AppController;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.fxml.JavaFXBuilderFactory;

4
gui/src/main/resources/fxml/mainapp/MainApp.fxml

@ -2,14 +2,10 @@
<!--suppress ALL -->
<?import javafx.scene.effect.*?>
<?import java.lang.*?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="rootPane" minHeight="600.0" minWidth="1024.0" prefHeight="600.0" prefWidth="1024.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sothr.imagetools.ui.controller.AppController">
<children>
<MenuBar fx:id="rootMenuBar" minWidth="-Infinity" prefHeight="30.0" prefWidth="600.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">

11
gui/src/main/scala/com/sothr/imagetools/ui/component/ImageTile.scala

@ -1,12 +1,11 @@
package com.sothr.imagetools.ui.component
import java.awt.Desktop
import java.io.{File, FileInputStream}
import javafx.event.{EventType, EventHandler}
import javafx.geometry.{Orientation, Insets, Pos}
import javafx.scene.control.{Separator, Tooltip, Label}
import javafx.scene.image.{ImageView}
import javafx.scene.input.{PickResult, ContextMenuEvent, MouseEvent}
import javafx.event.EventHandler
import javafx.geometry.{Orientation, Pos}
import javafx.scene.control.{Label, Separator, Tooltip}
import javafx.scene.image.ImageView
import javafx.scene.input.{ContextMenuEvent, MouseEvent, PickResult}
import javafx.scene.layout.VBox
import com.sothr.imagetools.ui.util.FileUtil

9
gui/src/main/scala/com/sothr/imagetools/ui/component/ImageTilePane.scala

@ -5,19 +5,18 @@ import javafx.application.Platform
import javafx.collections.{ModifiableObservableListBase, ObservableList}
import javafx.event.{ActionEvent, EventHandler}
import javafx.geometry.Side
import javafx.scene.control.{MenuItem, ContextMenu, MultipleSelectionModel}
import javafx.scene.Node
import javafx.scene.control.{ContextMenu, MenuItem, MultipleSelectionModel}
import javafx.scene.input.ContextMenuEvent
import javafx.scene.layout._
import javafx.scene.paint.Color
import javafx.scene.Node
import scala.concurrent._
import ExecutionContext.Implicits.global
import com.sothr.imagetools.engine.AppConfig
import com.sothr.imagetools.ui.controller.AppController
import grizzled.slf4j.Logging
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent._
import scala.util.{Failure, Success}
/**

4
gui/src/main/scala/com/sothr/imagetools/ui/controller/AppController.scala

@ -15,9 +15,9 @@ import javafx.util.Callback
import akka.actor._
import com.sothr.imagetools.engine._
import com.sothr.imagetools.engine.image.{Image, SimilarImages}
import com.sothr.imagetools.engine.image.Image
import com.sothr.imagetools.engine.util.{PropertiesService, ResourceLoader}
import com.sothr.imagetools.ui.component.{ImageTilePane, ImageTileFactory}
import com.sothr.imagetools.ui.component.{ImageTileFactory, ImageTilePane}
import grizzled.slf4j.Logging
import org.markdown4j.Markdown4jProcessor

12
gui/src/main/scala/com/sothr/imagetools/ui/util/FileUtil.scala

@ -14,9 +14,17 @@ object FileUtil extends Logging {
def openInEditor(file: File) = {
PropertiesService.OS.toLowerCase match {
// Open file on windows
case os if os.startsWith("windows") => Desktop.getDesktop.open(file)
case os if os.startsWith("linux") => Runtime.getRuntime.exec(s"xdg-open ${file.getAbsolutePath}")
case os if os.startsWith("windows") => openFileWindows(file)
case os if os.startsWith("linux") => openFileLinux(file)
case default => error(s"Do not know how to open editor for OS: ${PropertiesService.OS}, ${PropertiesService.OS_VERSION}, ${PropertiesService.OS_ARCH}")
}
}
private def openFileWindows(file: File) = {
Desktop.getDesktop.open(file)
}
private def openFileLinux(file: File) = {
Runtime.getRuntime.exec(s"xdg-open ${file.getAbsolutePath}")
}
}
Loading…
Cancel
Save