Added preliminary support for a Manual Display Widget.

Added a preliminary support for a manual display widget,
it's a very basic HTML text-browser, so it can have
hyperlinks, images and everything that a 1995 browser
has.

The long term plan is to subsittute this manual by
a more modern 'help' using QGraphicsView, that will
interact on the application level.

See #121

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-05-30 10:54:06 -03:00 committed by Dirk Hohndel
parent 32d8051404
commit 7f732559d8
2 changed files with 14 additions and 4 deletions

View file

@ -15,7 +15,7 @@
#include <QCloseEvent> #include <QCloseEvent>
#include <QApplication> #include <QApplication>
#include <QFontMetrics> #include <QFontMetrics>
#include <QTextBrowser>
#include "divelistview.h" #include "divelistview.h"
#include "starwidget.h" #include "starwidget.h"
@ -35,7 +35,7 @@ MainWindow* mainWindow()
return instance; return instance;
} }
MainWindow::MainWindow() : ui(new Ui::MainWindow()) MainWindow::MainWindow() : ui(new Ui::MainWindow()), helpView(0)
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowIcon(QIcon(":subsurface-icon")); setWindowIcon(QIcon(":subsurface-icon"));
@ -264,7 +264,11 @@ void MainWindow::on_actionAboutSubsurface_triggered()
void MainWindow::on_actionUserManual_triggered() void MainWindow::on_actionUserManual_triggered()
{ {
qDebug("actionUserManual"); if(!helpView){
helpView = new QTextBrowser();
}
helpView->setText(tr("HTML of Help menu here."));
helpView->show();
} }
QString MainWindow::filter() QString MainWindow::filter()
@ -492,6 +496,11 @@ void MainWindow::writeSettings()
void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::closeEvent(QCloseEvent *event)
{ {
if (helpView && helpView->isVisible()){
helpView->close();
helpView->deleteLater();
}
if (unsaved_changes() && (askSaveChanges() == FALSE)) { if (unsaved_changes() && (askSaveChanges() == FALSE)) {
event->ignore(); event->ignore();
return; return;

View file

@ -29,6 +29,7 @@ class DiveListView;
class GlobeGPS; class GlobeGPS;
class MainTab; class MainTab;
class ProfileGraphicsView; class ProfileGraphicsView;
class QTextBrowser;
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
@ -93,7 +94,7 @@ private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
QAction *actionNextDive; QAction *actionNextDive;
QAction *actionPreviousDive; QAction *actionPreviousDive;
QTextBrowser *helpView;
QString filter(); QString filter();
bool askSaveChanges(); bool askSaveChanges();
void writeSettings(); void writeSettings();