[Digikam-devel] extragear/graphics/digikam/digikam
Gilles Caulier
caulier.gilles at free.fr
Wed Sep 28 06:39:34 BST 2005
SVN commit 464720 by cgilles:
Accordinly with Renchi, digikam search result view widget using digiKam::thumbnailjob instead kio:previewjob:
- Homogenous thumbnails rendering like in image view.
- More fast with PNG and JPEG.
- Better results with PNG and TIFF. Kio::PreviewJob give weird preview (nuul)
with any PNG file using max compression level.
- RAW image files support !
CCMAIL: digikam-devel at kde.org
M +23 -21 searchresultsview.cpp
M +15 -8 searchresultsview.h
--- trunk/extragear/graphics/digikam/digikam/searchresultsview.cpp #464719:464720
@@ -21,7 +21,6 @@
#include <qdatastream.h>
#include <kio/job.h>
-#include <kio/previewjob.h>
#include <kfileitem.h>
#include <kurl.h>
@@ -33,8 +32,8 @@
SearchResultsView::SearchResultsView(QWidget* parent)
: QIconView(parent)
{
- m_listJob = 0;
- m_previewJob = 0;
+ m_listJob = 0;
+ m_thumbJob = 0;
m_libraryPath = AlbumManager::instance()->getLibraryPath();
m_filter = AlbumSettings::instance()->getAllFileFilter();
@@ -45,8 +44,8 @@
SearchResultsView::~SearchResultsView()
{
- if (m_previewJob)
- m_previewJob->kill();
+ if (!m_thumbJob.isNull())
+ m_thumbJob->kill();
if (m_listJob)
m_listJob->kill();
}
@@ -57,9 +56,9 @@
m_listJob->kill();
m_listJob = 0;
- if (m_previewJob)
- m_previewJob->kill();
- m_previewJob = 0;
+ if (!m_thumbJob.isNull())
+ m_thumbJob->kill();
+ m_thumbJob = 0;
QByteArray ba;
QDataStream ds(ba, IO_WriteOnly);
@@ -83,9 +82,9 @@
m_listJob->kill();
m_listJob = 0;
- if (m_previewJob)
- m_previewJob->kill();
- m_previewJob = 0;
+ if (!m_thumbJob.isNull())
+ m_thumbJob->kill();
+ m_thumbJob = 0;
m_itemDict.clear();
QIconView::clear();
@@ -134,11 +133,13 @@
if (!ulist.isEmpty())
{
- m_previewJob = KIO::filePreview(ulist, 128);
- connect(m_previewJob, SIGNAL(gotPreview(const KFileItem*, const QPixmap&)),
- SLOT(slotPreview(const KFileItem*, const QPixmap&)));
- connect(m_previewJob, SIGNAL(failed (const KFileItem*)),
- SLOT(slotFailed(const KFileItem*)));
+ m_thumbJob = new ThumbnailJob(ulist, 128, true);
+
+ connect(m_thumbJob, SIGNAL(signalThumbnail(const KURL&, const QPixmap&)),
+ this, SLOT(slotGotThumbnail(const KURL&, const QPixmap&)));
+
+ connect(m_thumbJob, SIGNAL(signalFailed(const KURL&)),
+ this, SLOT(slotFailedThumbnail(const KURL&)));
}
}
@@ -149,18 +150,19 @@
m_listJob = 0;
}
-void SearchResultsView::slotPreview(const KFileItem* item, const QPixmap& pix)
+
+void SearchResultsView::slotGotThumbnail(const KURL& url, const QPixmap& pix)
{
- QIconViewItem* i = m_itemDict.find(item->url().path());
+ QIconViewItem* i = m_itemDict.find(url.path());
if (i)
i->setPixmap(pix);
- m_previewJob = 0;
+ m_thumbJob = 0;
}
-void SearchResultsView::slotFailed(const KFileItem*)
+void SearchResultsView::slotFailedThumbnail(const KURL&)
{
- m_previewJob = 0;
+ m_thumbJob = 0;
}
#include "searchresultsview.moc"
--- trunk/extragear/graphics/digikam/digikam/searchresultsview.h #464719:464720
@@ -21,14 +21,18 @@
#include <qiconview.h>
#include <qcstring.h>
#include <qdict.h>
+#include <qguardedptr.h>
+// Local includes.
+
+#include "thumbnailjob.h"
+
class QPixmap;
class KFileItem;
namespace KIO
{
class TransferJob;
-class PreviewJob;
class Job;
}
@@ -46,18 +50,21 @@
private:
- KIO::TransferJob* m_listJob;
- KIO::PreviewJob* m_previewJob;
- QDict<QIconViewItem> m_itemDict;
- QString m_libraryPath;
- QString m_filter;
+ KIO::TransferJob* m_listJob;
+
+ QGuardedPtr<ThumbnailJob> m_thumbJob;
+
+ QDict<QIconViewItem> m_itemDict;
+
+ QString m_libraryPath;
+ QString m_filter;
private slots:
void slotData(KIO::Job *job, const QByteArray &data);
void slotResult(KIO::Job *job);
- void slotPreview(const KFileItem* item, const QPixmap&);
- void slotFailed(const KFileItem* item);
+ void slotGotThumbnail(const KURL& url, const QPixmap& pix);
+ void slotFailedThumbnail(const KURL& url);
};
#endif /* SEARCHRESULTSVIEW_H */
More information about the Digikam-devel
mailing list