mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fix crash
This commit is contained in:
parent
ba5d842767
commit
b887f1c90e
|
@ -155,26 +155,26 @@ void SettingsDialog::addTabs()
|
|||
// clang-format off
|
||||
this->addTab([]{return new GeneralPage;}, "General", ":/settings/about.svg");
|
||||
this->ui_.tabContainer->addSpacing(16);
|
||||
this->addTab([]{return new AccountsPage;}, "Accounts", ":/settings/accounts.svg");
|
||||
this->addTab([]{return new AccountsPage;}, "Accounts", ":/settings/accounts.svg", SettingsTabId::Accounts);
|
||||
this->ui_.tabContainer->addSpacing(16);
|
||||
this->addTab([]{return new CommandPage;}, "Commands", ":/settings/commands.svg");
|
||||
this->addTab([]{return new HighlightingPage;}, "Highlights", ":/settings/notifications.svg");
|
||||
this->addTab([]{return new IgnoresPage;}, "Ignores", ":/settings/ignore.svg");
|
||||
this->ui_.tabContainer->addSpacing(16);
|
||||
this->addTab([]{return new KeyboardSettingsPage;}, "Keybindings", ":/settings/keybinds.svg");
|
||||
this->addTab([]{return new ModerationPage;}, "Moderation", ":/settings/moderation.svg");
|
||||
this->addTab([]{return new ModerationPage;}, "Moderation", ":/settings/moderation.svg", SettingsTabId::Moderation);
|
||||
this->addTab([]{return new NotificationPage;}, "Notifications", ":/settings/notification2.svg");
|
||||
this->addTab([]{return new ExternalToolsPage;}, "External tools", ":/settings/externaltools.svg");
|
||||
this->ui_.tabContainer->addStretch(1);
|
||||
this->addTab([]{return new AboutPage;}, "About", ":/settings/about.svg", Qt::AlignBottom);
|
||||
this->addTab([]{return new AboutPage;}, "About", ":/settings/about.svg", SettingsTabId(), Qt::AlignBottom);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void SettingsDialog::addTab(std::function<SettingsPage *()> page,
|
||||
const QString &name, const QString &iconPath,
|
||||
Qt::Alignment alignment)
|
||||
SettingsTabId id, Qt::Alignment alignment)
|
||||
{
|
||||
auto tab = new SettingsDialogTab(this, std::move(page), name, iconPath);
|
||||
auto tab = new SettingsDialogTab(this, std::move(page), name, iconPath, id);
|
||||
|
||||
this->ui_.tabContainer->addWidget(tab, 0, alignment);
|
||||
this->tabs_.push_back(tab);
|
||||
|
@ -216,7 +216,12 @@ void SettingsDialog::selectTab(SettingsDialogTab *tab, bool byUser)
|
|||
|
||||
void SettingsDialog::selectTab(SettingsTabId id)
|
||||
{
|
||||
this->selectTab(this->tab(id));
|
||||
auto t = this->tab(id);
|
||||
assert(t);
|
||||
if (!t)
|
||||
return;
|
||||
|
||||
this->selectTab(t);
|
||||
}
|
||||
|
||||
SettingsDialogTab *SettingsDialog::tab(SettingsTabId id)
|
||||
|
|
|
@ -51,7 +51,7 @@ private:
|
|||
void initUi();
|
||||
void addTabs();
|
||||
void addTab(std::function<SettingsPage *()> page, const QString &name,
|
||||
const QString &iconPath,
|
||||
const QString &iconPath, SettingsTabId id = {},
|
||||
Qt::Alignment alignment = Qt::AlignTop);
|
||||
void selectTab(SettingsDialogTab *tab, const bool byUser = true);
|
||||
void selectTab(SettingsTabId id);
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
SettingsDialogTab(SettingsDialog *dialog_,
|
||||
std::function<SettingsPage *()> page_,
|
||||
const QString &name, QString imageFileName,
|
||||
SettingsTabId id = {});
|
||||
SettingsTabId id);
|
||||
|
||||
void setSelected(bool selected_);
|
||||
SettingsPage *page();
|
||||
|
|
|
@ -328,7 +328,8 @@ void GeneralPage::initLayout(SettingsLayout &layout)
|
|||
layout.addCheckbox("Smooth scrolling on new messages",
|
||||
s.enableSmoothScrollingNewMessages);
|
||||
layout.addDropdown<float>(
|
||||
"Pause on hover", {"Disabled", "0.5s", "1s", "2s", "5s", "Indefinite"},
|
||||
"Pause after hover",
|
||||
{"Disabled", "0.5s", "1s", "2s", "5s", "Indefinite"},
|
||||
s.pauseOnHoverDuration,
|
||||
[](auto val) {
|
||||
if (val < -0.5f)
|
||||
|
|
Loading…
Reference in a new issue