5 #include "youtubesearch.h"
6 #include "searchparams.h"
9 ItemTypeRole = Qt::UserRole,
14 DownloadButtonHoveredRole,
15 DownloadButtonPressedRole,
25 class ListModel : public QAbstractListModel {
31 ListModel(QWidget *parent);
34 // inherited from QAbstractListModel
35 int rowCount(const QModelIndex &parent = QModelIndex()) const;
36 // int rowCount( const QModelIndex& parent = QModelIndex() ) const { Q_UNUSED( parent ); return videos.size(); }
37 int columnCount( const QModelIndex& parent = QModelIndex() ) const { Q_UNUSED( parent ); return 4; }
38 QVariant data(const QModelIndex &index, int role) const;
39 bool removeRows(int position, int rows, const QModelIndex &parent);
41 Qt::ItemFlags flags(const QModelIndex &index) const;
42 QStringList mimeTypes() const;
43 Qt::DropActions supportedDropActions() const;
44 QMimeData* mimeData( const QModelIndexList &indexes ) const;
45 bool dropMimeData(const QMimeData *data,
46 Qt::DropAction action, int row, int column,
47 const QModelIndex &parent);
50 void setActiveRow( int row );
51 bool rowExists( int row ) const { return (( row >= 0 ) && ( row < videos.size() ) ); }
52 int activeRow() const { return m_activeRow; } // returns -1 if there is no active row
54 int previousRow() const;
55 void removeIndexes(QModelIndexList &indexes);
56 int rowForVideo(Video* video);
57 QModelIndex indexForVideo(Video* video);
58 void move(QModelIndexList &indexes, bool up);
60 Video* videoAt( int row ) const;
61 Video* activeVideo() const;
63 // video search methods
64 void search(SearchParams *searchParams);
71 void addVideo(Video* video);
72 void searchFinished(int total);
73 void searchError(QString message);
74 void updateThumbnail();
76 void setHoveredRow(int row);
78 void enterAuthorHover();
79 void exitAuthorHover();
80 void enterAuthorPressed();
81 void exitAuthorPressed();
85 void activeRowChanged(int);
86 void needSelectionFor(QList<Video*>);
87 void haveSuggestions(const QStringList &suggestions);
90 void searchMore(int max);
92 YouTubeSearch *youtubeSearch;
93 SearchParams *searchParams;
100 // the row being played
102 Video *m_activeVideo;
104 QString errorMessage;