From 199bf012a87ace47044627189012b854570e3970 Mon Sep 17 00:00:00 2001 From: Arno Date: Mon, 24 May 2010 14:14:00 +0200 Subject: Implemented PictureViewer class Don't call an external program for showing a picture. When an image is doubleclicked a new windows shows the picture. Pictures can still be opened in an exteral program by using the "Open with..." context menu item. --- pictureviewer.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 pictureviewer.h (limited to 'pictureviewer.h') diff --git a/pictureviewer.h b/pictureviewer.h new file mode 100644 index 0000000..2791bbe --- /dev/null +++ b/pictureviewer.h @@ -0,0 +1,45 @@ +/* + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version + 2 of the License, or (at your option) any later version. +*/ + +#ifndef PICTUREVIEWER_H +#define PICTUREVIEWER_H + +#include +#include + +class QGraphicsScene; +class QGraphicsPixmapItem; +class QWheelEvent; +class PictureviewerInfoItem; + +class PictureViewer : public QGraphicsView { + Q_OBJECT + public: + PictureViewer(QWidget *parent = 0); + + public slots: + void showPic(const QString &path); + void next(); + void previous(); + + protected: + void wheelEvent(QWheelEvent *event); + + private: + void setGradient(); + void setDir(const QString &path); + bool isPic(const QString &path); + QPointF center(const QPixmap &pic); + QGraphicsScene *mScene; + QGraphicsPixmapItem *mCurrentPic; + PictureviewerInfoItem *mInfoItem; + QString mCurrentDir; + QFileInfoList mDirEntries; + QFileInfoList::const_iterator mCurrentEntry; +}; + +#endif -- cgit v1.2.3-70-g09d2