New Features #1

Open
marvinelsen wants to merge 95 commits from develop into main
Showing only changes of commit 959a5c2680 - Show all commits

View File

@ -16,22 +16,18 @@ class SearchController(private val model: Model) {
@FXML @FXML
@Suppress("UnusedPrivateMember") @Suppress("UnusedPrivateMember")
private fun initialize() { private fun initialize() {
textFieldSearch.textProperty().addListener { _, _, newValue -> textFieldSearch.textProperty().addListener { _, _, _ -> search() }
if (newValue.isNullOrBlank()) { searchModeToggleGroup.selectedToggleProperty().addListener { _, _, _ -> search() }
return@addListener }
}
val searchMode = searchModeToggleGroup.selectedToggle.userData as SearchMode private fun search() {
model.search(newValue, searchMode) val searchQuery = textFieldSearch.text
val searchMode = searchModeToggleGroup.selectedToggle.userData as SearchMode
if (searchQuery.isNullOrBlank()) {
return
} }
searchModeToggleGroup.selectedToggleProperty().addListener { _, _, newValue -> model.search(searchQuery, searchMode)
if (textFieldSearch.text.isNullOrBlank()) {
return@addListener
}
val searchMode = newValue.userData as SearchMode
model.search(textFieldSearch.text, searchMode)
}
} }
} }