-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.h
More file actions
114 lines (101 loc) · 3.35 KB
/
mainwindow.h
File metadata and controls
114 lines (101 loc) · 3.35 KB
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
/*
* Renamifier's main window.
* Copyright (c) 2021 Benjamin Johnson
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QObject>
#include <QString>
#include <QStringList>
#include <QAction>
#include <QLineEdit>
#include <QMainWindow>
#include <QMenu>
#include <QProgressBar>
#include <QToolBar>
#include "viewer.h"
/*
* The application's main window.
*/
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr,
Qt::WindowFlags f = Qt::WindowFlags());
~MainWindow();
void addPath(const QString &path, bool recurseIntoSubdirs = false);
void browseForDir();
void browseForFiles();
void closeAll();
void closeCurrent();
void displayFile(int index = 0);
void displayNext();
void displayPrevious();
protected:
Viewer *viewer;
QMenu *fileMenu;
QMenu *goMenu;
QMenu *helpMenu;
QToolBar *toolBar;
QLineEdit *nameEntry;
QAction *actionDisplayNext;
QAction *actionDisplayPrevious;
QAction *actionFocusNameEntry;
QAction *actionRenameOnly;
QAction *actionRenameAndDisplayNext;
QAction *actionKpRenameOnly;
QAction *actionKpRenameAndDisplayNext;
QAction *actionStopRender;
int currentFileIndex;
QStringList fileNames;
QString lastBrowseDir;
QString lastMoveDir;
void addDir(const QString &path, bool recurseIntoSubdirs);
void addFile(const QString &path);
void createActions();
void createMenus();
void createToolBar();
void displayNextOrPromptToExit();
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
// The rename methods are protected because they should only be triggered
// interactively by the user, not programatically.
bool processRename();
bool processRenameAndMove();
bool readyToRename();
bool rename_(const QString &srcPath, const QString &dstPath);
void updateGoMenu();
void updateWindowTitle();
protected slots:
void displayRenderProgress(int pagesDone, int pagesTotal);
void triggerBrowseForDir(bool checked);
void triggerBrowseForFiles(bool checked);
void triggerCloseCurrent(bool checked);
void triggerDisplayFile(QAction *action);
void triggerDisplayNext(bool checked);
void triggerDisplayPrevious(bool checked);
void triggerFocusNameEntry(bool checked);
void triggerQuit(bool checked);
void triggerRenameOnly(bool checked);
void triggerRenameAndDisplayNext(bool checked);
void triggerRenameAndMove(bool checked);
void triggerShowAbout(bool checked);
void triggerStopRender(bool checked);
private:
friend class RenamifierTest;
};
#endif /* MAINWINDOW_H */