mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
added settings page for moderation
This commit is contained in:
parent
faf5da2bf7
commit
bc93ef7214
4 changed files with 47 additions and 2 deletions
|
@ -74,6 +74,9 @@ public:
|
|||
/// Links
|
||||
BoolSetting linksDoubleClickOnly = {"/links/doubleClickToOpen", false};
|
||||
|
||||
/// Moderation
|
||||
QStringSetting moderationActions = {"/moderation/actions", "/ban {user}\n/timeout {user} 300"};
|
||||
|
||||
/// Highlighting
|
||||
BoolSetting enableHighlights = {"/highlighting/enabled", true};
|
||||
BoolSetting enableHighlightsSelf = {"/highlighting/nameIsHighlightKeyword", true};
|
||||
|
|
|
@ -81,7 +81,7 @@ void SettingsDialog::addTabs()
|
|||
this->addTab(new settingspages::EmotesPage);
|
||||
this->addTab(new settingspages::HighlightingPage);
|
||||
// this->addTab(new settingspages::LogsPage);
|
||||
// this->addTab(new settingspages::ModerationPage);
|
||||
this->addTab(new settingspages::ModerationPage);
|
||||
this->ui.tabContainer->addStretch(1);
|
||||
this->addTab(new settingspages::AboutPage, Qt::AlignBottom);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,47 @@
|
|||
#include "moderationpage.hpp"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QListView>
|
||||
#include <QPushButton>
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "util/layoutcreator.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
namespace settingspages {
|
||||
ModerationPage::ModerationPage()
|
||||
: SettingsPage("Moderation", ":/images/VSO_Link_blue_16x.png")
|
||||
: SettingsPage("Moderation", "")
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
} // namespace settingspages
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#include "widgets/settingspages/settingspage.hpp"
|
||||
|
||||
class QPushButton;
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
namespace settingspages {
|
||||
|
@ -10,6 +14,9 @@ class ModerationPage : public SettingsPage
|
|||
{
|
||||
public:
|
||||
ModerationPage();
|
||||
|
||||
private:
|
||||
QTimer itemsChangedTimer;
|
||||
};
|
||||
} // namespace settingspages
|
||||
} // namespace widgets
|
||||
|
|
Loading…
Reference in a new issue