diff --git a/src/ui/form/opt/pages/addressespage.cpp b/src/ui/form/opt/pages/addressespage.cpp index 4cb54eea..98640de1 100644 --- a/src/ui/form/opt/pages/addressespage.cpp +++ b/src/ui/form/opt/pages/addressespage.cpp @@ -26,6 +26,14 @@ AddressesPage::AddressesPage(OptionsController *ctrl, setupUi(); } +void AddressesPage::setAddressGroup(AddressGroup *v) +{ + if (m_addressGroup != v) { + m_addressGroup = v; + emit addressGroupChanged(); + } +} + void AddressesPage::onRetranslateUi() { m_tabBar->setTabText(0, tr("Internet Addresses")); @@ -176,11 +184,11 @@ void AddressesPage::refreshGroup() void AddressesPage::setupAddressGroup() { + connect(this, &AddressesPage::addressGroupChanged, this, &AddressesPage::refreshGroup); + const auto refreshAddressGroup = [&] { const int tabIndex = m_tabBar->currentIndex(); setAddressGroup(addressGroupByIndex(tabIndex)); - - refreshGroup(); }; refreshAddressGroup(); diff --git a/src/ui/form/opt/pages/addressespage.h b/src/ui/form/opt/pages/addressespage.h index c101a09c..6c41cc2e 100644 --- a/src/ui/form/opt/pages/addressespage.h +++ b/src/ui/form/opt/pages/addressespage.h @@ -15,7 +15,10 @@ public: QWidget *parent = nullptr); AddressGroup *addressGroup() const { return m_addressGroup; } - void setAddressGroup(AddressGroup *v) { m_addressGroup = v; } + void setAddressGroup(AddressGroup *v); + +signals: + void addressGroupChanged(); protected slots: void onRetranslateUi() override; diff --git a/src/ui/form/opt/pages/applicationspage.cpp b/src/ui/form/opt/pages/applicationspage.cpp index 24e6ce7a..ea79b585 100644 --- a/src/ui/form/opt/pages/applicationspage.cpp +++ b/src/ui/form/opt/pages/applicationspage.cpp @@ -36,6 +36,14 @@ ApplicationsPage::ApplicationsPage(OptionsController *ctrl, setupUi(); } +void ApplicationsPage::setAppGroup(AppGroup *v) +{ + if (m_appGroup != v) { + m_appGroup = v; + emit appGroupChanged(); + } +} + void ApplicationsPage::onRetranslateUi() { m_editGroupName->setPlaceholderText(tr("Group Name")); @@ -438,11 +446,11 @@ void ApplicationsPage::refreshGroup() void ApplicationsPage::setupAppGroup() { + connect(this, &ApplicationsPage::appGroupChanged, this, &ApplicationsPage::refreshGroup); + const auto refreshAppGroup = [&] { const int tabIndex = m_tabBar->currentIndex(); setAppGroup(appGroupByIndex(tabIndex)); - - refreshGroup(); }; refreshAppGroup(); diff --git a/src/ui/form/opt/pages/applicationspage.h b/src/ui/form/opt/pages/applicationspage.h index bb118c74..ea259f5c 100644 --- a/src/ui/form/opt/pages/applicationspage.h +++ b/src/ui/form/opt/pages/applicationspage.h @@ -17,7 +17,10 @@ public: QWidget *parent = nullptr); AppGroup *appGroup() const { return m_appGroup; } - void setAppGroup(AppGroup *v) { m_appGroup = v; } + void setAppGroup(AppGroup *v); + +signals: + void appGroupChanged(); protected slots: void onRetranslateUi() override;