mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
prefere user selected tab in settings search
This commit is contained in:
parent
a6fd6300c9
commit
661a36c2e4
2 changed files with 14 additions and 4 deletions
|
@ -80,13 +80,18 @@ void SettingsDialog::initUi()
|
|||
// TODO: add originally selected page
|
||||
|
||||
// find next visible page
|
||||
if (!this->selectedTab_->isVisible())
|
||||
if (this->lastSelectedByUser_ &&
|
||||
this->lastSelectedByUser_->isVisible())
|
||||
{
|
||||
this->selectTab(this->lastSelectedByUser_, false);
|
||||
}
|
||||
else if (!this->selectedTab_->isVisible())
|
||||
{
|
||||
for (auto &&tab : this->tabs_)
|
||||
{
|
||||
if (tab->isVisible())
|
||||
{
|
||||
this->selectTab(tab);
|
||||
this->selectTab(tab, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +194,7 @@ void SettingsDialog::addTab(SettingsPage *page, Qt::Alignment alignment)
|
|||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::selectTab(SettingsDialogTab *tab)
|
||||
void SettingsDialog::selectTab(SettingsDialogTab *tab, bool byUser)
|
||||
{
|
||||
this->ui_.pageStack->setCurrentWidget(tab->getSettingsPage());
|
||||
|
||||
|
@ -205,6 +210,10 @@ void SettingsDialog::selectTab(SettingsDialogTab *tab)
|
|||
"border-top: 1px solid #444;"
|
||||
"border-bottom: 1px solid #444;");
|
||||
this->selectedTab_ = tab;
|
||||
if (byUser)
|
||||
{
|
||||
this->lastSelectedByUser_ = tab;
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::selectPage(SettingsPage *page)
|
||||
|
|
|
@ -43,7 +43,7 @@ private:
|
|||
void initUi();
|
||||
void addTabs();
|
||||
void addTab(SettingsPage *page, Qt::Alignment alignment = Qt::AlignTop);
|
||||
void selectTab(SettingsDialogTab *tab);
|
||||
void selectTab(SettingsDialogTab *tab, bool byUser = true);
|
||||
void selectPage(SettingsPage *page);
|
||||
|
||||
void onOkClicked();
|
||||
|
@ -61,6 +61,7 @@ private:
|
|||
std::vector<SettingsDialogTab *> tabs_;
|
||||
std::vector<SettingsPage *> pages_;
|
||||
SettingsDialogTab *selectedTab_{};
|
||||
SettingsDialogTab *lastSelectedByUser_{};
|
||||
|
||||
friend class SettingsDialogTab;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue