eros: account card improvements

This commit is contained in:
Bixilon 2021-07-30 12:44:03 +02:00
parent dc54c55aa1
commit 69ffca6d62
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
5 changed files with 25 additions and 18 deletions

View File

@ -139,9 +139,7 @@ class AccountController : EmbeddedJavaFXController<Pane>() {
isDisable = true
DefaultThreadPool += {
account.verify()
Platform.runLater {
refreshList()
}
Platform.runLater { refreshList() }
}
}
}, 3, 0)
@ -153,9 +151,7 @@ class AccountController : EmbeddedJavaFXController<Pane>() {
account.verify()
Minosoft.config.config.account.selected = account
Minosoft.config.saveToFile()
Platform.runLater {
refreshList()
}
Platform.runLater { refreshList() }
}
}
isDisable = Minosoft.config.config.account.selected === account
@ -176,7 +172,7 @@ class AccountController : EmbeddedJavaFXController<Pane>() {
val LAYOUT = "minosoft:eros/main/account/account.fxml".asResourceLocation()
private val ACCOUNT_INFO_PROPERTIES: List<Pair<ResourceLocation, (account: Account) -> Any?>> = listOf(
"minosoft:account.id".asResourceLocation() to { it.id },
"minosoft:main.account.account_info.id".asResourceLocation() to { it.id },
)
val ACCOUNT_TYPES = listOf(
@ -184,8 +180,8 @@ class AccountController : EmbeddedJavaFXController<Pane>() {
resourceLocation = MojangAccount.RESOURCE_LOCATION,
translationKey = "minosoft:main.account.type.mojang".asResourceLocation(),
additionalDetails = listOf(
"minosoft:account.email".asResourceLocation() to { it.email },
"minosoft:account.uuid".asResourceLocation() to { it.uuid },
"minosoft:main.account.account_info.email".asResourceLocation() to { it.email },
"minosoft:main.account.account_info.uuid".asResourceLocation() to { it.uuid },
),
icon = FontAwesomeSolid.BUILDING,
addHandler = { MojangAddController(it).show() },

View File

@ -29,17 +29,25 @@ class AccountTypeCardController : AbstractCard<ErosAccountType<*>>() {
@FXML private lateinit var textFX: TextFlow
override fun updateItem(item: ErosAccountType<*>?, empty: Boolean) {
super.updateItem(item, empty)
item ?: return
override fun updateItem(type: ErosAccountType<*>?, empty: Boolean) {
super.updateItem(type, empty)
type ?: return
iconFX.isVisible = true
iconFX.iconCode = item.icon
headerFX.text = Minosoft.LANGUAGE_MANAGER.translate(item)
iconFX.iconCode = type.icon
headerFX.text = Minosoft.LANGUAGE_MANAGER.translate(type)
textFX.text = "? accounts" // ToDo: Update on the fly
var count = 0
for (account in Minosoft.config.config.account.entries.values) {
if (account.type != type.resourceLocation) {
continue
}
count++
}
textFX.text = "$count accounts" // ToDo: Update on the fly
}

View File

@ -19,5 +19,5 @@ import javafx.scene.image.Image
object JavaFXAccountUtil {
val Account.avatar: Image?
get() = null // ToDo
get() = JavaFXUtil.MINOSOFT_LOGO // ToDo
}

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<HBox xmlns:fx="http://javafx.com/fxml/1" fx:id="root" prefHeight="100.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/16" fx:controller="de.bixilon.minosoft.gui.eros.main.account.AccountCardController">
<HBox xmlns:fx="http://javafx.com/fxml/1" fx:id="root" prefWidth="400.0" xmlns="http://javafx.com/javafx/16" fx:controller="de.bixilon.minosoft.gui.eros.main.account.AccountCardController">
<GridPane HBox.hgrow="ALWAYS">
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0"/>

View File

@ -66,6 +66,10 @@ minosoft:main.account.type.offline=Offline
minosoft:main.account.card.connection_count=%1$s connections
minosoft:main.account.account_info.id=Id
minosoft:main.account.account_info.email=E-Mail
minosoft:main.account.account_info.uuid=UUID
minosoft:main.account.add.offline.title=Add offline account
minosoft:main.account.add.offline.header=Add offline account
minosoft:main.account.add.offline.description=Please enter the username of the account you want to add.