summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-08-17 05:06:26 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2020-11-03 11:39:08 -0500
commit4c5e3da2334a1d0c474148be8881b46d6ca6d3fa (patch)
tree188be5f54644cc5e432f957fe5bf406d372e5e80 /src/main.cpp
parentee53312652af10fbddb5d1d16db6212bca2b9665 (diff)
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
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp27
1 files changed, 21 insertions, 6 deletions
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 <http://www.gnu.org/licenses/>.
#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> 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;