Fix premature garbage collection with preference dialog spinners
This commit is contained in:
parent
52acfeb5da
commit
e4f7e8ee5d
@ -49,13 +49,6 @@ class PreferencesDialogController(private val config: Config) {
|
|||||||
@FXML
|
@FXML
|
||||||
private lateinit var spinnerDefinitionFontSizeSearchResults: Spinner<Int>
|
private lateinit var spinnerDefinitionFontSizeSearchResults: Spinner<Int>
|
||||||
|
|
||||||
private val entryHeadwordFontSizeObjectProperty = config.details.headwordFontSize.asObject()
|
|
||||||
private val entryPronunciationFontSizeObjectProperty = config.details.pronunciationFontSize.asObject()
|
|
||||||
|
|
||||||
private val searchResultHeadwordFontSizeObjectProperty = config.searchResults.headwordFontSize.asObject()
|
|
||||||
private val searchResultPronunciationFontSizeObjectProperty = config.searchResults.pronunciationFontSize.asObject()
|
|
||||||
private val searchResultDefinitionFontSizeObjectProperty = config.searchResults.definitionFontSize.asObject()
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private fun initialize() {
|
private fun initialize() {
|
||||||
comboBoxLocale.items.addAll(
|
comboBoxLocale.items.addAll(
|
||||||
@ -82,27 +75,42 @@ class PreferencesDialogController(private val config: Config) {
|
|||||||
|
|
||||||
with(spinnerHeadwordFontSizeDetails) {
|
with(spinnerHeadwordFontSizeDetails) {
|
||||||
editor.textFormatter = FontSizeTextFormatter()
|
editor.textFormatter = FontSizeTextFormatter()
|
||||||
valueFactory.valueProperty().bindBidirectional(entryHeadwordFontSizeObjectProperty)
|
valueFactory.value = config.details.headwordFontSize.value
|
||||||
|
valueProperty().addListener { _, _, newValue ->
|
||||||
|
config.details.headwordFontSize.value = newValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
with(spinnerPronunciationFontSizeDetails) {
|
with(spinnerPronunciationFontSizeDetails) {
|
||||||
editor.textFormatter = FontSizeTextFormatter()
|
editor.textFormatter = FontSizeTextFormatter()
|
||||||
valueFactory.valueProperty().bindBidirectional(entryPronunciationFontSizeObjectProperty)
|
valueFactory.value = config.details.pronunciationFontSize.value
|
||||||
|
valueProperty().addListener { _, _, newValue ->
|
||||||
|
config.details.pronunciationFontSize.value = newValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
with(spinnerHeadwordFontSizeSearchResults) {
|
with(spinnerHeadwordFontSizeSearchResults) {
|
||||||
editor.textFormatter = FontSizeTextFormatter()
|
editor.textFormatter = FontSizeTextFormatter()
|
||||||
valueFactory.valueProperty().bindBidirectional(searchResultHeadwordFontSizeObjectProperty)
|
valueFactory.value = config.searchResults.headwordFontSize.value
|
||||||
|
valueProperty().addListener { _, _, newValue ->
|
||||||
|
config.searchResults.headwordFontSize.value = newValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
with(spinnerPronunciationFontSizeSearchResults) {
|
with(spinnerPronunciationFontSizeSearchResults) {
|
||||||
editor.textFormatter = FontSizeTextFormatter()
|
editor.textFormatter = FontSizeTextFormatter()
|
||||||
valueFactory.valueProperty().bindBidirectional(searchResultPronunciationFontSizeObjectProperty)
|
valueFactory.value = config.searchResults.pronunciationFontSize.value
|
||||||
|
valueProperty().addListener { _, _, newValue ->
|
||||||
|
config.searchResults.pronunciationFontSize.value = newValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
with(spinnerDefinitionFontSizeSearchResults) {
|
with(spinnerDefinitionFontSizeSearchResults) {
|
||||||
editor.textFormatter = FontSizeTextFormatter()
|
editor.textFormatter = FontSizeTextFormatter()
|
||||||
valueFactory.valueProperty().bindBidirectional(searchResultDefinitionFontSizeObjectProperty)
|
valueFactory.value = config.searchResults.definitionFontSize.value
|
||||||
|
valueProperty().addListener { _, _, newValue ->
|
||||||
|
config.searchResults.definitionFontSize.value = newValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user