~adamreichold/qpdfview/trunk

« back to all changes in this revision

Viewing changes to sources/mainwindow.h

  • Committer: Adam Reichold
  • Date: 2012-07-01 17:37:17 UTC
  • Revision ID: adamreichold@myopera.com-20120701173717-rjw063ohuse3wcri
manual merge of future branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 
3
 
Copyright 2012 Adam Reichold
4
 
 
5
 
This file is part of qpdfview.
6
 
 
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.
11
 
 
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.
16
 
 
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/>.
19
 
 
20
 
*/
21
 
 
22
 
#ifndef MAINWINDOW_H
23
 
#define MAINWINDOW_H
24
 
 
25
 
#include <QtCore>
26
 
#include <QtGui>
27
 
 
28
 
#ifdef WITH_DBUS
29
 
 
30
 
#include <QtDBus>
31
 
 
32
 
#endif
33
 
 
34
 
#include "documentview.h"
35
 
#include "miscellaneous.h"
36
 
 
37
 
class MainWindow : public QMainWindow
38
 
{
39
 
    Q_OBJECT
40
 
 
41
 
public:
42
 
    explicit MainWindow(QWidget* parent = 0);
43
 
 
44
 
    QSize sizeHint() const;
45
 
    QMenu* createPopupMenu();
46
 
 
47
 
public slots:
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);
50
 
 
51
 
protected:
52
 
    void closeEvent(QCloseEvent*);
53
 
 
54
 
    void dragEnterEvent(QDragEnterEvent* event);
55
 
    void dropEvent(QDropEvent* event);
56
 
 
57
 
    void keyPressEvent(QKeyEvent* event);
58
 
 
59
 
protected slots:
60
 
    void slotOpen();
61
 
    void slotOpenInNewTab();
62
 
    void slotRecentyUsedActionEntrySelected(const QString& filePath);
63
 
    void slotRefresh();
64
 
    void slotSaveCopy();
65
 
    void slotPrint();
66
 
 
67
 
    void slotPreviousPage();
68
 
    void slotNextPage();
69
 
    void slotFirstPage();
70
 
    void slotLastPage();
71
 
    void slotJumpToPage();
72
 
 
73
 
    void slotSearch();
74
 
 
75
 
    void slotStartSearch();
76
 
 
77
 
    void slotSearchProgressed(int value);
78
 
    void slotSearchCanceled();
79
 
    void slotSearchFinished();
80
 
 
81
 
    void slotFindPrevious();
82
 
    void slotFindNext();
83
 
    void slotCancelSearch();
84
 
 
85
 
    void slotSettings();
86
 
 
87
 
    void slotPageLayoutGroupTriggered(QAction* action);
88
 
    void slotScaleModeGroupTriggered(QAction* action);
89
 
 
90
 
    void slotZoomIn();
91
 
    void slotZoomOut();
92
 
 
93
 
    void slotRotateLeft();
94
 
    void slotRotateRight();
95
 
 
96
 
    void slotFonts();
97
 
 
98
 
    void slotFullscreen();
99
 
    void slotPresentation();
100
 
 
101
 
    void slotPreviousTab();
102
 
    void slotNextTab();
103
 
    void slotCloseTab();
104
 
 
105
 
    void slotCloseAllTabs();
106
 
    void slotCloseAllTabsButCurrentTab();
107
 
 
108
 
    void slotContents();
109
 
    void slotAbout();
110
 
 
111
 
    void slotTabWidgetCurrentChanged(int index);
112
 
    void slotTabWidgetTabCloseRequested(int index);
113
 
 
114
 
    void slotCurrentPageLineEditEditingFinished();
115
 
    void slotCurrentPageLineEditReturnPressed();
116
 
 
117
 
    void slotScaleFactorComboBoxCurrentIndexChanged(int index);
118
 
    void slotScaleFactorComboBoxEditingFinished();
119
 
    void slotScaleFactorComboBoxReturnPressed();
120
 
 
121
 
    void slotHighlightAllCheckBoxClicked(bool checked);
122
 
 
123
 
    void slotFilePathChanged(const QString& filePath);
124
 
    void slotNumberOfPagesChanged(int numberOfPages);
125
 
 
126
 
    void slotCurrentPageChanged(int currentPage);
127
 
    void slotPageLayoutChanged(DocumentView::PageLayout pageLayout);
128
 
    void slotScaleModeChanged(DocumentView::ScaleMode scaleMode);
129
 
    void slotScaleFactorChanged(qreal scaleFactor);
130
 
 
131
 
    void slotHighlightAllChanged(bool highlightAll);
132
 
 
133
 
private:
134
 
    // actions
135
 
 
136
 
    QAction* m_openAction;
137
 
    QAction* m_openInNewTabAction;
138
 
    RecentlyUsedAction* m_recentlyUsedAction;
