refactored skin apis

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2023-09-01 21:23:51 +03:00
parent c01e95b79c
commit 609eaa67ab
13 changed files with 145 additions and 225 deletions

View File

@ -35,6 +35,7 @@
#include <QFileDialog>
#include <QFileInfo>
#include <QMimeDatabase>
#include <QPainter>
#include <FileSystem.h>
@ -101,12 +102,12 @@ void SkinUploadDialog::on_buttonBox_accepted()
} else if (ui->alexBtn->isChecked()) {
model = SkinUpload::ALEX;
}
skinUpload.addTask(shared_qobject_ptr<SkinUpload>(new SkinUpload(this, m_acct->accessToken(), FS::read(fileName), model)));
skinUpload.addTask(SkinUpload::make(m_acct->accessToken(), FS::read(fileName), model));
}
auto selectedCape = ui->capeCombo->currentData().toString();
if (selectedCape != m_acct->accountData()->minecraftProfile.currentCape) {
skinUpload.addTask(shared_qobject_ptr<CapeChange>(new CapeChange(this, m_acct->accessToken(), selectedCape)));
skinUpload.addTask(CapeChange::make(m_acct->accessToken(), selectedCape));
}
if (prog.execWithTask(&skinUpload) != QDialog::Accepted) {
CustomMessageBox::selectable(this, tr("Skin Upload"), tr("Failed to upload skin!"), QMessageBox::Warning)->exec();

View File

@ -268,7 +268,7 @@ void AccountListPage::on_actionDeleteSkin_triggered()
QModelIndex selected = selection.first();
MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>();
ProgressDialog prog(this);
auto deleteSkinTask = std::make_shared<SkinDelete>(this, account->accessToken());
auto deleteSkinTask = SkinDelete::make(account->accessToken());
if (prog.execWithTask((Task*)deleteSkinTask.get()) != QDialog::Accepted) {
CustomMessageBox::selectable(this, tr("Skin Delete"), tr("Failed to delete current skin!"), QMessageBox::Warning)->exec();
return;