From 4c5e3da2334a1d0c474148be8881b46d6ca6d3fa Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Mon, 17 Aug 2020 05:06:26 -0400
Subject: moved nexus api stuff to GlobalSettings pass a pointer to Settings
around for things that can be called without settings, when creating the
first instance added dummy plugin list, mod list and iorganizer to initialize
plugins without an instance moved PluginContainer into the core filter, had
nothing to do with the plugins list NexusInterface is now created manually
instead of being a static singleton because it needs to know if the settings
are available
---
src/main.cpp | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
(limited to 'src/main.cpp')
diff --git a/src/main.cpp b/src/main.cpp
index 93580931..fd5a47c9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -26,6 +26,7 @@ along with Mod Organizer. If not, see .
#include "nxmaccessmanager.h"
#include "instancemanager.h"
#include "instancemanagerdialog.h"
+#include "createinstancedialog.h"
#include "organizercore.h"
#include "env.h"
#include "envmodule.h"
@@ -329,6 +330,9 @@ int runApplication(
// this must outlive `organizer`
std::unique_ptr pluginContainer;
+ log::debug("initializing nexus interface");
+ NexusInterface ni(&settings);
+
log::debug("initializing core");
OrganizerCore organizer(settings);
if (!organizer.bootstrap()) {
@@ -394,8 +398,8 @@ int runApplication(
auto splash = createSplash(settings, dataPath, game);
QString apiKey;
- if (settings.nexus().apiKey(apiKey)) {
- NexusInterface::instance().getAccessManager()->apiCheck(apiKey);
+ if (GlobalSettings::nexusApiKey(apiKey)) {
+ ni.getAccessManager()->apiCheck(apiKey);
}
log::debug("initializing tutorials");
@@ -415,8 +419,7 @@ int runApplication(
// set up main window and its data structures
MainWindow mainWindow(settings, organizer, *pluginContainer);
- NexusInterface::instance()
- .getAccessManager()->setTopLevelWidget(&mainWindow);
+ ni.getAccessManager()->setTopLevelWidget(&mainWindow);
QObject::connect(&mainWindow, SIGNAL(styleChanged(QString)), &application,
SLOT(setStyleFile(QString)));
@@ -443,8 +446,7 @@ int runApplication(
res = application.exec();
mainWindow.close();
- NexusInterface::instance()
- .getAccessManager()->setTopLevelWidget(nullptr);
+ ni.getAccessManager()->setTopLevelWidget(nullptr);
}
settings.geometry().resetIfNeeded();
@@ -507,6 +509,7 @@ QString determineDataPath(const cl::CommandLine& cl)
}
}
+
int doOneRun(
cl::CommandLine& cl, MOApplication& application, SingleInstance& instance)
{
@@ -515,6 +518,18 @@ int doOneRun(
// resets things when MO is "restarted"
resetForRestart(cl);
+
+ //{
+ // NexusInterface ni(nullptr);
+ //
+ // PluginContainer pc(nullptr);
+ // pc.loadPlugins();
+ //
+ // CreateInstanceDialog dlg(pc, nullptr);
+ // dlg.exec();
+ //}
+
+
const QString dataPath = determineDataPath(cl);
if (dataPath.isEmpty()) {
return 1;
--
cgit v1.3.1