this will break all functionality for now
[groove] / playlist.h
1 #ifndef PLAYLIST_H
2 #define PLAYLIST_H
3
4 #include <QObject>
5 #include <QStandardItem>
6 #include <QBuffer>
7 #include <QNetworkReply>
8 #include <QList>
9 #include <QSignalMapper>
10 #include <gscom.h>
11 class playlist : public QObject
12 {
13     Q_OBJECT
14 public:
15     enum failType
16     {
17         none = 0,
18         Aborted = 1,
19         Other =2
20     };
21     explicit playlist(QObject *parent = 0);
22     int addSong(QStandardItem *item);
23     QList<QStandardItem *> getPlaylist();
24     void removeSong(int position);
25     void getSong(int position);
26     QIODevice * getBuffer(int position);
27     bool isStream(int position);
28     void markPlayed(int position);
29     void deleteSong(int position);
30     void setGscom(gscom *comm);
31     void freeMemory(int position);
32     int currentplaying();
33     bool setCurrentPlaying(int position);
34     bool bReady(int b);
35     int findFirstNotPlayed();
36     void beginDownload(int position);
37
38 signals:
39     void downloadProgress(int position, qint64 d, qint64 t);
40     void bufferReady(int position);
41     void sFailure(int position,failType);
42     void downloadComplete(int position);
43     void freeze();
44     void unfreeze();
45
46 public slots:
47 private slots:
48     void downloadSlot(qint64 d, qint64 t);
49     void networkReplyFinish();
50     void downloadDone(int position);
51     void skeyFound();
52     void setBufferRdy(int b);
53 private:
54
55
56     enum elementType
57     {
58         EStream = 1,
59         EFile = 2,
60     };
61
62     struct songElement
63     {
64         QString *songId;
65         QString *streamkey;
66         QUrl *server;
67         QBuffer *buffer;
68         QIODevice *data;
69         elementType type;
70         bool downloaded;
71         bool played;
72         bool bufferready;
73     };
74     int currentplayingitem;
75     int currentSkeyItem;
76     QList<songElement *> *pList;
77     QSignalMapper *mapper;
78     QNetworkReply *reply;
79     QNetworkAccessManager *manager;
80     int currentdownloaditem;
81     gscom *gs;
82     QTime startStreamT;
83 };
84
85 #endif // PLAYLIST_H