mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
1682f0fb36
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <QColor>
|
|
#include <QString>
|
|
|
|
namespace chatterino {
|
|
|
|
/**
|
|
* @brief startsWithOrContains is a wrapper for checking
|
|
* whether str1 starts with or contains str2 within itself
|
|
**/
|
|
bool startsWithOrContains(const QString &str1, const QString &str2,
|
|
Qt::CaseSensitivity caseSensitivity, bool startsWith);
|
|
|
|
QString generateUuid();
|
|
|
|
QString formatRichLink(const QString &url, bool file = false);
|
|
|
|
QString formatRichNamedLink(const QString &url, const QString &name,
|
|
bool file = false);
|
|
|
|
QString shortenString(const QString &str, unsigned maxWidth = 50);
|
|
|
|
QString localizeNumbers(const int &number);
|
|
|
|
QString kFormatNumbers(const int &number);
|
|
|
|
QColor getRandomColor(const QString &userId);
|
|
|
|
/**
|
|
* @brief Takes a user's name and some formatting parameter and spits out the standardized way to format it
|
|
*
|
|
* @param userName a user's name
|
|
* @param isFirstWord signifies whether this mention would be the first word in a message
|
|
* @param mentionUsersWithComma postfix mentions with a comma. generally powered by getSettings()->mentionUsersWithComma
|
|
**/
|
|
QString formatUserMention(const QString &userName, bool isFirstWord,
|
|
bool mentionUsersWithComma);
|
|
|
|
} // namespace chatterino
|