]> git.sesse.net Git - kdenlive/commitdiff
When creating a slideshow, only create thumbnails for the first 80 images so that...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 13 Jan 2009 01:26:25 +0000 (01:26 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 13 Jan 2009 01:26:25 +0000 (01:26 +0000)
svn path=/branches/KDE4/; revision=2907

src/slideshowclip.cpp
src/slideshowclip.h

index 90651110af323a57d053718edbd92f558400b985..5cacc0e4387d64026a6bc2f912d45191333cbcce 100644 (file)
@@ -126,11 +126,34 @@ void SlideshowClip::parseFolder() {
     if (m_count == 0) m_view.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
     else m_view.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
     m_view.label_info->setText(i18n("%1 images found", m_count));
+    QListWidgetItem *item;
+    int i = 0;
+    KIcon unknownicon("unknown");
     foreach(const QString &path, result) {
-        QIcon icon(dir.filePath(path));
-        QListWidgetItem *item = new QListWidgetItem(icon, KUrl(path).fileName());
+        i++;
+        if (i < 80) {
+            QIcon icon(dir.filePath(path));
+            item = new QListWidgetItem(icon, KUrl(path).fileName());
+        } else {
+            item = new QListWidgetItem(unknownicon, KUrl(path).fileName());
+            item->setData(Qt::UserRole, dir.filePath(path));
+        }
         m_view.icon_list->addItem(item);
     }
+    if (m_count >= 80) connect(m_view.icon_list, SIGNAL(currentRowChanged(int)), this, SLOT(slotSetItemIcon(int)));
+    m_view.icon_list->setCurrentRow(0);
+}
+
+void SlideshowClip::slotSetItemIcon(int row) {
+    QListWidgetItem * item = m_view.icon_list->item(row);
+    if (item) {
+        QString path = item->data(Qt::UserRole).toString();
+        if (!path.isEmpty()) {
+            KIcon icon(path);
+            item->setIcon(icon);
+            item->setData(Qt::UserRole, QString());
+        }
+    }
 }
 
 QString SlideshowClip::selectedPath() const {
index 116219ea8477a1a375365dceaddf9af61bb23ea1..fd4c32cc903da61e2c8e3a2ae3da73f187df3066 100644 (file)
@@ -48,6 +48,7 @@ private slots:
     void parseFolder();
     void slotEnableLuma(int state);
     void slotEnableLumaFile(int state);
+    void slotSetItemIcon(int row);
 
 private:
     Ui::SlideshowClip_UI m_view;