2018-01-12 23:09:05 +01:00
|
|
|
#include "moderationpage.hpp"
|
|
|
|
|
2018-01-13 03:06:10 +01:00
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QListView>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QTextEdit>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
|
|
#include "util/layoutcreator.hpp"
|
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
|
|
|
namespace settingspages {
|
|
|
|
ModerationPage::ModerationPage()
|
2018-01-13 03:06:10 +01:00
|
|
|
: SettingsPage("Moderation", "")
|
2018-01-12 23:09:05 +01:00
|
|
|
{
|
2018-01-13 03:06:10 +01:00
|
|
|
singletons::SettingManager &settings = singletons::SettingManager::getInstance();
|
|
|
|
util::LayoutCreator<ModerationPage> layoutCreator(this);
|
|
|
|
|
|
|
|
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
|
|
|
{
|
|
|
|
// clang-format off
|
|
|
|
auto label = layout.emplace<QLabel>("In channels that you moderate there is a button <insert image of button here> to enable moderation mode.");
|
|
|
|
label->setWordWrap(true);
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
auto text = layout.emplace<QTextEdit>().getElement();
|
|
|
|
|
|
|
|
QObject::connect(text, &QTextEdit::textChanged, this,
|
|
|
|
[this] { this->itemsChangedTimer.start(200); });
|
|
|
|
|
|
|
|
QObject::connect(&this->itemsChangedTimer, &QTimer::timeout, this,
|
|
|
|
[text, &settings]() { settings.moderationActions = text->toPlainText(); });
|
|
|
|
|
|
|
|
settings.highlightUserBlacklist.connect([=](const QString &str, auto) {
|
|
|
|
text->setPlainText(str); //
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---- misc
|
|
|
|
this->itemsChangedTimer.setSingleShot(true);
|
2018-01-12 23:09:05 +01:00
|
|
|
}
|
2018-01-13 03:06:10 +01:00
|
|
|
|
2018-01-12 23:09:05 +01:00
|
|
|
} // namespace settingspages
|
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|