From e22331fa0305d8a0a2b8b6d37203dac1ed3524e9 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Sat, 23 Sep 2023 19:00:41 -0500 Subject: Restructure category refresh action - Remove plugins class - Route signals to run Nexus API call from MainWindow - Pass Dialog instance to route response data - Revert CategoryFactory::instance to return reference --- src/modlist.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/modlist.cpp') diff --git a/src/modlist.cpp b/src/modlist.cpp index 9f64cc71..7a951369 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -232,11 +232,11 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const } else { int category = modInfo->primaryCategory(); if (category != -1) { - CategoryFactory* categoryFactory = CategoryFactory::instance(); - if (categoryFactory->categoryExists(category)) { + CategoryFactory& categoryFactory = CategoryFactory::instance(); + if (categoryFactory.categoryExists(category)) { try { - int categoryIdx = categoryFactory->getCategoryIndex(category); - return categoryFactory->getCategoryName(categoryIdx); + int categoryIdx = categoryFactory.getCategoryIndex(category); + return categoryFactory.getCategoryName(categoryIdx); } catch (const std::exception& e) { log::error("failed to retrieve category name: {}", e.what()); return QString(); @@ -286,10 +286,10 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const if (column == COL_CATEGORY) { QVariantList categoryNames; std::set categories = modInfo->getCategories(); - CategoryFactory* categoryFactory = CategoryFactory::instance(); + CategoryFactory& categoryFactory = CategoryFactory::instance(); for (auto iter = categories.begin(); iter != categories.end(); ++iter) { categoryNames.append( - categoryFactory->getCategoryName(categoryFactory->getCategoryIndex(*iter))); + categoryFactory.getCategoryName(categoryFactory.getCategoryIndex(*iter))); } if (categoryNames.count() != 0) { return categoryNames; @@ -447,7 +447,7 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const const std::set& categories = modInfo->getCategories(); std::wostringstream categoryString; categoryString << ToWString(tr("Categories:
")); - CategoryFactory* categoryFactory = CategoryFactory::instance(); + CategoryFactory& categoryFactory = CategoryFactory::instance(); for (std::set::const_iterator catIter = categories.begin(); catIter != categories.end(); ++catIter) { if (catIter != categories.begin()) { @@ -455,8 +455,8 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const } try { categoryString << "" - << ToWString(categoryFactory->getCategoryName( - categoryFactory->getCategoryIndex(*catIter))) + << ToWString(categoryFactory.getCategoryName( + categoryFactory.getCategoryIndex(*catIter))) << ""; } catch (const std::exception& e) { log::error("failed to generate tooltip: {}", e.what()); -- cgit v1.3.1