1 | /**********************************************************************
|
---|
2 | ** Copyright (C) 2000-2007 Trolltech ASA. All rights reserved.
|
---|
3 | **
|
---|
4 | ** This file is part of Qt Assistant.
|
---|
5 | **
|
---|
6 | ** This file may be distributed and/or modified under the terms of the
|
---|
7 | ** GNU General Public License version 2 as published by the Free Software
|
---|
8 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
9 | ** packaging of this file.
|
---|
10 | **
|
---|
11 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
12 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
13 | ** Agreement provided with the Software.
|
---|
14 | **
|
---|
15 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
16 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
17 | **
|
---|
18 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
19 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
20 | ** information about Qt Commercial License Agreements.
|
---|
21 | **
|
---|
22 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
23 | ** not clear to you.
|
---|
24 | **
|
---|
25 | **********************************************************************/
|
---|
26 |
|
---|
27 | #ifndef HELPDIALOGIMPL_H
|
---|
28 | #define HELPDIALOGIMPL_H
|
---|
29 |
|
---|
30 | #include "helpdialog.h"
|
---|
31 | #include "index.h"
|
---|
32 | #include "helpwindow.h"
|
---|
33 | #include "docuparser.h"
|
---|
34 |
|
---|
35 | #include <qlistbox.h>
|
---|
36 | #include <qlistview.h>
|
---|
37 | #include <qmap.h>
|
---|
38 | #include <qstringlist.h>
|
---|
39 | #include <qvalidator.h>
|
---|
40 | #include <qpopupmenu.h>
|
---|
41 | #include <qdict.h>
|
---|
42 | #include <qpopupmenu.h>
|
---|
43 |
|
---|
44 | class QProgressBar;
|
---|
45 | class MainWindow;
|
---|
46 | class QTextBrowser;
|
---|
47 |
|
---|
48 | class HelpNavigationListItem : public QListBoxText
|
---|
49 | {
|
---|
50 | public:
|
---|
51 | HelpNavigationListItem( QListBox *ls, const QString &txt );
|
---|
52 |
|
---|
53 | void addLink( const QString &link );
|
---|
54 | QStringList links() const { return linkList; }
|
---|
55 | private:
|
---|
56 | QStringList linkList;
|
---|
57 |
|
---|
58 | };
|
---|
59 |
|
---|
60 | class SearchValidator : public QValidator
|
---|
61 | {
|
---|
62 | Q_OBJECT
|
---|
63 | public:
|
---|
64 | SearchValidator( QObject *parent, const char *name = 0 )
|
---|
65 | : QValidator( parent, name ) {}
|
---|
66 | ~SearchValidator() {}
|
---|
67 | QValidator::State validate( QString &str, int & ) const;
|
---|
68 | };
|
---|
69 |
|
---|
70 | class HelpNavigationContentsItem : public QListViewItem
|
---|
71 | {
|
---|
72 | public:
|
---|
73 | HelpNavigationContentsItem( QListView *v, QListViewItem *after );
|
---|
74 | HelpNavigationContentsItem( QListViewItem *v, QListViewItem *after );
|
---|
75 |
|
---|
76 | void setLink( const QString &lnk );
|
---|
77 | QString link() const;
|
---|
78 |
|
---|
79 | private:
|
---|
80 | QString theLink;
|
---|
81 | };
|
---|
82 |
|
---|
83 | class HelpDialog : public HelpDialogBase
|
---|
84 | {
|
---|
85 | Q_OBJECT
|
---|
86 |
|
---|
87 | public:
|
---|
88 | HelpDialog( QWidget *parent, MainWindow *h );
|
---|
89 |
|
---|
90 | QString titleOfLink( const QString &link );
|
---|
91 | bool eventFilter( QObject *, QEvent * );
|
---|
92 | bool lastWindowClosed() { return lwClosed; }
|
---|
93 |
|
---|
94 | void timerEvent(QTimerEvent *e);
|
---|
95 |
|
---|
96 | protected slots:
|
---|
97 | void showTopic( int, QListBoxItem *, const QPoint & );
|
---|
98 | void showTopic( int, QListViewItem *, const QPoint & );
|
---|
99 | void showTopic( QListViewItem * );
|
---|
100 | void loadIndexFile();
|
---|
101 | void insertContents();
|
---|
102 | void setupFullTextIndex();
|
---|
103 | void currentTabChanged( const QString &s );
|
---|
104 | void currentIndexChanged( QListBoxItem *i );
|
---|
105 | void showTopic();
|
---|
106 | void searchInIndex( const QString &s );
|
---|
107 | void addBookmark();
|
---|
108 | void removeBookmark();
|
---|
109 | void currentBookmarkChanged( QListViewItem *i );
|
---|
110 | void currentContentsChanged( QListViewItem *i );
|
---|
111 | void startSearch();
|
---|
112 | void showSearchHelp();
|
---|
113 |
|
---|
114 | public slots:
|
---|
115 | void initialize();
|
---|
116 | void toggleContents();
|
---|
117 | void toggleIndex();
|
---|
118 | void toggleBookmarks();
|
---|
119 | void toggleSearch();
|
---|
120 |
|
---|
121 |
|
---|
122 | signals:
|
---|
123 | void showLink( const QString &s );
|
---|
124 | void showSearchLink( const QString &s, const QStringList &terms );
|
---|
125 |
|
---|
126 | private slots:
|
---|
127 | void lastWinClosed();
|
---|
128 | void showResultPage( int button, QListBoxItem *i, const QPoint &p );
|
---|
129 | void showResultPage( QListBoxItem *i );
|
---|
130 | void setIndexingProgress( int prog );
|
---|
131 | void showItemMenu( QListBoxItem *item, const QPoint &pos );
|
---|
132 | void showItemMenu( QListViewItem *item, const QPoint &pos );
|
---|
133 | void insertBookmarks();
|
---|
134 | void processEvents();
|
---|
135 |
|
---|
136 | private:
|
---|
137 | typedef QValueList<ContentItem> ContentList;
|
---|
138 | void removeOldCacheFiles();
|
---|
139 | void buildKeywordDB();
|
---|
140 | Q_UINT32 getFileAges();
|
---|
141 | void showIndexTopic();
|
---|
142 | void showBookmarkTopic();
|
---|
143 | void setupTitleMap();
|
---|
144 | void saveBookmarks();
|
---|
145 | void showContentsTopic();
|
---|
146 | void showInitDoneMessage();
|
---|
147 | void buildContentDict();
|
---|
148 |
|
---|
149 | QMap<QString, QString> titleMap;
|
---|
150 | bool indexDone, bookmarksInserted, titleMapDone, contentsInserted;
|
---|
151 | bool lwClosed;
|
---|
152 | MainWindow *help;
|
---|
153 | QString documentationPath;
|
---|
154 | Index *fullTextIndex;
|
---|
155 | QStringList terms, foundDocs;
|
---|
156 | bool initDoneMsgShown;
|
---|
157 | void getAllContents();
|
---|
158 | QDict<ContentList> contentList;
|
---|
159 | QPopupMenu *itemPopup;
|
---|
160 | QString cacheFilesPath;
|
---|
161 | QStringList keywordDocuments;
|
---|
162 | };
|
---|
163 |
|
---|
164 | #endif
|
---|