mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-07-05 04:46:57 +03:00
feat: make dependencies auto disable/enable
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
22539a4ff8
commit
66f0f95fd7
4 changed files with 104 additions and 18 deletions
|
|
@ -37,6 +37,7 @@
|
|||
*/
|
||||
|
||||
#include "ModFolderPage.h"
|
||||
#include "minecraft/mod/Resource.h"
|
||||
#include "ui/dialogs/ExportToModListDialog.h"
|
||||
#include "ui/dialogs/InstallLoaderDialog.h"
|
||||
#include "ui_ExternalResourcesPage.h"
|
||||
|
|
@ -91,7 +92,7 @@ ModFolderPage::ModFolderPage(BaseInstance* inst, ModFolderModel* model, QWidget*
|
|||
auto depsDisabled = APPLICATION->settings()->getSetting("ModDependenciesDisabled");
|
||||
ui->actionVerifyItemDependencies->setVisible(!depsDisabled->get().toBool());
|
||||
connect(depsDisabled.get(), &Setting::SettingChanged, this,
|
||||
[this](const Setting& setting, const QVariant& value) { ui->actionVerifyItemDependencies->setVisible(!value.toBool()); });
|
||||
[this](const Setting&, const QVariant& value) { ui->actionVerifyItemDependencies->setVisible(!value.toBool()); });
|
||||
|
||||
updateMenu->addAction(ui->actionResetItemMetadata);
|
||||
connect(ui->actionResetItemMetadata, &QAction::triggered, this, &ModFolderPage::deleteModMetadata);
|
||||
|
|
@ -136,7 +137,22 @@ void ModFolderPage::removeItems(const QItemSelection& selection)
|
|||
if (response != QMessageBox::Yes)
|
||||
return;
|
||||
}
|
||||
m_model->deleteResources(selection.indexes());
|
||||
|
||||
auto indexes = selection.indexes();
|
||||
auto affected = m_model->getAffectedMods(indexes, EnableAction::DISABLE);
|
||||
if (!affected.isEmpty()) {
|
||||
auto response = CustomMessageBox::selectable(this, tr("Confirm Disable"),
|
||||
tr("The mods you are tring to disable are required by %1 mods.\n"
|
||||
"Do you want to disable them?")
|
||||
.arg(affected.length()),
|
||||
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
|
||||
->exec();
|
||||
|
||||
if (response != QMessageBox::Yes) {
|
||||
m_model->setResourceEnabled(affected, EnableAction::DISABLE);
|
||||
}
|
||||
}
|
||||
m_model->deleteResources(indexes);
|
||||
}
|
||||
|
||||
void ModFolderPage::downloadMods()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue