Clean up a few warnings

This commit is contained in:
Rasmus Karlsson
2019-08-10 13:47:17 +02:00
parent fdb0b62dee
commit ebef87f085
3 changed files with 46 additions and 37 deletions
+38
View File
@@ -0,0 +1,38 @@
#include "Helpers.hpp"
#include <QUuid>
namespace AB_NAMESPACE {
QString CreateUUID()
{
auto uuid = QUuid::createUuid();
return uuid.toString();
}
QString createLink(const QString &url, bool file)
{
return QString("<a href=\"") + (file ? "file:///" : "") + url + "\">" +
url + "</a>";
}
QString createNamedLink(const QString &url, const QString &name, bool file)
{
return QString("<a href=\"") + (file ? "file:///" : "") + url + "\">" +
name + "</a>";
}
QString shortenString(const QString &str, unsigned maxWidth)
{
auto shortened = QString(str);
if (str.size() > int(maxWidth))
{
shortened.resize(int(maxWidth));
shortened += "...";
}
return shortened;
}
} // namespace AB_NAMESPACE