MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / installMods

Method installMods

launcher/ui/pages/instance/ModFolderPage.cpp:199–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199void ModFolderPage::installMods()
200{
201 if (m_instance->typeName() != "Minecraft")
202 return; // this is a null instance or a legacy instance
203
204 auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile();
205 if (!profile->getModLoaders().has_value()) {
206 QMessageBox::critical(this, tr("Error"), tr("Please install a mod loader first!"));
207 return;
208 }
209
210 ResourceDownload::ModDownloadDialog mdownload(this, m_model, m_instance);
211 if (mdownload.exec()) {
212 auto tasks = new ConcurrentTask("Download Mods", APPLICATION->settings()->get("NumberOfConcurrentDownloads").toInt());
213 connect(tasks, &Task::failed, [this, tasks](QString reason) {
214 CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
215 tasks->deleteLater();
216 });
217 connect(tasks, &Task::aborted, [this, tasks]() {
218 CustomMessageBox::selectable(this, tr("Aborted"), tr("Download stopped by user."), QMessageBox::Information)->show();
219 tasks->deleteLater();
220 });
221 connect(tasks, &Task::succeeded, [this, tasks]() {
222 QStringList warnings = tasks->warnings();
223 if (warnings.count())
224 CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'), QMessageBox::Warning)->show();
225
226 tasks->deleteLater();
227 });
228
229 for (auto& task : mdownload.getTasks()) {
230 tasks->addTask(task);
231 }
232
233 ProgressDialog loadDialog(this);
234 loadDialog.setSkipButton(true, tr("Abort"));
235 loadDialog.execWithTask(tasks);
236
237 m_model->update();
238 }
239}
240
241void ModFolderPage::updateMods(bool includeDeps)
242{

Callers

nothing calls this directly

Calls 15

selectableFunction · 0.85
getPackProfileMethod · 0.80
getModLoadersMethod · 0.80
showMethod · 0.80
addTaskMethod · 0.80
setSkipButtonMethod · 0.80
execWithTaskMethod · 0.80
typeNameMethod · 0.45
execMethod · 0.45
getMethod · 0.45
settingsMethod · 0.45
warningsMethod · 0.45

Tested by

no test coverage detected