X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=playlist.h;h=51140c54e186445c2b248a0970b1bc7fc1393b6a;hb=050ff119dc844474b684fe0afcd7c46ed03b058e;hp=17895eef0ca80781f3248be9cd6c3f4c9d1ff72b;hpb=ece7001a5b569241115c0187d654b92e247c68f6;p=groove diff --git a/playlist.h b/playlist.h index 17895ee..51140c5 100644 --- a/playlist.h +++ b/playlist.h @@ -8,19 +8,53 @@ #include #include #include -class playlist : public QObject +class playlist : public QAbstractTableModel { Q_OBJECT public: + enum elementType + { + EStream = 1, + EFile = 2, + }; enum failType { none = 0, Aborted = 1, Other =2 }; + //this Enum MUST BE sequantial + //And when changed must update the length +#define PLAYLISTENUMS 9 + enum coulmnStruct + { + sPlaying, + sName, + sID, + sKey, + sURL, + sBuff, + sDownloaded, + sPlayed, + sReady + }; + + struct songElement + { + QString *name; + QString *songId; + QString *streamkey; + QUrl *server; + QBuffer *buffer; + QIODevice *data; + elementType type; + bool downloaded; + bool played; + bool bufferready; + }; + QList* getList(); explicit playlist(QObject *parent = 0); - int addSong(QStandardItem *item); - QList getPlaylist(); + int addSong(QStandardItem *item,QString name); void removeSong(int position); void getSong(int position); QIODevice * getBuffer(int position); @@ -30,18 +64,25 @@ public: void setGscom(gscom *comm); void freeMemory(int position); int currentplaying(); - bool setCurrentPlaying(int position); + void setCurrentPlaying(int position); bool bReady(int b); int findFirstNotPlayed(); void beginDownload(int position); + bool existAt(int position); + + //Implemented virtual classes for Model View + QVariant data(const QModelIndex &index, int role) const; + int columnCount(const QModelIndex &parent) const; + int rowCount(const QModelIndex &parent) const; signals: void downloadProgress(int position, qint64 d, qint64 t); void bufferReady(int position); void sFailure(int position,failType); void downloadComplete(int position); - void freeze(); - void unfreeze(); + void freeze(bool); + //void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void rowsInserted ( const QModelIndex & parent, int start, int end ); public slots: private slots: @@ -50,27 +91,13 @@ private slots: void downloadDone(int position); void skeyFound(); void setBufferRdy(int b); + void getNError(QNetworkReply::NetworkError); private: - enum elementType - { - EStream = 1, - EFile = 2, - }; - struct songElement - { - QString *songId; - QString *streamkey; - QUrl *server; - QBuffer *buffer; - QIODevice *data; - elementType type; - bool downloaded; - bool played; - bool bufferready; - }; + + int currentplayingitem; int currentSkeyItem; QList *pList; @@ -80,6 +107,8 @@ private: int currentdownloaditem; gscom *gs; QTime startStreamT; + QVariant *icon; + QVariant *invalid; }; #endif // PLAYLIST_H