Fixed icons

Also having a mod loader is now enforced
This commit is contained in:
timoreo
2022-01-14 20:22:15 +01:00
parent 9e6fa8f29a
commit 1a8c972aef
8 changed files with 43 additions and 30 deletions

View File

@ -349,25 +349,34 @@ void ModFolderPage::on_actionInstall_mods_triggered()
if(!m_controlsEnabled) {
return;
}
ModDownloadDialog mdownload(m_mods, this);
mdownload.exec();
ModDownloadTask * task = mdownload.getTask();
if(task){
connect(task, &Task::failed, [this](QString reason)
{
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
});
connect(task, &Task::succeeded, [this, task]()
{
QStringList warnings = task->warnings();
if(warnings.count())
{
CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'), QMessageBox::Warning)->show();
}
});
ProgressDialog loadDialog(this);
loadDialog.setSkipButton(true, tr("Abort"));
loadDialog.execWithTask(task);
if(m_inst->typeName() != "Minecraft"){
return; //this is a null instance or a legacy instance
}
bool hasFabric = !((MinecraftInstance *)m_inst)->getPackProfile()->getComponentVersion("net.fabricmc.fabric-loader").isEmpty();
bool hasForge = !((MinecraftInstance *)m_inst)->getPackProfile()->getComponentVersion("net.minecraftforge").isEmpty();
if (!hasFabric && !hasForge) {
QMessageBox::critical(this,tr("Error"),tr("Please install a mod loader first !"));
return;
}
ModDownloadDialog mdownload(m_mods, this, m_inst);
if(mdownload.exec()) {
ModDownloadTask *task = mdownload.getTask();
if (task) {
connect(task, &Task::failed, [this](QString reason) {
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
});
connect(task, &Task::succeeded, [this, task]() {
QStringList warnings = task->warnings();
if (warnings.count()) {
CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'),
QMessageBox::Warning)->show();
}
});
ProgressDialog loadDialog(this);
loadDialog.setSkipButton(true, tr("Abort"));
loadDialog.execWithTask(task);
m_mods->update();
}
}
}