#include "playlistmodel.h"
#include "mediaview.h"
+#include "playlistitemdelegate.h"
#include "searchparams.h"
#include "video.h"
#include "videomimedata.h"
videos.append(newVideos);
endInsertRows();
for (Video *video : newVideos) {
- connect(video, SIGNAL(gotThumbnail()), SLOT(updateVideoSender()), Qt::UniqueConnection);
- video->loadThumbnail();
+ connect(video, &Video::changed, this, [video, this] {
+ int row = rowForVideo(video);
+ emit dataChanged(createIndex(row, 0), createIndex(row, columnCount() - 1));
+ });
}
}
}
}
-void PlaylistModel::updateVideoSender() {
- Video *video = static_cast<Video *>(sender());
- if (!video) {
- qDebug() << "Cannot get sender";
- return;
- }
- int row = rowForVideo(video);
- emit dataChanged(createIndex(row, 0), createIndex(row, columnCount() - 1));
-}
-
void PlaylistModel::emitDataChanged() {
QModelIndex index = createIndex(rowCount() - 1, 0);
emit dataChanged(index, index);