This commit is contained in:
CodeSteak 2019-06-12 22:42:28 +02:00
parent cc03b32ade
commit 8dfbbae559
4 changed files with 24 additions and 4 deletions

View File

@ -20,9 +20,9 @@ class Main : App(StartupView::class) {
super.start(stage)
stage.minWidth = 1008.00
stage.minHeight = 535.00
stage.minHeight = 700.00
stage.width = 1008.00
stage.height = 535.00
stage.height = 700.00
stage.isResizable = true
stage.icons.add(Image("icons/TextureSync_Icon_256x256.png"))
stage.setOnCloseRequest { System.exit(0) }

View File

@ -10,6 +10,7 @@ import javafx.scene.layout.BackgroundFill
import javafx.scene.layout.CornerRadii
import javafx.scene.paint.Paint
import javafx.scene.layout.Priority
import org.hso.texturesyncclient.view.mainView.Preview3D
import tornadofx.*
class ImportView : View("TextureSync") {
@ -18,12 +19,16 @@ class ImportView : View("TextureSync") {
val tfName = JFXTextField()
val cvTags = JFXChipView<String>()
val btnImport = JFXButton("Importieren")
val preview = Preview3D()
private val btnBack = JFXButton("Zurück")
private val ivc: ImportViewController by inject()
init {
btnImport.isVisible = false
preview.root.isVisible = false
}
override val root = borderpane {
@ -39,6 +44,8 @@ class ImportView : View("TextureSync") {
style = "-fx-font: 20px Verdana; -fx-text-fill: #2b7bbb;"
}
add(preview)
vbox(20) {
hbox(10) {
add(tfFilePath)

View File

@ -1,9 +1,11 @@
package org.hso.texturesyncclient.view.importView
import javafx.scene.image.Image
import javafx.stage.FileChooser
import org.hso.texturesyncclient.controller.RootController
import tornadofx.Controller
import javafx.stage.FileChooser
import java.io.File
import java.io.FileInputStream
class ImportViewController : Controller() {
@ -29,6 +31,18 @@ class ImportViewController : Controller() {
iv.tfFilePath.text = file.absolutePath
iv.tfName.text = file.nameWithoutExtension
lastImportDir = file.parent.toString() //store last user chosen dir
runAsync {
try {
val fileInput = FileInputStream(file.absolutePath)
val img = Image(fileInput)
iv.preview.setTexture(img)
iv.preview.root.isVisible = true
} catch (e: Exception) {
// Got a catch'em all
println(e.message)
}
}
}
}

View File

@ -36,7 +36,6 @@ class Preview3D : View("Preview3D") {
pointLightFront.rotate = 90.0
}
override val root = stackpane {
add(dBox).apply {