Fix bug with 'disabled users' textbox

Fix 553
This commit is contained in:
datguy 2018-07-02 19:53:51 +03:00
parent 978931bcfc
commit b03c39cfd7
2 changed files with 5 additions and 15 deletions

View file

@ -67,15 +67,11 @@ HighlightingPage::HighlightingPage()
{ {
auto text = disabledUsers.emplace<QTextEdit>().getElement(); auto text = disabledUsers.emplace<QTextEdit>().getElement();
QObject::connect(text, &QTextEdit::textChanged, this, QObject::connect(text, &QTextEdit::textChanged, this, [text, app] {
[this] { this->disabledUsersChangedTimer.start(200); }); QStringList list = text->toPlainText().split("\n", QString::SkipEmptyParts);
list.removeDuplicates();
QObject::connect( app->settings->highlightUserBlacklist = list.join("\n") + "\n";
&this->disabledUsersChangedTimer, &QTimer::timeout, this, [text, app]() { });
QStringList list = text->toPlainText().split("\n", QString::SkipEmptyParts);
list.removeDuplicates();
app->settings->highlightUserBlacklist = list.join("\n") + "\n";
});
app->settings->highlightUserBlacklist.connect([=](const QString &str, auto) { app->settings->highlightUserBlacklist.connect([=](const QString &str, auto) {
text->setPlainText(str); // text->setPlainText(str); //
@ -98,9 +94,6 @@ HighlightingPage::HighlightingPage()
layout.append(createCheckBox(ALWAYS_PLAY, app->settings->highlightAlwaysPlaySound)); layout.append(createCheckBox(ALWAYS_PLAY, app->settings->highlightAlwaysPlaySound));
} }
// ---- misc
this->disabledUsersChangedTimer.setSingleShot(true);
} }
} // namespace chatterino } // namespace chatterino

View file

@ -14,9 +14,6 @@ class HighlightingPage : public SettingsPage
{ {
public: public:
HighlightingPage(); HighlightingPage();
private:
QTimer disabledUsersChangedTimer;
}; };
} // namespace chatterino } // namespace chatterino