aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/xyz/brysonsteck
diff options
context:
space:
mode:
authorBryson Steck <brysonsteck@protonmail.com>2023-05-13 19:10:58 -0600
committerBryson Steck <brysonsteck@protonmail.com>2023-05-13 19:10:58 -0600
commitb92a9c1ec9b7e8a39ff098d25dfda517a3338721 (patch)
treee50efbe59a5d87f375142284a0f4ad0ea2d6cc62 /app/src/main/kotlin/xyz/brysonsteck
parent844a94226777e78553726c3d3e3798db7ea7107e (diff)
downloadServerCraft-b92a9c1ec9b7e8a39ff098d25dfda517a3338721.tar
ServerCraft-b92a9c1ec9b7e8a39ff098d25dfda517a3338721.tar.gz
ServerCraft-b92a9c1ec9b7e8a39ff098d25dfda517a3338721.tar.bz2
added about dialog and fixed squished text on stock linux
Diffstat (limited to 'app/src/main/kotlin/xyz/brysonsteck')
-rw-r--r--app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/InfoController.kt51
-rw-r--r--app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/PrimaryController.kt (renamed from app/src/main/kotlin/xyz/brysonsteck/serverfordummies/PrimaryController.kt)27
2 files changed, 74 insertions, 4 deletions
diff --git a/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/InfoController.kt b/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/InfoController.kt
new file mode 100644
index 0000000..b91d3e2
--- /dev/null
+++ b/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/InfoController.kt
@@ -0,0 +1,51 @@
+package xyz.brysonsteck.serverfordummies.controllers
+
+import javafx.fxml.FXML
+import javafx.application.Platform
+import javafx.scene.Node
+import javafx.scene.control.Hyperlink
+import javafx.stage.Stage
+import javafx.event.ActionEvent
+import java.awt.Desktop
+import java.net.URI
+
+class InfoController {
+ private val emails = mapOf(
+ "bryson" to "me@brysonsteck.xyz"
+ )
+ private val websites = mapOf(
+ "bryson" to "https://brysonsteck.xyz"
+ )
+ private val source = "https://codeberg.org/brysonsteck/ServerCraft"
+ private val license = "https://www.gnu.org/licenses/gpl-3.0.html"
+
+ @FXML
+ private fun openHyperlink(e: ActionEvent) {
+ val link = e.source as Hyperlink
+ link.isVisited = false
+ val split = link.id.split('_')
+
+ val desktop = Desktop.getDesktop()
+ if (desktop.isSupported(Desktop.Action.BROWSE)) {
+ try {
+ when {
+ split[1].equals("email") -> {
+ desktop.browse(URI("mailto:" + websites[split[0]]))
+ }
+ else -> {
+ desktop.browse(URI(websites[split[0]]))
+ }
+ }
+ } catch (e: Exception) {
+ println(e)
+ }
+ }
+ }
+
+ @FXML
+ private fun closeInfo(e: ActionEvent) {
+ val source = e.getSource() as Node
+ val stage = source.getScene().getWindow() as Stage
+ stage.close();
+ }
+} \ No newline at end of file
diff --git a/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/PrimaryController.kt b/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/PrimaryController.kt
index 4939a26..d854138 100644
--- a/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/PrimaryController.kt
+++ b/app/src/main/kotlin/xyz/brysonsteck/serverfordummies/controllers/PrimaryController.kt
@@ -1,4 +1,4 @@
-package xyz.brysonsteck.serverfordummies
+package xyz.brysonsteck.serverfordummies.controllers
import kotlinx.coroutines.*
import kotlinx.coroutines.javafx.JavaFx
@@ -20,6 +20,7 @@ import javafx.concurrent.Task
import javafx.beans.property.BooleanProperty
import javafx.collections.FXCollections
import javafx.fxml.FXML
+import javafx.fxml.FXMLLoader
import javafx.geometry.Insets
import javafx.scene.control.Button
import javafx.scene.control.ChoiceBox
@@ -53,6 +54,7 @@ import org.rauschig.jarchivelib.*
import Download
import xyz.brysonsteck.serverfordummies.server.Server
+import xyz.brysonsteck.serverfordummies.App
class PrimaryController {
@FXML
@@ -170,12 +172,15 @@ class PrimaryController {
if (res) {
parentPane.isDisable = false
worldSettingsPane.isDisable = false
- buttonBar.isDisable = false
+ buildButton.isDisable = false
+ defaultsButton.isDisable = false
} else {
currentDirectoryLabel.text = "<NONE>"
parentPane.isDisable = true
worldSettingsPane.isDisable = true
- buttonBar.isDisable = true
+ startButton.isDisable = true
+ buildButton.isDisable = true
+ defaultsButton.isDisable = true
}
}
}
@@ -210,6 +215,18 @@ class PrimaryController {
}
@FXML
+ private fun onInfo() {
+ val stage = Stage()
+ val scene = Scene(FXMLLoader(App().javaClass.getResource("info.fxml")).load(), 398.0, 358.0)
+ stage.icons.add(Image(App().javaClass.getResourceAsStream("app-256x256.png")))
+ stage.setResizable(false)
+ stage.initModality(Modality.APPLICATION_MODAL);
+ stage.title = "About ServerCraft"
+ stage.scene = scene
+ stage.show()
+ }
+
+ @FXML
private fun onBuild() {
if (building) {
building = false
@@ -425,7 +442,8 @@ class PrimaryController {
imagePane.scaleX = 0.7
imagePane.scaleY = 0.7
imagePane.children.add(ImageView(icon))
- val label = Label("Do you agree to the terms of the Minecraft\nEnd User License Agreement?")
+ val label = Label("Do you agree to the terms of the Minecraft End User License Agreement?")
+ label.isWrapText = true
label.layoutX = 115.0
label.layoutY = 40.0
val buttonBar = ButtonBar()
@@ -485,6 +503,7 @@ class PrimaryController {
imagePane.scaleY = 0.7
imagePane.children.add(ImageView(icon))
val label = Label(msg)
+ label.isWrapText = true
label.layoutX = 115.0
label.layoutY = if (type == "warning") {10.0} else {40.0}
val buttonBar = ButtonBar()