mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:33:24 +00:00
Untangle Profile from MainWindow: turn off tts/ndl calculation
I'm not sure we can ever run into this issue anymore since we stop calculating TTS / NDL past 2 hours, but I guess on a fairly slow CPU this still could take too long. But instead of calling into MainWindow let's just change the setting right here and add a signal to show the notification - that way we can use the appropriate way to make such notifications on the mobile app. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
eb2e76a691
commit
000c9cc21c
3 changed files with 9 additions and 4 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
|
@ -690,11 +691,13 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
|
||||||
// OK, how long did this take us? Anything above the second is way too long,
|
// 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.
|
// so if we are calculation TTS / NDL then let's force that off.
|
||||||
if (measureDuration.elapsed() > 1000 && prefs.calcndltts) {
|
if (measureDuration.elapsed() > 1000 && prefs.calcndltts) {
|
||||||
MainWindow::instance()->turnOffNdlTts();
|
prefs.calcndltts = false;
|
||||||
MainWindow::instance()->getNotificationWidget()->showNotification(tr("Show NDL / TTS was disabled because of excessive processing time"), KMessageWidget::Error);
|
QSettings s;
|
||||||
|
s.beginGroup("TecDetails");
|
||||||
|
s.setValue("calcndltts", false);
|
||||||
|
report_error(qPrintable(tr("Show NDL / TTS was disabled because of excessive processing time")));
|
||||||
}
|
}
|
||||||
MainWindow::instance()->getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error);
|
emit showError();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileWidget2::recalcCeiling()
|
void ProfileWidget2::recalcCeiling()
|
||||||
|
|
|
@ -89,6 +89,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void fontPrintScaleChanged(double scale);
|
void fontPrintScaleChanged(double scale);
|
||||||
void enableToolbar(bool enable);
|
void enableToolbar(bool enable);
|
||||||
|
void showError();
|
||||||
|
|
||||||
public
|
public
|
||||||
slots: // Necessary to call from QAction's signals.
|
slots: // Necessary to call from QAction's signals.
|
||||||
|
|
|
@ -87,6 +87,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
// now let's set up some connections
|
// now let's set up some connections
|
||||||
QObject::connect(m->graphics(), &ProfileWidget2::enableToolbar ,m, &MainWindow::setEnabledToolbar, Qt::AutoConnection);
|
QObject::connect(m->graphics(), &ProfileWidget2::enableToolbar ,m, &MainWindow::setEnabledToolbar, Qt::AutoConnection);
|
||||||
|
QObject::connect(m->graphics(), &ProfileWidget2::showError, m, &MainWindow::showError, Qt::AutoConnection);
|
||||||
if (verbose > 0)
|
if (verbose > 0)
|
||||||
print_files();
|
print_files();
|
||||||
if (!quit)
|
if (!quit)
|
||||||
|
|
Loading…
Add table
Reference in a new issue