[Kde-imaging] extragear/graphics/kipi-plugins
Valerio Fuoglio
valerio.fuoglio at gmail.com
Sun Sep 14 20:08:19 CEST 2008
SVN commit 860961 by vfuoglio:
Added thumbnails into image list.
CCMAIL: kde-imaging at kde.org
M +1 -0 NEWS
M +41 -0 slideshow/listimageitems.cpp
M +20 -15 slideshow/listimageitems.h
--- trunk/extragear/graphics/kipi-plugins/NEWS #860960:860961
@@ -14,6 +14,7 @@
methods provided by dcraw with 8 bits color depth RAW image decoding.
SlideShow : Now filenames, captions and progress indicators can have transparent
backgrounds with OpenGL SlideShow as well.
+SlideShow : Added thumbnails into image list.
Kipi-plugins BUG FIXING from B.K.O (http://bugs.kde.org):
--- trunk/extragear/graphics/kipi-plugins/slideshow/listimageitems.cpp #860960:860961
@@ -30,9 +30,11 @@
#include <q3listbox.h>
#include <QDropEvent>
#include <QDragEnterEvent>
+#include <QIcon>
// KDE includes
#include <kurl.h>
+#include <kiconloader.h>
// Local includes
#include "listimageitems.h"
@@ -41,12 +43,51 @@
namespace KIPISlideShowPlugin
{
+ImageItem::ImageItem(QListWidget* parent, QString const & name, QString const & comments,
+ QString const & path, QString const & album)
+ : QListWidgetItem(parent), m_name(name), m_comments(comments), m_path(path), m_album(album)
+{
+ m_thumbJob = KIO::filePreview( KUrl(m_path), 32);
+
+
+ connect(m_thumbJob, SIGNAL(gotPreview(const KFileItem&, const QPixmap&)),
+ SLOT(slotGotPreview(const KFileItem&, const QPixmap&)));
+ connect(m_thumbJob, SIGNAL(failed(const KFileItem&)),
+ SLOT(slotFailedPreview(const KFileItem&)));
+}
+
+ImageItem::~ImageItem()
+{
+ if (m_thumbJob) delete m_thumbJob;
+}
+
+QString ImageItem::comments() { return m_comments; }
+QString ImageItem::name() { return m_name; }
+QString ImageItem::path() { return m_path; }
+QString ImageItem::album() { return m_album; }
+void ImageItem::setName(const QString &newName) { setText(newName); }
+
+void ImageItem::slotGotPreview(const KFileItem& , const QPixmap &pixmap)
+{
+ setIcon(QIcon(pixmap));
+ m_thumbJob = 0L;
+}
+
+void ImageItem::slotFailedPreview(const KFileItem&)
+{
+ setIcon(SmallIcon( "image-x-generic", KIconLoader::SizeLarge, KIconLoader::DisabledState ));
+ m_thumbJob = 0L;
+}
+
+// ---------------------------------------------
+
ListImageItems::ListImageItems(QWidget *parent)
: QListWidget(parent)
{
setSelectionMode(QAbstractItemView::SingleSelection);
setAcceptDrops(true);
setSortingEnabled(false);
+ setIconSize(QSize(32, 32));
}
void ListImageItems::dragEnterEvent(QDragEnterEvent *e)
--- trunk/extragear/graphics/kipi-plugins/slideshow/listimageitems.h #860960:860961
@@ -24,7 +24,6 @@
#define LISTIMAGEITEM_H
// QT includes
-
#include <QWidget>
#include <QString>
#include <QDropEvent>
@@ -34,32 +33,38 @@
// KDE includes
#include <kurl.h>
+#include "kio/previewjob.h"
namespace KIPISlideShowPlugin
{
-class ImageItem : public QListWidgetItem
+class ImageItem : public QObject, public QListWidgetItem
{
+ Q_OBJECT
public:
- ImageItem(QListWidget* parent, QString const & name, QString const & comments, QString const & path,
- QString const & album)
- : QListWidgetItem(parent), _name(name), _comments(comments), _path(path), _album(album)
- {}
+ ImageItem(QListWidget* parent, QString const & name, QString const & comments,
+ QString const & path, QString const & album);
+ ~ImageItem();
- QString comments() { return _comments; }
- QString name() { return _name; }
- QString path() { return _path; }
- QString album() { return _album; }
- void setName(const QString &newName) { setText(newName); }
+ QString comments();
+ QString name();
+ QString path();
+ QString album();
+ void setName(const QString &newName);
+private slots:
+ void slotGotPreview(const KFileItem& , const QPixmap &pixmap);
+ void slotFailedPreview(const KFileItem&);private:
+
private:
+ QString m_name;
+ QString m_comments;
+ QString m_path;
+ QString m_album;
- QString _name;
- QString _comments;
- QString _path;
- QString _album;
+ KIO::PreviewJob* m_thumbJob;
};
class ListImageItems : public QListWidget
More information about the Kde-imaging
mailing list