mirror of
https://github.com/spalencsar/bearwave.git
synced 2026-07-07 14:44:16 +02:00
Implement playing station visual feedback, track desktop notifications, and local cover caching
This commit is contained in:
50
src/notificationmanager.h
Normal file
50
src/notificationmanager.h
Normal 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
|
||||
Reference in New Issue
Block a user