Merge pull request #913 from Gingeh/cape-without-skin

This commit is contained in:
Sefa Eyeoglu 2022-07-17 09:57:03 +02:00 committed by GitHub
commit 56085310cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 44 deletions

View File

@ -57,6 +57,10 @@ void SkinUploadDialog::on_buttonBox_accepted()
{ {
QString fileName; QString fileName;
QString input = ui->skinPathTextBox->text(); QString input = ui->skinPathTextBox->text();
ProgressDialog prog(this);
SequentialTask skinUpload;
if (!input.isEmpty()) {
QRegularExpression urlPrefixMatcher(QRegularExpression::anchoredPattern("^([a-z]+)://.+$")); QRegularExpression urlPrefixMatcher(QRegularExpression::anchoredPattern("^([a-z]+)://.+$"));
bool isLocalFile = false; bool isLocalFile = false;
// it has an URL prefix -> it is an URL // it has an URL prefix -> it is an URL
@ -116,9 +120,9 @@ void SkinUploadDialog::on_buttonBox_accepted()
{ {
model = SkinUpload::ALEX; model = SkinUpload::ALEX;
} }
ProgressDialog prog(this);
SequentialTask skinUpload;
skinUpload.addTask(shared_qobject_ptr<SkinUpload>(new SkinUpload(this, m_acct->accessToken(), FS::read(fileName), model))); skinUpload.addTask(shared_qobject_ptr<SkinUpload>(new SkinUpload(this, m_acct->accessToken(), FS::read(fileName), model)));
}
auto selectedCape = ui->capeCombo->currentData().toString(); auto selectedCape = ui->capeCombo->currentData().toString();
if(selectedCape != m_acct->accountData()->minecraftProfile.currentCape) { if(selectedCape != m_acct->accountData()->minecraftProfile.currentCape) {
skinUpload.addTask(shared_qobject_ptr<CapeChange>(new CapeChange(this, m_acct->accessToken(), selectedCape))); skinUpload.addTask(shared_qobject_ptr<CapeChange>(new CapeChange(this, m_acct->accessToken(), selectedCape)));

View File

@ -21,7 +21,11 @@
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLineEdit" name="skinPathTextBox"/> <widget class="QLineEdit" name="skinPathTextBox">
<property name="placeholderText">
<string>Leave empty to keep current skin</string>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="skinBrowseBtn"> <widget class="QPushButton" name="skinBrowseBtn">