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