From eb69cbf5f511301fd28f94039c4d9eeb39d81b2e Mon Sep 17 00:00:00 2001 From: apa420 <17131426+apa420@users.noreply.github.com> Date: Thu, 5 Jul 2018 15:57:08 +0200 Subject: [PATCH] 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 --- src/widgets/settingspages/ModerationPage.cpp | 38 ++++++++++++++------ 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/widgets/settingspages/ModerationPage.cpp b/src/widgets/settingspages/ModerationPage.cpp index 4555e1834..9e61bd3d4 100644 --- a/src/widgets/settingspages/ModerationPage.cpp +++ b/src/widgets/settingspages/ModerationPage.cpp @@ -46,22 +46,40 @@ ModerationPage::ModerationPage() { // Logs (copied from LoggingMananger) - auto created = logs.emplace(); + auto logsPathLabel = logs.emplace(); + + 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 == "") { - created->setText("Logs are saved to " + - CreateLink(app->paths->messageLogDirectory, true)); + pathOriginal = app->paths->messageLogDirectory; } 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 " + pathShortened + ""; + + logsPathLabel->setText(pathShortened); + logsPathLabel->setToolTip(pathOriginal); }); - created->setTextFormat(Qt::RichText); - created->setTextInteractionFlags(Qt::TextBrowserInteraction | - Qt::LinksAccessibleByKeyboard | - Qt::LinksAccessibleByKeyboard); - created->setOpenExternalLinks(true); + logsPathLabel->setTextFormat(Qt::RichText); + logsPathLabel->setTextInteractionFlags(Qt::TextBrowserInteraction | + Qt::LinksAccessibleByKeyboard | + Qt::LinksAccessibleByKeyboard); + logsPathLabel->setOpenExternalLinks(true); logs.append(this->createCheckBox("Enable logging", app->settings->enableLogging)); logs->addStretch(1);