root/src/apipushevents.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
#ifndef APIPUSHEVENTS_H
#define APIPUSHEVENTS_H

#include <QObject>
#include <qhttprequest.h>
#include <qhttpresponse.h>
#include "library.h"
#include <videoplayer.h>

class ApiPushEvents : public QObject
{
    Q_OBJECT
public:
    explicit ApiPushEvents(const Library& library, const VideoPlayer& videoplayer, QObject *parent = 0);
    
    bool handleApiRequest(QHttpRequest *req, QHttpResponse *resp);
    void sendToListeners(const QString &message, const QString &event = QString());
signals:
    
public slots:

private slots:
    void listenerTerminated();
    void onShowAdded(TvShow* show);
    void playbackStarted();
    void playbackEnded();
    void paused();
    void unpaused();
    void jumped(int seconds);

private:
    QList<QHttpResponse*> listeners;
    const Library& library;
    const VideoPlayer& videoPlayer;
};

#endif // APIPUSHEVENTS_H