Move some helper functions to Helpers.hpp

This commit is contained in:
Rasmus Karlsson
2018-08-19 16:18:07 +02:00
parent 8bcc9c487b
commit 3fc91bded5
3 changed files with 45 additions and 36 deletions
+5 -26
View File
@@ -7,6 +7,7 @@
#include "controllers/taggedusers/TaggedUsersModel.hpp"
#include "singletons/Logging.hpp"
#include "singletons/Paths.hpp"
#include "util/Helpers.hpp"
#include "util/LayoutCreator.hpp"
#include "widgets/helper/EditableModelView.hpp"
@@ -25,18 +26,6 @@
namespace chatterino {
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>");
}
qint64 dirSize(QString dirPath)
{
qint64 size = 0;
@@ -110,20 +99,10 @@ ModerationPage::ModerationPage()
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>";
QString pathShortened =
"Logs saved at <a href=\"file:///" + pathOriginal +
"\"><span style=\"color: white;\">" +
shortenString(pathOriginal, 50) + "</span></a>";
logsPathLabel->setText(pathShortened);
logsPathLabel->setToolTip(pathOriginal);