mirror-chatterino2/src/widgets/settingspages/logspage.cpp

49 lines
1.4 KiB
C++
Raw Normal View History

2018-01-12 23:09:05 +01:00
#include "logspage.hpp"
#include "application.hpp"
2018-02-03 16:17:59 +01:00
#include "singletons/pathmanager.hpp"
2018-01-12 23:09:05 +01:00
#include <QFormLayout>
#include <QVBoxLayout>
#include "util/layoutcreator.hpp"
2018-01-12 23:09:05 +01:00
namespace chatterino {
namespace widgets {
namespace settingspages {
2018-02-03 16:17:59 +01:00
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>");
}
2018-01-12 23:09:05 +01:00
LogsPage::LogsPage()
: SettingsPage("Logs", "")
2018-01-12 23:09:05 +01:00
{
auto app = getApp();
util::LayoutCreator<LogsPage> layoutCreator(this);
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
auto logPath = app->paths->logsFolderPath;
2018-02-03 16:17:59 +01:00
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", app->settings->enableLogging));
layout->addStretch(1);
2018-01-12 23:09:05 +01:00
}
2018-01-12 23:09:05 +01:00
} // namespace settingspages
} // namespace widgets
} // namespace chatterino