mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-01 23:12:49 +02:00
Automatic mod conflict resolution
This commit is contained in:
@@ -496,7 +496,14 @@ QStringList CModListView::findDependentMods(QString mod, bool excludeDisabled)
|
||||
void CModListView::on_enableButton_clicked()
|
||||
{
|
||||
QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString();
|
||||
|
||||
enableModByName(modName);
|
||||
|
||||
checkManagerErrors();
|
||||
}
|
||||
|
||||
void CModListView::enableModByName(QString modName)
|
||||
{
|
||||
assert(findBlockingMods(modName).empty());
|
||||
assert(findInvalidDependencies(modName).empty());
|
||||
|
||||
@@ -505,17 +512,24 @@ void CModListView::on_enableButton_clicked()
|
||||
if(modModel->getMod(name).isDisabled())
|
||||
manager->enableMod(name);
|
||||
}
|
||||
checkManagerErrors();
|
||||
emit modsChanged();
|
||||
}
|
||||
|
||||
void CModListView::on_disableButton_clicked()
|
||||
{
|
||||
QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString();
|
||||
|
||||
disableModByName(modName);
|
||||
|
||||
checkManagerErrors();
|
||||
}
|
||||
|
||||
void CModListView::disableModByName(QString modName)
|
||||
{
|
||||
if(modModel->hasMod(modName) && modModel->getMod(modName).isEnabled())
|
||||
manager->disableMod(modName);
|
||||
|
||||
checkManagerErrors();
|
||||
emit modsChanged();
|
||||
}
|
||||
|
||||
void CModListView::on_updateButton_clicked()
|
||||
@@ -544,6 +558,8 @@ void CModListView::on_uninstallButton_clicked()
|
||||
manager->disableMod(modName);
|
||||
manager->uninstallMod(modName);
|
||||
}
|
||||
|
||||
emit modsChanged();
|
||||
checkManagerErrors();
|
||||
}
|
||||
|
||||
@@ -631,6 +647,8 @@ void CModListView::downloadFinished(QStringList savedFiles, QStringList failedFi
|
||||
|
||||
if(doInstallFiles)
|
||||
installFiles(savedFiles);
|
||||
|
||||
emit modsChanged();
|
||||
}
|
||||
|
||||
void CModListView::hideProgressBar()
|
||||
|
||||
@@ -66,6 +66,8 @@ class CModListView : public QWidget
|
||||
|
||||
signals:
|
||||
void extraResolutionsEnabledChanged(bool enabled);
|
||||
|
||||
void modsChanged();
|
||||
|
||||
public:
|
||||
explicit CModListView(QWidget * parent = 0);
|
||||
@@ -82,6 +84,10 @@ public:
|
||||
bool isExtraResolutionsModEnabled() const;
|
||||
|
||||
const CModList & getModList() const;
|
||||
|
||||
public slots:
|
||||
void enableModByName(QString modName);
|
||||
void disableModByName(QString modName);
|
||||
|
||||
private slots:
|
||||
void dataChanged(const QModelIndex & topleft, const QModelIndex & bottomRight);
|
||||
|
||||
Reference in New Issue
Block a user