aboutsummaryrefslogtreecommitdiff
path: root/launcher/StringUtils.cpp
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-02-08 00:35:03 -0800
committerRachel Powers <508861+Ryex@users.noreply.github.com>2023-03-20 14:56:32 -0700
commit6d160a7b7e31034c7a657f30003562c20f9b9c21 (patch)
tree5e7b7918892c25fadabc54a87540b9668fc740cd /launcher/StringUtils.cpp
parent32409a361b797342d625bfc6d0726cc330ced760 (diff)
downloadPrismLauncher-6d160a7b7e31034c7a657f30003562c20f9b9c21.tar.gz
PrismLauncher-6d160a7b7e31034c7a657f30003562c20f9b9c21.tar.bz2
PrismLauncher-6d160a7b7e31034c7a657f30003562c20f9b9c21.zip
feat: successful process elevation and comunication!
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/StringUtils.cpp')
-rw-r--r--launcher/StringUtils.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/launcher/StringUtils.cpp b/launcher/StringUtils.cpp
index 0f3c3669..93a44d4c 100644
--- a/launcher/StringUtils.cpp
+++ b/launcher/StringUtils.cpp
@@ -1,5 +1,7 @@
#include "StringUtils.h"
+#include <QRandomGenerator>
+
/// If you're wondering where these came from exactly, then know you're not the only one =D
/// TAKEN FROM Qt, because it doesn't expose it intelligently
@@ -74,3 +76,16 @@ int StringUtils::naturalCompare(const QString& s1, const QString& s2, Qt::CaseSe
// The two strings are the same (02 == 2) so fall back to the normal sort
return QString::compare(s1, s2, cs);
}
+
+QString StringUtils::getRandomAlphaNumeric(const int length)
+{
+ const QString possibleCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
+ QString randomString;
+ for(int i=0; i < length; ++i)
+ {
+ int index = QRandomGenerator::global()->bounded(0, possibleCharacters.length());
+ QChar nextChar = possibleCharacters.at(index);
+ randomString.append(nextChar);
+ }
+ return randomString;
+}