summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 8c600ea19..d3cd951d8 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -15,7 +15,7 @@
#include <QCloseEvent>
#include <QApplication>
#include <QFontMetrics>
-
+#include <QTextBrowser>
#include "divelistview.h"
#include "starwidget.h"
@@ -23,6 +23,7 @@
#include "../dive.h"
#include "../divelist.h"
#include "../pref.h"
+#include "../helpers.h"
#include "modeldelegates.h"
#include "models.h"
#include "downloadfromdivecomputer.h"
@@ -35,7 +36,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"));
@@ -52,6 +53,14 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow())
instance = this;
}
+// this gets called after we download dives from a divecomputer
+void MainWindow::refreshDisplay()
+{
+ if (!selected_dive)
+ current_dive_changed(dive_table.nr - 1);
+ ui->ListWidget->reload();
+}
+
void MainWindow::current_dive_changed(int divenr)
{
select_dive(divenr);
@@ -162,8 +171,8 @@ void MainWindow::on_actionQuit_triggered()
void MainWindow::on_actionDownloadDC_triggered()
{
- DownloadFromDCWidget* downloadWidget = new DownloadFromDCWidget();
- downloadWidget->show();
+ DownloadFromDCWidget* downloadWidget = DownloadFromDCWidget::instance();
+ downloadWidget->runDialog();
}
void MainWindow::on_actionDownloadWeb_triggered()
@@ -256,7 +265,17 @@ void MainWindow::on_actionAboutSubsurface_triggered()
void MainWindow::on_actionUserManual_triggered()
{
- qDebug("actionUserManual");
+ if(!helpView){
+ helpView = new QTextBrowser();
+ }
+ QString searchPath = getSubsurfaceDataPath("Documentation");
+ if (searchPath != "") {
+ QUrl url(searchPath.append("/user-manual.html"));
+ helpView->setSource(url);
+ } else {
+ helpView->setText(tr("Cannot find the Subsurface manual"));
+ }
+ helpView->show();
}
QString MainWindow::filter()
@@ -395,6 +414,7 @@ void MainWindow::readSettings()
GET_BOOL(v, "dcceiling", prefs.profile_dc_ceiling);
GET_BOOL(v, "calcceiling", prefs.profile_calc_ceiling);
GET_BOOL(v, "calcceiling3m", prefs.calc_ceiling_3m_incr);
+ GET_BOOL(v, "calcalltissues", prefs.calc_all_tissues);
v = settings.value(QString("gflow"));
if (v.isValid())
prefs.gflow = v.toInt();
@@ -471,6 +491,7 @@ void MainWindow::writeSettings()
SAVE_VALUE("redceiling", profile_red_ceiling);
SAVE_VALUE("calcceiling", profile_calc_ceiling);
SAVE_VALUE("calcceiling3m", calc_ceiling_3m_incr);
+ SAVE_VALUE("calcalltissues", calc_all_tissues);
SAVE_VALUE("dcceiling", profile_dc_ceiling);
SAVE_VALUE("gflow", gflow);
SAVE_VALUE("gfhigh", gfhigh);
@@ -482,6 +503,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;