added custom window frame for windows

This commit is contained in:
fourtf
2018-01-24 15:08:22 +01:00
parent 2b94c4cd33
commit 36b010e046
9 changed files with 134 additions and 63 deletions
+20 -8
View File
@@ -1,5 +1,6 @@
#include "moderationpage.hpp"
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QListView>
@@ -18,22 +19,33 @@ ModerationPage::ModerationPage()
singletons::SettingManager &settings = singletons::SettingManager::getInstance();
util::LayoutCreator<ModerationPage> layoutCreator(this);
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
{
// 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.\n\nOne action per line. {user} will be replaced with the username.\nExample `/timeout {user} 120`");
auto label = layout.emplace<QLabel>("Click the moderation mod button (<img width='18' height='18' src=':/images/moderatormode_disabled.png'>) in a channel that you moderate to enable moderator mode.<br>");
label->setWordWrap(true);
label->setStyleSheet("color: #bbb");
// clang-format on
auto text = layout.emplace<QTextEdit>().getElement();
auto modButtons =
layout.emplace<QGroupBox>("Custom moderator buttons").setLayoutType<QVBoxLayout>();
{
auto label2 =
modButtons.emplace<QLabel>("One action per line. {user} will be replaced with the "
"username.<br>Example `/timeout {user} 120`<br>");
label2->setWordWrap(true);
text->setPlainText(settings.moderationActions);
auto text = modButtons.emplace<QTextEdit>().getElement();
QObject::connect(text, &QTextEdit::textChanged, this,
[this] { this->itemsChangedTimer.start(200); });
text->setPlainText(settings.moderationActions);
QObject::connect(&this->itemsChangedTimer, &QTimer::timeout, this,
[text, &settings]() { settings.moderationActions = text->toPlainText(); });
QObject::connect(text, &QTextEdit::textChanged, this,
[this] { this->itemsChangedTimer.start(200); });
QObject::connect(&this->itemsChangedTimer, &QTimer::timeout, this, [text, &settings]() {
settings.moderationActions = text->toPlainText();
});
}
}
// ---- misc