Scribus
Open source desktop publishing at your fingertips
helpbrowser.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8 * Copyright (C) 2004 by Craig Bradney *
9 * cbradney@zip.com.au *
10 * Copyright (C) 2005 by Petr Vanek *
11 * petr@yarpen.cz *
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 * This program is distributed in the hope that it will be useful, *
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21 * GNU General Public License for more details. *
22 * *
23 * You should have received a copy of the GNU General Public License *
24 * along with this program; if not, write to the *
25 * Free Software Foundation, Inc., *
26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
27 ***************************************************************************/
28 
29 #ifndef HELPBROWSER_H
30 #define HELPBROWSER_H
31 
32 #include <QAction>
33 #include <QItemSelection>
34 #include <QList>
35 #include <QMainWindow>
36 #include <QMenu>
37 #include <QMenuBar>
38 #include <QPair>
39 #include <QProgressBar>
40 #include <QString>
41 #include <QToolBar>
42 #include <QTreeWidgetItem>
43 #include <QUrl>
44 #include <QVariant>
45 #include <QWidget>
46 
47 class QEvent;
48 
49 #include "ui_helpbrowser.h"
50 #include "scribusapi.h"
51 #include "scconfig.h"
52 #include "scpaths.h"
53 #include "prefsmanager.h"
54 #include "prefsfile.h"
55 #include "schelptreemodel.h"
56 
57 class HelpNavigation;
58 
60 struct histd2 {
61  QString url;
62  QString title;
63 };
64 
65 class SCRIBUS_API HelpBrowser : public QMainWindow, Ui::HelpBrowser
66 {
67  Q_OBJECT
68 
69 public:
70  HelpBrowser(QWidget* parent);
71  HelpBrowser(QWidget* parent, const QString& caption, const QString& guiLangage="en", const QString& jumpToSection="", const QString& jumpToFile="");
72  ~HelpBrowser();
73 
74 
75  virtual void changeEvent(QEvent *e);
76 
78  QMenu* histMenu;
80  QMap<QAction*, histd2> mHistory;
83  void setHtml(const QString& str);
84 
85  static bool firstRun;
86 
87 public slots:
88  void jumpToHelpSection(const QString& jumpToSection, const QString& jumpToFile="", bool dontChangeIfAlreadyLoaded=false);
89 
90 protected:
91  void closeEvent(QCloseEvent * event);
92 
93  void setupLocalUI();
95  void readBookmarks();
100  void searchingInDirectory(const QString&);
101 
103  void readHistory();
104 
106  void displayNoHelp();
107 
108  HelpNavigation * helpNav;
109 
110  QMenu* fileMenu;
111  QMenu* editMenu;
112  QMenu* bookMenu;
113  QAction* filePrint;
114  QAction* fileExit;
115  QAction* editFind;
116  QAction* editFindNext;
117  QAction* editFindPrev;
118  QAction* bookAdd;
119  QAction* bookDel;
120  QAction* bookDelAll;
121  QAction* goHome;
122  QAction* goBack;
123  QAction* goFwd;
124 
125  QProgressBar * progressBar;
126 
128  QString language;
130  QString finalBaseDir;
132  QString findText;
135  ScHelpTreeModel* menuModel;
136  QMap<QString, QString> quickHelpIndex;
137  QMap<QString, QPair<QString, QString> > bookmarkIndex;
138 
139 protected slots:
140  virtual void languageChange();
141  void histChosen(QAction* i);
142  void loadHelp(const QString& filename);
143  void loadMenu();
144 // void showLinkContents(const QString &link);
145  QString bookmarkFile();
146  QString historyFile();
147 
149  void itemSelected(const QItemSelection & selected, const QItemSelection & deselected);
150 
152  void itemSearchSelected(QTreeWidgetItem *, int);
153 
155  void itemBookmarkSelected(QTreeWidgetItem *, int);
156 
160  void searchingButton_clicked();
161 
165  void find();
166 
169  void findNext();
170 
173  void findPrevious();
174 
178  void print();
179 
181  void bookmarkButton_clicked();
182 
184  void deleteBookmarkButton_clicked();
185 
187  void deleteAllBookmarkButton_clicked();
188 
189 signals:
190  void closed();
191 
192 };
193 
194 #endif // HELPBROWSER_H
195 
Definition: schelptreemodel.h:54
QString finalBaseDir
QString holding location of menu.xml we are using, we load the help files from here.
Definition: helpbrowser.h:130
QMenu * histMenu
History menu. It's public because of history reader - separate class.
Definition: helpbrowser.h:78
QString findText
Text to be found in document.
Definition: helpbrowser.h:132
A structure holding title/file url reference.
Definition: helpbrowser.h:60
Definition: helpnavigation.h:17
Definition: prefscontext.h:40
QString language
Selected language is here. If there is no docs for this language, "en" is used.
Definition: helpbrowser.h:128
PrefsContext * prefs
Configuration structure.
Definition: helpbrowser.h:134
QMap< QAction *, histd2 > mHistory
Mapping the documents for history.
Definition: helpbrowser.h:80