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:
31
src/main.cpp
31
src/main.cpp
@@ -5,16 +5,19 @@
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusConnectionInterface>
|
||||
#include <QDBusMessage>
|
||||
#include <QDebug>
|
||||
#include <QIcon>
|
||||
#include <QLocale>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQuickWindow>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "radiobackend.h"
|
||||
#include "mprisadaptor.h"
|
||||
#include "bearwavecontroladaptor.h"
|
||||
#include "notificationmanager.h"
|
||||
#include "systemtraymanager.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -50,17 +53,22 @@ int main(int argc, char *argv[])
|
||||
RadioBackend backend;
|
||||
engine.rootContext()->setContextProperty("radioBackend", &backend);
|
||||
|
||||
MprisRootAdaptor mprisRoot(&backend, &app);
|
||||
MprisPlayerAdaptor mprisPlayer(&backend);
|
||||
BearWaveControlAdaptor controlAdaptor(&backend);
|
||||
NotificationManager notificationManager(&backend);
|
||||
auto *mprisRoot = new MprisRootAdaptor(&backend, &app);
|
||||
auto *mprisPlayer = new MprisPlayerAdaptor(&backend);
|
||||
auto *controlAdaptor = new BearWaveControlAdaptor(&backend);
|
||||
auto *notificationManager = new NotificationManager(&backend, &backend);
|
||||
Q_UNUSED(mprisRoot)
|
||||
Q_UNUSED(mprisPlayer)
|
||||
Q_UNUSED(controlAdaptor)
|
||||
Q_UNUSED(notificationManager)
|
||||
|
||||
sessionBus.registerObject(QStringLiteral("/org/mpris/MediaPlayer2"), &backend, QDBusConnection::ExportAdaptors);
|
||||
sessionBus.registerService(QStringLiteral("org.mpris.MediaPlayer2.bearwave"));
|
||||
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:/Main.qml"));
|
||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||
@@ -77,5 +85,14 @@ int main(int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
QQuickWindow *mainWindow = qobject_cast<QQuickWindow *>(engine.rootObjects().constFirst());
|
||||
if (!mainWindow) {
|
||||
qCritical("Failed to obtain main window");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
SystemTrayManager trayManager(&backend, mainWindow, &app);
|
||||
Q_UNUSED(trayManager)
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user