summaryrefslogtreecommitdiffstats
path: root/pictureviewer.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-05-24 14:14:00 +0200
committerArno <am@disconnect.de>2010-05-24 14:14:00 +0200
commit199bf012a87ace47044627189012b854570e3970 (patch)
tree735966e8d8843c3f5beddaaff6c657d8c5bba030 /pictureviewer.h
parentf3b7e335c988cadd463063ca72790a638e44970e (diff)
downloadSheMov-199bf012a87ace47044627189012b854570e3970.tar.gz
SheMov-199bf012a87ace47044627189012b854570e3970.tar.bz2
SheMov-199bf012a87ace47044627189012b854570e3970.zip
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.
Diffstat (limited to 'pictureviewer.h')
-rw-r--r--pictureviewer.h45
1 files changed, 45 insertions, 0 deletions
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 <QGraphicsView>
+#include <QFileInfoList>
+
+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