summaryrefslogtreecommitdiff
path: root/src/modlistcontextmenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modlistcontextmenu.cpp')
-rw-r--r--src/modlistcontextmenu.cpp379
1 files changed, 246 insertions, 133 deletions
diff --git a/src/modlistcontextmenu.cpp b/src/modlistcontextmenu.cpp
index 2d9577c5..e88cadc8 100644
--- a/src/modlistcontextmenu.cpp
+++ b/src/modlistcontextmenu.cpp
@@ -9,18 +9,24 @@
using namespace MOBase;
-ModListGlobalContextMenu::ModListGlobalContextMenu(OrganizerCore& core, ModListView* view, QWidget* parent)
- : ModListGlobalContextMenu(core, view, QModelIndex(), parent)
-{
-}
+ModListGlobalContextMenu::ModListGlobalContextMenu(OrganizerCore& core,
+ ModListView* view, QWidget* parent)
+ : ModListGlobalContextMenu(core, view, QModelIndex(), parent)
+{}
-ModListGlobalContextMenu::ModListGlobalContextMenu(OrganizerCore& core, ModListView* view, const QModelIndex& index, QWidget* parent)
- : QMenu(parent)
+ModListGlobalContextMenu::ModListGlobalContextMenu(OrganizerCore& core,
+ ModListView* view,
+ const QModelIndex& index,
+ QWidget* parent)
+ : QMenu(parent)
{
- connect(this, &QMenu::aboutToShow, [=, &core] { populate(core, view, index); });
+ connect(this, &QMenu::aboutToShow, [=, &core] {
+ populate(core, view, index);
+ });
}
-void ModListGlobalContextMenu::populate(OrganizerCore& core, ModListView* view, const QModelIndex& index)
+void ModListGlobalContextMenu::populate(OrganizerCore& core, ModListView* view,
+ const QModelIndex& index)
{
clear();
@@ -32,25 +38,35 @@ void ModListGlobalContextMenu::populate(OrganizerCore& core, ModListView* view,
// 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");
+ QString createText = tr("Create empty mod above");
if (info->isSeparator()) {
installText = tr("Install mod inside... ");
- createText = tr("Create empty mod inside");
- }
- else if (view->sortOrder() == Qt::DescendingOrder) {
+ createText = tr("Create empty mod inside");
+ } else if (view->sortOrder() == Qt::DescendingOrder) {
installText = tr("Install mod below... ");
- createText = tr("Create empty mod below");
+ createText = tr("Create empty mod below");
}
- addAction(installText, [=]() { view->actions().installMod("", index); });
- addAction(createText, [=]() { view->actions().createEmptyMod(index); });
- addAction(tr("Create separator above"), [=]() { view->actions().createSeparator(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(); });
+ } else {
+ addAction(tr("Install mod..."), [=]() {
+ view->actions().installMod();
+ });
+ addAction(tr("Create empty mod"), [=]() {
+ view->actions().createEmptyMod();
+ });
+ addAction(tr("Create separator"), [=]() {
+ view->actions().createSeparator();
+ });
}
if (view->hasCollapsibleSeparators()) {
@@ -61,25 +77,32 @@ void ModListGlobalContextMenu::populate(OrganizerCore& core, ModListView* view,
addSeparator();
- QString enableTxt = tr("Enable all"),
- disableTxt = tr("Disable all");
+ QString enableTxt = tr("Enable all"), disableTxt = tr("Disable all");
if (view->isFilterActive()) {
- enableTxt = tr("Enable all matching mods");
+ enableTxt = tr("Enable all matching mods");
disableTxt = tr("Disable all matching mods");
}
- addAction(enableTxt, [=] { view->actions().setAllMatchingModsEnabled(true); });
- addAction(disableTxt, [=] { view->actions().setAllMatchingModsEnabled(false); });
+ addAction(enableTxt, [=] {
+ view->actions().setAllMatchingModsEnabled(true);
+ });
+ addAction(disableTxt, [=] {
+ view->actions().setAllMatchingModsEnabled(false);
+ });
- addAction(tr("Check for updates"), [=]() { view->actions().checkModsForUpdates(); });
+ addAction(tr("Check for updates"), [=]() {
+ view->actions().checkModsForUpdates();
+ });
addAction(tr("Refresh"), &core, &OrganizerCore::profileRefresh);
- addAction(tr("Export to csv..."), [=]() { view->actions().exportModListCSV(); });
+ addAction(tr("Export to csv..."), [=]() {
+ view->actions().exportModListCSV();
+ });
}
-
-ModListChangeCategoryMenu::ModListChangeCategoryMenu(CategoryFactory& categories, ModInfo::Ptr mod, QMenu* parent)
- : QMenu(tr("Change Categories"), parent)
+ModListChangeCategoryMenu::ModListChangeCategoryMenu(CategoryFactory& categories,
+ ModInfo::Ptr mod, QMenu* parent)
+ : QMenu(tr("Change Categories"), parent)
{
populate(this, categories, mod);
}
@@ -89,15 +112,15 @@ std::vector<std::pair<int, bool>> ModListChangeCategoryMenu::categories() const
return categories(this);
}
-std::vector<std::pair<int, bool>> ModListChangeCategoryMenu::categories(const QMenu* menu) const
+std::vector<std::pair<int, bool>>
+ModListChangeCategoryMenu::categories(const QMenu* menu) const
{
std::vector<std::pair<int, bool>> cats;
for (QAction* action : menu->actions()) {
if (action->menu() != nullptr) {
auto pcats = categories(action->menu());
cats.insert(cats.end(), pcats.begin(), pcats.end());
- }
- else {
+ } else {
QWidgetAction* widgetAction = qobject_cast<QWidgetAction*>(action);
if (widgetAction != nullptr) {
QCheckBox* checkbox = qobject_cast<QCheckBox*>(widgetAction->defaultWidget());
@@ -108,7 +131,8 @@ std::vector<std::pair<int, bool>> ModListChangeCategoryMenu::categories(const QM
return cats;
}
-bool ModListChangeCategoryMenu::populate(QMenu* menu, CategoryFactory& factory, ModInfo::Ptr mod, int targetId)
+bool ModListChangeCategoryMenu::populate(QMenu* menu, CategoryFactory& factory,
+ ModInfo::Ptr mod, int targetId)
{
const std::set<int>& categories = mod->getCategories();
@@ -145,28 +169,30 @@ bool ModListChangeCategoryMenu::populate(QMenu* menu, CategoryFactory& factory,
return childEnabled;
}
-ModListPrimaryCategoryMenu::ModListPrimaryCategoryMenu(CategoryFactory& categories, ModInfo::Ptr mod, QMenu* parent)
- : QMenu(tr("Primary Category"), parent)
+ModListPrimaryCategoryMenu::ModListPrimaryCategoryMenu(CategoryFactory& categories,
+ ModInfo::Ptr mod, QMenu* parent)
+ : QMenu(tr("Primary Category"), parent)
{
- connect(this, &QMenu::aboutToShow, [=]() { populate(categories, mod); });
+ connect(this, &QMenu::aboutToShow, [=]() {
+ populate(categories, mod);
+ });
}
-void ModListPrimaryCategoryMenu::populate(const CategoryFactory& factory, ModInfo::Ptr mod)
+void ModListPrimaryCategoryMenu::populate(const CategoryFactory& factory,
+ ModInfo::Ptr mod)
{
clear();
const std::set<int>& categories = mod->getCategories();
for (int categoryID : categories) {
- int catIdx = factory.getCategoryIndex(categoryID);
+ int catIdx = factory.getCategoryIndex(categoryID);
QWidgetAction* action = new QWidgetAction(this);
try {
- QRadioButton* categoryBox = new QRadioButton(
- factory.getCategoryName(catIdx).replace('&', "&&"),
- this);
+ QRadioButton* categoryBox =
+ new QRadioButton(factory.getCategoryName(catIdx).replace('&', "&&"), this);
categoryBox->setChecked(categoryID == mod->primaryCategory());
action->setDefaultWidget(categoryBox);
action->setData(categoryID);
- }
- catch (const std::exception& e) {
+ } catch (const std::exception& e) {
log::error("failed to create category checkbox: {}", e.what());
}
@@ -189,25 +215,22 @@ int ModListPrimaryCategoryMenu::primaryCategory() const
return -1;
}
-ModListContextMenu::ModListContextMenu(
- const QModelIndex& index, OrganizerCore& core, CategoryFactory& categories, ModListView* view) :
- QMenu(view)
- , m_core(core)
- , m_categories(categories)
- , m_index(index.model() == view->model() ? view->indexViewToModel(index) : index)
- , m_view(view)
- , m_actions(view->actions())
+ModListContextMenu::ModListContextMenu(const QModelIndex& index, OrganizerCore& core,
+ CategoryFactory& categories, ModListView* view)
+ : QMenu(view), m_core(core), m_categories(categories),
+ m_index(index.model() == view->model() ? view->indexViewToModel(index) : index),
+ m_view(view), m_actions(view->actions())
{
if (view->selectionModel()->hasSelection()) {
m_selected = view->indexViewToModel(view->selectionModel()->selectedRows());
- }
- else {
- m_selected = { index };
+ } else {
+ m_selected = {index};
}
ModInfo::Ptr info = ModInfo::getByIndex(index.data(ModList::IndexRole).toInt());
- QMenu* allMods = new ModListGlobalContextMenu(core, view, m_index, view->topLevelWidget());
+ QMenu* allMods =
+ new ModListGlobalContextMenu(core, view, m_index, view->topLevelWidget());
allMods->setTitle(tr("All Mods"));
addMenu(allMods);
@@ -228,23 +251,21 @@ ModListContextMenu::ModListContextMenu(
// Add type-specific items
if (info->isOverwrite()) {
addOverwriteActions(info);
- }
- else if (info->isBackup()) {
+ } else if (info->isBackup()) {
addBackupActions(info);
- }
- else if (info->isSeparator()) {
+ } else if (info->isSeparator()) {
addSeparatorActions(info);
- }
- else if (info->isForeign()) {
+ } else if (info->isForeign()) {
addForeignActions(info);
- }
- else {
+ } else {
addRegularActions(info);
}
// add information for all except foreign
if (!info->isForeign()) {
- QAction* infoAction = addAction(tr("Information..."), [=]() { view->actions().displayModInformation(m_index.data(ModList::IndexRole).toInt()); });
+ QAction* infoAction = addAction(tr("Information..."), [=]() {
+ view->actions().displayModInformation(m_index.data(ModList::IndexRole).toInt());
+ });
setDefaultAction(infoAction);
}
}
@@ -261,28 +282,26 @@ void ModListContextMenu::addMenuAsPushButton(QMenu* menu)
void ModListContextMenu::addSendToContextMenu()
{
static const std::vector overwritten_flags{
- ModInfo::EConflictFlag::FLAG_CONFLICT_MIXED,
- ModInfo::EConflictFlag::FLAG_CONFLICT_OVERWRITTEN,
- ModInfo::EConflictFlag::FLAG_CONFLICT_REDUNDANT
- };
+ ModInfo::EConflictFlag::FLAG_CONFLICT_MIXED,
+ ModInfo::EConflictFlag::FLAG_CONFLICT_OVERWRITTEN,
+ ModInfo::EConflictFlag::FLAG_CONFLICT_REDUNDANT};
static const std::vector overwrite_flags{
- ModInfo::EConflictFlag::FLAG_CONFLICT_MIXED,
- ModInfo::EConflictFlag::FLAG_CONFLICT_OVERWRITE
- };
+ ModInfo::EConflictFlag::FLAG_CONFLICT_MIXED,
+ ModInfo::EConflictFlag::FLAG_CONFLICT_OVERWRITE};
bool overwrite = false, overwritten = false;
for (auto& idx : m_selected) {
auto index = idx.data(ModList::IndexRole);
if (index.isValid()) {
- auto info = ModInfo::getByIndex(index.toInt());
+ auto info = ModInfo::getByIndex(index.toInt());
auto flags = info->getConflictFlags();
- if (std::find_first_of(flags.begin(), flags.end(),
- overwritten_flags.begin(), overwritten_flags.end()) != flags.end()) {
+ if (std::find_first_of(flags.begin(), flags.end(), overwritten_flags.begin(),
+ overwritten_flags.end()) != flags.end()) {
overwritten = true;
}
- if (std::find_first_of(flags.begin(), flags.end(),
- overwrite_flags.begin(), overwrite_flags.end()) != flags.end()) {
+ if (std::find_first_of(flags.begin(), flags.end(), overwrite_flags.begin(),
+ overwrite_flags.end()) != flags.end()) {
overwrite = true;
}
}
@@ -290,28 +309,42 @@ void ModListContextMenu::addSendToContextMenu()
QMenu* menu = new QMenu(m_view);
menu->setTitle(tr("Send to... "));
- menu->addAction(tr("Lowest priority"), [this] { m_actions.sendModsToTop(m_selected); });
- menu->addAction(tr("Highest priority"), [this] { m_actions.sendModsToBottom(m_selected); });
- menu->addAction(tr("Priority..."), [this] { m_actions.sendModsToPriority(m_selected); });
- menu->addAction(tr("Separator..."), [this] { m_actions.sendModsToSeparator(m_selected); });
+ menu->addAction(tr("Lowest priority"), [this] {
+ m_actions.sendModsToTop(m_selected);
+ });
+ menu->addAction(tr("Highest priority"), [this] {
+ m_actions.sendModsToBottom(m_selected);
+ });
+ menu->addAction(tr("Priority..."), [this] {
+ m_actions.sendModsToPriority(m_selected);
+ });
+ menu->addAction(tr("Separator..."), [this] {
+ m_actions.sendModsToSeparator(m_selected);
+ });
if (overwrite) {
- menu->addAction(tr("First conflict"), [this] { m_actions.sendModsToFirstConflict(m_selected); });
+ menu->addAction(tr("First conflict"), [this] {
+ m_actions.sendModsToFirstConflict(m_selected);
+ });
}
if (overwritten) {
- menu->addAction(tr("Last conflict"), [this] { m_actions.sendModsToLastConflict(m_selected); });
+ menu->addAction(tr("Last conflict"), [this] {
+ m_actions.sendModsToLastConflict(m_selected);
+ });
}
addMenu(menu);
}
void ModListContextMenu::addCategoryContextMenus(ModInfo::Ptr mod)
{
- ModListChangeCategoryMenu* categoriesMenu = new ModListChangeCategoryMenu(m_categories, mod, this);
+ ModListChangeCategoryMenu* categoriesMenu =
+ new ModListChangeCategoryMenu(m_categories, mod, this);
connect(categoriesMenu, &QMenu::aboutToHide, [=]() {
m_actions.setCategories(m_selected, m_index, categoriesMenu->categories());
});
addMenuAsPushButton(categoriesMenu);
- ModListPrimaryCategoryMenu* primaryCategoryMenu = new ModListPrimaryCategoryMenu(m_categories, mod, this);
+ ModListPrimaryCategoryMenu* primaryCategoryMenu =
+ new ModListPrimaryCategoryMenu(m_categories, mod, this);
connect(primaryCategoryMenu, &QMenu::aboutToHide, [=]() {
int category = primaryCategoryMenu->primaryCategory();
if (category != -1) {
@@ -324,12 +357,22 @@ void ModListContextMenu::addCategoryContextMenus(ModInfo::Ptr mod)
void ModListContextMenu::addOverwriteActions(ModInfo::Ptr mod)
{
if (QDir(mod->absolutePath()).count() > 2) {
- addAction(tr("Sync to Mods..."), [=]() { m_core.syncOverwrite(); });
- addAction(tr("Create Mod..."), [=]() { m_actions.createModFromOverwrite(); });
- addAction(tr("Move content to Mod..."), [=]() { m_actions.moveOverwriteContentToExistingMod(); });
- addAction(tr("Clear Overwrite..."), [=]() { m_actions.clearOverwrite(); });
+ addAction(tr("Sync to Mods..."), [=]() {
+ m_core.syncOverwrite();
+ });
+ addAction(tr("Create Mod..."), [=]() {
+ m_actions.createModFromOverwrite();
+ });
+ addAction(tr("Move content to Mod..."), [=]() {
+ m_actions.moveOverwriteContentToExistingMod();
+ });
+ addAction(tr("Clear Overwrite..."), [=]() {
+ m_actions.clearOverwrite();
+ });
}
- addAction(tr("Open in Explorer"), [=]() { m_actions.openExplorer(m_selected); });
+ addAction(tr("Open in Explorer"), [=]() {
+ m_actions.openExplorer(m_selected);
+ });
}
void ModListContextMenu::addSeparatorActions(ModInfo::Ptr mod)
@@ -337,19 +380,26 @@ void ModListContextMenu::addSeparatorActions(ModInfo::Ptr mod)
addCategoryContextMenus(mod);
addSeparator();
-
- addAction(tr("Rename Separator..."), [=]() { m_actions.renameMod(m_index); });
- addAction(tr("Remove Separator..."), [=]() { m_actions.removeMods(m_selected); });
+ addAction(tr("Rename Separator..."), [=]() {
+ m_actions.renameMod(m_index);
+ });
+ addAction(tr("Remove Separator..."), [=]() {
+ m_actions.removeMods(m_selected);
+ });
addSeparator();
if (m_view->sortColumn() == ModList::COL_PRIORITY) {
addSendToContextMenu();
addSeparator();
}
- addAction(tr("Select Color..."), [=]() { m_actions.setColor(m_selected, m_index); });
+ addAction(tr("Select Color..."), [=]() {
+ m_actions.setColor(m_selected, m_index);
+ });
if (mod->color().isValid()) {
- addAction(tr("Reset Color"), [=]() { m_actions.resetColor(m_selected); });
+ addAction(tr("Reset Color"), [=]() {
+ m_actions.resetColor(m_selected);
+ });
}
addSeparator();
@@ -365,26 +415,41 @@ void ModListContextMenu::addForeignActions(ModInfo::Ptr mod)
void ModListContextMenu::addBackupActions(ModInfo::Ptr mod)
{
auto flags = mod->getFlags();
- addAction(tr("Restore Backup"), [=]() { m_actions.restoreBackup(m_index); });
- addAction(tr("Remove Backup..."), [=]() { m_actions.removeMods(m_selected); });
+ addAction(tr("Restore Backup"), [=]() {
+ m_actions.restoreBackup(m_index);
+ });
+ addAction(tr("Remove Backup..."), [=]() {
+ m_actions.removeMods(m_selected);
+ });
addSeparator();
if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_INVALID) != flags.end()) {
- addAction(tr("Ignore missing data"), [=]() { m_actions.ignoreMissingData(m_selected); });
+ addAction(tr("Ignore missing data"), [=]() {
+ m_actions.ignoreMissingData(m_selected);
+ });
}
- if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_ALTERNATE_GAME) != flags.end()) {
- addAction(tr("Mark as converted/working"), [=]() { m_actions.markConverted(m_selected); });
+ if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_ALTERNATE_GAME) !=
+ flags.end()) {
+ addAction(tr("Mark as converted/working"), [=]() {
+ m_actions.markConverted(m_selected);
+ });
}
addSeparator();
if (mod->nexusId() > 0) {
- addAction(tr("Visit on Nexus"), [=]() { m_actions.visitOnNexus(m_selected); });
+ addAction(tr("Visit on Nexus"), [=]() {
+ m_actions.visitOnNexus(m_selected);
+ });
}
const auto url = mod->parseCustomURL();
if (url.isValid()) {
- addAction(tr("Visit on %1").arg(url.host()), [=]() { m_actions.visitWebPage(m_selected); });
+ addAction(tr("Visit on %1").arg(url.host()), [=]() {
+ m_actions.visitWebPage(m_selected);
+ });
}
- addAction(tr("Open in Explorer"), [=]() { m_actions.openExplorer(m_selected); });
+ addAction(tr("Open in Explorer"), [=]() {
+ m_actions.openExplorer(m_selected);
+ });
}
void ModListContextMenu::addRegularActions(ModInfo::Ptr mod)
@@ -395,47 +460,72 @@ void ModListContextMenu::addRegularActions(ModInfo::Ptr mod)
addSeparator();
if (mod->downgradeAvailable()) {
- addAction(tr("Change versioning scheme"), [=]() { m_actions.changeVersioningScheme(m_index); });
+ addAction(tr("Change versioning scheme"), [=]() {
+ m_actions.changeVersioningScheme(m_index);
+ });
}
if (mod->nexusId() > 0)
- addAction(tr("Force-check updates"), [=]() { m_actions.checkModsForUpdates(m_selected); });
+ addAction(tr("Force-check updates"), [=]() {
+ m_actions.checkModsForUpdates(m_selected);
+ });
if (mod->updateIgnored()) {
- addAction(tr("Un-ignore update"), [=]() { m_actions.setIgnoreUpdate(m_selected, false); });
- }
- else {
+ addAction(tr("Un-ignore update"), [=]() {
+ m_actions.setIgnoreUpdate(m_selected, false);
+ });
+ } else {
if (mod->updateAvailable() || mod->downgradeAvailable()) {
- addAction(tr("Ignore update"), [=]() { m_actions.setIgnoreUpdate(m_selected, true); });
+ addAction(tr("Ignore update"), [=]() {
+ m_actions.setIgnoreUpdate(m_selected, true);
+ });
}
}
addSeparator();
- addAction(tr("Enable selected"), [=]() { m_core.modList()->setActive(m_selected, true); });
- addAction(tr("Disable selected"), [=]() { m_core.modList()->setActive(m_selected, false); });
+ addAction(tr("Enable selected"), [=]() {
+ m_core.modList()->setActive(m_selected, true);
+ });
+ addAction(tr("Disable selected"), [=]() {
+ m_core.modList()->setActive(m_selected, false);
+ });
addSeparator();
-
if (m_view->sortColumn() == ModList::COL_PRIORITY) {
addSendToContextMenu();
addSeparator();
}
- addAction(tr("Rename Mod..."), [=]() { m_actions.renameMod(m_index); });
- addAction(tr("Reinstall Mod"), [=]() { m_actions.reinstallMod(m_index); });
- addAction(tr("Remove Mod..."), [=]() { m_actions.removeMods(m_selected); });
- addAction(tr("Create Backup"), [=]() { m_actions.createBackup(m_index); });
+ addAction(tr("Rename Mod..."), [=]() {
+ m_actions.renameMod(m_index);
+ });
+ addAction(tr("Reinstall Mod"), [=]() {
+ m_actions.reinstallMod(m_index);
+ });
+ addAction(tr("Remove Mod..."), [=]() {
+ m_actions.removeMods(m_selected);
+ });
+ addAction(tr("Create Backup"), [=]() {
+ m_actions.createBackup(m_index);
+ });
- if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_HIDDEN_FILES) != flags.end()) {
- addAction(tr("Restore hidden files"), [=]() { m_actions.restoreHiddenFiles(m_selected); });
+ if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_HIDDEN_FILES) !=
+ flags.end()) {
+ addAction(tr("Restore hidden files"), [=]() {
+ m_actions.restoreHiddenFiles(m_selected);
+ });
}
addSeparator();
if (m_index.column() == ModList::COL_NOTES) {
- addAction(tr("Select Color..."), [=]() { m_actions.setColor(m_selected, m_index); });
+ addAction(tr("Select Color..."), [=]() {
+ m_actions.setColor(m_selected, m_index);
+ });
if (mod->color().isValid()) {
- addAction(tr("Reset Color"), [=]() { m_actions.resetColor(m_selected); });
+ addAction(tr("Reset Color"), [=]() {
+ m_actions.resetColor(m_selected);
+ });
}
addSeparator();
}
@@ -443,14 +533,22 @@ void ModListContextMenu::addRegularActions(ModInfo::Ptr mod)
if (mod->nexusId() > 0 && Settings::instance().nexus().endorsementIntegration()) {
switch (mod->endorsedState()) {
case EndorsedState::ENDORSED_TRUE: {
- addAction(tr("Un-Endorse"), [=]() { m_actions.setEndorsed(m_selected, false); });
+ addAction(tr("Un-Endorse"), [=]() {
+ m_actions.setEndorsed(m_selected, false);
+ });
} break;
case EndorsedState::ENDORSED_FALSE: {
- addAction(tr("Endorse"), [=]() { m_actions.setEndorsed(m_selected, true); });
- addAction(tr("Won't endorse"), [=]() { m_actions.willNotEndorsed(m_selected); });
+ addAction(tr("Endorse"), [=]() {
+ m_actions.setEndorsed(m_selected, true);
+ });
+ addAction(tr("Won't endorse"), [=]() {
+ m_actions.willNotEndorsed(m_selected);
+ });
} break;
case EndorsedState::ENDORSED_NEVER: {
- addAction(tr("Endorse"), [=]() { m_actions.setEndorsed(m_selected, true); });
+ addAction(tr("Endorse"), [=]() {
+ m_actions.setEndorsed(m_selected, true);
+ });
} break;
default: {
QAction* action = new QAction(tr("Endorsement state unknown"), this);
@@ -463,10 +561,14 @@ void ModListContextMenu::addRegularActions(ModInfo::Ptr mod)
if (mod->nexusId() > 0 && Settings::instance().nexus().trackedIntegration()) {
switch (mod->trackedState()) {
case TrackedState::TRACKED_FALSE: {
- addAction(tr("Start tracking"), [=]() { m_actions.setTracked(m_selected, true); });
+ addAction(tr("Start tracking"), [=]() {
+ m_actions.setTracked(m_selected, true);
+ });
} break;
case TrackedState::TRACKED_TRUE: {
- addAction(tr("Stop tracking"), [=]() { m_actions.setTracked(m_selected, false); });
+ addAction(tr("Stop tracking"), [=]() {
+ m_actions.setTracked(m_selected, false);
+ });
} break;
default: {
QAction* action = new QAction(tr("Tracked state unknown"), this);
@@ -479,23 +581,34 @@ void ModListContextMenu::addRegularActions(ModInfo::Ptr mod)
addSeparator();
if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_INVALID) != flags.end()) {
- addAction(tr("Ignore missing data"), [=]() { m_actions.ignoreMissingData(m_selected); });
+ addAction(tr("Ignore missing data"), [=]() {
+ m_actions.ignoreMissingData(m_selected);
+ });
}
- if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_ALTERNATE_GAME) != flags.end()) {
- addAction(tr("Mark as converted/working"), [=]() { m_actions.markConverted(m_selected); });
+ if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_ALTERNATE_GAME) !=
+ flags.end()) {
+ addAction(tr("Mark as converted/working"), [=]() {
+ m_actions.markConverted(m_selected);
+ });
}
addSeparator();
if (mod->nexusId() > 0) {
- addAction(tr("Visit on Nexus"), [=]() { m_actions.visitOnNexus(m_selected); });
+ addAction(tr("Visit on Nexus"), [=]() {
+ m_actions.visitOnNexus(m_selected);
+ });
}
const auto url = mod->parseCustomURL();
if (url.isValid()) {
- addAction(tr("Visit on %1").arg(url.host()), [=]() { m_actions.visitWebPage(m_selected); });
+ addAction(tr("Visit on %1").arg(url.host()), [=]() {
+ m_actions.visitWebPage(m_selected);
+ });
}
- addAction(tr("Open in Explorer"), [=]() { m_actions.openExplorer(m_selected); });
+ addAction(tr("Open in Explorer"), [=]() {
+ m_actions.openExplorer(m_selected);
+ });
}