summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/preferences
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-11-24 12:50:52 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-12-12 15:52:40 -0800
commit2d7be7a0e366b562fdff914e92219ab1852cd3c8 (patch)
tree7f4501cfe26b31f3a98f3b66cfaf925107a588d9 /desktop-widgets/preferences
parent8bbd778c28f52277dbee4a8d7bcb577c61a611f6 (diff)
downloadsubsurface-2d7be7a0e366b562fdff914e92219ab1852cd3c8.tar.gz
preferences: create global settingsChanged signal
So far, the PreferencesDialog emitted a settingsChanged signal. This meant that models that listened to that signal had to conditionally compile out the code for mobile or the connection had to be made in MainWindow. Instead, introduce a global signal that does this and move the connects to the listeners to remove inter-dependencies. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/preferences')
-rw-r--r--desktop-widgets/preferences/preferencesdialog.cpp9
-rw-r--r--desktop-widgets/preferences/preferencesdialog.h2
2 files changed, 5 insertions, 6 deletions
diff --git a/desktop-widgets/preferences/preferencesdialog.cpp b/desktop-widgets/preferences/preferencesdialog.cpp
index e1c737f99..ca5e606cd 100644
--- a/desktop-widgets/preferences/preferencesdialog.cpp
+++ b/desktop-widgets/preferences/preferencesdialog.cpp
@@ -16,6 +16,7 @@
#include "preferences_reset.h"
#include "core/qthelper.h"
+#include "core/subsurface-qt/divelistnotifier.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
@@ -25,7 +26,7 @@
#include <QAbstractButton>
#include <QDebug>
-PreferencesDialog* PreferencesDialog::instance()
+PreferencesDialog *PreferencesDialog::instance()
{
static PreferencesDialog *self = new PreferencesDialog();
return self;
@@ -130,10 +131,10 @@ void PreferencesDialog::refreshPages()
void PreferencesDialog::applyRequested(bool closeIt)
{
Q_FOREACH(AbstractPreferencesWidget *page, pages) {
- connect(page, &AbstractPreferencesWidget::settingsChanged, this, &PreferencesDialog::settingsChanged, Qt::UniqueConnection);
+ connect(page, &AbstractPreferencesWidget::settingsChanged, &diveListNotifier, &DiveListNotifier::settingsChanged, Qt::UniqueConnection);
page->syncSettings();
}
- emit settingsChanged();
+ emit diveListNotifier.settingsChanged();
if (closeIt)
accept();
}
@@ -152,6 +153,6 @@ void PreferencesDialog::defaultsRequested()
Q_FOREACH(AbstractPreferencesWidget *page, pages) {
page->refreshSettings();
}
- emit settingsChanged();
+ emit diveListNotifier.settingsChanged();
accept();
}
diff --git a/desktop-widgets/preferences/preferencesdialog.h b/desktop-widgets/preferences/preferencesdialog.h
index 67433f0fd..8abf812e9 100644
--- a/desktop-widgets/preferences/preferencesdialog.h
+++ b/desktop-widgets/preferences/preferencesdialog.h
@@ -19,8 +19,6 @@ public:
void addPreferencePage(AbstractPreferencesWidget *page);
void refreshPages();
void defaultsRequested();
-signals:
- void settingsChanged();
private:
PreferencesDialog();
void cancelRequested();