Implement playing station visual feedback, track desktop notifications, and local cover caching

This commit is contained in:
Sebastian Palencsar
2026-05-22 10:26:26 +02:00
parent a172e62ef9
commit 79e2278a54
9 changed files with 587 additions and 91 deletions

50
src/notificationmanager.h Normal file
View File

@@ -0,0 +1,50 @@
#ifndef NOTIFICATIONMANAGER_H
#define NOTIFICATIONMANAGER_H
#include <QObject>
#include <QString>
#include <QTimer>
#include <QNetworkAccessManager>
#include <QNetworkReply>
class RadioBackend;
class BearPlayer;
class NotificationManager : public QObject
{
Q_OBJECT
public:
explicit NotificationManager(RadioBackend *backend, QObject *parent = nullptr);
~NotificationManager();
private slots:
void onTrackInfoChanged();
void onDownloadFinished();
void onNotifyTimeout();
private:
void showNotification(const QString &station, const QString &artist, const QString &title, const QString &coverPath);
void closeNotification();
void downloadCover(const QString &url);
void triggerNotification();
RadioBackend *m_backend = nullptr;
BearPlayer *m_player = nullptr;
QNetworkAccessManager *m_networkManager = nullptr;
QNetworkReply *m_currentReply = nullptr;
QTimer m_notifyTimer;
quint32 m_lastNotificationId = 0;
QString m_coversDir;
QString m_lastArtist;
QString m_lastTitle;
QString m_lastStation;
QString m_notifiedCoverUrl;
QString m_pendingCoverUrl;
QString m_activeCoverPath;
bool m_notificationShown = false;
};
#endif // NOTIFICATIONMANAGER_H