void StatusChecker::reloadStatus() { if (isLoadingStatus()) { // QLOG_INFO() << "Ignored request to reload status. Currently reloading already."; return; } // QLOG_INFO() << "Reloading status."; NetJob* job = new NetJob("Status JSON"); job->addNetAction(ByteArrayDownload::make(URLConstants::MOJANG_STATUS_URL)); QObject::connect(job, &NetJob::succeeded, this, &StatusChecker::statusDownloadFinished); QObject::connect(job, &NetJob::failed, this, &StatusChecker::statusDownloadFailed); m_statusNetJob.reset(job); job->start(); }
void UpdateChecker::updateChanList() { QLOG_DEBUG() << "Loading the channel list."; if (m_channelListUrl.isEmpty()) { QLOG_ERROR() << "Failed to update channel list. No channel list URL set." << "If you'd like to use MultiMC's update system, please pass the channel " "list URL to CMake at compile time."; return; } m_chanListLoading = true; NetJob *job = new NetJob("Update System Channel List"); job->addNetAction(ByteArrayDownload::make(QUrl(m_channelListUrl))); QObject::connect(job, &NetJob::succeeded, this, &UpdateChecker::chanListDownloadFinished); QObject::connect(job, &NetJob::failed, this, &UpdateChecker::chanListDownloadFailed); chanListJob.reset(job); job->start(); }
void LegacyJarModPage::on_addForgeBtn_clicked() { VersionSelectDialog vselect(MMC->forgelist().get(), tr("Select Forge version"), this); vselect.setExactFilter(1, m_inst->intendedVersionId()); if (vselect.exec() && vselect.selectedVersion()) { ForgeVersionPtr forge = std::dynamic_pointer_cast<ForgeVersion>(vselect.selectedVersion()); if (!forge) return; auto entry = MMC->metacache()->resolveEntry("minecraftforge", forge->filename()); if (entry->stale) { NetJob *fjob = new NetJob("Forge download"); fjob->addNetAction(CacheDownload::make(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(); } } }
void OneSixModEditDialog::on_forgeBtn_clicked() { VersionSelectDialog vselect(MMC->forgelist().get(), tr("Select Forge version"), this); vselect.setFilter(1, m_inst->currentVersionId()); if (vselect.exec() && vselect.selectedVersion()) { if (m_inst->versionIsCustom()) { auto reply = QMessageBox::question( this, tr("Revert?"), tr("This will revert any " "changes you did to the version up to this point. Is that " "OK?"), QMessageBox::Yes | QMessageBox::No); if (reply == QMessageBox::Yes) { m_inst->revertCustomVersion(); m_inst->customizeVersion(); { m_version = m_inst->getFullVersion(); main_model->setSourceModel(m_version.get()); updateVersionControls(); } } else return; } else { m_inst->customizeVersion(); m_version = m_inst->getFullVersion(); main_model->setSourceModel(m_version.get()); updateVersionControls(); } ForgeVersionPtr forgeVersion = std::dynamic_pointer_cast<ForgeVersion>(vselect.selectedVersion()); if (!forgeVersion) return; auto entry = MMC->metacache()->resolveEntry("minecraftforge", forgeVersion->filename); if (entry->stale) { NetJob *fjob = new NetJob("Forge download"); fjob->addNetAction(CacheDownload::make(forgeVersion->installer_url, entry)); ProgressDialog dlg(this); dlg.exec(fjob); if (dlg.result() == QDialog::Accepted) { // install QString forgePath = entry->getFullPath(); ForgeInstaller forge(forgePath, forgeVersion->universal_url); if (!forge.apply(m_version)) { // failure notice } } else { // failed to download forge :/ } } else { // install QString forgePath = entry->getFullPath(); ForgeInstaller forge(forgePath, forgeVersion->universal_url); if (!forge.apply(m_version)) { // failure notice } } } }