1 #ifndef PLAYLISTMODEL_H
2 #define PLAYLISTMODEL_H
10 ItemTypeRole = Qt::UserRole,
15 DownloadButtonHoveredRole,
16 DownloadButtonPressedRole,
26 class PlaylistModel : public QAbstractListModel {
31 PlaylistModel(QWidget *parent = 0);
33 int rowCount(const QModelIndex &parent = QModelIndex()) const;
34 int columnCount( const QModelIndex& parent = QModelIndex() ) const { Q_UNUSED( parent ); return 4; }
35 QVariant data(const QModelIndex &index, int role) const;
36 bool removeRows(int position, int rows, const QModelIndex &parent);
38 Qt::ItemFlags flags(const QModelIndex &index) const;
39 QStringList mimeTypes() const;
40 Qt::DropActions supportedDropActions() const;
41 Qt::DropActions supportedDragActions() const;
42 QMimeData* mimeData( const QModelIndexList &indexes ) const;
43 bool dropMimeData(const QMimeData *data,
44 Qt::DropAction action, int row, int column,
45 const QModelIndex &parent);
47 void setActiveRow(int row , bool notify = true);
48 bool rowExists( int row ) const { return (( row >= 0 ) && ( row < videos.size() ) ); }
49 int activeRow() const { return m_activeRow; } // returns -1 if there is no active row
51 int previousRow() const;
52 void removeIndexes(QModelIndexList &indexes);
53 int rowForVideo(Video* video);
54 QModelIndex indexForVideo(Video* video);
55 void move(QModelIndexList &indexes, bool up);
57 Video* videoAt( int row ) const;
58 Video* activeVideo() const;
59 int rowForCloneVideo(Video *video) const;
61 VideoSource* getVideoSource() { return videoSource; }
62 void setVideoSource(VideoSource *videoSource);
68 void addVideos(QList<Video*> newVideos);
69 void searchFinished(int total);
70 void searchError(QString message);
71 void updateThumbnail();
73 void setHoveredRow(int row);
75 void enterAuthorHover();
76 void exitAuthorHover();
77 void enterAuthorPressed();
78 void exitAuthorPressed();
82 void activeRowChanged(int);
83 void needSelectionFor(QList<Video*>);
84 void haveSuggestions(const QStringList &suggestions);
87 void handleFirstVideo(Video* video);
88 void searchMore(int max);
90 VideoSource *videoSource;
100 Video *m_activeVideo;
102 QString errorMessage;