summaryrefslogtreecommitdiff
path: root/src/modlist.cpp
diff options
context:
space:
mode:
authorJeremy Rimpo <jeremy.rimpo@servermonkey.com>2023-09-23 19:00:41 -0500
committerJeremy Rimpo <jeremy.rimpo@servermonkey.com>2023-09-23 19:00:41 -0500
commite22331fa0305d8a0a2b8b6d37203dac1ed3524e9 (patch)
tree3231affb718494c342fc6197bae2b784fde9fd21 /src/modlist.cpp
parent31a85a3db5fcb34b36dc6ed6f56a351a5dcb319a (diff)
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
Diffstat (limited to 'src/modlist.cpp')
-rw-r--r--src/modlist.cpp18
1 files changed, 9 insertions, 9 deletions
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<int> 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<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()) {
@@ -455,8 +455,8 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const
}
try {
categoryString << "<span style=\"white-space: nowrap;\"><i>"
- << ToWString(categoryFactory->getCategoryName(
- categoryFactory->getCategoryIndex(*catIter)))
+ << ToWString(categoryFactory.getCategoryName(
+ categoryFactory.getCategoryIndex(*catIter)))
<< "</font></span>";
} catch (const std::exception& e) {
log::error("failed to generate tooltip: {}", e.what());