GH-1072 use crafatar for grabbing the user skin

This commit is contained in:
Petr Mrázek 2015-09-28 22:43:57 +02:00
parent 1cbe543b39
commit ccb5fc6f4a
4 changed files with 10 additions and 9 deletions

View File

@ -548,9 +548,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
{ {
for (auto profile : account->profiles()) for (auto profile : account->profiles())
{ {
auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.name + ".png"); auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png");
auto action = CacheDownload::make( auto action = CacheDownload::make(
QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"), meta); QUrl("https://" + URLConstants::SKINS_BASE + profile.id + ".png"), meta);
skin_dls.append(action); skin_dls.append(action);
meta->stale = true; meta->stale = true;
} }
@ -775,7 +775,7 @@ void MainWindow::repopulateAccountsMenu()
action->setChecked(true); action->setChecked(true);
} }
action->setIcon(SkinUtils::getFaceFromCache(profile.name)); action->setIcon(SkinUtils::getFaceFromCache(profile.id));
accountMenu->addAction(action); accountMenu->addAction(action);
connect(action, SIGNAL(triggered(bool)), SLOT(changeActiveAccount())); connect(action, SIGNAL(triggered(bool)), SLOT(changeActiveAccount()));
} }
@ -834,7 +834,7 @@ void MainWindow::activeAccountChanged()
const AccountProfile *profile = account->currentProfile(); const AccountProfile *profile = account->currentProfile();
if (profile != nullptr) if (profile != nullptr)
{ {
accountMenuButton->setIcon(SkinUtils::getFaceFromCache(profile->name)); accountMenuButton->setIcon(SkinUtils::getFaceFromCache(profile->id));
accountMenuButton->setText(profile->name); accountMenuButton->setText(profile->name);
return; return;
} }

View File

@ -129,9 +129,9 @@ void AccountListPage::addAccount(const QString &errMsg)
for (AccountProfile profile : account->profiles()) for (AccountProfile profile : account->profiles())
{ {
auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.name + ".png"); auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png");
auto action = CacheDownload::make( auto action = CacheDownload::make(
QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"), meta); QUrl("https://" + URLConstants::SKINS_BASE + profile.id + ".png"), meta);
job->addNetAction(action); job->addNetAction(action);
meta->stale = true; meta->stale = true;
} }

View File

@ -21,5 +21,5 @@
namespace SkinUtils namespace SkinUtils
{ {
QPixmap MULTIMC_LOGIC_EXPORT getFaceFromCache(QString username, int height = 64, int width = 64); QPixmap MULTIMC_LOGIC_EXPORT getFaceFromCache(QString id, int height = 64, int width = 64);
} }

View File

@ -8,7 +8,8 @@ const QString AWS_DOWNLOAD_INDEXES(AWS_DOWNLOAD_BASE + "indexes/");
const QString ASSETS_BASE("assets.minecraft.net/"); const QString ASSETS_BASE("assets.minecraft.net/");
const QString RESOURCE_BASE("resources.download.minecraft.net/"); const QString RESOURCE_BASE("resources.download.minecraft.net/");
const QString LIBRARY_BASE("libraries.minecraft.net/"); const QString LIBRARY_BASE("libraries.minecraft.net/");
const QString SKINS_BASE("skins.minecraft.net/MinecraftSkins/"); //const QString SKINS_BASE("skins.minecraft.net/MinecraftSkins/");
const QString SKINS_BASE("crafatar.com/skins/");
const QString AUTH_BASE("authserver.mojang.com/"); const QString AUTH_BASE("authserver.mojang.com/");
const QString FORGE_LEGACY_URL("http://files.minecraftforge.net/minecraftforge/json"); const QString FORGE_LEGACY_URL("http://files.minecraftforge.net/minecraftforge/json");
const QString const QString
@ -20,4 +21,4 @@ const QString IMGUR_BASE_URL("https://api.imgur.com/3/");
const QString FMLLIBS_OUR_BASE_URL("http://files.multimc.org/fmllibs/"); const QString FMLLIBS_OUR_BASE_URL("http://files.multimc.org/fmllibs/");
const QString FMLLIBS_FORGE_BASE_URL("http://files.minecraftforge.net/fmllibs/"); const QString FMLLIBS_FORGE_BASE_URL("http://files.minecraftforge.net/fmllibs/");
const QString TRANSLATIONS_BASE_URL("http://files.multimc.org/translations/"); const QString TRANSLATIONS_BASE_URL("http://files.multimc.org/translations/");
} }