resize&shortcuts #25
@ -13,12 +13,12 @@ import org.hso.texturesyncclient.model.Sha256
 | 
			
		||||
import org.hso.texturesyncclient.model.Texture
 | 
			
		||||
import org.hso.texturesyncclient.model.TextureFormat
 | 
			
		||||
import org.hso.texturesyncclient.view.importView.ImportView
 | 
			
		||||
import org.hso.texturesyncclient.view.importView.ImportViewController
 | 
			
		||||
import org.hso.texturesyncclient.view.mainView.MainView
 | 
			
		||||
import org.hso.texturesyncclient.view.mainView.MainViewController
 | 
			
		||||
import org.hso.texturesyncclient.view.startupView.StartupView
 | 
			
		||||
import org.hso.texturesyncclient.view.startupView.StartupViewController
 | 
			
		||||
import tornadofx.Controller
 | 
			
		||||
import tornadofx.find
 | 
			
		||||
import tornadofx.observable
 | 
			
		||||
import java.net.InetAddress
 | 
			
		||||
import java.util.Calendar
 | 
			
		||||
@ -34,12 +34,10 @@ class RootController : Controller() {
 | 
			
		||||
 | 
			
		||||
    private val mvc: MainViewController by inject()
 | 
			
		||||
    private val svc: StartupViewController by inject()
 | 
			
		||||
    private val ivc: ImportViewController by inject()
 | 
			
		||||
 | 
			
		||||
    private lateinit var con: Connection
 | 
			
		||||
 | 
			
		||||
    private lateinit var selectedTexture: Texture
 | 
			
		||||
 | 
			
		||||
    private var lastExportDir: String = System.getProperty("user.home")
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@ -167,26 +165,6 @@ class RootController : Controller() {
 | 
			
		||||
        return previewList
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // TODO this could be a companion object
 | 
			
		||||
    fun switchStartupToMain() {
 | 
			
		||||
        Platform.runLater {
 | 
			
		||||
            find(StartupView::class).replaceWith(MainView::class, sizeToScene = true, centerOnScreen = true)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // These runLater calls should be unnecessary
 | 
			
		||||
    fun switchMainToImport() {
 | 
			
		||||
        Platform.runLater {
 | 
			
		||||
            find(MainView::class).replaceWith(ImportView::class, sizeToScene = true, centerOnScreen = true)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun switchImportToMain() {
 | 
			
		||||
        Platform.runLater {
 | 
			
		||||
            find(ImportView::class).replaceWith(MainView::class, sizeToScene = true, centerOnScreen = true)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * save the texture file to a local directory
 | 
			
		||||
     * @param data the texture as meta element
 | 
			
		||||
@ -286,7 +264,28 @@ class RootController : Controller() {
 | 
			
		||||
    /**
 | 
			
		||||
     * show all available textures at start
 | 
			
		||||
     */
 | 
			
		||||
    fun showAll() {
 | 
			
		||||
    private fun showAll() {
 | 
			
		||||
        queryElements(mvc.getTags())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    companion object {
 | 
			
		||||
        fun switchStartupToMain() {
 | 
			
		||||
            Platform.runLater {
 | 
			
		||||
                find(StartupView::class).replaceWith(MainView::class, sizeToScene = true, centerOnScreen = true)
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // These runLater calls should be unnecessary
 | 
			
		||||
        fun switchMainToImport() {
 | 
			
		||||
            Platform.runLater {
 | 
			
		||||
                find(MainView::class).replaceWith(ImportView::class, sizeToScene = true, centerOnScreen = true)
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        fun switchImportToMain() {
 | 
			
		||||
            Platform.runLater {
 | 
			
		||||
                find(ImportView::class).replaceWith(MainView::class, sizeToScene = true, centerOnScreen = true)
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -18,7 +18,7 @@ class ImportView : View("TextureSync") {
 | 
			
		||||
    val tfName = JFXTextField()
 | 
			
		||||
    val cvTags = JFXChipView<String>()
 | 
			
		||||
    val btnImport = JFXButton("Importieren")
 | 
			
		||||
    val btnBack = JFXButton("Zurück")
 | 
			
		||||
    private val btnBack = JFXButton("Zurück")
 | 
			
		||||
 | 
			
		||||
    private val ivc: ImportViewController by inject()
 | 
			
		||||
 | 
			
		||||
@ -27,8 +27,8 @@ class ImportView : View("TextureSync") {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    override val root = borderpane {
 | 
			
		||||
        minWidth = 1000.0
 | 
			
		||||
        minHeight = 500.0
 | 
			
		||||
        prefWidth = FX.primaryStage.width
 | 
			
		||||
        prefHeight = FX.primaryStage.height
 | 
			
		||||
        background = Background(BackgroundFill(Paint.valueOf("#2b2b2b"), CornerRadii.EMPTY, Insets.EMPTY))
 | 
			
		||||
 | 
			
		||||
        center = vbox(50) {
 | 
			
		||||
 | 
			
		||||
@ -34,7 +34,7 @@ class ImportViewController : Controller() {
 | 
			
		||||
 | 
			
		||||
    fun btnImportAction() {
 | 
			
		||||
        rootc.importTexture(iv.tfFilePath.text, iv.tfName.text, iv.cvTags.chips)
 | 
			
		||||
        rootc.switchImportToMain()
 | 
			
		||||
        RootController.switchImportToMain()
 | 
			
		||||
        iv.tfFilePath.clear()
 | 
			
		||||
        iv.tfName.clear()
 | 
			
		||||
        iv.cvTags.chips.clear()
 | 
			
		||||
@ -46,7 +46,7 @@ class ImportViewController : Controller() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun btnBackAction() {
 | 
			
		||||
        rootc.switchImportToMain()
 | 
			
		||||
        RootController.switchImportToMain()
 | 
			
		||||
        iv.tfFilePath.clear()
 | 
			
		||||
        iv.tfName.clear()
 | 
			
		||||
        iv.cvTags.chips.clear()
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,7 @@ import tornadofx.*
 | 
			
		||||
class MainView : View("TextureSync") {
 | 
			
		||||
 | 
			
		||||
    val cvSearch = JFXChipView<String>()
 | 
			
		||||
    val btnImport = JFXButton("+")
 | 
			
		||||
    private val btnImport = JFXButton("+")
 | 
			
		||||
    val folderView = find(FolderView::class)
 | 
			
		||||
    val detailView = find(DetailView::class)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -70,7 +70,7 @@ class MainViewController : Controller() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun btnImportAction() {
 | 
			
		||||
        rootc.switchMainToImport()
 | 
			
		||||
        RootController.switchMainToImport()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun removeTextureFromView(data: Texture) {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user