From b1052fa8942a13d794a2f8513a693f318f7e29b1 Mon Sep 17 00:00:00 2001 From: Seil0 Date: Mon, 10 Jun 2019 12:41:11 +0200 Subject: [PATCH] added shortcut ctrl+e for exporting a texture --- .../org/hso/texturesyncclient/controller/RootController.kt | 3 ++- .../org/hso/texturesyncclient/view/mainView/MainView.kt | 4 ++++ .../texturesyncclient/view/mainView/MainViewController.kt | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/controller/RootController.kt b/client/src/main/kotlin/org/hso/texturesyncclient/controller/RootController.kt index 8b34881..601d576 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/controller/RootController.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/controller/RootController.kt @@ -37,8 +37,9 @@ class RootController : Controller() { private lateinit var con: Connection - private lateinit var selectedTexture: Texture private var lastExportDir: String = System.getProperty("user.home") + lateinit var selectedTexture: Texture + fun isSelectedTextureInitialized() = ::selectedTexture.isInitialized /** * calculate the resolution, get today's date -> upload to server diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt index 208a0d5..1199b8c 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt @@ -86,6 +86,10 @@ class MainView : View("TextureSync") { shortcut("Ctrl+I") { mvc.btnImportAction() } + + shortcut("Ctrl+E") { + mvc.scExport() + } } } \ No newline at end of file diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainViewController.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainViewController.kt index 2310209..457b9c2 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainViewController.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainViewController.kt @@ -60,6 +60,7 @@ class MainViewController : Controller() { folderView.children.clear() mv.cvSearch.isDisable = true setPreview3DTexture(Image("icons/TextureSync_Icon_256x256.jpeg")) // reset the 3DPreview to the logo + // TODO should we clear the selectedTexture? runAsync { rootc.queryElements(tags) @@ -89,4 +90,10 @@ class MainViewController : Controller() { } } + fun scExport() { + if (rootc.isSelectedTextureInitialized()) { + rootc.exportTexture(rootc.selectedTexture) + } + } + } \ No newline at end of file