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 <QApplication>
#include <QFontMetrics>
#include <QTextBrowser>
#include "divelistview.h"
#include "starwidget.h"
@ -35,7 +35,7 @@ MainWindow* mainWindow()
return instance;
}
MainWindow::MainWindow() : ui(new Ui::MainWindow())
MainWindow::MainWindow() : ui(new Ui::MainWindow()), helpView(0)
{
ui->setupUi(this);
setWindowIcon(QIcon(":subsurface-icon"));
@ -264,7 +264,11 @@ void MainWindow::on_actionAboutSubsurface_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()
@ -492,6 +496,11 @@ void MainWindow::writeSettings()
void MainWindow::closeEvent(QCloseEvent *event)
{
if (helpView && helpView->isVisible()){
helpView->close();
helpView->deleteLater();
}
if (unsaved_changes() && (askSaveChanges() == FALSE)) {
event->ignore();
return;

View file

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