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