diff options
| author | Mikaƫl Capelle <capelle.mikael@gmail.com> | 2021-01-18 21:17:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-18 21:17:46 +0100 |
| commit | 0a683c0a5adda925e7dce5c9e0df5222b5ce3462 (patch) | |
| tree | fdf38d77f9ab5615161141d9df314551f696870e /src/modlistcontextmenu.cpp | |
| parent | 1f9a1da7f450937810a7ac8ee317cd28bdac0bdd (diff) | |
| parent | 3c0201a79909a878e6ae572b28bc7fc9588ff1c2 (diff) | |
Merge pull request #1372 from Holt59/install-mod-at
Modify 'Install mod... ' in context menu to install above current mod.
Diffstat (limited to 'src/modlistcontextmenu.cpp')
| -rw-r--r-- | src/modlistcontextmenu.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/modlistcontextmenu.cpp b/src/modlistcontextmenu.cpp index f4aea109..2d9577c5 100644 --- a/src/modlistcontextmenu.cpp +++ b/src/modlistcontextmenu.cpp @@ -24,24 +24,31 @@ void ModListGlobalContextMenu::populate(OrganizerCore& core, ModListView* view, { clear(); - addAction(tr("Install Mod..."), [=]() { view->actions().installMod(); }); - auto modIndex = index.data(ModList::IndexRole); if (modIndex.isValid() && view->sortColumn() == ModList::COL_PRIORITY) { auto info = ModInfo::getByIndex(modIndex.toInt()); if (!info->isBackup()) { - QString text = tr("Create empty mod above"); + + // the mod are not created/installed at the same position depending + // on the clicked mod and the sort order + QString installText = tr("Install mod above... "); + QString createText = tr("Create empty mod above"); if (info->isSeparator()) { - text = tr("Create empty mod inside"); + installText = tr("Install mod inside... "); + createText = tr("Create empty mod inside"); } else if (view->sortOrder() == Qt::DescendingOrder) { - text = tr("Create empty mod below"); + installText = tr("Install mod below... "); + createText = tr("Create empty mod below"); } - addAction(text, [=]() { view->actions().createEmptyMod(index); }); + + addAction(installText, [=]() { view->actions().installMod("", index); }); + addAction(createText, [=]() { view->actions().createEmptyMod(index); }); addAction(tr("Create separator above"), [=]() { view->actions().createSeparator(index); }); } } else { + addAction(tr("Install mod..."), [=]() { view->actions().installMod(); }); addAction(tr("Create empty mod"), [=]() { view->actions().createEmptyMod(); }); addAction(tr("Create separator"), [=]() { view->actions().createSeparator(); }); } |
