5 #include "youtubesearch.h"
6 #include "searchparams.h"
9 ItemTypeRole = Qt::UserRole,
14 DownloadButtonHoveredRole,
15 DownloadButtonPressedRole
23 class ListModel : public QAbstractListModel {
29 ListModel(QWidget *parent);
32 // inherited from QAbstractListModel
33 int rowCount(const QModelIndex &parent = QModelIndex()) const;
34 // int rowCount( const QModelIndex& parent = QModelIndex() ) const { Q_UNUSED( parent ); return videos.size(); }
35 int columnCount( const QModelIndex& parent = QModelIndex() ) const { Q_UNUSED( parent ); return 4; }
36 QVariant data(const QModelIndex &index, int role) const;
37 bool removeRows(int position, int rows, const QModelIndex &parent);
39 Qt::ItemFlags flags(const QModelIndex &index) const;
40 QStringList mimeTypes() const;
41 Qt::DropActions supportedDropActions() 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);
48 void setActiveRow( int row );
49 bool rowExists( int row ) const { return (( row >= 0 ) && ( row < videos.size() ) ); }
50 int activeRow() const { return m_activeRow; } // returns -1 if there is no active row
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;
60 // video search methods
61 void search(SearchParams *searchParams);
68 void addVideo(Video* video);
69 void searchFinished(int total);
70 void searchError(QString message);
71 void updateThumbnail();
74 void activeRowChanged(int);
75 void needSelectionFor(QList<Video*>);
78 void searchMore(int max);
80 YouTubeSearch *youtubeSearch;
81 SearchParams *searchParams;
88 // the row being played