aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/instance
diff options
context:
space:
mode:
authortimoreo <timo.oreo34@gmail.com>2022-01-14 20:22:15 +0100
committertimoreo <timo.oreo34@gmail.com>2022-01-14 20:22:15 +0100
commit1a8c972aefae75ee91295ea5a926cca71d95140a (patch)
tree74c034e6746549d03152d00f8c054bb7d4fa47f7 /launcher/ui/pages/instance
parent9e6fa8f29aa8bc0f609bfcdb6460c6845b73448a (diff)
downloadPrismLauncher-1a8c972aefae75ee91295ea5a926cca71d95140a.tar.gz
PrismLauncher-1a8c972aefae75ee91295ea5a926cca71d95140a.tar.bz2
PrismLauncher-1a8c972aefae75ee91295ea5a926cca71d95140a.zip
Fixed icons
Also having a mod loader is now enforced
Diffstat (limited to 'launcher/ui/pages/instance')
-rw-r--r--launcher/ui/pages/instance/ModFolderPage.cpp47
1 files changed, 28 insertions, 19 deletions
diff --git a/launcher/ui/pages/instance/ModFolderPage.cpp b/launcher/ui/pages/instance/ModFolderPage.cpp
index d2f5dead..7ebf66f6 100644
--- a/launcher/ui/pages/instance/ModFolderPage.cpp
+++ b/launcher/ui/pages/instance/ModFolderPage.cpp
@@ -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();
+ }
}
}