added directory chooser for export

This commit is contained in:
Hendrik Schutter 2019-06-03 22:24:18 +02:00
parent ae92167206
commit ca2ad079d4
2 changed files with 39 additions and 4 deletions

View File

@ -2,18 +2,15 @@ package org.hso.texturesyncclient.controller
import javafx.collections.ObservableList
import org.hso.texturesyncclient.controller.net.Connection
import org.hso.texturesyncclient.model.GUIModel
import org.hso.texturesyncclient.model.Texture
import org.hso.texturesyncclient.view.importView.ImportViewController
import org.hso.texturesyncclient.view.mainView.MainViewController
import org.hso.texturesyncclient.view.startupView.StartupViewController
import tornadofx.Controller
import java.net.InetAddress
import java.util.*
import java.util.Calendar
import java.io.File
import javax.imageio.ImageIO
import java.awt.image.BufferedImage
@ -61,4 +58,6 @@ class RootController : Controller() {
println("Height: ${bimg.getHeight()} With: ${bimg.getWidth()}")
}
}

View File

@ -3,7 +3,15 @@ package org.hso.texturesyncclient.view.mainView
import javafx.collections.ObservableList
import javafx.scene.image.Image
import org.hso.texturesyncclient.model.GUIModel
import org.hso.texturesyncclient.model.TextureFormat
import tornadofx.Controller
import javafx.stage.DirectoryChooser
import javax.swing.JColorChooser.showDialog
import java.io.File
class MainViewController : Controller() {
@ -47,4 +55,32 @@ class MainViewController : Controller() {
println(cvTags.chips)
}
/**
* save the texture file to r
* @param data the file as a byte array
* @param name name for the file
* @param format specific file format. jpeg or png
*/
fun exportTexture(data: ByteArray, name: String, format : TextureFormat){
val directoryChooser = DirectoryChooser()
directoryChooser.title = "Export Verzeichnis wählen"
// TODO directoryChooser.setInitialDirectory(new File(System.getProperty("user.home")))
val dir = directoryChooser.showDialog(primaryStage)
if (dir != null) {
//copy data (bytesarray) with name and extension to dir
}
}
}