Merge branch 'master' into logging

This commit is contained in:
pajlada
2018-06-05 13:16:20 +02:00
committed by GitHub
172 changed files with 5997 additions and 3348 deletions
+38 -11
View File
@@ -2,14 +2,20 @@
#include "application.hpp"
#include "singletons/loggingmanager.hpp"
#include "controllers/taggedusers/taggeduserscontroller.hpp"
#include "controllers/taggedusers/taggedusersmodel.hpp"
#include "singletons/pathmanager.hpp"
#include "util/layoutcreator.hpp"
#include "widgets/helper/editablemodelview.hpp"
#include <QFormLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QLabel>
#include <QListView>
#include <QPushButton>
#include <QTableView>
#include <QTextEdit>
#include <QVBoxLayout>
@@ -33,11 +39,13 @@ ModerationPage::ModerationPage()
auto app = getApp();
util::LayoutCreator<ModerationPage> layoutCreator(this);
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
auto tabs = layoutCreator.emplace<QTabWidget>();
auto logs = tabs.appendTab(new QVBoxLayout, "Logs");
{
// Logs (copied from LoggingMananger)
auto created = layout.emplace<QLabel>();
auto created = logs.emplace<QLabel>();
if (app->settings->logPath == "") {
created->setText("Logs are saved to " +
CreateLink(QCoreApplication::applicationDirPath(), true));
@@ -49,9 +57,10 @@ ModerationPage::ModerationPage()
Qt::LinksAccessibleByKeyboard |
Qt::LinksAccessibleByKeyboard);
created->setOpenExternalLinks(true);
layout.append(this->createCheckBox("Enable logging", app->settings->enableLogging));
logs.append(this->createCheckBox("Enable logging", app->settings->enableLogging));
layout->addStretch(1);
<
logs->addStretch(1);
auto selectDir = layout.emplace<QPushButton>("Set custom logpath");
@@ -90,21 +99,25 @@ ModerationPage::ModerationPage()
});
// Logs end
}
auto modMode = tabs.appendTab(new QVBoxLayout, "Moderation mode");
{
// clang-format off
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>");
auto label = modMode.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 form = layout.emplace<QFormLayout>();
{
form->addRow("Action on timed out messages (unimplemented):",
this->createComboBox({"Disable", "Hide"}, app->settings->timeoutAction));
}
// auto form = modMode.emplace<QFormLayout>();
// {
// form->addRow("Action on timed out messages (unimplemented):",
// this->createComboBox({"Disable", "Hide"},
// app->settings->timeoutAction));
// }
auto modButtons =
layout.emplace<QGroupBox>("Custom moderator buttons").setLayoutType<QVBoxLayout>();
modMode.emplace<QGroupBox>("Custom moderator buttons").setLayoutType<QVBoxLayout>();
{
auto label2 =
modButtons.emplace<QLabel>("One action per line. {user} will be replaced with the "
@@ -122,6 +135,20 @@ ModerationPage::ModerationPage()
app->settings->moderationActions = text->toPlainText();
});
}
/*auto taggedUsers = tabs.appendTab(new QVBoxLayout, "Tagged users");
{
helper::EditableModelView *view = *taggedUsers.emplace<helper::EditableModelView>(
app->taggedUsers->createModel(nullptr));
view->setTitles({"Name"});
view->getTableView()->horizontalHeader()->setStretchLastSection(true);
view->addButtonPressed.connect([] {
getApp()->taggedUsers->users.appendItem(
controllers::taggedusers::TaggedUser(ProviderId::Twitch, "example", "xD"));
});
}*/
}
// ---- misc