aboutsummaryrefslogtreecommitdiff
path: root/launcher/StringUtils.h
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-05-14 14:20:04 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-05-14 14:20:04 +0300
commit8c7fd3327ecfb31fde4ae843a5d66e0ef29026ff (patch)
treeb48975200ce3eee6c5dbf1070c71b8d71ece1ffb /launcher/StringUtils.h
parente4449a0ba32593b4fd76e3f2ced176e5b3bbd952 (diff)
parentd5c6a1b4d1e6d052e42366d19ffa0047168e030d (diff)
downloadPrismLauncher-8c7fd3327ecfb31fde4ae843a5d66e0ef29026ff.tar.gz
PrismLauncher-8c7fd3327ecfb31fde4ae843a5d66e0ef29026ff.tar.bz2
PrismLauncher-8c7fd3327ecfb31fde4ae843a5d66e0ef29026ff.zip
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into Fix_Assert
Diffstat (limited to 'launcher/StringUtils.h')
-rw-r--r--launcher/StringUtils.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/launcher/StringUtils.h b/launcher/StringUtils.h
index 36c8cf8f..f90a6ac7 100644
--- a/launcher/StringUtils.h
+++ b/launcher/StringUtils.h
@@ -37,6 +37,7 @@
#pragma once
#include <QString>
+#include <QUrl>
namespace StringUtils {
@@ -66,5 +67,16 @@ inline QString fromStdString(string s)
int naturalCompare(const QString& s1, const QString& s2, Qt::CaseSensitivity cs);
+/**
+ * @brief Truncate a url while keeping its readability py placing the `...` in the middle of the path
+ * @param url Url to truncate
+ * @param max_len max lenght of url in charaters
+ * @param hard_limit if truncating the path can't get the url short enough, truncate it normaly.
+ */
+QString truncateUrlHumanFriendly(QUrl &url, int max_len, bool hard_limit = false);
+
+QString humanReadableFileSize(double bytes, bool use_si = false, int decimal_points = 1);
+
+
QString getRandomAlphaNumeric();
} // namespace StringUtils