]> git.sur5r.net Git - minitube/blobdiff - src/playlistmodel.cpp
New upstream version 3.9.1
[minitube] / src / playlistmodel.cpp
index be0819479e1a5096b6bfe58d7c05bc218d0fc903..f2e0e5f32d0f5c9a10c4c6e84e3dfa85e7c311e8 100644 (file)
@@ -20,6 +20,7 @@ $END_LICENSE */
 
 #include "playlistmodel.h"
 #include "mediaview.h"
+#include "playlistitemdelegate.h"
 #include "searchparams.h"
 #include "video.h"
 #include "videomimedata.h"
@@ -242,8 +243,10 @@ void PlaylistModel::addVideos(const QVector<Video *> &newVideos) {
     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));
+        });
     }
 }
 
@@ -297,16 +300,6 @@ void PlaylistModel::handleFirstVideo(Video *video) {
     }
 }
 
-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);