5 #include "youtubesearch.h"
6 #include "searchparams.h"
9 ItemTypeRole = Qt::UserRole,
19 class ListModel : public QAbstractListModel {
25 ListModel(QWidget *parent);
28 // inherited from QAbstractListModel
29 int rowCount(const QModelIndex &parent = QModelIndex()) const;
30 // int rowCount( const QModelIndex& parent = QModelIndex() ) const { Q_UNUSED( parent ); return videos.size(); }
31 int columnCount( const QModelIndex& parent = QModelIndex() ) const { Q_UNUSED( parent ); return 4; }
32 QVariant data(const QModelIndex &index, int role) const;
33 bool removeRows(int position, int rows, const QModelIndex &parent);
35 Qt::ItemFlags flags(const QModelIndex &index) const;
36 QStringList mimeTypes() const;
37 Qt::DropActions supportedDropActions() const;
38 QMimeData* mimeData( const QModelIndexList &indexes ) const;
39 bool dropMimeData(const QMimeData *data,
40 Qt::DropAction action, int row, int column,
41 const QModelIndex &parent);
44 void setActiveRow( int row );
45 bool rowExists( int row ) const { return (( row >= 0 ) && ( row < videos.size() ) ); }
46 int activeRow() const { return m_activeRow; } // returns -1 if there is no active row
48 void removeIndexes(QModelIndexList &indexes);
49 int rowForVideo(Video* video);
50 QModelIndex indexForVideo(Video* video);
51 void move(QModelIndexList &indexes, bool up);
53 Video* videoAt( int row ) const;
54 Video* activeVideo() const;
56 // video search methods
57 void search(SearchParams *searchParams);
64 void addVideo(Video* video);
65 void searchFinished(int total);
66 void updateThumbnail();
69 void activeRowChanged(int);
70 void needSelectionFor(QList<Video*>);
73 void searchMore(int max);
75 YouTubeSearch *youtubeSearch;
76 SearchParams *searchParams;
83 // the row being played