Unscuffed settings log page

This commit is contained in:
Rasmus Karlsson 2018-02-03 16:17:59 +01:00
parent e2b54edb2d
commit 25979d4535
2 changed files with 22 additions and 6 deletions

View file

@ -5,6 +5,7 @@
namespace chatterino {
namespace widgets {
namespace settingspages {
EmotesPage::EmotesPage()
: SettingsPage("Emotes", ":/images/emote.svg")
{
@ -22,6 +23,7 @@ EmotesPage::EmotesPage()
layout->addStretch(1);
}
} // namespace settingspages
} // namespace widgets
} // namespace chatterino

View file

@ -1,4 +1,5 @@
#include "logspage.hpp"
#include "singletons/pathmanager.hpp"
#include <QFormLayout>
#include <QVBoxLayout>
@ -9,6 +10,16 @@ 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>");
}
LogsPage::LogsPage()
: SettingsPage("Logs", "")
{
@ -16,13 +27,16 @@ LogsPage::LogsPage()
util::LayoutCreator<LogsPage> layoutCreator(this);
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
{
auto form = layout.emplace<QFormLayout>();
singletons::PathManager &pathManager = singletons::PathManager::getInstance();
auto logPath = pathManager.logsFolderPath;
// clang-format off
form->addRow("Enabled:", this->createCheckBox("Enable logging", settings.enableLogging));
// clang-format on
}
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);
}