aboutsummaryrefslogtreecommitdiff
path: root/launcher/SkinUtils.cpp
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-08-15 12:16:00 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-08-15 12:16:00 +0300
commitc94ee67077076fdfb3ad04e93a0de2ae32b6a4e5 (patch)
tree437dec3be224cae5e229eeaa4ac9ebeedffd03e3 /launcher/SkinUtils.cpp
parent019e5ca3e819f5daf9933bc0fb091784b0ca561f (diff)
parent8f5bb982cd27dd9158b63d826769c168455a139b (diff)
downloadPrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.tar.gz
PrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.tar.bz2
PrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.zip
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into curseforge-url-handle3
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/SkinUtils.cpp')
-rw-r--r--launcher/SkinUtils.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/launcher/SkinUtils.cpp b/launcher/SkinUtils.cpp
index 1fe0c896..989114ad 100644
--- a/launcher/SkinUtils.cpp
+++ b/launcher/SkinUtils.cpp
@@ -14,17 +14,16 @@
*/
#include "SkinUtils.h"
-#include "net/HttpMetaCache.h"
#include "Application.h"
+#include "net/HttpMetaCache.h"
#include <QFile>
-#include <QPainter>
+#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
-#include <QJsonArray>
+#include <QPainter>
-namespace SkinUtils
-{
+namespace SkinUtils {
/*
* Given a username, return a pixmap of the cached skin (if it exists), QPixmap() otherwise
*/
@@ -32,12 +31,15 @@ QPixmap getFaceFromCache(QString username, int height, int width)
{
QFile fskin(APPLICATION->metacache()->resolveEntry("skins", username + ".png")->getFullPath());
- if (fskin.exists())
- {
+ if (fskin.exists()) {
QPixmap skinTexture(fskin.fileName());
- if(!skinTexture.isNull())
- {
+ if (!skinTexture.isNull()) {
QPixmap skin = QPixmap(8, 8);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+ skin.fill(QColorConstants::Transparent);
+#else
+ skin.fill(QColor(0, 0, 0, 0));
+#endif
QPainter painter(&skin);
painter.drawPixmap(0, 0, skinTexture.copy(8, 8, 8, 8));
painter.drawPixmap(0, 0, skinTexture.copy(40, 8, 8, 8));
@@ -47,4 +49,4 @@ QPixmap getFaceFromCache(QString username, int height, int width)
return QPixmap();
}
-}
+} // namespace SkinUtils