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#ifndef HELPBROWSER_HH_
43#define HELPBROWSER_HH_
44
45
46#include <QtWidgets>
47#include <QTextBrowser>
48#include <QtHelp>
49
56class HelpBrowser : public QTextBrowser {
57 Q_OBJECT
58
59public:
60
68 HelpBrowser(QHelpEngine* _helpEngine, QWidget* parent = 0);
69
71 virtual ~HelpBrowser();
72
82 QVariant loadResource ( int _type, const QUrl& _name );
83
89
94 bool isForwardAvailable();
95
101 QUrl resolveUrl(const QUrl &_url);
102
103signals:
104/*
105 * is emitted, when the page history was changed.
106 * it is not equal to the signal 'sourceChanged'
107 * because saving in the history can be skipped
108 */
109 void historyChanged(const QUrl&);
110
111public slots:
112
113 void open(const QString& _url);
114
120 void open(const QUrl& _url, bool _skipSave = false);
121
125 void backward();
126
130 void forward();
131
132private:
133
141 QUrl getCurrentDir(const QUrl& _url);
142
151 void updateNameSpaceAndFolder (const QUrl& _url);
152
153private slots:
158 void rememberHistory (const QUrl& _url);
159private:
160
162 QHelpEngine* helpEngine_;
163
165 QList<QUrl> visitedPages_;
166
169
176
183
184};
185
186
187#endif /* HELPBROWSER_HH_ */
HelpBrowser(QHelpEngine *_helpEngine, QWidget *parent=0)
Constructor.
Definition: helpBrowser.cc:46
void forward()
Show next page stored in the history.
Definition: helpBrowser.cc:207
QString currentNameSpace_
The currently active namespace.
Definition: helpBrowser.hh:182
QUrl getCurrentDir(const QUrl &_url)
Extract path from URL.
Definition: helpBrowser.cc:174
QUrl resolveUrl(const QUrl &_url)
resolves relative urls to absolute
Definition: helpBrowser.cc:97
QVariant loadResource(int _type, const QUrl &_name)
re implementation of the load resource function of the text browser
Definition: helpBrowser.cc:128
QList< QUrl > visitedPages_
History of the visited pages.
Definition: helpBrowser.hh:165
QString currentVirtualFolder_
The currently active virtual folder.
Definition: helpBrowser.hh:175
int currentPage_
Current position in the history.
Definition: helpBrowser.hh:168
void backward()
Show last page stored in the history.
Definition: helpBrowser.cc:198
virtual ~HelpBrowser()
Destructor.
Definition: helpBrowser.cc:57
QHelpEngine * helpEngine_
The help engine the widget is working on.
Definition: helpBrowser.hh:162
void updateNameSpaceAndFolder(const QUrl &_url)
updateNameSpaceAndFolder
Definition: helpBrowser.cc:62
bool isForwardAvailable()
Checks if the back button was pressed and we can go forward to the next page.
Definition: helpBrowser.cc:188
bool isBackwardAvailable()
Checks if we visited other pages before.
Definition: helpBrowser.cc:193
void rememberHistory(const QUrl &_url)
Adds a new page to the history.
Definition: helpBrowser.cc:78