diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-07-30 00:48:46 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-03 11:39:06 -0500 |
| commit | c4df6b8ec98feb34cc9b9785e6d4d0eac6b3f571 (patch) | |
| tree | c874d57f52243362ab2e7114c3d409b6326729cc /src/nexusinterface.cpp | |
| parent | c699aeb6d862f2c0960de126538931e4f13368b7 (diff) | |
split nexus connection stuff into NexusConnectionUI so it can be reused in the instance creation dialog
removed the PluginContainer* parameter from NexusInterface::instance()
- it's a singleton, so it only needs to be given once, not every time
- it doesn't even matter because the first time instance() is called, it creates the singleton, but the plugin container is always null
- and setPluginContainer() is called much later from OrganizerCore with the correct value
added non functional nexus page to instance creation dialog
Diffstat (limited to 'src/nexusinterface.cpp')
| -rw-r--r-- | src/nexusinterface.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index 9eb1540a..396cec11 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -26,6 +26,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <utility.h> #include "shared/util.h" #include <log.h> +#include <moassert.h> #include <QApplication> #include <QNetworkCookieJar> @@ -50,7 +51,7 @@ void throttledWarning(const APIUserAccount& user) NexusBridge::NexusBridge(PluginContainer *pluginContainer, const QString &subModule) - : m_Interface(NexusInterface::instance(pluginContainer)) + : m_Interface(&NexusInterface::instance()) , m_SubModule(subModule) { } @@ -234,8 +235,8 @@ APILimits NexusInterface::parseLimits( } -NexusInterface::NexusInterface(PluginContainer *pluginContainer) - : m_PluginContainer(pluginContainer) +NexusInterface::NexusInterface() + : m_PluginContainer(nullptr) { m_User.limits(defaultAPILimits()); m_MOVersion = createVersionInfo(); @@ -255,10 +256,10 @@ NexusInterface::~NexusInterface() cleanup(); } -NexusInterface *NexusInterface::instance(PluginContainer *pluginContainer) +NexusInterface& NexusInterface::instance() { - static NexusInterface s_Instance(pluginContainer); - return &s_Instance; + static NexusInterface ni; + return ni; } void NexusInterface::setCacheDirectory(const QString &directory) @@ -284,7 +285,7 @@ void NexusInterface::interpretNexusFileName(const QString &fileName, QString &mo static const QRegularExpression complex(R"(^([a-zA-Z0-9_'"\-.() ]*?)([-_ ][VvRr]+[0-9]+(?:(?:[\.][0-9]+){0,2}|(?:[_][0-9]+){0,2}|(?:[-.][0-9]+){0,2})?[ab]?)??-([1-9][0-9]+)?-.*?\.(zip|rar|7z))"); //complex regex explanation: //group 1: modname. - //group 2: optional version, + //group 2: optional version, // assumed to start with v (empty most of the time). //group 3: NexusId, // assumed wrapped in "-", will miss single digit IDs for better accuracy. |
