From adab063a49fad4298c24ae0f1ed075b440cf2545 Mon Sep 17 00:00:00 2001 From: jenli669 Date: Sat, 29 Jun 2019 09:53:58 +0200 Subject: [PATCH] refactor(widget): make PrivacyForm use signals for clearAllReceipts() --- src/widget/form/settings/privacyform.cpp | 2 +- src/widget/form/settings/privacyform.h | 3 +++ src/widget/form/settingswidget.cpp | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/widget/form/settings/privacyform.cpp b/src/widget/form/settings/privacyform.cpp index a569e3c78..5d0ed9445 100644 --- a/src/widget/form/settings/privacyform.cpp +++ b/src/widget/form/settings/privacyform.cpp @@ -59,7 +59,7 @@ void PrivacyForm::on_cbKeepHistory_stateChanged() { Settings::getInstance().setEnableLogging(bodyUI->cbKeepHistory->isChecked()); if (!bodyUI->cbKeepHistory->isChecked()) { - Widget::getInstance()->clearAllReceipts(); + emit clearAllReceipts(); QMessageBox::StandardButton dialogDelHistory; dialogDelHistory = QMessageBox::question(nullptr, tr("Confirmation"), diff --git a/src/widget/form/settings/privacyform.h b/src/widget/form/settings/privacyform.h index 0d84983e8..1110ef630 100644 --- a/src/widget/form/settings/privacyform.h +++ b/src/widget/form/settings/privacyform.h @@ -37,6 +37,9 @@ public: return tr("Privacy"); } +signals: + void clearAllReceipts(); + private slots: void on_cbKeepHistory_stateChanged(); void on_cbTypingNotification_stateChanged(); diff --git a/src/widget/form/settingswidget.cpp b/src/widget/form/settingswidget.cpp index 8bef3cc86..352c4b2d1 100644 --- a/src/widget/form/settingswidget.cpp +++ b/src/widget/form/settingswidget.cpp @@ -62,6 +62,8 @@ SettingsWidget::SettingsWidget(UpdateCheck* updateCheck, IAudioControl& audio, W std::unique_ptr uifrm(new UserInterfaceForm(this)); std::unique_ptr pfrm(new PrivacyForm()); + connect(pfrm.get(), &PrivacyForm::clearAllReceipts, parent, &Widget::clearAllReceipts); + AVForm* rawAvfrm = new AVForm(audio, coreAV, camera, audioSettings, videoSettings); std::unique_ptr avfrm(rawAvfrm); std::unique_ptr expfrm(new AdvancedForm());