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();
74
void slotStartSearch();
76
void slotSearchProgressed(int value);
77
void slotSearchCanceled();
78
void slotSearchFinished();
80
void slotFindPrevious();
82
void slotCancelSearch();
86
void slotPageLayoutGroupTriggered(QAction* action);
87
void slotScaleModeGroupTriggered(QAction* action);
92
void slotRotateLeft();
93
void slotRotateRight();
95
void slotFullscreen();
96
void slotPresentation();
98
void slotPreviousTab();
102
void slotCloseAllTabs();
103
void slotCloseAllTabsButCurrentTab();
108
void slotTabWidgetCurrentChanged(int index);
109
void slotTabWidgetTabCloseRequested(int index);
111
void slotCurrentPageLineEditReturnPressed();
113
void slotScaleFactorComboBoxCurrentIndexChanged(int index);
114
void slotScaleFactorComboBoxEditingFinished();
116
void slotHighlightAllCheckBoxClicked(bool checked);
118
void slotFilePathChanged(const QString& filePath);
119
void slotNumberOfPagesChanged(int numberOfPages);
121
void slotCurrentPageChanged(int currentPage);
122
void slotPageLayoutChanged(DocumentView::PageLayout pageLayout);
123
void slotScaleModeChanged(DocumentView::ScaleMode scaleMode);
124
void slotScaleFactorChanged(qreal scaleFactor);
126
void slotHighlightAllChanged(bool highlightAll);
131
QAction* m_openAction;
132
QAction* m_openInNewTabAction;
133
RecentlyUsedAction* m_recentlyUsedAction;
134
QAction* m_refreshAction;
135
QAction* m_saveCopyAction;
136
QAction* m_printAction;
138
QAction* m_exitAction;
140
QAction* m_previousPageAction;
141
QAction* m_nextPageAction;
142
QAction* m_firstPageAction;
143
QAction* m_lastPageAction;
145
QAction* m_searchAction;
146
QAction* m_findPreviousAction;
147
QAction* m_findNextAction;
148
QAction* m_cancelSearchAction;
150
QAction* m_settingsAction;
152
QAction* m_onePageAction;
153
QAction* m_twoPagesAction;
154
QAction* m_oneColumnAction;
155
QAction* m_twoColumnsAction;
156
QActionGroup* m_pageLayoutGroup;
158
QAction* m_fitToPageAction;
159
QAction* m_fitToPageWidthAction;
160
QAction* m_doNotScaleAction;
161
QActionGroup* m_scaleModeGroup;
163
QAction* m_zoomInAction;
164
QAction* m_zoomOutAction;
166
QAction* m_rotateLeftAction;
167
QAction* m_rotateRightAction;
169
QAction* m_fullscreenAction;
170
QAction* m_presentationAction;
172
QAction* m_previousTabAction;
173
QAction* m_nextTabAction;
175
QAction* m_closeTabAction;
176
QAction* m_closeAllTabsAction;
177
QAction* m_closeAllTabsButCurrentTabAction;
179
QAction* m_contentsAction;
180
QAction* m_aboutAction;
182
void createActions();
186
TabWidget* m_tabWidget;
188
LineEdit* m_currentPageLineEdit;
189
QIntValidator* m_currentPageValidator;
191
QLabel* m_numberOfPagesLabel;
193
ComboBox* m_scaleFactorComboBox;
195
QWidget* m_searchWidget;
196
QLineEdit* m_searchLineEdit;
197
QTimer* m_searchTimer;
198
QCheckBox* m_matchCaseCheckBox;
199
QCheckBox* m_highlightAllCheckBox;
201
void createWidgets();
205
QToolBar* m_fileToolBar;
206
QToolBar* m_editToolBar;
207
QToolBar* m_viewToolBar;
209
QToolBar* m_searchToolBar;
211
void createToolBars();
215
QDockWidget* m_outlineDock;
216
QDockWidget* m_metaInformationDock;
217
QDockWidget* m_thumbnailsDock;
233
QSettings m_settings;
234
QByteArray m_geometry;
238
friend class MainWindowAdaptor;
241
class MainWindowAdaptor : public QDBusAbstractAdaptor
244
Q_CLASSINFO("D-Bus Interface", "local.qpdfview.MainWindow")
247
MainWindowAdaptor(MainWindow* mainWindow);
250
bool open(const QString& filePath, int page = 1, qreal top = 0.0);
251
bool openInNewTab(const QString& filePath, int page = 1, qreal top = 0.0);
253
Q_NOREPLY void refresh(const QString& filePath, int page = 1, qreal top = 0.0);
263
#endif // MAINWINDOW_H