author | warmi <warmi> | 2002-08-15 03:19:48 (UTC) |
---|---|---|
committer | warmi <warmi> | 2002-08-15 03:19:48 (UTC) |
commit | 70d4827ec37cce74180c687eab53f9324756d739 (patch) (unidiff) | |
tree | e08a85c79bc82867e3e2ca08026867301f52ddbe /noncore | |
parent | acdedf093413a37a3e2c1ab5b12c1ab0a95b670b (diff) | |
download | opie-70d4827ec37cce74180c687eab53f9324756d739.zip opie-70d4827ec37cce74180c687eab53f9324756d739.tar.gz opie-70d4827ec37cce74180c687eab53f9324756d739.tar.bz2 |
Bunch of new GUI features ( brightness control, ability to view unscaled images ..)
Qte image handling issues are still not fixed though.
-rw-r--r-- | noncore/multimedia/showimg/showimg.h | 215 |
1 files changed, 185 insertions, 30 deletions
diff --git a/noncore/multimedia/showimg/showimg.h b/noncore/multimedia/showimg/showimg.h index 71003b1..0d3bc7d 100644 --- a/noncore/multimedia/showimg/showimg.h +++ b/noncore/multimedia/showimg/showimg.h | |||
@@ -28,5 +28,8 @@ | |||
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qscrollview.h> | ||
30 | #include <qdialog.h> | ||
31 | #include <qstringlist.h> | ||
29 | 32 | ||
30 | 33 | class QPEToolBar; | |
31 | class QMenuBar; | 34 | class QPEMenuBar; |
32 | class QPopupMenu; | 35 | class QPopupMenu; |
@@ -35,2 +38,7 @@ class FileSelector; | |||
35 | class DocLnk; | 38 | class DocLnk; |
39 | class QLabel; | ||
40 | class QAction; | ||
41 | class QSpinBox; | ||
42 | class ImageFileSelector; | ||
43 | |||
36 | 44 | ||
@@ -40,9 +48,21 @@ class ImageWidget : public QWidget | |||
40 | Q_OBJECT | 48 | Q_OBJECT |
41 | public: | 49 | public: |
42 | ImageWidget( QWidget *parent=0 ) : QWidget( parent ) { } | 50 | ImageWidget( |
43 | ~ImageWidget() { } | 51 | QWidget *parent=0 |
52 | ) : QWidget( parent ) | ||
53 | { | ||
54 | setBackgroundMode(NoBackground); | ||
55 | } | ||
56 | ~ImageWidget() | ||
57 | { | ||
58 | |||
59 | } | ||
44 | 60 | ||
45 | void setPixmap( const QPixmap &pm ) { pixmap = pm; } | 61 | void setPixmap( const QPixmap &pm ) |
62 | { | ||
63 | pixmap = pm; | ||
64 | show(); | ||
65 | } | ||
46 | 66 | ||
47 | signals: | 67 | signals: |
48 | void clicked(); | 68 | void clicked(); |
@@ -57,2 +77,37 @@ private: | |||
57 | 77 | ||
78 | class InfoDialog:public QDialog | ||
79 | { | ||
80 | Q_OBJECT | ||
81 | |||
82 | public: | ||
83 | |||
84 | static void displayInfo(const QString &caption, const QStringList text, QWidget *parent); | ||
85 | |||
86 | private: | ||
87 | |||
88 | InfoDialog(const QString &caption,const QStringList text, QWidget *parent); | ||
89 | |||
90 | }; | ||
91 | |||
92 | class ControlsDialog:public QDialog | ||
93 | { | ||
94 | Q_OBJECT | ||
95 | |||
96 | public: | ||
97 | ControlsDialog(const QString &caption,const QImage image,int *brightness, QWidget *parent); | ||
98 | |||
99 | |||
100 | private slots: | ||
101 | |||
102 | void bValueChanged(int); | ||
103 | void accept(); | ||
104 | |||
105 | |||
106 | private: | ||
107 | ImageWidget *pixmap; | ||
108 | QSpinBox *spb; | ||
109 | QImage img; | ||
110 | int *b; | ||
111 | }; | ||
112 | |||
58 | 113 | ||
@@ -61,12 +116,39 @@ class ImagePane : public QWidget | |||
61 | Q_OBJECT | 116 | Q_OBJECT |
62 | public: | 117 | public: |
63 | ImagePane( QWidget *parent=0 ); | 118 | ImagePane( QWidget *parent=0 ); |
64 | ~ImagePane() { } | 119 | ~ImagePane() |
120 | { | ||
121 | |||
122 | } | ||
65 | 123 | ||
66 | void showStatus(); | 124 | //void showStatus(); |
67 | void hideStatus(); | 125 | //void hideStatus(); |
68 | QLabel *statusLabel() { return status; } | 126 | //QLabel *statusLabel() |
127 | //{ | ||
128 | // return status; | ||
129 | //} | ||
69 | void setPixmap( const QPixmap &pm ); | 130 | void setPixmap( const QPixmap &pm ); |
70 | 131 | ||
71 | signals: | 132 | |
133 | int paneWidth() const | ||
134 | { | ||
135 | return image->visibleWidth(); | ||
136 | } | ||
137 | |||
138 | int paneHeight() const | ||
139 | { | ||
140 | return image->visibleHeight(); | ||
141 | } | ||
142 | |||
143 | void setPosition(int x, int y) | ||
144 | { | ||
145 | image->setContentsPos (x,y ); | ||
146 | } | ||
147 | |||
148 | void disable() | ||
149 | { | ||
150 | pic->hide(); | ||
151 | } | ||
152 | |||
153 | signals: | ||
72 | void clicked(); | 154 | void clicked(); |
@@ -74,4 +156,4 @@ signals: | |||
74 | private: | 156 | private: |
75 | ImageWidget*image; | 157 | QScrollView *image; |
76 | QLabel*status; | 158 | ImageWidget *pic; |
77 | QVBoxLayout *vb; | 159 | QVBoxLayout *vb; |
@@ -86,3 +168,3 @@ class ImageViewer : public QMainWindow | |||
86 | Q_OBJECT | 168 | Q_OBJECT |
87 | public: | 169 | public: |
88 | ImageViewer( QWidget *parent=0, const char *name=0, int wFlags=0 ); | 170 | ImageViewer( QWidget *parent=0, const char *name=0, int wFlags=0 ); |
@@ -94,6 +176,26 @@ public: | |||
94 | 176 | ||
177 | |||
178 | enum INFO_STRINGS | ||
179 | { | ||
180 | PATH, | ||
181 | FORMAT, | ||
182 | FILE_SIZE, | ||
183 | SIZE, | ||
184 | COLORS, | ||
185 | ALPHA, | ||
186 | LAST | ||
187 | }; | ||
188 | |||
189 | enum RotateDirection | ||
190 | { | ||
191 | Rotate90, Rotate180, Rotate270 | ||
192 | }; | ||
193 | |||
194 | |||
195 | static QImage rotate(QImage &img, RotateDirection r); | ||
196 | static QImage& intensity(QImage &image, float percent); | ||
197 | static QImage& toGray(QImage &image, bool fast = false); | ||
198 | |||
95 | protected: | 199 | protected: |
96 | void resizeEvent( QResizeEvent * ); | 200 | void resizeEvent( QResizeEvent * ); |
97 | void mousePressEvent( QMouseEvent * ); | ||
98 | void mouseMoveEvent( QMouseEvent * ); | ||
99 | void closeEvent( QCloseEvent * ); | 201 | void closeEvent( QCloseEvent * ); |
@@ -104,3 +206,2 @@ private: | |||
104 | void scale(); | 206 | void scale(); |
105 | void convertEvent( QMouseEvent* e, int& x, int& y ); | ||
106 | bool reconvertImage(); | 207 | bool reconvertImage(); |
@@ -108,5 +209,15 @@ private: | |||
108 | void setImage(const QImage& newimage); | 209 | void setImage(const QImage& newimage); |
109 | void updateStatus(); | 210 | void updateImageInfo(QString &filePath); |
211 | void switchToFileSelector(); | ||
212 | void switchToImageView(); | ||
213 | |||
214 | void updateImage(); | ||
215 | |||
216 | |||
217 | |||
110 | 218 | ||
111 | private slots: | 219 | private slots: |
220 | |||
221 | void switchThumbView(); | ||
222 | void switchSizeToScreen(); | ||
112 | void setDocument(const QString& fileref); | 223 | void setDocument(const QString& fileref); |
@@ -114,2 +225,3 @@ private slots: | |||
114 | void openFile( const DocLnk &file ); | 225 | void openFile( const DocLnk &file ); |
226 | //void openFile(); | ||
115 | void open(); | 227 | void open(); |
@@ -120,21 +232,64 @@ private slots: | |||
120 | void rot90(); | 232 | void rot90(); |
233 | void rot270(); | ||
121 | void normalView(); | 234 | void normalView(); |
122 | void fullScreen(); | 235 | void fullScreen(); |
236 | void blackAndWhite(); | ||
237 | void displayInfoDialog(); | ||
238 | void displayControlsDialog(); | ||
239 | |||
240 | |||
241 | |||
242 | |||
243 | |||
244 | |||
245 | |||
246 | |||
247 | |||
123 | 248 | ||
124 | private: | 249 | private: |
250 | |||
251 | |||
252 | |||
253 | |||
254 | enum MENU_ITEMS | ||
255 | { | ||
256 | SHOW_THUMBNAILS, | ||
257 | SIZE_TO_SCREEN, | ||
258 | BLACKANDWHITE | ||
259 | }; | ||
260 | |||
261 | |||
262 | |||
125 | QString filename; | 263 | QString filename; |
126 | QString delayLoad; | 264 | QString delayLoad; |
127 | QImage image; // the loaded image | 265 | QImage image; // the loaded image |
128 | QPixmap pm; // the converted pixmap | 266 | QPixmap pm; // the converted pixmap |
129 | QPixmap pmScaled; // the scaled pixmap | 267 | QPixmap pmScaled; // the scaled pixmap |
130 | QMenuBar *menubar; | 268 | QPEToolBar *toolBar; |
269 | QPEToolBar *iconToolBar; | ||
270 | QPEMenuBar *menuBar; | ||
271 | QPEMenuBar *current; | ||
272 | |||
273 | |||
274 | QPopupMenu *fileMenuFile; | ||
275 | QPopupMenu *viewMenuFile; | ||
276 | QPopupMenu *optionsMenuFile; | ||
277 | QPopupMenu *fileMenuView; | ||
278 | QPopupMenu *viewMenuView; | ||
279 | |||
280 | QAction *sss; // scale to screen size | ||
281 | |||
282 | QLabel *lab; | ||
131 | ImagePane *imagePanel; | 283 | ImagePane *imagePanel; |
132 | QToolBar *toolBar; | ||
133 | QWidgetStack *stack; | 284 | QWidgetStack *stack; |
134 | FileSelector *fileSelector; | 285 | //FileSelector *fileSelector; |
135 | int pickx, picky; | 286 | ImageFileSelector *fileSelector; |
136 | int clickx, clicky; | ||
137 | bool isFullScreen; | 287 | bool isFullScreen; |
138 | bool bFromDocView; // a flag to indicate whether or not we were | 288 | bool isSized; // true if image is to be resized to fit the window size |
139 | // launched from the document view... | 289 | bool bFromDocView; // a flag to indicate whether or not we were |
290 | // launched from the document view... | ||
291 | |||
292 | bool showThumbView; // a flag to indicate if FileSelector should be initialized with thumbnail view | ||
293 | |||
294 | QString imageInfo[LAST]; | ||
140 | }; | 295 | }; |