forked from oferkv/phototonic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.h
365 lines (338 loc) · 8.79 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
/*
* Copyright (C) 2013-2015 Ofer Kashayov <[email protected]>
* This file is part of Phototonic Image Viewer.
*
* Phototonic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Phototonic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Phototonic. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtWidgets>
#include "thumbview.h"
#include "imageview.h"
#include "dialogs.h"
#define VERSION "Phototonic v1.7.14"
class Phototonic : public QMainWindow
{
Q_OBJECT
public:
Phototonic(QString fileOrDirectory, QWidget *parent = 0);
QMenu *createPopupMenu();
int copyCutCount;
protected:
void mouseDoubleClickEvent(QMouseEvent *event);
void closeEvent(QCloseEvent *event);
void mousePressEvent(QMouseEvent *event);
public slots:
bool event(QEvent *event);
void setStatus(QString state);
void dropOp(Qt::KeyboardModifiers keyMods, bool dirOp, QString cpMvDirPath);
void showViewer();
void loadImagefromThumb(const QModelIndex &idx);
void updateViewerImageBySelection(const QItemSelection& selection);
void loadImagefromCli();
void hideViewer();
void showBusyStatus(bool busy);
private slots:
void about();
void sortThumbnains();
void reload();
void setIncludeSubFolders();
void showSettings();
void toggleFullScreen();
void updateActions();
void reloadThumbsSlot();
void renameDir();
void setThumbviewWindowTitle();
void rename();
void openOp();
void newImage();
void addNewBookmark();
void deleteDir();
void createSubDirectory();
void checkDirState(const QModelIndex &, int, int);
void goSelectedDir(const QModelIndex &currDir);
void bookmarkClicked(QTreeWidgetItem *item, int col);
void goPathBarDir();
void setThumbsFilter();
void clearThumbsFilter();
void goBack();
void goTo(QString path);
void goForward();
void goUp();
void goHome();
void slideShow();
void slideShowHandler();
void loadNextImage();
void loadPrevImage();
void loadFirstImage();
void loadLastImage();
void loadRandomImage();
void updateIndexByViewerImage();
void selectAllThumbs();
void deleteOp();
void cutThumbs();
void copyThumbs();
void pasteThumbs();
void thumbsZoomIn();
void thumbsZoomOut();
void zoomIn();
void zoomOut();
void resetZoom();
void origZoom();
void keepZoom();
void keepTransformClicked();
void rotateLeft();
void rotateRight();
void flipVert();
void cropImage();
void scaleImage();
void freeRotateLeft();
void freeRotateRight();
void showColorsDialog();
void findDuplicateImages();
void setMirrorDisabled();
void setMirrorDual();
void setMirrorTriple();
void setMirrorVDual();
void setMirrorQuad();
void flipHoriz();
void moveRight();
void moveLeft();
void moveUp();
void moveDown();
void setDocksVisibility(bool visible);
void goTop();
void goBottom();
void setClassicThumbs();
void setCompactThumbs();
void setSquarishThumbs();
void showHiddenFiles();
void toggleImageToolbar();
void showLabels();
void setToolbarIconSize();
void chooseExternalApp();
void updateExternalApps();
void runExternalApp();
void cleanupSender();
void externalAppError();
void setEditToolBarVisibility();
void setGoToolBarVisibility();
void setViewToolBarVisibility();
void setImageToolBarVisibility();
void setFsDockVisibility();
void setBmDockVisibility();
void setTagsDockVisibility();
void setIiDockVisibility();
void setPvDockVisibility();
void lockDocks();
void cleanupCropDialog();
void cleanupScaleDialog();
void cleanupColorsDialog();
void filterImagesFocus();
void setPathFocus();
void copyImagesTo();
void moveImagesTo();
private:
QString cliFileName;
QMenuBar *thumbsMenuBar;
QMenu *fileMenu;
QMenu *editMenu;
QMenu *goMenu;
QMenu *sortMenu;
QMenu *viewMenu;
QMenu *toolsMenu;
QMenu *helpMenu;
QMenu *zoomSubMenu;
QMenu *transformSubMenu;
QMenu *viewSubMenu;
QMenu *imageFileSubMenu;
QMenu *MirroringSubMenu;
QMenu *openWithSubMenu;
QToolBar *viewToolBar;
QToolBar *editToolBar;
QToolBar *goToolBar;
QToolBar *imageToolBar;
QAction *exitAction;
QAction *cutAction;
QAction *copyAction;
QAction *copyToAction;
QAction *moveToAction;
QAction *deleteAction;
QAction *saveAction;
QAction *saveAsAction;
QAction *renameAction;
QAction *selectAllAction;
QAction *copyImageAction;
QAction *pasteImageAction;
QAction *showClipboardAction;
QAction *addBookmarkAction;
QAction *removeBookmarkAction;
QActionGroup *sortTypesGroup;
QActionGroup *thumbLayoutsGroup;
QAction *actName;
QAction *actTime;
QAction *actSize;
QAction *actType;
QAction *actReverse;
QAction *refreshAction;
QAction *subFoldersAction;
QAction *fullScreenAct;
QAction *thumbsGoTopAct;
QAction *thumbsGoBottomAct;
QAction *closeImageAct;
QAction *settingsAction;
QAction *thumbsZoomInAct;
QAction *thumbsZoomOutAct;
QAction *zoomSubMenuAct;
QAction *zoomInAct;
QAction *zoomOutAct;
QAction *resetZoomAct;
QAction *origZoomAct;
QAction *keepZoomAct;
QAction *keepTransformAct;
QAction *transformSubMenuAct;
QAction *viewSubMenuAct;
QAction *rotateLeftAct;
QAction *rotateRightAct;
QAction *flipHAct;
QAction *flipVAct;
QAction *cropAct;
QAction *cropToSelectionAct;
QAction *resizeAct;
QAction *freeRotateLeftAct;
QAction *freeRotateRightAct;
QAction *colorsAct;
QActionGroup *mirroringGroup;
QAction *mirrorSubMenuAct;
QAction *mirrorDisabledAct;
QAction *mirrorDualAct;
QAction *mirrorTripleAct;
QAction *mirrorVDualAct;
QAction *mirrorQuadAct;
QAction *moveLeftAct;
QAction *moveRightAct;
QAction *moveUpAct;
QAction *moveDownAct;
QAction *actClassic;
QAction *actCompact;
QAction *actSquarish;
QAction *aboutAction;
QAction *actShowHidden;
QAction *actShowLabels;
QAction *actSmallIcons;
QAction *actLockDocks;
QAction *actShowViewerToolbars;
QAction *pasteAction;
QAction *createDirAction;
QAction *goBackAction;
QAction *goFrwdAction;
QAction *goUpAction;
QAction *goHomeAction;
QAction *slideShowAction;
QAction *nextImageAction;
QAction *prevImageAction;
QAction *firstImageAction;
QAction *lastImageAction;
QAction *randomImageAction;
QAction *openAction;
QAction *findDupesAction;
QAction *filterImagesFocusAct;
QAction *setPathFocusAct;
QAction *openWithMenuAct;
QAction *chooseAppAct;
QAction *invertSelectionAct;
QLineEdit *pathBar;
QLineEdit *filterBar;
QLabel *stateLabel;
QDockWidget *fsDock;
QDockWidget *bmDock;
QDockWidget *tagsDock;
QDockWidget *pvDock;
FSTree *fsTree;
BookMarks *bookmarks;
QHBoxLayout *mainLayout;
QDockWidget *iiDock;
ThumbView *thumbView;
ImageView *imageView;
QList<QString> pathHistory;
QTimer *SlideShowTimer;
CopyMoveToDialog *copyMoveToDialog;
QWidget *fsDockOrigWidget;
QWidget *bmDockOrigWidget;
QWidget *tagsDockOrigWidget;
QWidget *iiDockOrigWidget;
QWidget *pvDockOrigWidget;
QWidget *fsDockEmptyWidget;
QWidget *bmDockEmptyWidget;
QWidget *tagsDockEmptyWidget;
QWidget *iiDockEmptyWidget;
QWidget *pvDockEmptyWidget;
QVBoxLayout *imageViewLayout;
bool interfaceDisabled;
MetadataCache *mdCache;
enum CentralWidgets {
thumbViewIdx = 0,
imageViewIdx
};
int currentHistoryIdx;
bool needHistoryRecord;
bool initComplete;
bool needThumbsRefresh;
bool cliImageLoaded;
bool thumbViewBusy;
bool shouldMaximize;
bool editToolBarVisible;
bool goToolBarVisible;
bool viewToolBarVisible;
bool imageToolBarVisible;
QMovie *busyMovie;
QLabel *busyLabel;
ResizeDialog *resizeDialog;
ColorsDialog *colorsDialog;
CropDialog *cropDialog;
void refreshThumbs(bool noScroll);
void loadShortcuts();
void setupDocks();
void deleteViewerImage();
void loadCurrentImage(int currentRow);
void selectCurrentViewDir();
void handleStartupArgs(QString fileOrDirectory);
void addMenuSeparator(QWidget *widget);
void createImageView();
void createThumbView();
void createActions();
void createMenus();
void createToolBars();
void createStatusBar();
void setfsModelFlags();
void createFSTree();
void createBookmarks();
void createImageTags();
void writeSettings();
void readSettings();
void recordHistory(QString dir);
bool isValidPath(QString &path);
QString getSelectedPath();
void setCopyCutActions(bool setEnabled);
void setDeleteAction(bool setEnabled);
void wheelEvent(QWheelEvent *event);
void copyOrCutThumbs(bool copy);
void showNewImageWarning(QWidget *parent);
bool removeDirOp(QString dirToDelete);
void setInterfaceEnabled(bool enable);
void addBookmark(QString path);
void copyMoveImages(bool move);
void setViewerKeyEventsEnabled(bool enabled);
};
#endif // MAINWINDOW_H