Some checks failed
CodeQL Code Scanning / CodeQL (push) Has been cancelled
Build Application / Build Debug (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (macos-13, x86_64-darwin) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (macos-14, aarch64-darwin) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (ubuntu-22.04, x86_64-linux) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (ubuntu-22.04-arm, aarch64-linux) (push) Has been cancelled
Update Flake Lockfile / update-flake (push) Has been cancelled
37 lines
860 B
C++
Executable File
37 lines
860 B
C++
Executable File
|
|
#include "GetSkinStep.h"
|
|
|
|
#include <QNetworkRequest>
|
|
|
|
#include "Application.h"
|
|
|
|
GetSkinStep::GetSkinStep(AccountData* data) : AuthStep(data) {}
|
|
|
|
QString GetSkinStep::describe()
|
|
{
|
|
return tr("Getting skin.");
|
|
}
|
|
|
|
void GetSkinStep::perform()
|
|
{
|
|
QUrl url(m_data->minecraftProfile.skin.url);
|
|
|
|
m_response.reset(new QByteArray());
|
|
m_request = Net::Download::makeByteArray(url, m_response);
|
|
|
|
m_task.reset(new NetJob("GetSkinStep", APPLICATION->network()));
|
|
m_task->setAskRetry(false);
|
|
m_task->addNetAction(m_request);
|
|
|
|
connect(m_task.get(), &Task::finished, this, &GetSkinStep::onRequestDone);
|
|
|
|
m_task->start();
|
|
}
|
|
|
|
void GetSkinStep::onRequestDone()
|
|
{
|
|
if (m_request->error() == QNetworkReply::NoError)
|
|
m_data->minecraftProfile.skin.data = *m_response;
|
|
emit finished(AccountTaskState::STATE_WORKING, tr("Got skin"));
|
|
}
|