Developer Documentation
helpBrowser.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 
51 /*
52  * helpBrowser.hh
53  *
54  * Created on: Apr 8, 2009
55  * Author: kremer
56  */
57 
58 #ifndef HELPBROWSER_HH_
59 #define HELPBROWSER_HH_
60 
61 
62 #if QT_VERSION >= 0x050000
63  #include <QtWidgets>
64 #else
65  #include <QtGui>
66 #endif
67 
68 #include <QTextBrowser>
69 #include <QtHelp>
70 
77 class HelpBrowser : public QTextBrowser {
78  Q_OBJECT
79 
80 public:
81 
89  HelpBrowser(QHelpEngine* _helpEngine, QWidget* parent = 0);
90 
92  virtual ~HelpBrowser();
93 
103  QVariant loadResource ( int _type, const QUrl& _name );
104 
109  bool isBackwardAvailable();
110 
115  bool isForwardAvailable();
116 
122  QUrl resolveUrl(const QUrl &_url);
123 
124 signals:
125 /*
126  * is emitted, when the page history was changed.
127  * it is not equal to the signal 'sourceChanged'
128  * because saving in the history can be skipped
129  */
130  void historyChanged(const QUrl&);
131 
132 public slots:
133 
134  void open(const QString& _url);
135 
141  void open(const QUrl& _url, bool _skipSave = false);
142 
146  void backward();
147 
151  void forward();
152 
153 private:
154 
162  QUrl getCurrentDir(const QUrl& _url);
163 
172  void updateNameSpaceAndFolder (const QUrl& _url);
173 
174 private slots:
179  void rememberHistory (const QUrl& _url);
180 private:
181 
183  QHelpEngine* helpEngine_;
184 
186  QList<QUrl> visitedPages_;
187 
190 
197 
204 
205 };
206 
207 
208 #endif /* HELPBROWSER_HH_ */
void rememberHistory(const QUrl &_url)
Adds a new page to the history.
Definition: helpBrowser.cc:93
bool isForwardAvailable()
Checks if the back button was pressed and we can go forward to the next page.
Definition: helpBrowser.cc:203
void backward()
Show last page stored in the history.
Definition: helpBrowser.cc:213
QUrl getCurrentDir(const QUrl &_url)
Extract path from URL.
Definition: helpBrowser.cc:189
QHelpEngine * helpEngine_
The help engine the widget is working on.
Definition: helpBrowser.hh:183
QUrl resolveUrl(const QUrl &_url)
resolves relative urls to absolute
Definition: helpBrowser.cc:112
virtual ~HelpBrowser()
Destructor.
Definition: helpBrowser.cc:72
QString currentNameSpace_
The currently active namespace.
Definition: helpBrowser.hh:203
void updateNameSpaceAndFolder(const QUrl &_url)
updateNameSpaceAndFolder
Definition: helpBrowser.cc:77
QList< QUrl > visitedPages_
History of the visited pages.
Definition: helpBrowser.hh:186
QVariant loadResource(int _type, const QUrl &_name)
re implementation of the load resource function of the text browser
Definition: helpBrowser.cc:143
bool isBackwardAvailable()
Checks if we visited other pages before.
Definition: helpBrowser.cc:208
HelpBrowser(QHelpEngine *_helpEngine, QWidget *parent=0)
Constructor.
Definition: helpBrowser.cc:61
int currentPage_
Current position in the history.
Definition: helpBrowser.hh:189
QString currentVirtualFolder_
The currently active virtual folder.
Definition: helpBrowser.hh:196
void forward()
Show next page stored in the history.
Definition: helpBrowser.cc:222