diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/mainwindow.cpp | 6 | ||||
-rw-r--r-- | qt-ui/mainwindow.h | 1 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 8 |
3 files changed, 15 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index f6dd1b37f..ee0e6f090 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -1226,6 +1226,12 @@ void MainWindow::on_profNdl_tts_clicked(bool triggered) prefs.calcndltts = triggered; TOOLBOX_PREF_PROFILE(calcndltts); } +void MainWindow::turnOffNdlTts() +{ + const bool triggered = prefs.calcndltts = false; + TOOLBOX_PREF_PROFILE(calcndltts); +} + void MainWindow::on_profPhe_clicked(bool triggered) { prefs.pp_graphs.phe = triggered; diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 6f352cc74..46f685f1f 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -148,6 +148,7 @@ protected: public slots: + void turnOffNdlTts(); void readSettings(); void refreshDisplay(bool doRecreateDiveList = true); void recreateDiveList(); diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 67b0c4b9f..92c368cb8 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -355,6 +355,8 @@ void ProfileWidget2::setupSceneAndFlags() void ProfileWidget2::plotDives(QList<dive *> dives) { static bool firstCall = true; + QTime measureDuration; // let's measure how long this takes us (maybe we'll turn of TTL calculation later + measureDuration.start(); // I Know that it's a list, but currently we are // using just the first. @@ -517,6 +519,12 @@ void ProfileWidget2::plotDives(QList<dive *> dives) DivePlannerPointsModel *model = DivePlannerPointsModel::instance(); model->deleteTemporaryPlan(); } + // OK, how long did this take us? Anything above the second is way too long, + // so if we are calculation TTS / NDL then let's force that off. + if (measureDuration.elapsed() > 1000 && prefs.calcndltts) { + MainWindow::instance()->turnOffNdlTts(); + MainWindow::instance()->showError("Show NDL / TTS was disabled because of excessive processing time"); + } } void ProfileWidget2::settingsChanged() |