author | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
commit | 15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff) | |
tree | c2fa0399a2c47fda8e2cd0092c73a809d17f68eb /noncore/multimedia/showimg/showimg.h | |
download | opie-15318cad33835e4e2dc620d033e43cd930676cdd.zip opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2 |
Initial revision
Diffstat (limited to 'noncore/multimedia/showimg/showimg.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/showimg/showimg.h | 143 |
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 | |||
31 | class QMenuBar; | ||
32 | class QPopupMenu; | ||
33 | class QWidgetStack; | ||
34 | class FileSelector; | ||
35 | class DocLnk; | ||
36 | |||
37 | |||
38 | class ImageWidget : public QWidget | ||
39 | { | ||
40 | Q_OBJECT | ||
41 | public: | ||
42 | ImageWidget( QWidget *parent=0 ) : QWidget( parent ) { } | ||
43 | ~ImageWidget() { } | ||
44 | |||
45 | void setPixmap( const QPixmap &pm ) { pixmap = pm; } | ||
46 | |||
47 | signals: | ||
48 | void clicked(); | ||
49 | |||
50 | protected: | ||
51 | void paintEvent( QPaintEvent * ); | ||
52 | void mouseReleaseEvent(QMouseEvent* event); | ||
53 | |||
54 | private: | ||
55 | QPixmap pixmap; | ||
56 | }; | ||
57 | |||
58 | |||
59 | class ImagePane : public QWidget | ||
60 | { | ||
61 | Q_OBJECT | ||
62 | public: | ||
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 | |||
71 | signals: | ||
72 | void clicked(); | ||
73 | |||
74 | private: | ||
75 | ImageWidget*image; | ||
76 | QLabel*status; | ||
77 | QVBoxLayout *vb; | ||
78 | |||
79 | private slots: | ||
80 | void imageClicked(); | ||
81 | }; | ||
82 | |||
83 | |||
84 | class ImageViewer : public QMainWindow | ||
85 | { | ||
86 | Q_OBJECT | ||
87 | public: | ||
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 | |||
95 | protected: | ||
96 | void resizeEvent( QResizeEvent * ); | ||
97 | void mousePressEvent( QMouseEvent * ); | ||
98 | void mouseMoveEvent( QMouseEvent * ); | ||
99 | void closeEvent( QCloseEvent * ); | ||
100 | |||
101 | private: | ||
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 | |||
111 | private 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 | |||
124 | private: | ||
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 | ||