Rename settings dialog to preferences dialog

This commit is contained in:
Marvin Elsen 2024-09-26 23:13:17 +02:00
parent fee7cbf260
commit 6003bc678e
Signed by: marvinelsen
GPG Key ID: 820672408CC318C2
4 changed files with 8 additions and 8 deletions

View File

@ -2,7 +2,7 @@ package com.marvinelsen.willow.ui.controllers
import com.marvinelsen.willow.Config import com.marvinelsen.willow.Config
import com.marvinelsen.willow.Model import com.marvinelsen.willow.Model
import com.marvinelsen.willow.ui.dialogs.SettingsDialog import com.marvinelsen.willow.ui.dialogs.PreferencesDialog
import javafx.application.Platform import javafx.application.Platform
import javafx.beans.binding.Bindings import javafx.beans.binding.Bindings
import javafx.fxml.FXML import javafx.fxml.FXML
@ -28,10 +28,10 @@ class MenuController(private val model: Model, private val config: Config) {
@FXML @FXML
private fun onMenuItemPreferencesAction() { private fun onMenuItemPreferencesAction() {
SettingsDialog(menuBar.scene.window, config).showAndWait().ifPresent { result -> PreferencesDialog(menuBar.scene.window, config).showAndWait().ifPresent { result ->
when (result) { when (result) {
SettingsDialog.Result.CHANGES -> config.save() PreferencesDialog.Result.CHANGES -> config.save()
SettingsDialog.Result.NO_CHANGES -> config.load() PreferencesDialog.Result.NO_CHANGES -> config.load()
} }
} }
} }

View File

@ -17,7 +17,7 @@ import javafx.stage.Window
import javafx.util.Callback import javafx.util.Callback
@Suppress("MemberVisibilityCanBePrivate") @Suppress("MemberVisibilityCanBePrivate")
class SettingsDialog(owner: Window?, config: Config) : Dialog<SettingsDialog.Result>() { class PreferencesDialog(owner: Window?, config: Config) : Dialog<PreferencesDialog.Result>() {
companion object { companion object {
private const val DIALOG_MIN_HEIGHT = 400.0 private const val DIALOG_MIN_HEIGHT = 400.0
private const val DIALOG_MIN_WIDTH = 400.0 private const val DIALOG_MIN_WIDTH = 400.0
@ -42,7 +42,7 @@ class SettingsDialog(owner: Window?, config: Config) : Dialog<SettingsDialog.Res
private val entryHeadwordFontSizeObjectProperty = config.detailHeadwordFontSize.asObject() private val entryHeadwordFontSizeObjectProperty = config.detailHeadwordFontSize.asObject()
init { init {
val loader = FXMLLoader(WillowApplication::class.java.getResource("/fxml/settings-dialog.fxml")) val loader = FXMLLoader(WillowApplication::class.java.getResource("/fxml/preferences-dialog.fxml"))
loader.setController(this) loader.setController(this)
val root: DialogPane = loader.load() val root: DialogPane = loader.load()

View File

@ -37,6 +37,6 @@
-fx-font: 16 "Noto Sans TC"; -fx-font: 16 "Noto Sans TC";
} }
.settings-dialog .content { .preferences-dialog .content {
-fx-padding: 0; -fx-padding: 0;
} }

View File

@ -6,7 +6,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<DialogPane styleClass="settings-dialog" xmlns="http://javafx.com/javafx/23" xmlns:fx="http://javafx.com/fxml/1"> <DialogPane styleClass="preferences-dialog" xmlns="http://javafx.com/javafx/23" xmlns:fx="http://javafx.com/fxml/1">
<fx:define> <fx:define>
<FXCollections fx:factory="observableArrayList" fx:id="phoneticAlphabets"> <FXCollections fx:factory="observableArrayList" fx:id="phoneticAlphabets">
<Pronunciation fx:value="PINYIN_WITH_TONE_MARKS"/> <Pronunciation fx:value="PINYIN_WITH_TONE_MARKS"/>