diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-08-17 05:06:26 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-03 11:39:08 -0500 |
| commit | 4c5e3da2334a1d0c474148be8881b46d6ca6d3fa (patch) | |
| tree | 188be5f54644cc5e432f957fe5bf406d372e5e80 /src/nexusinterface.cpp | |
| parent | ee53312652af10fbddb5d1d16db6212bca2b9665 (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/nexusinterface.cpp')
| -rw-r--r-- | src/nexusinterface.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index 396cec11..1364d7e1 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -23,6 +23,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "nxmaccessmanager.h" #include "selectiondialog.h" #include "bbcode.h" +#include "settings.h" #include <utility.h> #include "shared/util.h" #include <log.h> @@ -235,31 +236,42 @@ APILimits NexusInterface::parseLimits( } -NexusInterface::NexusInterface() +static NexusInterface* g_instance = nullptr; + +NexusInterface::NexusInterface(Settings* s) : m_PluginContainer(nullptr) { + MO_ASSERT(!g_instance); + g_instance = this; + m_User.limits(defaultAPILimits()); m_MOVersion = createVersionInfo(); - m_AccessManager = new NXMAccessManager(this, m_MOVersion.displayString(3)); + m_AccessManager = new NXMAccessManager( + this, s, m_MOVersion.displayString(3)); + m_DiskCache = new QNetworkDiskCache(this); + connect(m_AccessManager, SIGNAL(requestNXMDownload(QString)), this, SLOT(downloadRequestedNXM(QString))); } -NXMAccessManager *NexusInterface::getAccessManager() +NexusInterface::~NexusInterface() { - return m_AccessManager; + cleanup(); + + MO_ASSERT(g_instance == this); + g_instance = nullptr; } -NexusInterface::~NexusInterface() +NXMAccessManager *NexusInterface::getAccessManager() { - cleanup(); + return m_AccessManager; } NexusInterface& NexusInterface::instance() { - static NexusInterface ni; - return ni; + MO_ASSERT(g_instance); + return *g_instance; } void NexusInterface::setCacheDirectory(const QString &directory) |
