diff options
author | Andrew <forkk@forkk.net> | 2013-11-27 14:20:42 -0600 |
---|---|---|
committer | Andrew <forkk@forkk.net> | 2013-11-27 14:20:42 -0600 |
commit | d794a4d0bfac0341c15bd5273e8dc81fe82531ef (patch) | |
tree | 23cdea484bd18b7abee2ce0e6e61e5ff03cb1214 /gui/dialogs/LoginDialog.cpp | |
parent | 7e87278da9fa8afcaab53a00e2d670371a4ab52d (diff) | |
parent | 38732636d3c1f1563c2dceeae723fd51f7b5fda6 (diff) | |
download | MultiMC-d794a4d0bfac0341c15bd5273e8dc81fe82531ef.tar MultiMC-d794a4d0bfac0341c15bd5273e8dc81fe82531ef.tar.gz MultiMC-d794a4d0bfac0341c15bd5273e8dc81fe82531ef.tar.lz MultiMC-d794a4d0bfac0341c15bd5273e8dc81fe82531ef.tar.xz MultiMC-d794a4d0bfac0341c15bd5273e8dc81fe82531ef.zip |
Merge branch 'develop' of github.com:MultiMC/MultiMC5 into develop
Diffstat (limited to 'gui/dialogs/LoginDialog.cpp')
-rw-r--r-- | gui/dialogs/LoginDialog.cpp | 44 |
1 files changed, 4 insertions, 40 deletions
diff --git a/gui/dialogs/LoginDialog.cpp b/gui/dialogs/LoginDialog.cpp index 19c6437d..28bbb1ee 100644 --- a/gui/dialogs/LoginDialog.cpp +++ b/gui/dialogs/LoginDialog.cpp @@ -18,6 +18,7 @@ #include "keyring.h" #include "gui/Platform.h" #include "MultiMC.h" +#include "logic/SkinUtils.h" #include <QFile> #include <QJsonObject> @@ -168,47 +169,10 @@ void LoginDialog::userTextChanged(const QString &user) ui->rememberPasswordCheckbox->setChecked(!passwd.isEmpty()); ui->passwordTextBox->setText(passwd); - QByteArray data; - { - auto filename = - MMC->metacache()->resolveEntry("skins", "skins.json")->getFullPath(); - QFile listFile(filename); - if (!listFile.open(QIODevice::ReadOnly)) - return; - data = listFile.readAll(); - } - - QJsonParseError jsonError; - QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError); - QJsonObject root = jsonDoc.object(); - QJsonObject mappings = root.value("mappings").toObject(); + QPixmap face = SkinUtils::getFaceFromCache(user); + gotFace = !face.isNull(); - if (!mappings[user].isUndefined()) - { - QJsonArray usernames = mappings.value(user).toArray(); - if (!usernames.isEmpty()) - { - QString mapped_username = usernames[0].toString(); - - if (!mapped_username.isEmpty()) - { - QFile fskin(MMC->metacache() - ->resolveEntry("skins", mapped_username + ".png") - ->getFullPath()); - if (fskin.exists()) - { - QPixmap skin(MMC->metacache() - ->resolveEntry("skins", mapped_username + ".png") - ->getFullPath()); - QPixmap face = - skin.copy(8, 8, 8, 8).scaled(48, 48, Qt::KeepAspectRatio); - - ui->lblFace->setPixmap(face); - gotFace = true; - } - } - } - } + if(gotFace) ui->lblFace->setPixmap(face); } ui->lblFace->setVisible(gotFace); |