From 7f732559d893964210181202a417d7c300b3cf19 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 30 May 2013 10:54:06 -0300 Subject: 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 --- qt-ui/mainwindow.cpp | 15 ++++++++++++--- qt-ui/mainwindow.h | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 79e3f2c7d..b70bb1ab9 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -15,7 +15,7 @@ #include #include #include - +#include #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; diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 36b174284..f3e728176 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -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(); -- cgit v1.2.3-70-g09d2