mirror of
https://github.com/spalencsar/bearwave.git
synced 2026-07-06 22:24:17 +02:00
fix: show window on startup and on MPRIS Raise (1.0.5 pkgrel 4)
Register MPRIS only after QML loads, always connect raiseRequested to the main window (not only when the tray icon exists), and show or activate the window explicitly on launch. Fix circular dialog property aliases.
This commit is contained in:
2
PKGBUILD
2
PKGBUILD
@@ -1,7 +1,7 @@
|
||||
# Maintainer: Sebastian Palencsar <moin@nerdbear.de>
|
||||
pkgname=bearwave-git
|
||||
pkgver=1.0.5
|
||||
pkgrel=3
|
||||
pkgrel=4
|
||||
pkgdesc="KDE-focused desktop internet radio app"
|
||||
arch=('x86_64')
|
||||
url="https://github.com/spalencsar/bearwave"
|
||||
|
||||
@@ -68,6 +68,8 @@
|
||||
<li>About dialog shows version and git build id; removed “Public beta” label</li>
|
||||
<li>Fixed About, Add station, and Edit station dialogs not opening after QML refactor</li>
|
||||
<li>Flatpak: grant GPU access via --device=dri (fixes EGL/MESA warnings)</li>
|
||||
<li>Fixed startup when re-launching: MPRIS Raise now always shows the window</li>
|
||||
<li>Fixed dialog property aliases and About version label binding</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
|
||||
29
src/main.cpp
29
src/main.cpp
@@ -38,6 +38,7 @@ int main(int argc, char *argv[])
|
||||
QStringLiteral("Raise")
|
||||
);
|
||||
sessionBus.call(call);
|
||||
qInfo() << "BearWave is already running; raised the existing window.";
|
||||
return 0;
|
||||
}
|
||||
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("de.nerdbear.bearwave")));
|
||||
@@ -64,15 +65,6 @@ int main(int argc, char *argv[])
|
||||
Q_UNUSED(controlAdaptor)
|
||||
Q_UNUSED(notificationManager)
|
||||
|
||||
if (!sessionBus.registerObject(QStringLiteral("/org/mpris/MediaPlayer2"), &backend, QDBusConnection::ExportAdaptors)) {
|
||||
qWarning() << "Failed to register MPRIS D-Bus object";
|
||||
}
|
||||
if (!sessionBus.registerService(QStringLiteral("org.mpris.MediaPlayer2.bearwave"))) {
|
||||
qWarning() << "Failed to register MPRIS D-Bus service org.mpris.MediaPlayer2.bearwave";
|
||||
} else {
|
||||
mprisPlayer->publishState();
|
||||
}
|
||||
|
||||
const QUrl url(QStringLiteral("qrc:/qml/Main.qml"));
|
||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||
&app, [&app, url](QObject *obj, const QUrl &objUrl) {
|
||||
@@ -94,6 +86,25 @@ int main(int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
QObject::connect(&backend, &RadioBackend::raiseRequested, mainWindow, [mainWindow]() {
|
||||
mainWindow->show();
|
||||
mainWindow->raise();
|
||||
mainWindow->requestActivate();
|
||||
});
|
||||
|
||||
if (!sessionBus.registerObject(QStringLiteral("/org/mpris/MediaPlayer2"), &backend, QDBusConnection::ExportAdaptors)) {
|
||||
qWarning() << "Failed to register MPRIS D-Bus object";
|
||||
}
|
||||
if (!sessionBus.registerService(QStringLiteral("org.mpris.MediaPlayer2.bearwave"))) {
|
||||
qWarning() << "Failed to register MPRIS D-Bus service org.mpris.MediaPlayer2.bearwave";
|
||||
} else {
|
||||
mprisPlayer->publishState();
|
||||
}
|
||||
|
||||
mainWindow->show();
|
||||
mainWindow->raise();
|
||||
mainWindow->requestActivate();
|
||||
|
||||
SystemTrayManager trayManager(&backend, mainWindow, &app);
|
||||
Q_UNUSED(trayManager)
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ ApplicationWindow {
|
||||
property string countrySearchText: ""
|
||||
property alias searchField: searchToolbar.searchField
|
||||
property alias stationList: stationPanel.stationList
|
||||
property alias addDialog: addDialog
|
||||
property alias editDialog: editDialog
|
||||
property alias aboutDialog: aboutDialog
|
||||
property alias addDialog: addDialogPane
|
||||
property alias editDialog: editDialogPane
|
||||
property alias aboutDialog: aboutDialogPane
|
||||
|
||||
function toast(message) {
|
||||
toastPopup.show(message)
|
||||
@@ -231,19 +231,19 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
AddStationDialog {
|
||||
id: addDialog
|
||||
id: addDialogPane
|
||||
app: root
|
||||
compactMode: root.compactMode
|
||||
}
|
||||
|
||||
EditStationDialog {
|
||||
id: editDialog
|
||||
id: editDialogPane
|
||||
app: root
|
||||
compactMode: root.compactMode
|
||||
}
|
||||
|
||||
AboutDialog {
|
||||
id: aboutDialog
|
||||
id: aboutDialogPane
|
||||
compactMode: root.compactMode
|
||||
appVersion: root.appVersion
|
||||
buildId: root.appBuildId
|
||||
|
||||
@@ -55,7 +55,7 @@ Dialog {
|
||||
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: qsTr("Version %1 · build %2").arg(root.appVersion, root.buildId)
|
||||
text: qsTr("Version %1 · build %2").arg(String(root.appVersion), String(root.buildId))
|
||||
color: BearTheme.textMuted
|
||||
font.pixelSize: 12
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user