The file-url for logging is now displayed as a smaller link (#570)

* The file-url for logging is now displayed as a smaller link, todo: Show link on hover

* added a label to the folder-url in the settings
This commit is contained in:
apa420 2018-07-05 15:57:08 +02:00 committed by fourtf
parent 3d7926cac1
commit eb69cbf5f5

View file

@ -46,22 +46,40 @@ ModerationPage::ModerationPage()
{ {
// Logs (copied from LoggingMananger) // Logs (copied from LoggingMananger)
auto created = logs.emplace<QLabel>(); auto logsPathLabel = logs.emplace<QLabel>();
app->settings->logPath.connect([app, logsPathLabel](const QString &logPath, auto) mutable {
QString pathOriginal;
app->settings->logPath.connect([app, created](const QString &logPath, auto) mutable {
if (logPath == "") { if (logPath == "") {
created->setText("Logs are saved to " + pathOriginal = app->paths->messageLogDirectory;
CreateLink(app->paths->messageLogDirectory, true));
} else { } else {
created->setText("Logs are saved to " + CreateLink(logPath, true)); pathOriginal = logPath;
} }
QString pathShortened;
if (pathOriginal.size() > 50) {
pathShortened = pathOriginal;
pathShortened.resize(50);
pathShortened += "...";
} else {
pathShortened = pathOriginal;
}
pathShortened = "Logs saved at <a href=\"file:///" + pathOriginal +
"\"><span style=\"color: white;\">" + pathShortened + "</span></a>";
logsPathLabel->setText(pathShortened);
logsPathLabel->setToolTip(pathOriginal);
}); });
created->setTextFormat(Qt::RichText); logsPathLabel->setTextFormat(Qt::RichText);
created->setTextInteractionFlags(Qt::TextBrowserInteraction | logsPathLabel->setTextInteractionFlags(Qt::TextBrowserInteraction |
Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByKeyboard |
Qt::LinksAccessibleByKeyboard); Qt::LinksAccessibleByKeyboard);
created->setOpenExternalLinks(true); logsPathLabel->setOpenExternalLinks(true);
logs.append(this->createCheckBox("Enable logging", app->settings->enableLogging)); logs.append(this->createCheckBox("Enable logging", app->settings->enableLogging));
logs->addStretch(1); logs->addStretch(1);