[Kde-imaging] extragear/libs/kipi-plugins/rawconverter
Gilles Caulier
caulier.gilles at gmail.com
Fri Nov 23 11:22:29 CET 2007
SVN commit 740468 by cgilles:
kipi-plugins from trunk (KDE4) : RAW Converter now support thumbnails extraction from Kipi host
CCMAIL: kde-imaging at kde.org
M +21 -1 batchdialog.cpp
M +2 -0 batchdialog.h
M +26 -10 singledialog.cpp
M +13 -8 singledialog.h
--- trunk/extragear/libs/kipi-plugins/rawconverter/batchdialog.cpp #740467:740468
@@ -253,6 +253,9 @@
connect(d->thread, SIGNAL(finished(const ActionData&)),
this, SLOT(slotAction(const ActionData&)));
+ connect(d->iface, SIGNAL(gotThumbnail( const KUrl&, const QPixmap& )),
+ this, SLOT(slotThumbnail(const KUrl&, const QPixmap&)));
+
// ---------------------------------------------------------------
d->itemDict.setAutoDelete(true);
@@ -505,13 +508,30 @@
if (!urlList.empty())
{
+ if (!d->iface->hasFeature(KIPI::HostSupportsThumbnails))
+ d->thread->thumbRawFiles(urlList);
+ else
+ d->iface->thumbnails(urlList, 256);
+
d->thread->identifyRawFiles(urlList);
- d->thread->thumbRawFiles(urlList);
if (!d->thread->isRunning())
d->thread->start();
}
}
+void BatchDialog::slotThumbnail(const KUrl& url, const QPixmap& pix)
+{
+ RawItem *rawItem = d->itemDict.find(url.fileName());
+ if (rawItem)
+ {
+ if (!pix.isNull())
+ {
+ QPixmap pixmap = pix.scaled(64, 64, Qt::KeepAspectRatio);
+ rawItem->viewItem->setThumbnail(pixmap);
+ }
+ }
+}
+
void BatchDialog::slotSaveFormatChanged()
{
QString ext;
--- trunk/extragear/libs/kipi-plugins/rawconverter/batchdialog.h #740467:740468
@@ -92,6 +92,8 @@
void slotAction(const ActionData&);
+ void slotThumbnail(const KUrl&, const QPixmap&);
+
private:
BatchDialogPriv* d;
--- trunk/extragear/libs/kipi-plugins/rawconverter/singledialog.cpp #740467:740468
@@ -45,7 +45,6 @@
#include <QEvent>
#include <QPushButton>
#include <QFile>
-#include <QPixmap>
// KDE includes.
@@ -439,12 +438,28 @@
void SingleDialog::slotIdentify()
{
+ if (!d->iface->hasFeature(KIPI::HostSupportsThumbnails))
+ {
+ d->thread->thumbRawFile(KUrl(d->inputFile));
+ }
+ else
+ {
+ connect(d->iface, SIGNAL(gotThumbnail( const KUrl&, const QPixmap& )),
+ this, SLOT(slotThumbnail(const KUrl&, const QPixmap&)));
+
+ d->iface->thumbnail(KUrl(d->inputFile), 256);
+ }
+
d->thread->identifyRawFile(KUrl(d->inputFile), true);
- d->thread->thumbRawFile(KUrl(d->inputFile));
if (!d->thread->isRunning())
d->thread->start();
}
+void SingleDialog::slotThumbnail(const KUrl& url, const QPixmap& pix)
+{
+ setThumbnail(url.path(), pix);
+}
+
void SingleDialog::busy(bool val)
{
d->decodingSettingsBox->setEnabled(!val);
@@ -455,24 +470,25 @@
enableButton(Close, !val);
}
-void SingleDialog::setIdentity(const QString&, const QString& identity)
+void SingleDialog::setIdentity(const QString& /*file*/, const QString& identity)
{
d->previewWidget->setIdentity(d->inputFileName + QString(" :\n") + identity, Qt::white);
}
-void SingleDialog::setThumbnail(const QString&, const QPixmap& thumbnail)
+void SingleDialog::setThumbnail(const QString& file, const QPixmap& thumbnail)
{
- d->previewWidget->setThumbnail(thumbnail);
+ if (file == d->inputFile)
+ d->previewWidget->setThumbnail(thumbnail);
}
-void SingleDialog::previewing(const QString&)
+void SingleDialog::previewing(const QString& /*file*/)
{
d->previewBlink = false;
d->previewWidget->setCursor( Qt::WaitCursor );
d->blinkPreviewTimer->start(200);
}
-void SingleDialog::previewed(const QString&, const QString& tmpFile)
+void SingleDialog::previewed(const QString& /*file*/, const QString& tmpFile)
{
d->previewWidget->unsetCursor();
d->blinkPreviewTimer->stop();
@@ -480,14 +496,14 @@
::remove(QFile::encodeName(tmpFile));
}
-void SingleDialog::previewFailed(const QString&)
+void SingleDialog::previewFailed(const QString& /*file*/)
{
d->previewWidget->unsetCursor();
d->blinkPreviewTimer->stop();
d->previewWidget->setIdentity(i18n("Failed to generate preview"), Qt::red);
}
-void SingleDialog::processing(const QString&)
+void SingleDialog::processing(const QString& /*file*/)
{
d->convertBlink = false;
d->previewWidget->setCursor( Qt::WaitCursor );
@@ -567,7 +583,7 @@
}
}
-void SingleDialog::processingFailed(const QString&)
+void SingleDialog::processingFailed(const QString& /*file*/)
{
d->previewWidget->unsetCursor();
d->blinkConvertTimer->stop();
--- trunk/extragear/libs/kipi-plugins/rawconverter/singledialog.h #740467:740468
@@ -26,10 +26,13 @@
// Qt includes.
+#include <QString>
+#include <QPixmap>
// KDE includes.
#include <kdialog.h>
+#include <kurl.h>
class QCloseEvent;
@@ -64,16 +67,16 @@
void busy(bool busy);
- void setIdentity(const QString&, const QString& identity);
- void setThumbnail(const QString&, const QPixmap& thumb);
+ void setIdentity(const QString& file, const QString& identity);
+ void setThumbnail(const QString& file, const QPixmap& thumb);
- void previewing(const QString&);
- void previewed(const QString&, const QString& tmpFile);
- void previewFailed(const QString&);
+ void previewing(const QString& file);
+ void previewed(const QString& file, const QString& tmpFile);
+ void previewFailed(const QString& file);
- void processing(const QString&);
- void processed(const QString&, const QString& tmpFile);
- void processingFailed(const QString&);
+ void processing(const QString& file);
+ void processed(const QString& file, const QString& tmpFile);
+ void processingFailed(const QString& file);
private slots:
@@ -90,6 +93,8 @@
void slotConvertBlinkTimerDone();
void slotAction(const ActionData&);
+
+ void slotThumbnail(const KUrl&, const QPixmap&);
private:
More information about the Kde-imaging
mailing list