139
 
    QAction* m_refreshAction;
140
 
    QAction* m_saveCopyAction;
141
 
    QAction* m_printAction;
142
 
 
143
 
    QAction* m_exitAction;
144
 
 
145
 
    QAction* m_previousPageAction;
146
 
    QAction* m_nextPageAction;
147
 
    QAction* m_firstPageAction;
148
 
    QAction* m_lastPageAction;
149
 
    QAction* m_jumpToPageAction;
150
 
 
151
 
    QAction* m_searchAction;
152
 
    QAction* m_findPreviousAction;
153
 
    QAction* m_findNextAction;
154
 
    QAction* m_cancelSearchAction;
155
 
 
156
 
    QAction* m_settingsAction;
157
 
 
158
 
    QAction* m_onePageAction;
159
 
    QAction* m_twoPagesAction;
160
 
    QAction* m_oneColumnAction;
161
 
    QAction* m_twoColumnsAction;
162
 
    QActionGroup* m_pageLayoutGroup;
163
 
 
164
 
    QAction* m_fitToPageAction;
165
 
    QAction* m_fitToPageWidthAction;
166
 
    QAction* m_doNotScaleAction;
167
 
    QActionGroup* m_scaleModeGroup;
168
 
 
169
 
    QAction* m_zoomInAction;
170
 
    QAction* m_zoomOutAction;
171
 
 
172
 
    QAction* m_rotateLeftAction;
173
 
    QAction* m_rotateRightAction;
174
 
 
175
 
    QAction* m_fontsAction;
176
 
 
177
 
    QAction* m_fullscreenAction;
178
 
    QAction* m_presentationAction;
179
 
 
180
 
    QAction* m_previousTabAction;
181
 
    QAction* m_nextTabAction;
182
 
 
183
 
    QAction* m_closeTabAction;
184
 
    QAction* m_closeAllTabsAction;
185
 
    QAction* m_closeAllTabsButCurrentTabAction;
186
 
 
187
 
    QAction* m_contentsAction;
188
 
    QAction* m_aboutAction;
189
 
 
190
 
    void createActions();
191
 
 
192
 
    // widgets
193
 
 
194
 
    TabWidget* m_tabWidget;
195
 
 
196
 
    LineEdit* m_currentPageLineEdit;
197
 
    QIntValidator* m_currentPageValidator;
198
 
 
199
 
    QLabel* m_numberOfPagesLabel;
200
 
 
201
 
    ComboBox* m_scaleFactorComboBox;
202
 
 
203
 
    QWidget* m_searchWidget;
204
 
    QLineEdit* m_searchLineEdit;
205
 
    QTimer* m_searchTimer;
206
 
    QCheckBox* m_matchCaseCheckBox;
207
 
    QCheckBox* m_highlightAllCheckBox;
208
 
 
209
 
    void createWidgets();
210
 
 
211
 
    // toolbars
212
 
 
213
 
    QToolBar* m_fileToolBar;
214
 
    QToolBar* m_editToolBar;
215
 
    QToolBar* m_viewToolBar;
216
 
 
217
 
    QToolBar* m_searchToolBar;
218
 
 
219
 
    void createToolBars();
220
 
 
221
 
    // docks
222
 
 
223
 
    QDockWidget* m_outlineDock;
224
 
    QDockWidget* m_metaInformationDock;
225
 
    QDockWidget* m_thumbnailsDock;
226
 
 
227
 
    void createDocks();
228
 
 
229
 
    // menus
230
 
 
231
 
    QMenu* m_fileMenu;
232
 
    QMenu* m_editMenu;
233
 
    QMenu* m_viewMenu;
234
 
    QMenu* m_tabMenu;
235
 
    QMenu* m_helpMenu;
236
 
 
237
 
    void createMenus();
238
 
 
239
 
    // settings
240
 
 
241
 
    QSettings m_settings;
242
 
    QByteArray m_geometry;
243
 
 
244
 
#ifdef WITH_DBUS
245
 
 
246
 
    friend class MainWindowAdaptor;
247
 
};
248
 
 
249
 
class MainWindowAdaptor : public QDBusAbstractAdaptor
250
 
{
251
 
    Q_OBJECT
252
 
    Q_CLASSINFO("D-Bus Interface", "local.qpdfview.MainWindow")
253
 
 
254
 
public:
255
 
    MainWindowAdaptor(MainWindow* mainWindow);
256
 
 
257
 
public slots:
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);
260
 
 
261
 
    Q_NOREPLY void refresh(const QString& filePath, int page = 1, qreal top = 0.0);
262
 
 
263
 
};
264
 
 
265
 
#else
266
 
 
267
 
};
268
 
 
269
 
#endif // WITH_DBUS
270
 
 
271
 
#endif // MAINWINDOW_H