Implement legacy forge button!

Many refactors of the task system.
Progress dialog now accepts generic ProgressProvider objects
This commit is contained in:
Petr Mrázek 2013-09-18 00:00:35 +02:00
parent d38b90530b
commit b979d0ce5d
28 changed files with 296 additions and 236 deletions

View file

@ -13,10 +13,15 @@
* limitations under the License.
*/
#include "MultiMC.h"
#include "LegacyModEditDialog.h"
#include "ModEditDialogCommon.h"
#include "versionselectdialog.h"
#include "ProgressDialog.h"
#include "ui_LegacyModEditDialog.h"
#include <logic/ModList.h>
#include "logic/ModList.h"
#include "logic/lists/ForgeVersionList.h"
#include <pathutils.h>
#include <QFileDialog>
#include <QDebug>
@ -194,7 +199,39 @@ void LegacyModEditDialog::on_addCoreBtn_clicked()
}
void LegacyModEditDialog::on_addForgeBtn_clicked()
{
VersionSelectDialog vselect(MMC->forgelist(), this);
vselect.setFilter(1, m_inst->intendedVersionId());
if (vselect.exec() && vselect.selectedVersion())
{
ForgeVersionPtr forge = vselect.selectedVersion().dynamicCast<ForgeVersion>();
if(!forge)
return;
auto entry = MMC->metacache()->resolveEntry("minecraftforge", forge->filename);
if(entry->stale)
{
DownloadJob * fjob = new DownloadJob("Forge download");
fjob->add(forge->universal_url, entry);
ProgressDialog dlg(this);
dlg.exec(fjob);
if(dlg.result() == QDialog::Accepted)
{
m_jarmods->stopWatching();
m_jarmods->installMod(QFileInfo(entry->getFullPath()));
m_jarmods->startWatching();
}
else
{
// failed to download forge :/
}
}
else
{
m_jarmods->stopWatching();
m_jarmods->installMod(QFileInfo(entry->getFullPath()));
m_jarmods->startWatching();
}
//m_selectedInstance->setIntendedVersionId(->descriptor());
}
}
void LegacyModEditDialog::on_addJarBtn_clicked()
{