show all textures at startup

This commit is contained in:
Hendrik Schutter 2019-06-08 21:59:09 +02:00
parent f4db466b37
commit 29354199cc
2 changed files with 23 additions and 8 deletions

View File

@ -104,6 +104,7 @@ class RootController : Controller() {
con.ping()
println("auto Connection to Server successful")
switchStartupToMain()
showAll()
} else {
println("[auto] no server found")
}
@ -119,6 +120,7 @@ class RootController : Controller() {
con.ping()
println("[file] Connection to Server successful")
switchStartupToMain()
showAll()
} catch (e: Exception) {
println(e)
println("[file] Connection to Server NOT successful")
@ -135,6 +137,7 @@ class RootController : Controller() {
println("Connection to Server successful")
SettingsController.setServerAddress(name) //store address in settings file
switchStartupToMain()
showAll()
println("swithing to MainView @ initCon")
} catch (e: Exception) {
println(e)
@ -230,7 +233,12 @@ class RootController : Controller() {
mvc.setPreview3DTexture(con.getTexturePreview(data.textureHash))
val sdf = SimpleDateFormat("dd.MM.yyyy")
mvc.setMeta(data.name, "${data.resolution.first}px x ${data.resolution.second}px", data.format.toString(), sdf.format(data.addedOn.time))
mvc.setMeta(
data.name,
"${data.resolution.first}px x ${data.resolution.second}px",
data.format.toString(),
sdf.format(data.addedOn.time)
)
mvc.setTags(data.tags.toList().observable())
selectedTexture = data
}
@ -255,7 +263,10 @@ class RootController : Controller() {
dialogDelete.showAndWait()
}
/**
* send a changed texture to the server
* @param chips the new tag list
*/
fun updateTexture(chips: ObservableList<String>) {
val uuid = UUID.randomUUID()
val newTexture = Texture(
@ -270,4 +281,10 @@ class RootController : Controller() {
con.updateTexture(selectedTexture, newTexture, con.getTextureFile(selectedTexture.textureHash))
}
/**
* show all available textures at start
*/
fun showAll() {
queryElements(mvc.getTags())
}
}

View File

@ -26,11 +26,6 @@ class MainViewController : Controller() {
folderView.children.add(element)
}
fun addAllElements(elementList: ArrayList<GUIModel>) {
folderView.children.addAll(elementList)
}
// DetailView functions
fun setPreview3DTexture(img: Image) {
preview.setTexture(img)
@ -47,6 +42,10 @@ class MainViewController : Controller() {
lockUpdate = true //allow update with onChange
}
fun getTags(): ObservableList<String>{
return cvTags.chips
}
fun updateTags() {
if (lockUpdate) { //the chipView was changed by the user
println("Tags changed")
@ -74,7 +73,6 @@ class MainViewController : Controller() {
rootc.switchMainToImport()
}
fun removeTextureFromView(data: Texture) {
// stream all children nodes, filter them as GUIModel with data.id == data.id, for any found object if it's still present remove it from the folderView
folderView.children.stream().filter { x -> (x as GUIModel).data.id == data.id }.findAny()