diff options
Diffstat (limited to 'src/modlist.cpp')
| -rw-r--r-- | src/modlist.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp index 7a951369..41d679d9 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(); @@ -285,11 +285,10 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const } else if (role == GroupingRole) { if (column == COL_CATEGORY) { QVariantList categoryNames; - std::set<int> categories = modInfo->getCategories(); - CategoryFactory& categoryFactory = CategoryFactory::instance(); + std::set<int> categories = modInfo->getCategories(); + CategoryFactory* categoryFactory = CategoryFactory::instance(); for (auto iter = categories.begin(); iter != categories.end(); ++iter) { - categoryNames.append( - categoryFactory.getCategoryName(categoryFactory.getCategoryIndex(*iter))); + categoryNames.append(categoryFactory->getCategoryName(categoryFactory->getCategoryIndex(*iter))); } if (categoryNames.count() != 0) { return categoryNames; @@ -447,17 +446,14 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const const std::set<int>& categories = modInfo->getCategories(); std::wostringstream categoryString; categoryString << ToWString(tr("Categories: <br>")); - CategoryFactory& categoryFactory = CategoryFactory::instance(); + CategoryFactory* categoryFactory = CategoryFactory::instance(); for (std::set<int>::const_iterator catIter = categories.begin(); catIter != categories.end(); ++catIter) { if (catIter != categories.begin()) { categoryString << " , "; } try { - categoryString << "<span style=\"white-space: nowrap;\"><i>" - << ToWString(categoryFactory.getCategoryName( - categoryFactory.getCategoryIndex(*catIter))) - << "</font></span>"; + categoryString << "<span style=\"white-space: nowrap;\"><i>" << ToWString(categoryFactory->getCategoryName(categoryFactory->getCategoryIndex(*catIter))) << "</font></span>"; } catch (const std::exception& e) { log::error("failed to generate tooltip: {}", e.what()); return QString(); |
