diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-09-28 21:51:59 +0200 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-09-28 21:51:59 +0200 |
| commit | 92585af197136df91842c8bd8496653d6df56832 (patch) | |
| tree | 13b7f411636a10fb13f976ad82927711c2abe2f6 /src/mainwindow.cpp | |
| parent | e261fffa8d88e385a21cadb2f45b68e6c96b5d67 (diff) | |
Do not show 'Enable Mods... ' action for game without SaveGameInfo feature.
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 03675a2b..fa5a790c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4973,25 +4973,25 @@ void MainWindow::fixMods_clicked(SaveGameInfo::MissingAssets const &missingAsset } -void MainWindow::on_savegameList_customContextMenuRequested(const QPoint &pos) +void MainWindow::on_savegameList_customContextMenuRequested(const QPoint& pos) { - QItemSelectionModel *selection = ui->savegameList->selectionModel(); + QItemSelectionModel* selection = ui->savegameList->selectionModel(); if (!selection->hasSelection()) { return; } QMenu menu; - QAction *action = menu.addAction(tr("Enable Mods...")); - action->setEnabled(false); - if (selection->selectedIndexes().count() == 1) { - SaveGameInfo const *info = this->m_OrganizerCore.managedGame()->feature<SaveGameInfo>(); - if (info != nullptr) { + SaveGameInfo const* info = this->m_OrganizerCore.managedGame()->feature<SaveGameInfo>(); + if (info != nullptr) { + QAction* action = menu.addAction(tr("Enable Mods...")); + action->setEnabled(false); + if (selection->selectedIndexes().count() == 1) { QString save = ui->savegameList->currentItem()->data(Qt::UserRole).toString(); SaveGameInfo::MissingAssets missing = info->getMissingAssets(save); if (missing.size() != 0) { - connect(action, &QAction::triggered, this, [this, missing]{ fixMods_clicked(missing); }); + connect(action, &QAction::triggered, this, [this, missing] { fixMods_clicked(missing); }); action->setEnabled(true); } } |
