diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-11-05 12:51:05 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-11-05 13:45:51 -0800 |
commit | e28f171731122e6ce1c3d9b1173be5d62dd34e6b (patch) | |
tree | 78f83d7b52ce541c9c40163eb32df5a55f59daaf | |
parent | 281a0a945ad87cb77a98ec30e2e2e29aecac4e89 (diff) | |
download | subsurface-e28f171731122e6ce1c3d9b1173be5d62dd34e6b.tar.gz |
Untangle Profile from MainWindow: refresh display
Instead of directly calling into the MainWindow, redirect this via a
signal so Subsurface mobile can hook it up as needed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | profile-widget/profilewidget2.cpp | 5 | ||||
-rw-r--r-- | profile-widget/profilewidget2.h | 1 | ||||
-rw-r--r-- | subsurface-desktop-main.cpp | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 0b126e6b6..310652b75 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -1351,7 +1351,8 @@ void ProfileWidget2::deleteCurrentDC() mark_divelist_changed(true); // we need to force it since it's likely the same dive and same dc_number - but that's a different dive computer now MainWindow::instance()->graphics()->plotDive(0, true); - MainWindow::instance()->refreshDisplay(); + + emit refreshDisplay(true); } void ProfileWidget2::makeFirstDC() @@ -1363,7 +1364,7 @@ void ProfileWidget2::makeFirstDC() // dive list may change). // As a side benefit, this returns focus to the dive list. dc_number = 0; - MainWindow::instance()->refreshDisplay(); + emit refreshDisplay(true); } void ProfileWidget2::hideEvents() diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index c102bbcf3..5fc6e8d4b 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -92,6 +92,7 @@ signals: void showError(); void enableShortcuts(); void disableShortcuts(bool paste); + void refreshDisplay(bool recreateDivelist); public slots: // Necessary to call from QAction's signals. diff --git a/subsurface-desktop-main.cpp b/subsurface-desktop-main.cpp index bbe602848..fed774303 100644 --- a/subsurface-desktop-main.cpp +++ b/subsurface-desktop-main.cpp @@ -90,6 +90,7 @@ int main(int argc, char **argv) QObject::connect(m->graphics(), &ProfileWidget2::showError, m, &MainWindow::showError, Qt::AutoConnection); QObject::connect(m->graphics(), &ProfileWidget2::disableShortcuts, m, &MainWindow::disableShortcuts, Qt::AutoConnection); QObject::connect(m->graphics(), &ProfileWidget2::enableShortcuts, m, &MainWindow::enableShortcuts, Qt::AutoConnection); + QObject::connect(m->graphics(), &ProfileWidget2::refreshDisplay, m, &MainWindow::refreshDisplay, Qt::AutoConnection); if (verbose > 0) print_files(); if (!quit) |