use QWebView to show the user manual

Looks like the QTextBrowser can't render the manual correctly.
Also, QWebView provides a better way to find contents on a webpage,
which is an important feature for an user manual (to be implemented).

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
This commit is contained in:
Danilo Cesar Lemes de Paula 2013-08-22 16:20:47 -03:00
parent 2fb2918607
commit 1e69731804
3 changed files with 7 additions and 7 deletions

View file

@ -106,7 +106,7 @@ ifeq ($(strip $(QMAKE)),)
$(error Could not find qmake or qmake-qt4 in $$PATH for the Qt4 version they failed) $(error Could not find qmake or qmake-qt4 in $$PATH for the Qt4 version they failed)
endif endif
QT_MODULES = QtGui QtSvg QtNetwork QT_MODULES = QtGui QtSvg QtNetwork QtWebKit
QT_CORE = QtCore QT_CORE = QtCore
MOC = $(shell $(PKGCONFIG) --variable=moc_location QtCore) MOC = $(shell $(PKGCONFIG) --variable=moc_location QtCore)
UIC = $(shell $(PKGCONFIG) --variable=uic_location QtGui) UIC = $(shell $(PKGCONFIG) --variable=uic_location QtGui)

View file

@ -15,7 +15,7 @@
#include <QCloseEvent> #include <QCloseEvent>
#include <QApplication> #include <QApplication>
#include <QFontMetrics> #include <QFontMetrics>
#include <QTextBrowser> #include <QWebView>
#include <QTableView> #include <QTableView>
#include "divelistview.h" #include "divelistview.h"
#include "starwidget.h" #include "starwidget.h"
@ -411,14 +411,14 @@ void MainWindow::on_actionAboutSubsurface_triggered()
void MainWindow::on_actionUserManual_triggered() void MainWindow::on_actionUserManual_triggered()
{ {
if(!helpView){ if(!helpView){
helpView = new QTextBrowser(); helpView = new QWebView();
} }
QString searchPath = getSubsurfaceDataPath("Documentation"); QString searchPath = getSubsurfaceDataPath("Documentation");
if (searchPath != "") { if (searchPath != "") {
QUrl url(searchPath.append("/user-manual.html")); QUrl url(searchPath.append("/user-manual.html"));
helpView->setSource(url); helpView->setUrl(url);
} else { } else {
helpView->setText(tr("Cannot find the Subsurface manual")); helpView->setHtml(tr("Cannot find the Subsurface manual"));
} }
helpView->show(); helpView->show();
} }

View file

@ -29,7 +29,7 @@ class DiveListView;
class GlobeGPS; class GlobeGPS;
class MainTab; class MainTab;
class ProfileGraphicsView; class ProfileGraphicsView;
class QTextBrowser; class QWebView;
enum MainWindowTitleFormat { MWTF_DEFAULT, MWTF_FILENAME }; enum MainWindowTitleFormat { MWTF_DEFAULT, MWTF_FILENAME };
@ -110,7 +110,7 @@ private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
QAction *actionNextDive; QAction *actionNextDive;
QAction *actionPreviousDive; QAction *actionPreviousDive;
QTextBrowser *helpView; QWebView *helpView;
QString filter(); QString filter();
bool askSaveChanges(); bool askSaveChanges();
void writeSettings(); void writeSettings();