1 /* Copyright (C) 2003-2006 Jesper K. Pedersen <blackie@kde.org>
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public
5 License as published by the Free Software Foundation; either
6 version 2 of the License, or (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; see the file COPYING. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
22 #include <QStackedWidget>
26 #include "DB/ImageInfoPtr.h"
27 #include "DB/Result.h"
28 #include <config-kpa-exiv2.h>
33 class QContextMenuEvent
;
35 class KActionCollection
;
39 namespace DB
{ class ImageInfo
; class ResultId
; }
40 namespace MainWindow
{ class ExternalPopup
; class CategoryImagePopup
; }
51 class ViewerWidget
:public QStackedWidget
55 enum UsageType
{ InlineViewer
, ViewerWindow
};
57 ViewerWidget( UsageType type
= ViewerWindow
,
58 QMap
<Qt::Key
, QPair
<QString
,QString
> > *macroStore
= 0);
60 static ViewerWidget
* latest();
61 void load( const QStringList
& list
, int index
= 0 );
63 bool showingFullScreen() const;
64 void setShowFullScreen( bool on
);
65 void show( bool slideShow
);
66 KActionCollection
* actions();
69 virtual bool close(bool alsoDelete
= false );
72 void moveInfoBox( int );
77 void soughtTo( const DB::ResultId
& id
);
80 OVERRIDE
void contextMenuEvent ( QContextMenuEvent
* e
);
81 OVERRIDE
void resizeEvent( QResizeEvent
* );
82 OVERRIDE
void keyPressEvent( QKeyEvent
* );
83 OVERRIDE
void wheelEvent( QWheelEvent
* event
);
86 void setAsWallpaper(int mode
);
89 void setupContextMenu();
90 void createShowContextMenu();
91 void createWallPaperMenu();
92 void createInvokeExternalMenu();
93 void createRotateMenu();
94 void createSkipMenu();
95 void createZoomMenu();
96 void createSlideShowMenu();
97 void createVideoMenu();
98 void createCategoryImageMenu();
99 void createFilterMenu();
100 void changeSlideShowInterval( int delta
);
101 void createVideoViewer();
103 DB::ImageInfoPtr
currentInfo() const;
104 friend class InfoBox
;
109 int find_tag_in_list(const QStringList
&list
, QString
&namefound
);
122 void deleteCurrent();
123 void removeCurrent();
127 void toggleFullScreen();
128 void slotStartStopSlideShow();
129 void slotSlideShowNext();
130 void slotSlideShowNextFromTimer();
131 void slotSlideShowFaster();
132 void slotSlideShowSlower();
135 void filterSelected();
137 void filterContrastStretch();
138 void filterHistogramEqualization();
140 void slotSetStackHead();
141 void updateCategoryConfig();
142 void slotSetWallpaperC();
143 void slotSetWallpaperT();
144 void slotSetWallpaperCT();
145 void slotSetWallpaperCM();
146 void slotSetWallpaperTM();
147 void slotSetWallpaperS();
148 void slotSetWallpaperCAF();
149 void populateExternalPopup();
150 void populateCategoryImagePopup();
152 void showExifViewer();
156 void zoomPixelForPixel();
158 /** Set the current window title (filename) and add the given detail */
159 void setCaptionWithDetail( const QString
& detail
);
162 static ViewerWidget
* _latest
;
164 QList
<KAction
*> _forwardActions
;
165 QList
<KAction
*> _backwardActions
;
167 KAction
* _startStopSlideShow
;
168 KAction
* _slideShowRunFaster
;
169 KAction
* _slideShowRunSlower
;
170 KAction
* _setStackHead
;
171 KAction
* _filterNone
;
172 KAction
* _filterSelected
;
174 KAction
* _filterContrastStretch
;
175 KAction
* _filterHistogramEqualization
;
176 KAction
* _filterMono
;
179 ImageDisplay
* _imageDisplay
;
180 VideoDisplay
* _videoDisplay
;
181 TextDisplay
* _textDisplay
;
189 QMenu
* _wallpaperMenu
;
191 MainWindow::ExternalPopup
* _externalPopup
;
192 MainWindow::CategoryImagePopup
* _categoryImagePopup
;
198 KAction
* _showExifViewer
;
202 QImage _currentImage
;
204 bool _showingFullScreen
;
207 SpeedDisplay
* _speedDisplay
;
208 KActionCollection
* _actions
;
210 QTimer
* _slideShowTimer
;
211 bool _isRunningSlideShow
;
213 QList
<QAction
*> _videoActions
;
216 bool _videoPlayerStoppedManually
;
219 enum InputMode
{ InACategory
, AlwaysStartWithCategory
};
221 InputMode _currentInputMode
;
222 QString _currentInput
;
223 QString _currentCategory
;
224 QString _currentInputList
;
227 QString _lastCategory
;
228 QMap
<Qt::Key
, QPair
<QString
,QString
> >* _inputMacros
;
229 QMap
<Qt::Key
, QPair
<QString
,QString
> >* _myInputMacros
;
234 #endif /* VIEWER_H */