void CModListView::on_disableButton_clicked() { QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString(); if (modModel->hasMod(modName) && modModel->getMod(modName).isEnabled()) manager->disableMod(modName); checkManagerErrors(); }
void CModListView::on_disableButton_clicked() { QString modName = modModel->modIndexToName(filterModel->mapToSource(ui->allModsView->currentIndex()).row()); if (modModel->hasMod(modName) && modModel->getMod(modName).isEnabled()) manager->disableMod(modName); checkManagerErrors(); }
void CModListView::on_enableButton_clicked() { QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString(); assert(findBlockingMods(modName).empty()); assert(findInvalidDependencies(modName).empty()); for (auto & name : modModel->getRequirements(modName)) if (modModel->getMod(name).isDisabled()) manager->enableMod(name); checkManagerErrors(); }
void CModListView::on_enableButton_clicked() { QString modName = modModel->modIndexToName(filterModel->mapToSource(ui->allModsView->currentIndex()).row()); assert(findBlockingMods(modName).empty()); assert(findInvalidDependencies(modName).empty()); for (auto & name : modModel->getRequirements(modName)) if (modModel->getMod(name).isDisabled()) manager->enableMod(name); checkManagerErrors(); }
void CModListView::installMods(QStringList archives) { QStringList modNames; for (QString archive : archives) { // get basename out of full file name // remove path remove extension QString modName = archive.section('/', -1, -1).section('.', 0, 0); modNames.push_back(modName); } QStringList modsToEnable; // disable mod(s), to properly recalculate dependencies, if changed for (QString mod : boost::adaptors::reverse(modNames)) { CModEntry entry = modModel->getMod(mod); if (entry.isInstalled()) { // enable mod if installed and enabled if (entry.isEnabled()) modsToEnable.push_back(mod); } else { // enable mod if m if (settings["launcher"]["enableInstalledMods"].Bool()) modsToEnable.push_back(mod); } } // uninstall old version of mod, if installed for (QString mod : boost::adaptors::reverse(modNames)) { if (modModel->getMod(mod).isInstalled()) manager->uninstallMod(mod); } for (int i=0; i<modNames.size(); i++) manager->installMod(modNames[i], archives[i]); for (QString mod : modsToEnable) manager->enableMod(mod); for (QString archive : archives) QFile::remove(archive); checkManagerErrors(); }
void CModListView::on_uninstallButton_clicked() { QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString(); // NOTE: perhaps add "manually installed" flag and uninstall those dependencies that don't have it? if (modModel->hasMod(modName) && modModel->getMod(modName).isInstalled()) { if (modModel->getMod(modName).isEnabled()) manager->disableMod(modName); manager->uninstallMod(modName); } checkManagerErrors(); }
void CModListView::on_uninstallButton_clicked() { QString modName = modModel->modIndexToName(filterModel->mapToSource(ui->allModsView->currentIndex()).row()); // NOTE: perhaps add "manually installed" flag and uninstall those dependencies that don't have it? if (modModel->hasMod(modName) && modModel->getMod(modName).isInstalled()) { if (modModel->getMod(modName).isEnabled()) manager->disableMod(modName); manager->uninstallMod(modName); } checkManagerErrors(); }