author | llornkcor <llornkcor> | 2002-11-03 17:59:00 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-03 17:59:00 (UTC) |
commit | 16e8fad81f7ee6045990f48edc84542638bf07d7 (patch) (unidiff) | |
tree | 96d836f914e0d1104d7c84830acac08a43ee4ac2 /noncore/multimedia/showimg/showimg.h | |
parent | 2981b8f55f4a33860452f4571ef9f04781267489 (diff) | |
download | opie-16e8fad81f7ee6045990f48edc84542638bf07d7.zip opie-16e8fad81f7ee6045990f48edc84542638bf07d7.tar.gz opie-16e8fad81f7ee6045990f48edc84542638bf07d7.tar.bz2 |
added preferences dialog, and added slidshow
Diffstat (limited to 'noncore/multimedia/showimg/showimg.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/showimg/showimg.h | 104 |
1 files changed, 47 insertions, 57 deletions
diff --git a/noncore/multimedia/showimg/showimg.h b/noncore/multimedia/showimg/showimg.h index 0d3bc7d..8555ff0 100644 --- a/noncore/multimedia/showimg/showimg.h +++ b/noncore/multimedia/showimg/showimg.h | |||
@@ -28,9 +28,13 @@ | |||
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qscrollview.h> | 29 | #include <qscrollview.h> |
30 | #include <qdialog.h> | 30 | #include <qdialog.h> |
31 | #include <qstringlist.h> | 31 | #include <qstringlist.h> |
32 | #include <qvaluelist.h> | ||
33 | #include <qwmatrix.h> | ||
32 | 34 | ||
35 | |||
36 | class QAction; | ||
33 | class QPEToolBar; | 37 | class QPEToolBar; |
34 | class QPEMenuBar; | 38 | class QPEMenuBar; |
35 | class QPopupMenu; | 39 | class QPopupMenu; |
36 | class QWidgetStack; | 40 | class QWidgetStack; |
@@ -39,33 +43,27 @@ class DocLnk; | |||
39 | class QLabel; | 43 | class QLabel; |
40 | class QAction; | 44 | class QAction; |
41 | class QSpinBox; | 45 | class QSpinBox; |
42 | class ImageFileSelector; | 46 | class ImageFileSelector; |
43 | 47 | class QTimer; | |
44 | 48 | ||
45 | 49 | ||
46 | class ImageWidget : public QWidget | 50 | class ImageWidget : public QWidget |
47 | { | 51 | { |
48 | Q_OBJECT | 52 | Q_OBJECT |
49 | public: | 53 | public: |
50 | ImageWidget( | 54 | ImageWidget( QWidget *parent=0 ) |
51 | QWidget *parent=0 | 55 | : QWidget( parent ) { |
52 | ) : QWidget( parent ) | ||
53 | { | ||
54 | setBackgroundMode(NoBackground); | 56 | setBackgroundMode(NoBackground); |
55 | } | 57 | } |
56 | ~ImageWidget() | 58 | ~ImageWidget() { } |
57 | { | ||
58 | |||
59 | } | ||
60 | 59 | ||
61 | void setPixmap( const QPixmap &pm ) | 60 | void setPixmap( const QPixmap &pm ) { |
62 | { | ||
63 | pixmap = pm; | 61 | pixmap = pm; |
64 | show(); | 62 | show(); |
65 | } | 63 | } |
66 | 64 | ||
67 | signals: | 65 | signals: |
68 | void clicked(); | 66 | void clicked(); |
69 | 67 | ||
70 | protected: | 68 | protected: |
71 | void paintEvent( QPaintEvent * ); | 69 | void paintEvent( QPaintEvent * ); |
@@ -78,9 +76,9 @@ private: | |||
78 | class InfoDialog:public QDialog | 76 | class InfoDialog:public QDialog |
79 | { | 77 | { |
80 | Q_OBJECT | 78 | Q_OBJECT |
81 | 79 | ||
82 | public: | 80 | public: |
83 | 81 | ||
84 | static void displayInfo(const QString &caption, const QStringList text, QWidget *parent); | 82 | static void displayInfo(const QString &caption, const QStringList text, QWidget *parent); |
85 | 83 | ||
86 | private: | 84 | private: |
@@ -92,9 +90,9 @@ private: | |||
92 | class ControlsDialog:public QDialog | 90 | class ControlsDialog:public QDialog |
93 | { | 91 | { |
94 | Q_OBJECT | 92 | Q_OBJECT |
95 | 93 | ||
96 | public: | 94 | public: |
97 | ControlsDialog(const QString &caption,const QImage image,int *brightness, QWidget *parent); | 95 | ControlsDialog(const QString &caption,const QImage image,int *brightness, QWidget *parent); |
98 | 96 | ||
99 | 97 | ||
100 | private slots: | 98 | private slots: |
@@ -113,14 +111,11 @@ private: | |||
113 | 111 | ||
114 | class ImagePane : public QWidget | 112 | class ImagePane : public QWidget |
115 | { | 113 | { |
116 | Q_OBJECT | 114 | Q_OBJECT |
117 | public: | 115 | public: |
118 | ImagePane( QWidget *parent=0 ); | 116 | ImagePane( QWidget *parent=0 ); |
119 | ~ImagePane() | 117 | ~ImagePane() { } |
120 | { | ||
121 | |||
122 | } | ||
123 | 118 | ||
124 | //void showStatus(); | 119 | //void showStatus(); |
125 | //void hideStatus(); | 120 | //void hideStatus(); |
126 | //QLabel *statusLabel() | 121 | //QLabel *statusLabel() |
@@ -129,29 +124,25 @@ class ImagePane : public QWidget | |||
129 | //} | 124 | //} |
130 | void setPixmap( const QPixmap &pm ); | 125 | void setPixmap( const QPixmap &pm ); |
131 | 126 | ||
132 | 127 | ||
133 | int paneWidth() const | 128 | int paneWidth() const { |
134 | { | ||
135 | return image->visibleWidth(); | 129 | return image->visibleWidth(); |
136 | } | 130 | } |
137 | 131 | ||
138 | int paneHeight() const | 132 | int paneHeight() const { |
139 | { | ||
140 | return image->visibleHeight(); | 133 | return image->visibleHeight(); |
141 | } | 134 | } |
142 | 135 | ||
143 | void setPosition(int x, int y) | 136 | void setPosition(int x, int y) { |
144 | { | ||
145 | image->setContentsPos (x,y ); | 137 | image->setContentsPos (x,y ); |
146 | } | 138 | } |
147 | 139 | ||
148 | void disable() | 140 | void disable() { |
149 | { | ||
150 | pic->hide(); | 141 | pic->hide(); |
151 | } | 142 | } |
152 | 143 | ||
153 | signals: | 144 | signals: |
154 | void clicked(); | 145 | void clicked(); |
155 | 146 | ||
156 | private: | 147 | private: |
157 | QScrollView *image; | 148 | QScrollView *image; |
@@ -165,19 +156,18 @@ private slots: | |||
165 | 156 | ||
166 | class ImageViewer : public QMainWindow | 157 | class ImageViewer : public QMainWindow |
167 | { | 158 | { |
168 | Q_OBJECT | 159 | Q_OBJECT |
169 | public: | 160 | public: |
170 | ImageViewer( QWidget *parent=0, const char *name=0, int wFlags=0 ); | 161 | ImageViewer( QWidget *parent=0, const char *name=0, int wFlags=0 ); |
171 | ~ImageViewer(); | 162 | ~ImageViewer(); |
172 | 163 | ||
173 | void loadImage( const char *fileName ); | 164 | void loadImage( const char *fileName ); |
174 | void show(const QString& fileref); | 165 | void show(const QString& fileref); |
175 | void show(); | 166 | void show(); |
176 | 167 | ||
177 | 168 | ||
178 | enum INFO_STRINGS | 169 | enum INFO_STRINGS { |
179 | { | ||
180 | PATH, | 170 | PATH, |
181 | FORMAT, | 171 | FORMAT, |
182 | FILE_SIZE, | 172 | FILE_SIZE, |
183 | SIZE, | 173 | SIZE, |
@@ -185,23 +175,25 @@ class ImageViewer : public QMainWindow | |||
185 | ALPHA, | 175 | ALPHA, |
186 | LAST | 176 | LAST |
187 | }; | 177 | }; |
188 | 178 | ||
189 | enum RotateDirection | 179 | enum RotateDirection { |
190 | { | ||
191 | Rotate90, Rotate180, Rotate270 | 180 | Rotate90, Rotate180, Rotate270 |
192 | }; | 181 | }; |
193 | 182 | ||
194 | 183 | ||
195 | static QImage rotate(QImage &img, RotateDirection r); | 184 | static QImage rotate(QImage &img, RotateDirection r); |
196 | static QImage& intensity(QImage &image, float percent); | 185 | static QImage& intensity(QImage &image, float percent); |
197 | static QImage& toGray(QImage &image, bool fast = false); | 186 | static QImage& toGray(QImage &image, bool fast = false); |
187 | bool showThumbView; // a flag to indicate if FileSelector should be initialized with thumbnail view | ||
198 | 188 | ||
199 | protected: | 189 | protected: |
200 | void resizeEvent( QResizeEvent * ); | 190 | void resizeEvent( QResizeEvent * ); |
201 | void closeEvent( QCloseEvent * ); | 191 | void closeEvent( QCloseEvent * ); |
202 | 192 | ||
203 | private: | 193 | private: |
194 | int imageIndex(void); | ||
195 | |||
204 | void updateCaption( QString name ); | 196 | void updateCaption( QString name ); |
205 | bool loadSelected(); | 197 | bool loadSelected(); |
206 | void scale(); | 198 | void scale(); |
207 | bool reconvertImage(); | 199 | bool reconvertImage(); |
@@ -212,19 +204,23 @@ private: | |||
212 | void switchToImageView(); | 204 | void switchToImageView(); |
213 | 205 | ||
214 | void updateImage(); | 206 | void updateImage(); |
215 | 207 | ||
216 | |||
217 | |||
218 | |||
219 | private slots: | 208 | private slots: |
220 | 209 | ||
210 | void slideShow( bool on ); | ||
211 | void help(); | ||
212 | void slideUpdate(); | ||
213 | bool nextImage(); | ||
214 | bool prevImage(); | ||
215 | void settings(); | ||
216 | |||
221 | void switchThumbView(); | 217 | void switchThumbView(); |
222 | void switchSizeToScreen(); | 218 | void switchSizeToScreen(); |
223 | void setDocument(const QString& fileref); | 219 | void setDocument(const QString& fileref); |
224 | void doDelayedLoad(); | 220 | void doDelayedLoad(); |
225 | void openFile( const DocLnk &file ); | 221 | void openFile( const DocLnk &file ); |
226 | //void openFile(); | 222 | void openFile(); |
227 | void open(); | 223 | void open(); |
228 | void closeFileSelector(); | 224 | void closeFileSelector(); |
229 | void hFlip(); | 225 | void hFlip(); |
230 | void vFlip(); | 226 | void vFlip(); |
@@ -232,35 +228,21 @@ private slots: | |||
232 | void rot90(); | 228 | void rot90(); |
233 | void rot270(); | 229 | void rot270(); |
234 | void normalView(); | 230 | void normalView(); |
235 | void fullScreen(); | 231 | void fullScreen(); |
232 | void stopSlideShow(); | ||
236 | void blackAndWhite(); | 233 | void blackAndWhite(); |
237 | void displayInfoDialog(); | 234 | void displayInfoDialog(); |
238 | void displayControlsDialog(); | 235 | void displayControlsDialog(); |
239 | |||
240 | |||
241 | |||
242 | |||
243 | |||
244 | |||
245 | |||
246 | |||
247 | |||
248 | |||
249 | private: | 236 | private: |
250 | 237 | QWMatrix matrix; | |
251 | 238 | bool rotated90; | |
252 | 239 | enum MENU_ITEMS { | |
253 | |||
254 | enum MENU_ITEMS | ||
255 | { | ||
256 | SHOW_THUMBNAILS, | 240 | SHOW_THUMBNAILS, |
257 | SIZE_TO_SCREEN, | 241 | SIZE_TO_SCREEN, |
258 | BLACKANDWHITE | 242 | BLACKANDWHITE |
259 | }; | 243 | }; |
260 | 244 | ||
261 | |||
262 | |||
263 | QString filename; | 245 | QString filename; |
264 | QString delayLoad; | 246 | QString delayLoad; |
265 | QImage image; // the loaded image | 247 | QImage image; // the loaded image |
266 | QPixmap pm; // the converted pixmap | 248 | QPixmap pm; // the converted pixmap |
@@ -288,9 +270,17 @@ private: | |||
288 | bool isSized; // true if image is to be resized to fit the window size | 270 | bool isSized; // true if image is to be resized to fit the window size |
289 | bool bFromDocView; // a flag to indicate whether or not we were | 271 | bool bFromDocView; // a flag to indicate whether or not we were |
290 | // launched from the document view... | 272 | // launched from the document view... |
291 | 273 | ||
292 | bool showThumbView; // a flag to indicate if FileSelector should be initialized with thumbnail view | 274 | int slideDelay; |
275 | bool slideRepeat; | ||
276 | bool slideReverse; // show slideshow in reverse order | ||
277 | bool rotateOnLoad; // rotate by 90 degrees on loading | ||
278 | bool fastLoad; | ||
279 | QTimer *slideTimer; | ||
280 | QValueList<DocLnk> imageList; | ||
281 | QAction *slideAction; | ||
282 | |||
293 | 283 | ||
294 | QString imageInfo[LAST]; | 284 | QString imageInfo[LAST]; |
295 | }; | 285 | }; |
296 | 286 | ||