summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/categoriesdialog.cpp7
-rw-r--r--src/filterlist.cpp2
-rw-r--r--src/mainwindow.cpp6
-rw-r--r--src/moapplication.cpp2
-rw-r--r--src/modinfo.cpp2
-rw-r--r--src/modlistcontextmenu.cpp26
-rw-r--r--src/modlistcontextmenu.h12
-rw-r--r--src/modlistview.cpp2
8 files changed, 32 insertions, 27 deletions
diff --git a/src/categoriesdialog.cpp b/src/categoriesdialog.cpp
index 3f4ea034..4019f197 100644
--- a/src/categoriesdialog.cpp
+++ b/src/categoriesdialog.cpp
@@ -256,8 +256,9 @@ void CategoriesDialog::removeCategory_clicked()
void CategoriesDialog::nexusRefresh_clicked()
{
- NexusInterface *nexus = NexusInterface::instance(m_PluginContainer);
- nexus->requestGameInfo(Settings::instance().game().plugin()->gameShortName(), this, QVariant(), QString());
+ NexusInterface &nexus = NexusInterface::instance();
+ nexus.setPluginContainer(m_PluginContainer);
+ nexus.requestGameInfo(Settings::instance().game().plugin()->gameShortName(), this, QVariant(), QString());
}
@@ -307,7 +308,7 @@ void CategoriesDialog::nxmGameInfoAvailable(QString gameName, QVariant, QVariant
{
QVariantMap result = resultData.toMap();
QVariantList categories = result["categories"].toList();
- auto catFactory = CategoryFactory::instance();
+ CategoryFactory *catFactory = CategoryFactory::instance();
QListWidget* list = ui->nexusCategoryList;
list->clear();
for (auto category : categories) {
diff --git a/src/filterlist.cpp b/src/filterlist.cpp
index 45dab109..ba0671a7 100644
--- a/src/filterlist.cpp
+++ b/src/filterlist.cpp
@@ -426,7 +426,7 @@ void FilterList::checkCriteria()
void FilterList::editCategories()
{
- CategoriesDialog dialog(m_pluginContainer, qApp->activeWindow());
+ CategoriesDialog dialog(&m_core.pluginContainer(), qApp->activeWindow());
if (dialog.exec() == QDialog::Accepted) {
dialog.commitChanges();
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 76b7e37f..0521a17c 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -303,6 +303,8 @@ MainWindow::MainWindow(Settings& settings, OrganizerCore& organizerCore,
m_Filters.get(), &FilterList::optionsChanged,
[&](auto&& mode, auto&& sep) { onFiltersOptions(mode, sep); });
+ m_CategoryFactory->loadCategories();
+
ui->logList->setCore(m_OrganizerCore);
setupToolbar();
@@ -421,6 +423,8 @@ MainWindow::MainWindow(Settings& settings, OrganizerCore& organizerCore,
connect(CategoryFactory::instance(), SIGNAL(requestNexusCategories()), this, SLOT(requestNexusCategories()));
+ connect(CategoryFactory::instance(), SIGNAL(requestNexusCategories()), this, SLOT(requestNexusCategories()));
+
connect(
NexusInterface::instance(&pluginContainer)->getAccessManager(),
SIGNAL(credentialsReceived(const APIUserAccount&)),
@@ -552,7 +556,7 @@ MainWindow::MainWindow(Settings& settings, OrganizerCore& organizerCore,
void MainWindow::setupModList()
{
- ui->modList->setup(m_OrganizerCore, m_CategoryFactory, this, ui);
+ ui->modList->setup(m_OrganizerCore, *m_CategoryFactory, this, ui);
connect(&ui->modList->actions(), &ModListViewActions::overwriteCleared, [=]() {
scheduleCheckForProblems();
diff --git a/src/moapplication.cpp b/src/moapplication.cpp
index e131d3d9..7e95217e 100644
--- a/src/moapplication.cpp
+++ b/src/moapplication.cpp
@@ -296,7 +296,7 @@ int MOApplication::setup(MOMultiProcess& multiProcess, bool forceSelect)
m_instance->gamePlugin()->steamAPPId(),
m_instance->gamePlugin()->gameDirectory().absolutePath());
- CategoryFactory::instance().loadCategories();
+ CategoryFactory::instance()->loadCategories();
m_core->updateExecutablesList();
m_core->updateModInfoFromDisc();
m_core->setCurrentProfile(m_instance->profileName());
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 68c8ea9e..5ef36ef0 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -549,7 +549,7 @@ bool ModInfo::categorySet(int categoryID) const
for (std::set<int>::const_iterator iter = m_Categories.begin();
iter != m_Categories.end(); ++iter) {
if ((*iter == categoryID) ||
- (CategoryFactory::instance()->isDecendantOf(*iter, categoryID))) {
+ (CategoryFactory::instance()->isDescendantOf(*iter, categoryID))) {
return true;
}
}
diff --git a/src/modlistcontextmenu.cpp b/src/modlistcontextmenu.cpp
index e88cadc8..8c9c0206 100644
--- a/src/modlistcontextmenu.cpp
+++ b/src/modlistcontextmenu.cpp
@@ -100,7 +100,7 @@ void ModListGlobalContextMenu::populate(OrganizerCore& core, ModListView* view,
});
}
-ModListChangeCategoryMenu::ModListChangeCategoryMenu(CategoryFactory& categories,
+ModListChangeCategoryMenu::ModListChangeCategoryMenu(CategoryFactory* categories,
ModInfo::Ptr mod, QMenu* parent)
: QMenu(tr("Change Categories"), parent)
{
@@ -131,24 +131,24 @@ ModListChangeCategoryMenu::categories(const QMenu* menu) const
return cats;
}
-bool ModListChangeCategoryMenu::populate(QMenu* menu, CategoryFactory& factory,
+bool ModListChangeCategoryMenu::populate(QMenu* menu, CategoryFactory* factory,
ModInfo::Ptr mod, int targetId)
{
const std::set<int>& categories = mod->getCategories();
bool childEnabled = false;
- for (unsigned int i = 1; i < factory.numCategories(); ++i) {
- if (factory.getParentID(i) == targetId) {
+ for (unsigned int i = 1; i < factory->numCategories(); ++i) {
+ if (factory->getParentID(i) == targetId) {
QMenu* targetMenu = menu;
- if (factory.hasChildren(i)) {
- targetMenu = menu->addMenu(factory.getCategoryName(i).replace('&', "&&"));
+ if (factory->hasChildren(i)) {
+ targetMenu = menu->addMenu(factory->getCategoryName(i).replace('&', "&&"));
}
- int id = factory.getCategoryID(i);
+ int id = factory->getCategoryID(i);
QScopedPointer<QCheckBox> checkBox(new QCheckBox(targetMenu));
bool enabled = categories.find(id) != categories.end();
- checkBox->setText(factory.getCategoryName(i).replace('&', "&&"));
+ checkBox->setText(factory->getCategoryName(i).replace('&', "&&"));
if (enabled) {
childEnabled = true;
}
@@ -159,8 +159,8 @@ bool ModListChangeCategoryMenu::populate(QMenu* menu, CategoryFactory& factory,
checkableAction->setData(id);
targetMenu->addAction(checkableAction.take());
- if (factory.hasChildren(i)) {
- if (populate(targetMenu, factory, mod, factory.getCategoryID(i)) || enabled) {
+ if (factory->hasChildren(i)) {
+ if (populate(targetMenu, factory, mod, factory->getCategoryID(i)) || enabled) {
targetMenu->setIcon(QIcon(":/MO/gui/resources/check.png"));
}
}
@@ -169,7 +169,7 @@ bool ModListChangeCategoryMenu::populate(QMenu* menu, CategoryFactory& factory,
return childEnabled;
}
-ModListPrimaryCategoryMenu::ModListPrimaryCategoryMenu(CategoryFactory& categories,
+ModListPrimaryCategoryMenu::ModListPrimaryCategoryMenu(CategoryFactory* categories,
ModInfo::Ptr mod, QMenu* parent)
: QMenu(tr("Primary Category"), parent)
{
@@ -178,7 +178,7 @@ ModListPrimaryCategoryMenu::ModListPrimaryCategoryMenu(CategoryFactory& categori
});
}
-void ModListPrimaryCategoryMenu::populate(const CategoryFactory& factory,
+void ModListPrimaryCategoryMenu::populate(const CategoryFactory* factory,
ModInfo::Ptr mod)
{
clear();
@@ -216,7 +216,7 @@ int ModListPrimaryCategoryMenu::primaryCategory() const
}
ModListContextMenu::ModListContextMenu(const QModelIndex& index, OrganizerCore& core,
- CategoryFactory& categories, ModListView* view)
+ 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())
diff --git a/src/modlistcontextmenu.h b/src/modlistcontextmenu.h
index 320ece93..c2fe5bbf 100644
--- a/src/modlistcontextmenu.h
+++ b/src/modlistcontextmenu.h
@@ -36,7 +36,7 @@ class ModListChangeCategoryMenu : public QMenu
{
Q_OBJECT
public:
- ModListChangeCategoryMenu(CategoryFactory& categories, ModInfo::Ptr mod,
+ ModListChangeCategoryMenu(CategoryFactory* categories, ModInfo::Ptr mod,
QMenu* parent = nullptr);
// return a list of pair <category id, enabled> from the menu
@@ -47,7 +47,7 @@ private:
// populate the tree with the category, using the enabled/disabled state from the
// given mod
//
- bool populate(QMenu* menu, CategoryFactory& categories, ModInfo::Ptr mod,
+ bool populate(QMenu* menu, CategoryFactory* categories, ModInfo::Ptr mod,
int targetId = 0);
// internal implementation of categories() for recursion
@@ -59,7 +59,7 @@ class ModListPrimaryCategoryMenu : public QMenu
{
Q_OBJECT
public:
- ModListPrimaryCategoryMenu(CategoryFactory& categories, ModInfo::Ptr mod,
+ ModListPrimaryCategoryMenu(CategoryFactory* categories, ModInfo::Ptr mod,
QMenu* parent = nullptr);
// return the selected primary category
@@ -69,7 +69,7 @@ public:
private:
// populate the categories
//
- void populate(const CategoryFactory& categories, ModInfo::Ptr mod);
+ void populate(const CategoryFactory* categories, ModInfo::Ptr mod);
};
class ModListContextMenu : public QMenu
@@ -81,7 +81,7 @@ public:
// valid
//
ModListContextMenu(const QModelIndex& index, OrganizerCore& core,
- CategoryFactory& categories, ModListView* modListView);
+ CategoryFactory* categories, ModListView* modListView);
private:
// adds the "Send to... " context menu
@@ -105,7 +105,7 @@ private:
void addRegularActions(ModInfo::Ptr mod);
OrganizerCore& m_core;
- CategoryFactory& m_categories;
+ CategoryFactory* m_categories;
QModelIndex m_index;
QModelIndexList m_selected;
ModListView* m_view;
diff --git a/src/modlistview.cpp b/src/modlistview.cpp
index 73bbd33d..944825fa 100644
--- a/src/modlistview.cpp
+++ b/src/modlistview.cpp
@@ -970,7 +970,7 @@ void ModListView::onCustomContextMenuRequested(const QPoint& pos)
// no selection
ModListGlobalContextMenu(*m_core, this).exec(viewport()->mapToGlobal(pos));
} else {
- ModListContextMenu(contextIdx, *m_core, *m_categories, this)
+ ModListContextMenu(contextIdx, *m_core, m_categories, this)
.exec(viewport()->mapToGlobal(pos));
}
} catch (const std::exception& e) {