UI: Fix connections.

This commit is contained in:
Nodir Temirkhodjaev 2019-12-23 14:19:16 +05:00
parent cb51a7c94c
commit e4f38a9d91
4 changed files with 28 additions and 6 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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();

View File

@ -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;