1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Assistant of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #ifndef MAINWINDOW_H |
30 | #define MAINWINDOW_H |
31 | |
32 | #include <QtCore/QList> |
33 | #include <QtCore/QUrl> |
34 | #include <QtWidgets/QMainWindow> |
35 | |
36 | QT_BEGIN_NAMESPACE |
37 | |
38 | class QAction; |
39 | class QComboBox; |
40 | class QLineEdit; |
41 | class ; |
42 | |
43 | class CentralWidget; |
44 | class CmdLineParser; |
45 | class ContentWindow; |
46 | class IndexWindow; |
47 | class QtDocInstaller; |
48 | class SearchWidget; |
49 | struct QHelpLink; |
50 | |
51 | class MainWindow : public QMainWindow |
52 | { |
53 | Q_OBJECT |
54 | |
55 | public: |
56 | explicit MainWindow(CmdLineParser *cmdLine, QWidget *parent = nullptr); |
57 | ~MainWindow() override; |
58 | |
59 | static void activateCurrentBrowser(); |
60 | static QString collectionFileDirectory(bool createDir = false, |
61 | const QString &cacheDir = QString()); |
62 | static QString defaultHelpCollectionFileName(); |
63 | |
64 | public: |
65 | void setIndexString(const QString &str); |
66 | void expandTOC(int depth); |
67 | bool usesDefaultCollection() const; |
68 | |
69 | signals: |
70 | void initDone(); |
71 | |
72 | public slots: |
73 | void setContentsVisible(bool visible); |
74 | void setIndexVisible(bool visible); |
75 | void setBookmarksVisible(bool visible); |
76 | void setSearchVisible(bool visible); |
77 | void syncContents(); |
78 | void activateCurrentCentralWidgetTab(); |
79 | void currentFilterChanged(const QString &filter); |
80 | |
81 | private slots: |
82 | void showContents(); |
83 | void showIndex(); |
84 | void showSearch(); |
85 | void showOpenPages(); |
86 | void insertLastPages(); |
87 | void gotoAddress(); |
88 | void showPreferences(); |
89 | void showNewAddress(); |
90 | void showAboutDialog(); |
91 | void showNewAddress(const QUrl &url); |
92 | void showTopicChooser(const QList<QHelpLink> &documents, const QString &keyword); |
93 | void updateApplicationFont(); |
94 | void filterDocumentation(int filterIndex); |
95 | void setupFilterCombo(); |
96 | void lookForNewQtDocumentation(); |
97 | void indexingStarted(); |
98 | void indexingFinished(); |
99 | void qtDocumentationInstalled(); |
100 | void registerDocumentation(const QString &component, |
101 | const QString &absFileName); |
102 | void resetQtDocInfo(const QString &component); |
103 | void checkInitState(); |
104 | void documentationRemoved(const QString &namespaceName); |
105 | void documentationUpdated(const QString &namespaceName); |
106 | |
107 | private: |
108 | bool initHelpDB(bool registerInternalDoc); |
109 | void setupActions(); |
110 | void closeEvent(QCloseEvent *e) override; |
111 | void activateDockWidget(QWidget *w); |
112 | void updateAboutMenuText(); |
113 | void setupFilterToolbar(); |
114 | void setupAddressToolbar(); |
115 | QMenu *toolBarMenu(); |
116 | void hideContents(); |
117 | void hideIndex(); |
118 | void hideSearch(); |
119 | |
120 | private slots: |
121 | void showBookmarksDockWidget(); |
122 | void hideBookmarksDockWidget(); |
123 | void handlePageCountChanged(); |
124 | |
125 | private: |
126 | QWidget *m_bookmarkWidget = nullptr; |
127 | CentralWidget *m_centralWidget; |
128 | IndexWindow *m_indexWindow; |
129 | ContentWindow *m_contentWindow; |
130 | SearchWidget *m_searchWindow; |
131 | QLineEdit *m_addressLineEdit; |
132 | QComboBox *m_filterCombo = nullptr; |
133 | |
134 | QAction *m_syncAction; |
135 | QAction *m_printPreviewAction; |
136 | QAction *m_pageSetupAction; |
137 | QAction *m_resetZoomAction; |
138 | QAction *m_aboutAction; |
139 | QAction *m_closeTabAction; |
140 | QAction *m_newTabAction; |
141 | |
142 | QMenu *m_viewMenu; |
143 | QMenu *m_toolBarMenu = nullptr; |
144 | |
145 | CmdLineParser *m_cmdLine; |
146 | |
147 | QWidget *m_progressWidget = nullptr; |
148 | QtDocInstaller *m_qtDocInstaller = nullptr; |
149 | |
150 | bool m_connectedInitSignals = false; |
151 | }; |
152 | |
153 | QT_END_NAMESPACE |
154 | |
155 | #endif // MAINWINDOW_H |
156 | |