3
Copyright 2012 Adam Reichold
5
This file is part of qpdfview.
7
qpdfview is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 2 of the License, or
10
(at your option) any later version.
12
qpdfview is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with qpdfview. If not, see <http://www.gnu.org/licenses/>.
34
#include "documentview.h"
35
#include "miscellaneous.h"
37
class MainWindow : public QMainWindow
42
explicit MainWindow(QWidget* parent = 0);
44
QSize sizeHint() const;
45
QMenu* createPopupMenu();
48
bool open(const QString& filePath, int page = 1, qreal top = 0.0);
49
bool openInNewTab(const QString& filePath, int page = 1, qreal top = 0.0);
52
void closeEvent(QCloseEvent*);
54
void dragEnterEvent(QDragEnterEvent* event);
55
void dropEvent(QDropEvent* event);
57
void keyPressEvent(QKeyEvent* event);
61
void slotOpenInNewTab();
62
void slotRecentyUsedActionEntrySelected(const QString& filePath);
67
void slotPreviousPage();
71
void slotJumpToPage();
75
void slotStartSearch();
77
void slotSearchProgressed(int value);
78
void slotSearchCanceled();
79
void slotSearchFinished();
81
void slotFindPrevious();
83
void slotCancelSearch();
87
void slotPageLayoutGroupTriggered(QAction* action);
88
void slotScaleModeGroupTriggered(QAction* action);
93
void slotRotateLeft();
94
void slotRotateRight();
98
void slotFullscreen();
99
void slotPresentation();
101
void slotPreviousTab();
105
void slotCloseAllTabs();
106
void slotCloseAllTabsButCurrentTab();
111
void slotTabWidgetCurrentChanged(int index);
112
void slotTabWidgetTabCloseRequested(int index);
114
void slotCurrentPageLineEditEditingFinished();
115
void slotCurrentPageLineEditReturnPressed();
117
void slotScaleFactorComboBoxCurrentIndexChanged(int index);
118
void slotScaleFactorComboBoxEditingFinished();
119
void slotScaleFactorComboBoxReturnPressed();
121
void slotHighlightAllCheckBoxClicked(bool checked);
123
void slotFilePathChanged(const QString& filePath);
124
void slotNumberOfPagesChanged(int numberOfPages);
126
void slotCurrentPageChanged(int currentPage);
127
void slotPageLayoutChanged(DocumentView::PageLayout pageLayout);
128
void slotScaleModeChanged(DocumentView::ScaleMode scaleMode);
129
void slotScaleFactorChanged(qreal scaleFactor);
131
void slotHighlightAllChanged(bool highlightAll);
136
QAction* m_openAction;
137
QAction* m_openInNewTabAction;
138
RecentlyUsedAction* m_recentlyUsedAction;
139
QAction* m_refreshAction;
140
QAction* m_saveCopyAction;
141
QAction* m_printAction;
143
QAction* m_exitAction;
145
QAction* m_previousPageAction;
146
QAction* m_nextPageAction;
147
QAction* m_firstPageAction;
148
QAction* m_lastPageAction;
149
QAction* m_jumpToPageAction;
151
QAction* m_searchAction;
152
QAction* m_findPreviousAction;
153
QAction* m_findNextAction;
154
QAction* m_cancelSearchAction;
156
QAction* m_settingsAction;
158
QAction* m_onePageAction;
159
QAction* m_twoPagesAction;
160
QAction* m_oneColumnAction;
161
QAction* m_twoColumnsAction;
162
QActionGroup* m_pageLayoutGroup;
164
QAction* m_fitToPageAction;
165
QAction* m_fitToPageWidthAction;
166
QAction* m_doNotScaleAction;
167
QActionGroup* m_scaleModeGroup;
169
QAction* m_zoomInAction;
170
QAction* m_zoomOutAction;
172
QAction* m_rotateLeftAction;
173
QAction* m_rotateRightAction;
175
QAction* m_fontsAction;
177
QAction* m_fullscreenAction;
178
QAction* m_presentationAction;
180
QAction* m_previousTabAction;
181
QAction* m_nextTabAction;
183
QAction* m_closeTabAction;
184
QAction* m_closeAllTabsAction;
185
QAction* m_closeAllTabsButCurrentTabAction;
187
QAction* m_contentsAction;
188
QAction* m_aboutAction;
190
void createActions();
194
TabWidget* m_tabWidget;
196
LineEdit* m_currentPageLineEdit;
197
QIntValidator* m_currentPageValidator;
199
QLabel* m_numberOfPagesLabel;
201
ComboBox* m_scaleFactorComboBox;
203
QWidget* m_searchWidget;
204
QLineEdit* m_searchLineEdit;
205
QTimer* m_searchTimer;
206
QCheckBox* m_matchCaseCheckBox;
207
QCheckBox* m_highlightAllCheckBox;
209
void createWidgets();
213
QToolBar* m_fileToolBar;
214
QToolBar* m_editToolBar;
215
QToolBar* m_viewToolBar;
217
QToolBar* m_searchToolBar;
219
void createToolBars();
223
QDockWidget* m_outlineDock;
224
QDockWidget* m_metaInformationDock;
225
QDockWidget* m_thumbnailsDock;
241
QSettings m_settings;
242
QByteArray m_geometry;
246
friend class MainWindowAdaptor;
249
class MainWindowAdaptor : public QDBusAbstractAdaptor
252
Q_CLASSINFO("D-Bus Interface", "local.qpdfview.MainWindow")
255
MainWindowAdaptor(MainWindow* mainWindow);
258
bool open(const QString& filePath, int page = 1, qreal top = 0.0);
259
bool openInNewTab(const QString& filePath, int page = 1, qreal top = 0.0);
261
Q_NOREPLY void refresh(const QString& filePath, int page = 1, qreal top = 0.0);
271
#endif // MAINWINDOW_H