mirror of
https://github.com/spalencsar/bearwave.git
synced 2026-07-06 22:24:17 +02:00
Fix playback, API races, tray, MPRIS, and search UX; add tests
- Correct history/resume next-previous context and list index resync after reload - Abort stale RadioBrowser requests and suppress error banners when cache satisfies loads - Reset local search filter on page changes and debounce compact-mode API search - Move system tray to C++ (QSystemTrayIcon) for reliable Wayland context menus - Harden MPRIS registration and metadata updates for Plasma media widgets - Add playback and API race unit tests - Drop unused KF6 Kirigami, I18n, and CoreAddons build dependencies - Update packaging docs, CI, and PKGBUILD to match Qt-only requirements
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import Qt.labs.platform 1.1 as Platform
|
||||
|
||||
ApplicationWindow {
|
||||
id: root
|
||||
@@ -20,62 +19,6 @@ ApplicationWindow {
|
||||
root.hide()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: backend
|
||||
function onRaiseRequested() {
|
||||
root.show()
|
||||
root.raise()
|
||||
root.requestActivate()
|
||||
}
|
||||
}
|
||||
|
||||
Platform.SystemTrayIcon {
|
||||
id: systray
|
||||
visible: true
|
||||
icon.name: "multimedia-player"
|
||||
tooltip: qsTr("BearWave")
|
||||
|
||||
menu: Platform.Menu {
|
||||
Platform.MenuItem {
|
||||
text: backend && backend.player && backend.player.playing ? qsTr("Pause") : qsTr("Play")
|
||||
onTriggered: {
|
||||
if (backend && backend.player) {
|
||||
backend.player.togglePlayPause()
|
||||
}
|
||||
}
|
||||
}
|
||||
Platform.MenuItem {
|
||||
text: root.visible ? qsTr("Hide") : qsTr("Show")
|
||||
onTriggered: {
|
||||
if (root.visible) {
|
||||
root.hide()
|
||||
} else {
|
||||
root.show()
|
||||
root.raise()
|
||||
root.requestActivate()
|
||||
}
|
||||
}
|
||||
}
|
||||
Platform.MenuSeparator {}
|
||||
Platform.MenuItem {
|
||||
text: qsTr("Quit")
|
||||
onTriggered: Qt.quit()
|
||||
}
|
||||
}
|
||||
|
||||
onActivated: function(reason) {
|
||||
if (reason === Platform.SystemTrayIcon.Trigger) {
|
||||
if (root.visible) {
|
||||
root.hide()
|
||||
} else {
|
||||
root.show()
|
||||
root.raise()
|
||||
root.requestActivate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property var currentPage: "top"
|
||||
property var backend: (typeof radioBackend !== "undefined" ? radioBackend : null)
|
||||
property bool compactMode: width < 780
|
||||
@@ -116,6 +59,15 @@ ApplicationWindow {
|
||||
toastPopup.open()
|
||||
}
|
||||
|
||||
function resetSearchFilter() {
|
||||
searchTimer.stop()
|
||||
if (searchField.text !== "") {
|
||||
searchField.text = ""
|
||||
} else if (backend && backend.filterQuery !== "") {
|
||||
backend.filterQuery = ""
|
||||
}
|
||||
}
|
||||
|
||||
function getFilteredCountries() {
|
||||
if (!backend || !backend.countries) return [];
|
||||
var query = countrySearchText.toLowerCase().trim();
|
||||
@@ -160,6 +112,9 @@ ApplicationWindow {
|
||||
onCurrentPageChanged: {
|
||||
contentOpacity = 0.85
|
||||
contentFadeRestart.restart()
|
||||
if (currentPage !== "search") {
|
||||
resetSearchFilter()
|
||||
}
|
||||
if (currentPage !== "world") {
|
||||
selectedWorldCategory = ""
|
||||
selectedWorldType = ""
|
||||
@@ -485,6 +440,7 @@ ApplicationWindow {
|
||||
if (backend) {
|
||||
backend.filterQuery = text
|
||||
}
|
||||
searchTimer.restart()
|
||||
}
|
||||
onAccepted: {
|
||||
if (text.length < 2 || !backend) return
|
||||
|
||||
Reference in New Issue
Block a user