[Digikam-devel] [Bug 111873] Modifying and then navigating in the thumbbar does not update photo thumbnail
Gilles Caulier
caulier.gilles at free.fr
Mon Sep 5 09:44:18 BST 2005
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=111873
------- Additional Comments From caulier.gilles free fr 2005-09-05 10:44 -------
SVN commit 457252 by cgilles:
Use digikamthumbnail protocol with showfoto thumbar when its available, for exemple in a both digikam/showfoto installation. This way :
- always update properly thumbnails after image save/saveas.
- improve thumnails computation speed, especially with PNG and JPEG files.
- digikamthumbnail protocol will render properly PNG, TIFF, and JPEG files preview in all case (KIO::filePreview can't do it).
If showfoto is installed without digikam (digikamthumbnail protocol unavialable), showfoto thumbar use KIO::filePreview protocol instead to rendering thumbnails.
CCBUG: 111873
M +1 -1 digikam/Makefile.am
D digikam/thumbnailjob.cpp
D digikam/thumbnailjob.h
M +1 -1 libs/thumbbar/Makefile.am
M +60 -7 libs/thumbbar/thumbbar.cpp
M +2 -0 libs/thumbbar/thumbbar.h
A libs/thumbbar/thumbnailjob.cpp [License: GPL]
A libs/thumbbar/thumbnailjob.h [License: GPL]
M +7 -7 showfoto/Makefile.am
--- trunk/extragear/graphics/digikam/digikam/Makefile.am #457251:457252
@ -22,7 +22,7 @
libdigikam_la_SOURCES = albummanager.cpp album.cpp \
albumitemhandler.cpp albumdb.cpp albumdb_sqlite2.cpp \
- albumlister.cpp thumbnailjob.cpp dragobjects.cpp \
+ albumlister.cpp dragobjects.cpp \
iconview.cpp icongroupitem.cpp iconitem.cpp \
digikamapp.cpp digikamview.cpp \
albumfolderview.cpp \
--- trunk/extragear/graphics/digikam/libs/thumbbar/Makefile.am #457251:457252
@ -2,7 +2,7 @
noinst_LTLIBRARIES = libthumbbar.la
-libthumbbar_la_SOURCES = thumbbar.cpp
+libthumbbar_la_SOURCES = thumbbar.cpp thumbnailjob.cpp
libthumbbar_la_LDFLAGS = $(all_libraries) $(KDE_RPATH)
--- trunk/extragear/graphics/digikam/libs/thumbbar/thumbbar.cpp #457251:457252
@ -25,6 +25,7 @
#include <qdict.h>
#include <qpoint.h>
#include <qdatetime.h>
+#include <qguardedptr.h>
#include <kfileitem.h>
#include <kapplication.h>
@ -38,6 +39,7 @
#include <cmath>
#include "thumbbar.h"
+#include "thumbnailjob.h"
namespace Digikam
{
@ -67,6 +69,8 @
QTimer* timer;
ThumbBarToolTip* tip;
+
+ QGuardedPtr<ThumbnailJob> thumbJob;
};
ThumbBarView::ThumbBarView(QWidget* parent)
@ -93,8 +97,11 @
ThumbBarView::~ThumbBarView()
{
+ if (!d->thumbJob.isNull())
+ d->thumbJob->kill();
+
clear(false);
-
+
delete d->timer;
delete d->tip;
delete d;
@ -198,12 +205,17 @
delete item->m_pixmap;
item->m_pixmap = 0;
}
- KIO::PreviewJob* job = KIO::filePreview(item->url(), d->tileSize, 0, 0, 70, true, false);
- connect(job, SIGNAL(gotPreview(const KFileItem *, const QPixmap &)),
- SLOT(slotGotPreview(const KFileItem *, const QPixmap &)));
- connect(job, SIGNAL(failed(const KFileItem *)),
- SLOT(slotFailedPreview(const KFileItem *)));
+ if (!d->thumbJob.isNull())
+ d->thumbJob->kill();
+
+ d->thumbJob = new ThumbnailJob(item->url(), d->tileSize, true);
+
+ connect(d->thumbJob, SIGNAL(signalThumbnail(const KURL&, const QPixmap&)),
+ this, SLOT(slotGotThumbnail(const KURL&, const QPixmap&)));
+
+ connect(d->thumbJob, SIGNAL(signalFailed(const KURL&)),
+ this, SLOT(slotFailedThumbnail(const KURL&)));
}
void ThumbBarView::viewportPaintEvent(QPaintEvent* e)
@ -374,12 +386,24 @
if (!urlList.isEmpty())
{
+ if (!d->thumbJob.isNull())
+ d->thumbJob->kill();
+
+ d->thumbJob = new ThumbnailJob(urlList, d->tileSize, true);
+
+ connect(d->thumbJob, SIGNAL(signalThumbnail(const KURL&, const QPixmap&)),
+ this, SLOT(slotGotThumbnail(const KURL&, const QPixmap&)));
+
+ connect(d->thumbJob, SIGNAL(signalFailed(const KURL&)),
+ this, SLOT(slotFailedThumbnail(const KURL&)));
+
+/*
KIO::PreviewJob* job = KIO::filePreview(urlList, d->tileSize, 0, 0, 70, true, false);
connect(job, SIGNAL(gotPreview(const KFileItem *, const QPixmap &)),
SLOT(slotGotPreview(const KFileItem *, const QPixmap &)));
connect(job, SIGNAL(failed(const KFileItem *)),
- SLOT(slotFailedPreview(const KFileItem *)));
+ SLOT(slotFailedPreview(const KFileItem *)));*/
}
}
@ -398,6 +422,35 @
viewport()->update();
}
+void ThumbBarView::slotGotThumbnail(const KURL& url, const QPixmap& pix)
+{
+ if (!pix.isNull())
+ {
+ ThumbBarItem* item = d->itemDict.find(url.url());
+ if (!item)
+ return;
+
+ if (item->m_pixmap)
+ {
+ delete item->m_pixmap;
+ item->m_pixmap = 0;
+ }
+
+ item->m_pixmap = new QPixmap(pix);
+ item->repaint();
+ }
+}
+
+void ThumbBarView::slotFailedThumbnail(const KURL& url)
+{
+ KIO::PreviewJob* job = KIO::filePreview(url, d->tileSize, 0, 0, 70, true, false);
+
+ connect(job, SIGNAL(gotPreview(const KFileItem *, const QPixmap &)),
+ SLOT(slotGotPreview(const KFileItem *, const QPixmap &)));
+ connect(job, SIGNAL(failed(const KFileItem *)),
+ SLOT(slotFailedPreview(const KFileItem *)));
+}
+
void ThumbBarView::slotGotPreview(const KFileItem *fileItem,
const QPixmap& pix)
{
--- trunk/extragear/graphics/digikam/libs/thumbbar/thumbbar.h #457251:457252
@ -86,6 +86,8 @
void slotUpdate();
void slotGotPreview(const KFileItem *, const QPixmap &);
void slotFailedPreview(const KFileItem *);
+ void slotGotThumbnail(const KURL& url, const QPixmap& pix);
+ void slotFailedThumbnail(const KURL& url);
private:
--- trunk/extragear/graphics/digikam/showfoto/Makefile.am #457251:457252
@ -13,16 +13,16 @
imageproperties.cpp imagepropertiesgeneral.cpp \
imagepropertiesexif.cpp imagepropertieshistogram.cpp
-showfoto_LDADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) \
+showfoto_LDADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KUTILS) \
$(LIB_KFILE) $(LIB_KPARTS) $(LIBJPEG) \
+ $(top_builddir)/digikam/libs/histogram/libhistogram.la \
+ $(top_builddir)/digikam/libs/widgets/libwidgets.la \
+ $(top_builddir)/digikam/libs/thumbbar/libthumbbar.la \
+ $(top_builddir)/digikam/libs/curves/libcurves.la \
+ $(top_builddir)/digikam/utilities/imageeditor/libimageeditor.la \
$(top_builddir)/digikam/utilities/imageeditor/libimagecanvas.la \
$(top_builddir)/digikam/utilities/imageeditor/libshowfoto.la \
- $(top_builddir)/digikam/libs/histogram/libhistogram.la \
- $(top_builddir)/digikam/libs/widgets/libwidgets.la \
- $(top_builddir)/digikam/utilities/splashscreen/libsplashscreen.la \
- $(top_builddir)/digikam/libs/thumbbar/libthumbbar.la \
- $(top_builddir)/digikam/utilities/imageeditor/libimageeditor.la \
- $(top_builddir)/digikam/libs/curves/libcurves.la
+ $(top_builddir)/digikam/utilities/splashscreen/libsplashscreen.la
showfoto_LDFLAGS = $(KDE_RPATH) $(all_libraries)
More information about the Digikam-devel
mailing list