improved the highlights settings page

This commit is contained in:
fourtf
2018-04-26 23:07:02 +02:00
parent ea7fcf260c
commit e23ce31e05
8 changed files with 528 additions and 449 deletions
@@ -8,20 +8,47 @@
#include <QTextEdit>
#include <QVBoxLayout>
#include "singletons/pathmanager.hpp"
#include "util/layoutcreator.hpp"
namespace chatterino {
namespace widgets {
namespace settingspages {
inline QString CreateLink(const QString &url, bool file = false)
{
if (file) {
return QString("<a href=\"file:///" + url + "\"><span style=\"color: white;\">" + url +
"</span></a>");
}
return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" + url + "</span></a>");
}
ModerationPage::ModerationPage()
: SettingsPage("Moderation", "")
{
singletons::SettingManager &settings = singletons::SettingManager::getInstance();
singletons::PathManager &pathManager = singletons::PathManager::getInstance();
util::LayoutCreator<ModerationPage> layoutCreator(this);
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
{
// Logs (copied from LoggingMananger)
auto logPath = pathManager.logsFolderPath;
auto created = layout.emplace<QLabel>();
created->setText("Logs are saved to " + CreateLink(logPath, true));
created->setTextFormat(Qt::RichText);
created->setTextInteractionFlags(Qt::TextBrowserInteraction |
Qt::LinksAccessibleByKeyboard |
Qt::LinksAccessibleByKeyboard);
created->setOpenExternalLinks(true);
layout.append(this->createCheckBox("Enable logging", settings.enableLogging));
layout->addStretch(1);
// Logs end
// 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>");
label->setWordWrap(true);