summaryrefslogtreecommitdiff
path: root/noncore/multimedia/showimg/showimg.h
Unidiff
Diffstat (limited to 'noncore/multimedia/showimg/showimg.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/showimg/showimg.h143
1 files changed, 143 insertions, 0 deletions
diff --git a/noncore/multimedia/showimg/showimg.h b/noncore/multimedia/showimg/showimg.h
new file mode 100644
index 0000000..71003b1
--- a/dev/null
+++ b/noncore/multimedia/showimg/showimg.h
@@ -0,0 +1,143 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef SHOWIMG_H
22#define SHOWIMG_H
23
24#include <qwidget.h>
25#include <qmainwindow.h>
26#include <qimage.h>
27#include <qlabel.h>
28#include <qlayout.h>
29
30
31class QMenuBar;
32class QPopupMenu;
33class QWidgetStack;
34class FileSelector;
35class DocLnk;
36
37
38class ImageWidget : public QWidget
39{
40 Q_OBJECT
41public:
42 ImageWidget( QWidget *parent=0 ) : QWidget( parent ) { }
43 ~ImageWidget() { }
44
45 void setPixmap( const QPixmap &pm ) { pixmap = pm; }
46
47signals:
48 void clicked();
49
50protected:
51 void paintEvent( QPaintEvent * );
52 void mouseReleaseEvent(QMouseEvent* event);
53
54private:
55 QPixmap pixmap;
56};
57
58
59class ImagePane : public QWidget
60{
61 Q_OBJECT
62public:
63 ImagePane( QWidget *parent=0 );
64 ~ImagePane() { }
65
66 void showStatus();
67 void hideStatus();
68 QLabel *statusLabel() { return status; }
69 void setPixmap( const QPixmap &pm );
70
71signals:
72 void clicked();
73
74private:
75 ImageWidget*image;
76 QLabel*status;
77 QVBoxLayout *vb;
78
79private slots:
80 void imageClicked();
81};
82
83
84class ImageViewer : public QMainWindow
85{
86 Q_OBJECT
87public:
88 ImageViewer( QWidget *parent=0, const char *name=0, int wFlags=0 );
89 ~ImageViewer();
90
91 void loadImage( const char *fileName );
92 void show(const QString& fileref);
93 void show();
94
95protected:
96 void resizeEvent( QResizeEvent * );
97 void mousePressEvent( QMouseEvent * );
98 void mouseMoveEvent( QMouseEvent * );
99 void closeEvent( QCloseEvent * );
100
101private:
102 void updateCaption( QString name );
103 bool loadSelected();
104 void scale();
105 void convertEvent( QMouseEvent* e, int& x, int& y );
106 bool reconvertImage();
107 int calcHeight();
108 void setImage(const QImage& newimage);
109 void updateStatus();
110
111private slots:
112 void setDocument(const QString& fileref);
113 void doDelayedLoad();
114 void openFile( const DocLnk &file );
115 void open();
116 void closeFileSelector();
117 void hFlip();
118 void vFlip();
119 void rot180();
120 void rot90();
121 void normalView();
122 void fullScreen();
123
124private:
125 QString filename;
126 QString delayLoad;
127 QImage image; // the loaded image
128 QPixmap pm; // the converted pixmap
129 QPixmap pmScaled; // the scaled pixmap
130 QMenuBar *menubar;
131 ImagePane *imagePanel;
132 QToolBar *toolBar;
133 QWidgetStack *stack;
134 FileSelector *fileSelector;
135 int pickx, picky;
136 int clickx, clicky;
137 bool isFullScreen;
138 bool bFromDocView; // a flag to indicate whether or not we were
139 // launched from the document view...
140};
141
142
143#endif // SHOWIMG_H