1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #ifndef MAINWINDOW_H |
5 | #define MAINWINDOW_H |
6 | |
7 | #include <QtCore/QList> |
8 | #include <QtCore/QUrl> |
9 | #include <QtWidgets/QMainWindow> |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | class QAction; |
14 | class QComboBox; |
15 | class QLineEdit; |
16 | class ; |
17 | |
18 | class CentralWidget; |
19 | class CmdLineParser; |
20 | class ContentWindow; |
21 | class IndexWindow; |
22 | class QtDocInstaller; |
23 | class SearchWidget; |
24 | struct QHelpLink; |
25 | |
26 | class MainWindow : public QMainWindow |
27 | { |
28 | Q_OBJECT |
29 | Q_MOC_INCLUDE(<QtHelp/qhelplink.h>) |
30 | |
31 | public: |
32 | explicit MainWindow(CmdLineParser *cmdLine, QWidget *parent = nullptr); |
33 | ~MainWindow() override; |
34 | |
35 | static void activateCurrentBrowser(); |
36 | static QString collectionFileDirectory(bool createDir = false, |
37 | const QString &cacheDir = QString()); |
38 | static QString defaultHelpCollectionFileName(); |
39 | |
40 | public: |
41 | void setIndexString(const QString &str); |
42 | void expandTOC(int depth); |
43 | bool usesDefaultCollection() const; |
44 | |
45 | signals: |
46 | void initDone(); |
47 | |
48 | public slots: |
49 | void setContentsVisible(bool visible); |
50 | void setIndexVisible(bool visible); |
51 | void setBookmarksVisible(bool visible); |
52 | void setSearchVisible(bool visible); |
53 | void syncContents(); |
54 | void activateCurrentCentralWidgetTab(); |
55 | void currentFilterChanged(const QString &filter); |
56 | |
57 | private slots: |
58 | void showContents(); |
59 | void showIndex(); |
60 | void showSearch(); |
61 | void showOpenPages(); |
62 | void insertLastPages(); |
63 | void gotoAddress(); |
64 | void showPreferences(); |
65 | void showNewAddress(); |
66 | void showAboutDialog(); |
67 | void showNewAddress(const QUrl &url); |
68 | void showTopicChooser(const QList<QHelpLink> &documents, const QString &keyword); |
69 | void updateApplicationFont(); |
70 | void filterDocumentation(int filterIndex); |
71 | void setupFilterCombo(); |
72 | void lookForNewQtDocumentation(); |
73 | void indexingStarted(); |
74 | void indexingFinished(); |
75 | void qtDocumentationInstalled(); |
76 | void registerDocumentation(const QString &component, |
77 | const QString &absFileName); |
78 | void resetQtDocInfo(const QString &component); |
79 | void checkInitState(); |
80 | void documentationRemoved(const QString &namespaceName); |
81 | void documentationUpdated(const QString &namespaceName); |
82 | |
83 | private: |
84 | bool initHelpDB(bool registerInternalDoc); |
85 | void setupActions(); |
86 | void closeEvent(QCloseEvent *e) override; |
87 | void activateDockWidget(QWidget *w); |
88 | void updateAboutMenuText(); |
89 | void setupFilterToolbar(); |
90 | void setupAddressToolbar(); |
91 | QMenu *toolBarMenu(); |
92 | void hideContents(); |
93 | void hideIndex(); |
94 | void hideSearch(); |
95 | |
96 | private slots: |
97 | void showBookmarksDockWidget(); |
98 | void hideBookmarksDockWidget(); |
99 | void handlePageCountChanged(); |
100 | |
101 | private: |
102 | QWidget *m_bookmarkWidget = nullptr; |
103 | CentralWidget *m_centralWidget; |
104 | IndexWindow *m_indexWindow; |
105 | ContentWindow *m_contentWindow; |
106 | SearchWidget *m_searchWindow; |
107 | QLineEdit *m_addressLineEdit; |
108 | QComboBox *m_filterCombo = nullptr; |
109 | |
110 | QAction *m_syncAction; |
111 | QAction *m_printPreviewAction; |
112 | QAction *m_pageSetupAction; |
113 | QAction *m_resetZoomAction; |
114 | QAction *m_aboutAction; |
115 | QAction *m_closeTabAction; |
116 | QAction *m_newTabAction; |
117 | |
118 | QMenu *m_viewMenu; |
119 | QMenu *m_toolBarMenu = nullptr; |
120 | |
121 | CmdLineParser *m_cmdLine; |
122 | |
123 | QWidget *m_progressWidget = nullptr; |
124 | QtDocInstaller *m_qtDocInstaller = nullptr; |
125 | |
126 | bool m_connectedInitSignals = false; |
127 | }; |
128 | |
129 | QT_END_NAMESPACE |
130 | |
131 | #endif // MAINWINDOW_H |
132 | |