Krazy/EBN: qMin is better than QMIN
[kphotoalbum.git] / MainWindow / Window.h
blobfafa939ac593cc7f70279ef8f5ca0e78ef709480
1 #include <Browser/BreadcrumbList.h>
2 #include <QContextMenuEvent>
3 #include <QMoveEvent>
4 #include <QCloseEvent>
5 #include <QResizeEvent>
6 #include <QLabel>
7 #include <KAction>
8 /* Copyright (C) 2003-2006 Jesper K. Pedersen <blackie@kde.org>
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public
12 License as published by the Free Software Foundation; either
13 version 2 of the License, or (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; see the file COPYING. If not, write to
22 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 Boston, MA 02110-1301, USA.
26 #ifndef MAINVIEW_H
27 #define MAINVIEW_H
28 class BreadcrumbViewer;
29 class KToggleAction;
30 class Q3WidgetStack;
31 class QTimer;
32 class KTipDialog;
33 class QLabel;
34 class KActionMenu;
36 #include "DB/ImageInfoList.h"
37 #include <kmainwindow.h>
38 #include "Settings/SettingsData.h"
39 #include <kurl.h>
40 #include <kxmlguiwindow.h>
41 #include <QPointer>
42 #include <config-kpa-kipi.h>
43 #ifdef HASKIPI
44 # include <libkipi/pluginloader.h>
45 #endif
46 #include "DB/Result.h"
47 #include "DB/ResultId.h"
49 namespace Plugins { class Interface; }
50 namespace ThumbnailView { class ThumbnailFacade; }
51 namespace Browser{ class BrowserWidget; }
52 namespace AnnotationDialog { class Dialog; }
53 namespace Settings { class SettingsDialog; }
54 namespace DateBar { class DateBarWidget; }
55 namespace HTMLGenerator { class HTMLDialog; }
57 namespace MainWindow
59 class DeleteDialog;
60 class TokenEditor;
61 class ImageCounter;
62 class DirtyIndicator;
64 class Window :public KXmlGuiWindow
66 Q_OBJECT
68 public:
69 Window( QWidget* parent );
70 ~Window();
71 static void configureImages( const DB::ImageInfoList& list, bool oneAtATime );
72 static Window* theMainWindow();
73 DB::Result selected(bool keepSortOrderOfDatabase=false);
74 DB::ImageSearchInfo currentContext();
75 QString currentBrowseCategory() const;
76 void setStackHead( const DB::ResultId image );
78 public slots:
79 void showThumbNails(const DB::Result& items);
80 void loadPlugins();
82 protected slots:
83 void showThumbNails();
84 bool slotExit();
85 void slotOptions();
86 void slotConfigureAllImages();
87 void slotConfigureImagesOneAtATime();
88 void slotCreateImageStack();
89 void slotUnStackImages();
90 void slotSetStackHead();
91 void slotSave();
92 void slotCopySelectedURLs();
93 void slotDeleteSelected();
94 void slotReReadExifInfo();
95 void slotSearch();
96 void slotView( bool reuse = true, bool slideShow = false, bool random = false );
97 void slotViewNewWindow();
98 void slotSortByDateAndTime();
99 void slotLimitToSelected();
100 void slotExportToHTML();
101 void slotAutoSave();
102 void showBrowser();
103 void slotOptionGroupChanged();
104 void showTipOfDay();
105 void runDemo();
106 void lockToDefaultScope();
107 void setDefaultScopePositive();
108 void setDefaultScopeNegative();
109 void unlockFromDefaultScope();
110 void changePassword();
111 void slotConfigureKeyBindings();
112 void slotSetFileName( const DB::ResultId& );
113 void slotThumbNailSelectionChanged(int selectionSize);
114 void reloadThumbnails(bool flushCache);
115 void reloadThumbnailsAndFlushCache();
116 void reloadThumbnailsAfterRotation();
117 void slotUpdateViewMenu( DB::Category::ViewType );
118 void slotShowNotOnDisk();
119 void slotBuildThumbnails();
120 void slotRunSlideShow();
121 void slotRunRandomizedSlideShow();
122 void slotConfigureToolbars();
123 void slotNewToolbarConfig();
124 void slotImport();
125 void slotExport();
126 void delayedInit();
127 void slotReenableMessages();
128 void slotImagesChanged( const KUrl::List& );
129 void slotSelectionChanged(int count);
130 void plug();
131 void slotRemoveTokens();
132 void slotShowListOfFiles();
133 void updateDateBar( const Browser::BreadcrumbList& );
134 void updateDateBar();
135 void slotShowImagesWithInvalidDate();
136 void slotShowImagesWithChangedMD5Sum();
137 void showDateBarTip( const QString& );
138 void slotJumpToContext();
139 void setDateRange( const DB::ImageDate& );
140 void clearDateRange();
141 void startAutoSaveTimer();
142 void convertBackend();
143 void slotRecalcCheckSums();
144 void slotShowExifInfo();
145 void showFeatures();
146 void showImage( const DB::ResultId& fileName );
147 void slotOrderIncr();
148 void slotOrderDecr();
149 void slotRotateSelectedLeft();
150 void slotRotateSelectedRight();
151 void rotateSelected( int angle );
152 void showVideos();
153 void slotStatistics();
154 void slotRecreateExifDB();
156 protected:
157 void configureImages( bool oneAtATime );
158 QString welcome();
159 virtual void closeEvent( QCloseEvent* e );
160 virtual void resizeEvent( QResizeEvent* );
161 virtual void moveEvent ( QMoveEvent * );
162 void setupMenuBar();
163 void createAnnotationDialog();
164 bool load();
165 virtual void contextMenuEvent( QContextMenuEvent* e );
166 void setLocked( bool b, bool force );
167 void configImages( const DB::ImageInfoList& list, bool oneAtATime );
168 void updateStates( bool thumbNailView );
169 DB::Result selectedOnDisk();
170 void setupPluginMenu();
171 void launchViewer(const DB::Result& mediaList, bool reuse, bool slideShow, bool random);
172 void setupStatusBar();
173 void setPluginMenuState( const char* name, const QList<QAction*>& actions );
174 void createSarchBar();
176 private:
177 static Window* _instance;
179 ThumbnailView::ThumbnailFacade* _thumbnailView;
180 Settings::SettingsDialog* _optionsDialog;
181 QPointer<AnnotationDialog::Dialog> _annotationDialog;
182 Q3WidgetStack* _stack;
183 QWidget* _welcome;
184 QTimer* _autoSaveTimer;
185 Browser::BrowserWidget* _browser;
186 KTipDialog* _tipDialog;
187 DeleteDialog* _deleteDialog;
188 DirtyIndicator* _dirtyIndicator;
189 QLabel* _lockedIndicator;
190 KAction* _lock;
191 KAction* _unlock;
192 KAction* _setDefaultPos;
193 KAction* _setDefaultNeg;
194 KAction* _jumpToContext;
195 HTMLGenerator::HTMLDialog* _htmlDialog;
196 KAction* _configOneAtATime;
197 KAction* _configAllSimultaniously;
198 KAction* _createImageStack;
199 KAction* _unStackImages;
200 KAction* _setStackHead;
201 KAction* _view;
202 KAction* _rotLeft;
203 KAction* _rotRight;
204 KAction* _sortByDateAndTime;
205 KAction* _viewInNewWindow;
206 KActionMenu* _viewMenu;
207 KToggleAction* _smallListView;
208 KToggleAction* _largeListView;
209 KToggleAction* _smallIconView;
210 KToggleAction* _largeIconView;
211 KAction* _generateHtml;
212 KAction* _cut;
213 KAction* _paste;
214 KAction* _deleteSelected;
215 KAction* _limitToMarked;
216 KAction* _selectAll;
217 KAction* _runSlideShow;
218 KAction* _runRandomSlideShow;
219 Plugins::Interface* _pluginInterface;
220 KAction* _showExifDialog;
221 #ifdef HASKIPI
222 KIPI::PluginLoader* _pluginLoader;
223 #endif
224 KAction* _recreateThumbnails;
225 TokenEditor* _tokenEditor;
226 DateBar::DateBarWidget* _dateBar;
227 bool _hasLoadedPlugins;
228 ImageCounter* _partial;
229 BreadcrumbViewer* _pathIndicator;
230 QMap<Qt::Key, QPair<QString,QString> > _viewerInputMacros;
235 #endif /* MAINVIEW_H */