1
/***************************************************************************
2
* Project TUPI: Magia 2D *
3
* Project Contact: info@maefloresta.com *
4
* Project Website: http://www.maefloresta.com *
5
* Project Leader: Gustav Gonzalez <info@maefloresta.com> *
9
* Gustavo Gonzalez / xtingray *
20
* Copyright (C) 2010 Gustav Gonzalez - http://www.maefloresta.com *
22
* This program is free software; you can redistribute it and/or modify *
23
* it under the terms of the GNU General Public License as published by *
24
* the Free Software Foundation; either version 3 of the License, or *
25
* (at your option) any later version. *
27
* This program is distributed in the hope that it will be useful, *
28
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
29
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30
* GNU General Public License for more details. *
32
* You should have received a copy of the GNU General Public License *
33
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
34
***************************************************************************/
36
#include "tuphelpbrowser.h"
40
#include <QHBoxLayout>
41
#include <QVBoxLayout>
43
#include <QMouseEvent>
47
TupHelpBrowser::TupHelpBrowser(QWidget *parent) : QWidget(parent)
49
setWindowTitle(tr("Help"));
50
setWindowIcon(QIcon(QPixmap(THEME_DIR + "icons/help_mode.png")));
52
QHBoxLayout *layout = new QHBoxLayout(this);
53
layout->setMargin(15);
54
m_separator = new QSplitter(this);
55
layout->addWidget(m_separator);
57
m_pageArea = new QTextBrowser(m_separator);
58
m_pageArea->setOpenExternalLinks(true);
60
m_document = new QTextDocument(m_pageArea);
62
m_pageArea->setDocument(m_document);
65
TupHelpBrowser::~TupHelpBrowser()
69
void TupHelpBrowser::setDocument(const QString &doc)
71
m_document->setHtml(doc);
74
void TupHelpBrowser::setSource(const QString &filePath)
76
m_pageArea->setSource(filePath);
79
void TupHelpBrowser::setDataDirs(const QStringList &dirs)
81
m_pageArea->setSearchPaths(dirs);
84
// SQA: These methods are just temporary for developing reasons
86
void TupHelpBrowser::keyPressEvent(QKeyEvent * event) {
87
switch (event->key()) {
89
if (event->modifiers() == Qt::ControlModifier)
95
void TupHelpBrowser::reload()