forked from Elleo/libQtSpotify
-
Notifications
You must be signed in to change notification settings - Fork 3
/
qspotifyevents.h
120 lines (96 loc) · 2.83 KB
/
qspotifyevents.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef QSPOTIFYEVENTS_H
#define QSPOTIFYEVENTS_H
#include <QtCore/QEvent>
#include <QtCore/QString>
#include <libspotify/api.h>
extern const QEvent::Type NotifyMainThreadEventType;
extern const QEvent::Type ConnectionErrorEventType;
extern const QEvent::Type MetaDataEventType;
extern const QEvent::Type StreamingStartedEventType;
extern const QEvent::Type EndOfTrackEventType;
extern const QEvent::Type StopEventType;
extern const QEvent::Type ResumeEventType;
extern const QEvent::Type SuspendEventType;
extern const QEvent::Type AudioStopEventType;
extern const QEvent::Type ResetBufferEventType;
extern const QEvent::Type TrackProgressEventType;
extern const QEvent::Type SendImageRequestEventType;
extern const QEvent::Type ReceiveImageRequestEventType;
extern const QEvent::Type PlayTokenLostEventType;
extern const QEvent::Type LoggedInEventType;
extern const QEvent::Type LoggedOutEventType;
extern const QEvent::Type OfflineErrorEventType;
extern const QEvent::Type ScrobbleLoginErrorEventType;
extern const QEvent::Type ConnectionStateUpdateEventType;
class QSpotifyConnectionErrorEvent : public QEvent
{
public:
QSpotifyConnectionErrorEvent(sp_error error)
: QEvent(Type(ConnectionErrorEventType))
, m_error(error)
{ }
sp_error error() const { return m_error; }
private:
sp_error m_error;
QString m_message;
};
class QSpotifyStreamingStartedEvent : public QEvent
{
public:
QSpotifyStreamingStartedEvent(int channels, int sampleRate)
: QEvent(Type(StreamingStartedEventType))
, m_channels(channels)
, m_sampleRate(sampleRate)
{ }
int channels() const { return m_channels; }
int sampleRate() const { return m_sampleRate; }
private:
int m_channels;
int m_sampleRate;
};
class QSpotifyTrackProgressEvent : public QEvent
{
public:
QSpotifyTrackProgressEvent(int delta)
: QEvent(Type(TrackProgressEventType))
, m_delta(delta)
{ }
int delta() const { return m_delta; }
private:
int m_delta;
};
class QSpotifyRequestImageEvent : public QEvent
{
public:
QSpotifyRequestImageEvent(const QString &id)
: QEvent(Type(SendImageRequestEventType))
, m_id(id)
{ }
QString imageId() const { return m_id; }
private:
QString m_id;
};
class QSpotifyReceiveImageEvent : public QEvent
{
public:
QSpotifyReceiveImageEvent(sp_image *image)
: QEvent(Type(ReceiveImageRequestEventType))
, m_image(image)
{ Q_ASSERT(image); }
sp_image *image() const { return m_image; }
private:
sp_image *m_image;
};
class QSpotifyOfflineErrorEvent : public QEvent
{
public:
QSpotifyOfflineErrorEvent(sp_error error)
: QEvent(Type(OfflineErrorEventType))
, m_error(error)
{ }
sp_error error() const { return m_error; }
private:
sp_error m_error;
QString m_message;
};
#endif // QSPOTIFYEVENTS_H