<label>Name of the chosen color theme.</label>
<default></default>
</entry>
+
+ <entry name="showslideshowthumbs" type="Bool">
+ <label>Show thumbnails in slideshow dialog.</label>
+ <default>false</default>
+ </entry>
</group>
</kcfg>
#include <KFileItem>
#include <QDir>
+#include <QtConcurrentRun>
+#include <QFutureWatcher>
+
SlideshowClip::SlideshowClip(Timecode tc, QWidget * parent) :
QDialog(parent),
m_view.clip_name->setText(i18n("Slideshow Clip"));
m_view.folder_url->setMode(KFile::Directory);
m_view.icon_list->setIconSize(QSize(50, 50));
+ m_view.show_thumbs->setChecked(KdenliveSettings::showslideshowthumbs());
+
connect(m_view.folder_url, SIGNAL(textChanged(const QString &)), this, SLOT(parseFolder()));
connect(m_view.image_type, SIGNAL(currentIndexChanged(int)), this, SLOT(parseFolder()));
+ connect(m_view.show_thumbs, SIGNAL(stateChanged(int)), this, SLOT(slotEnableThumbs(int)));
connect(m_view.slide_fade, SIGNAL(stateChanged(int)), this, SLOT(slotEnableLuma(int)));
connect(m_view.luma_fade, SIGNAL(stateChanged(int)), this, SLOT(slotEnableLumaFile(int)));
m_view.luma_softness->setEnabled(m_view.label_softness->isEnabled());
}
+void SlideshowClip::slotEnableThumbs(int state)
+{
+ if (state == Qt::Checked) {
+ KdenliveSettings::setShowslideshowthumbs(true);
+ slotGenerateThumbs();
+ } else {
+ KdenliveSettings::setShowslideshowthumbs(false);
+ }
+
+}
+
void SlideshowClip::slotEnableLumaFile(int state)
{
bool enable = false;
KIcon unknownicon("unknown");
foreach(const QString &path, result) {
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));
- }
+ 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)));
+ if (m_view.show_thumbs->isChecked()) slotGenerateThumbs();
m_view.icon_list->setCurrentRow(0);
}
-void SlideshowClip::slotSetItemIcon(int row)
+void SlideshowClip::slotGenerateThumbs()
+{
+ if (!m_future.isRunning()) {
+ connect(&m_watcher, SIGNAL(finished()), this, SLOT(slotCheckGenerateThumbs()));
+ m_future = QtConcurrent::run(this, &SlideshowClip::doGetThumbs);
+ m_watcher.setFuture(m_future);
+ }
+}
+
+void SlideshowClip::slotCheckGenerateThumbs()
+{
+ QListWidgetItem* item = m_view.icon_list->item(m_view.icon_list->count() - 1);
+ if (!item || item->data(Qt::UserRole).toString().isEmpty() || m_view.show_thumbs->isChecked() == false) return;
+ QTimer::singleShot(300, this, SLOT(slotGenerateThumbs()));
+}
+
+void SlideshowClip::doGetThumbs()
{
- 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());
+ for (int i = 0; i < m_view.icon_list->count(); i++) {
+ QListWidgetItem* item = m_view.icon_list->item(i);
+ if (item && m_view.show_thumbs->isChecked()) {
+ QString path = item->data(Qt::UserRole).toString();
+ if (path.isEmpty()) continue;
+ else {
+ item->setIcon(KIcon(path));
+ item->setData(Qt::UserRole, QString());
+ break;
+ }
}
}
}
#include "timecode.h"
#include "ui_slideshowclip_ui.h"
+#include <QFuture>
+#include <QFutureWatcher>
+
class SlideshowClip : public QDialog
{
Q_OBJECT
private slots:
void parseFolder();
void slotEnableLuma(int state);
+ void slotEnableThumbs(int state);
void slotEnableLumaFile(int state);
- void slotSetItemIcon(int row);
+ void doGetThumbs();
void slotUpdateDurationFormat(int ix);
+ void slotGenerateThumbs();
+ void slotCheckGenerateThumbs();
private:
Ui::SlideshowClip_UI m_view;
int m_count;
Timecode m_timecode;
+ QFuture<void> m_future;
+ QFutureWatcher<void> m_watcher;
};
<rect>
<x>0</x>
<y>0</y>
- <width>275</width>
+ <width>268</width>
<height>359</height>
</rect>
</property>
<item row="3" column="1" colspan="2">
<widget class="KComboBox" name="image_type"/>
</item>
- <item row="4" column="0" colspan="3">
+ <item row="4" column="0">
<widget class="QCheckBox" name="slide_loop">
<property name="text">
<string>Loop</string>
<widget class="KListWidget" name="icon_list"/>
</item>
<item row="9" column="0" colspan="3">
- <widget class="QLabel" name="label_info">
- <property name="text">
- <string>No image found</string>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QCheckBox" name="show_thumbs">
+ <property name="text">
+ <string>Show thumbnails</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_info">
+ <property name="text">
+ <string>No image found</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="10" column="0" colspan="3">
+ <item row="10" column="1" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</layout>
</widget>
<customwidgets>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
- <class>KLineEdit</class>
- <extends>QLineEdit</extends>
- <header>klineedit.h</header>
+ <class>KUrlRequester</class>
+ <extends>QFrame</extends>
+ <header>kurlrequester.h</header>
</customwidget>
<customwidget>
<class>KListWidget</class>
<extends>QListWidget</extends>
<header>klistwidget.h</header>
</customwidget>
+ <customwidget>
+ <class>KLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>klineedit.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
<customwidget>
<class>KRestrictedLine</class>
<extends>KLineEdit</extends>
<header>krestrictedline.h</header>
</customwidget>
- <customwidget>
- <class>KUrlRequester</class>
- <extends>QFrame</extends>
- <header>kurlrequester.h</header>
- </customwidget>
</customwidgets>
<resources/>
<connections>
<rect>
<x>0</x>
<y>0</y>
- <width>1383</width>
- <height>835</height>
+ <width>986</width>
+ <height>621</height>
</rect>
</property>
<property name="sizePolicy">
</item>
<item row="0" column="0">
<widget class="KColorButton" name="backgroundColor">
- <property name="color" stdset="0">
+ <property name="color">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
- <property name="defaultColor" stdset="0">
+ <property name="defaultColor">
<color>
<red>0</red>
<green>0</green>
</item>
<item row="0" column="1">
<widget class="KColorButton" name="rectBColor">
- <property name="color" stdset="0">
+ <property name="color">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
- <property name="defaultColor" stdset="0">
+ <property name="defaultColor">
<color>
<red>0</red>
<green>0</green>
</item>
<item row="0" column="5">
<widget class="KColorButton" name="rectFColor">
- <property name="color" stdset="0">
+ <property name="color">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
- <property name="defaultColor" stdset="0">
+ <property name="defaultColor">
<color>
<red>0</red>
<green>0</green>
<property name="flat">
<bool>false</bool>
</property>
- <property name="color" stdset="0">
+ <property name="color">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
- <property name="defaultColor" stdset="0">
+ <property name="defaultColor">
<color>
<red>0</red>
<green>0</green>