#include "ignoremessagespage.hpp" #include "util/layoutcreator.hpp" #include #include namespace chatterino { namespace widgets { namespace settingspages { IgnoreMessagesPage::IgnoreMessagesPage() : SettingsPage("Ignore Messages", "") { singletons::SettingManager &settings = singletons::SettingManager::getInstance(); util::LayoutCreator layoutCreator(this); auto layout = layoutCreator.setLayoutType(); layout.emplace("Ignored keywords:"); QTextEdit *textEdit = layout.emplace().getElement(); textEdit->setPlainText(settings.ignoredKeywords); QObject::connect(textEdit, &QTextEdit::textChanged, [this] { this->keywordsUpdated.start(200); }); QObject::connect(&this->keywordsUpdated, &QTimer::timeout, [textEdit, &settings] { QString text = textEdit->toPlainText(); settings.ignoredKeywords = text; }); // ---- misc this->keywordsUpdated.setSingleShot(true); } } // namespace settingspages } // namespace widgets } // namespace chatterino