From 0f8ae514592c46dc8465bc5830d7a830b68affe2 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 17 Oct 2015 19:05:00 +0100 Subject: Added support for include-what-you-use in a very simplistic fashion to the Scons build. This isn't exactly production ready because the qt headers are a nightmarish web of interdependencies but it's useful for checking. I've also removed a few unused include files it detected and corrected some things that upset clang in a big way. --- src/nxmaccessmanager.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nxmaccessmanager.cpp') diff --git a/src/nxmaccessmanager.cpp b/src/nxmaccessmanager.cpp index 0763bb71..6ec282f6 100644 --- a/src/nxmaccessmanager.cpp +++ b/src/nxmaccessmanager.cpp @@ -25,7 +25,6 @@ along with Mod Organizer. If not, see . #include "persistentcookiejar.h" #include "settings.h" #include -#include #include #include #include -- cgit v1.3.1 From 82e6c98043bd18f5329e8b6d0a6f99c4d28cc0a2 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Thu, 26 Nov 2015 07:39:35 +0000 Subject: Replace last occurrence of GameInfo::getNexusGameID and remove a whole load of gameinfo.h includes --- src/browserdialog.cpp | 6 ++---- src/categories.cpp | 4 ++-- src/directoryrefresher.cpp | 1 - src/executableslist.cpp | 8 +++++--- src/executableslist.h | 5 +++-- src/installationmanager.cpp | 7 +++++-- src/mainwindow.cpp | 2 ++ src/modinfo.cpp | 1 - src/modlist.cpp | 5 +++-- src/nexusinterface.cpp | 1 + src/nexusinterface.h | 1 - src/nxmaccessmanager.cpp | 15 +++++++++++++-- src/nxmaccessmanager.h | 7 ++++++- src/organizercore.cpp | 1 + src/organizerproxy.cpp | 1 - src/pluginlist.cpp | 1 - src/settingsdialog.cpp | 3 +-- src/shared/fallout3info.h | 1 - src/shared/falloutnvinfo.h | 1 - src/shared/gameinfo.h | 33 +++++++++++++-------------------- src/shared/oblivioninfo.h | 1 - src/shared/skyriminfo.h | 1 - src/spawn.cpp | 8 +++++--- src/syncoverwritedialog.cpp | 3 ++- src/transfersavesdialog.cpp | 5 ++++- src/transfersavesdialog.h | 6 ++---- 26 files changed, 70 insertions(+), 58 deletions(-) (limited to 'src/nxmaccessmanager.cpp') diff --git a/src/browserdialog.cpp b/src/browserdialog.cpp index c382c112..bbdf95c5 100644 --- a/src/browserdialog.cpp +++ b/src/browserdialog.cpp @@ -18,18 +18,16 @@ along with Mod Organizer. If not, see . */ #include "browserdialog.h" + #include "ui_browserdialog.h" #include "browserview.h" - #include "messagedialog.h" #include "report.h" #include "persistentcookiejar.h" - #include "json.h" - #include -#include #include "settings.h" + #include #include #include diff --git a/src/categories.cpp b/src/categories.cpp index 400cc74b..59291a49 100644 --- a/src/categories.cpp +++ b/src/categories.cpp @@ -18,9 +18,10 @@ along with Mod Organizer. If not, see . */ #include "categories.h" + #include #include -#include + #include #include #include @@ -29,7 +30,6 @@ along with Mod Organizer. If not, see . using namespace MOBase; -using namespace MOShared; CategoryFactory* CategoryFactory::s_Instance = nullptr; diff --git a/src/directoryrefresher.cpp b/src/directoryrefresher.cpp index f4ad2a7d..4eac4103 100644 --- a/src/directoryrefresher.cpp +++ b/src/directoryrefresher.cpp @@ -23,7 +23,6 @@ along with Mod Organizer. If not, see . #include "utility.h" #include "report.h" #include "modinfo.h" -#include #include #include diff --git a/src/executableslist.cpp b/src/executableslist.cpp index 2182a425..a4511ade 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -18,16 +18,18 @@ along with Mod Organizer. If not, see . */ #include "executableslist.h" -#include + +#include "iplugingame.h" +#include "utility.h" + #include #include #include -#include "utility.h" + #include using namespace MOBase; -using namespace MOShared; ExecutablesList::ExecutablesList() diff --git a/src/executableslist.h b/src/executableslist.h index 833829c8..3d5ba0ed 100644 --- a/src/executableslist.h +++ b/src/executableslist.h @@ -20,13 +20,14 @@ along with Mod Organizer. If not, see . #ifndef EXECUTABLESLIST_H #define EXECUTABLESLIST_H +#include "executableinfo.h" #include + #include #include -#include -#include +namespace MOBase { class IPluginGame; } /*! * @brief Information about an executable diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index a6af1a7f..4b3722b8 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -18,6 +18,7 @@ along with Mod Organizer. If not, see . */ #include "installationmanager.h" + #include "utility.h" #include "report.h" #include "categories.h" @@ -32,9 +33,9 @@ along with Mod Organizer. If not, see . #include "modinfo.h" #include #include -#include #include #include + #include #include #include @@ -42,11 +43,13 @@ along with Mod Organizer. If not, see . #include #include #include -#include #include #include #include #include + +#include + #include #include diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2d90d5b8..3a2da562 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -68,6 +68,7 @@ along with Mod Organizer. If not, see . #include #include #include +#include "gameinfo.h" #include #include @@ -113,6 +114,7 @@ along with Mod Organizer. If not, see . #include #include #include + #ifndef Q_MOC_RUN #include #include diff --git a/src/modinfo.cpp b/src/modinfo.cpp index df34c00f..ef195bea 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -29,7 +29,6 @@ along with Mod Organizer. If not, see . #include "messagedialog.h" #include "filenamestring.h" -#include #include #include #include diff --git a/src/modlist.cpp b/src/modlist.cpp index 197250a3..9d7f32c8 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -24,15 +24,14 @@ along with Mod Organizer. If not, see . #include "qtgroupingproxy.h" #include "viewmarkingscrollbar.h" #include "modlistsortproxy.h" -#include #include #include #include + #include #include #include #include -#include #include #include #include @@ -44,7 +43,9 @@ along with Mod Organizer. If not, see . #include #include #include + #include +#include #include diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index 078ca29d..8a7c88b6 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -555,6 +555,7 @@ void NexusInterface::requestTimeout() void NexusInterface::managedGameChanged(IPluginGame const *game) { m_Game = game; + m_AccessManager->managedGameChanged(game); } diff --git a/src/nexusinterface.h b/src/nexusinterface.h index 091b5446..807d0aec 100644 --- a/src/nexusinterface.h +++ b/src/nexusinterface.h @@ -21,7 +21,6 @@ along with Mod Organizer. If not, see . #define NEXUSINTERFACE_H #include -#include #include #include diff --git a/src/nxmaccessmanager.cpp b/src/nxmaccessmanager.cpp index 0763bb71..08572d50 100644 --- a/src/nxmaccessmanager.cpp +++ b/src/nxmaccessmanager.cpp @@ -18,6 +18,8 @@ along with Mod Organizer. If not, see . */ #include "nxmaccessmanager.h" + +#include "iplugingame.h" #include "nxmurl.h" #include "report.h" #include "utility.h" @@ -26,6 +28,7 @@ along with Mod Organizer. If not, see . #include "settings.h" #include #include + #include #include #include @@ -127,9 +130,13 @@ void NXMAccessManager::startLoginCheck() void NXMAccessManager::retrieveCredentials() { qDebug("retrieving credentials"); - QNetworkRequest request(ToQString(GameInfo::instance().getNexusPage()) + + //This may be overkill as + //www.nexusmods.com/Core/Libs/Flamework/Entities/User?GetCredentials + //seems to work fine. + QNetworkRequest request(m_Game->getNexusManagementURL() + QString("/Core/Libs/Flamework/Entities/User?GetCredentials&game_id=%1" - ).arg(GameInfo::instance().getNexusGameID())); + ).arg(m_Game->getNexusGameID())); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); request.setRawHeader("User-Agent", userAgent().toUtf8()); @@ -339,3 +346,7 @@ void NXMAccessManager::loginChecked() m_LoginReply = nullptr; } +void NXMAccessManager::managedGameChanged(MOBase::IPluginGame const *game) +{ + m_Game = game; +} diff --git a/src/nxmaccessmanager.h b/src/nxmaccessmanager.h index a03dbe36..2a016cad 100644 --- a/src/nxmaccessmanager.h +++ b/src/nxmaccessmanager.h @@ -27,6 +27,7 @@ along with Mod Organizer. If not, see . #include #include +namespace MOBase { class IPluginGame; } /** * @brief access manager extended to handle nxm links @@ -84,7 +85,9 @@ private slots: void loginError(QNetworkReply::NetworkError errorCode); void loginTimeout(); -public slots: +public: + //This would be a slot but the NexusInterface code calls this + void managedGameChanged(MOBase::IPluginGame const *game); protected: @@ -127,6 +130,8 @@ private: LOGIN_VALID } m_LoginState = LOGIN_NOT_CHECKED; + MOBase::IPluginGame const *m_Game; + }; #endif // NXMACCESSMANAGER_H diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 7473ec3e..66a3799a 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -162,6 +162,7 @@ OrganizerCore::OrganizerCore(const QSettings &initSettings) connect(NexusInterface::instance()->getAccessManager(), SIGNAL(loginSuccessful(bool)), this, SLOT(loginSuccessful(bool))); connect(NexusInterface::instance()->getAccessManager(), SIGNAL(loginFailed(QString)), this, SLOT(loginFailed(QString))); + //This seems awfully imperative connect(this, SIGNAL(managedGameChanged(MOBase::IPluginGame const *)), &m_Settings, SLOT(managedGameChanged(MOBase::IPluginGame const *))); connect(this, SIGNAL(managedGameChanged(MOBase::IPluginGame const *)), &m_DownloadManager, SLOT(managedGameChanged(MOBase::IPluginGame const *))); connect(this, SIGNAL(managedGameChanged(MOBase::IPluginGame const *)), &m_PluginList, SLOT(managedGameChanged(MOBase::IPluginGame const *))); diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index fdc60a27..ba07c154 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -1,6 +1,5 @@ #include "organizerproxy.h" -#include #include #include diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 48b27f05..7a609374 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -24,7 +24,6 @@ along with Mod Organizer. If not, see . #include "scopeguard.h" #include "modinfo.h" #include -#include #include #include #include diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 36e177ab..c7f15dc9 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -24,19 +24,18 @@ along with Mod Organizer. If not, see . #include "helper.h" #include "noeditdelegate.h" #include "iplugingame.h" -#include #include "settings.h" #include #include #include #include + #define WIN32_LEAN_AND_MEAN #include using namespace MOBase; -using namespace MOShared; SettingsDialog::SettingsDialog(QWidget *parent) diff --git a/src/shared/fallout3info.h b/src/shared/fallout3info.h index b5585eaf..e6064825 100644 --- a/src/shared/fallout3info.h +++ b/src/shared/fallout3info.h @@ -50,7 +50,6 @@ public: virtual std::wstring getReferenceDataFile(); virtual std::wstring getNexusPage(bool nmmScheme = true); - virtual int getNexusGameID() { return 120; } virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); diff --git a/src/shared/falloutnvinfo.h b/src/shared/falloutnvinfo.h index 40e11720..aa187fb3 100644 --- a/src/shared/falloutnvinfo.h +++ b/src/shared/falloutnvinfo.h @@ -50,7 +50,6 @@ public: virtual std::wstring getReferenceDataFile(); virtual std::wstring getNexusPage(bool nmmScheme = true); - virtual int getNexusGameID() { return 130; } virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h index 45069165..b6a4f142 100644 --- a/src/shared/gameinfo.h +++ b/src/shared/gameinfo.h @@ -47,29 +47,30 @@ public: TYPE_SKYRIM }; - enum LoadOrderMechanism { - TYPE_FILETIME, - TYPE_PLUGINSTXT - }; - public: virtual ~GameInfo() {} - //**USED ONLY IN HOOKDLL - virtual std::wstring getRegPath() = 0; - //**Used only in savegame which needs refactoring a lot. virtual GameInfo::Type getType() = 0; + //**Used only in savegame which needs refactoring a lot. + // get a list of file extensions for additional files belonging to a save game + virtual std::vector getSavegameAttachmentExtensions() = 0; + //**Currently only used in a nasty mess at initialisation time. virtual std::wstring getGameName() const = 0; //**USED IN HOOKDLL and in initialisation virtual std::wstring getGameDirectory() const; - // get a list of file extensions for additional files belonging to a save game - virtual std::vector getSavegameAttachmentExtensions() = 0; + //**USED IN HOOKDLL and initialisation + // initialise with the path to the mo directory (needs to be where hook.dll is stored). This + // needs to be called before the instance can be retrieved + static bool init(const std::wstring &moDirectory, const std::wstring &gamePath = L""); + + //**USED ONLY IN HOOKDLL + virtual std::wstring getRegPath() = 0; //**USED ONLY IN HOOKDLL // file name of this games ini file(s) @@ -78,20 +79,12 @@ public: //**USED ONLY IN HOOKDLL virtual std::wstring getReferenceDataFile() = 0; - virtual std::wstring getNexusPage(bool nmmScheme = true) = 0; - virtual int getNexusGameID() = 0; - //**USED ONLY IN HOOKDLL virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) = 0; -public: - - //**USED IN HOOKDLL - // initialise with the path to the mo directory (needs to be where hook.dll is stored). This - // needs to be called before the instance can be retrieved - static bool init(const std::wstring &moDirectory, const std::wstring &gamePath = L""); + virtual std::wstring getNexusPage(bool nmmScheme = true) = 0; - //**USED IN HOOKDLL + //**USED IN HOOKDLL and everywhere that uses GameInfo static GameInfo& instance(); protected: diff --git a/src/shared/oblivioninfo.h b/src/shared/oblivioninfo.h index b6b3d867..f9045703 100644 --- a/src/shared/oblivioninfo.h +++ b/src/shared/oblivioninfo.h @@ -48,7 +48,6 @@ public: virtual std::wstring getReferenceDataFile(); virtual std::wstring getNexusPage(bool nmmScheme = true); - virtual int getNexusGameID() { return 101; } virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h index ee81ace3..47a35b3e 100644 --- a/src/shared/skyriminfo.h +++ b/src/shared/skyriminfo.h @@ -52,7 +52,6 @@ public: virtual std::wstring getNexusPage(bool nmmScheme = true); static int getNexusGameIDStatic() { return 110; } - virtual int getNexusGameID() { return getNexusGameIDStatic(); } virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); diff --git a/src/spawn.cpp b/src/spawn.cpp index c79714bb..49e89a8b 100644 --- a/src/spawn.cpp +++ b/src/spawn.cpp @@ -18,18 +18,20 @@ along with Mod Organizer. If not, see . */ #include "spawn.h" + #include "report.h" #include "utility.h" -#include -#include #include #include -#include #include #include + #include #include +#include + +#include using namespace MOBase; using namespace MOShared; diff --git a/src/syncoverwritedialog.cpp b/src/syncoverwritedialog.cpp index 0e3e98d7..aeed0a55 100644 --- a/src/syncoverwritedialog.cpp +++ b/src/syncoverwritedialog.cpp @@ -18,10 +18,11 @@ along with Mod Organizer. If not, see . */ #include "syncoverwritedialog.h" + #include "ui_syncoverwritedialog.h" #include #include -#include + #include #include #include diff --git a/src/transfersavesdialog.cpp b/src/transfersavesdialog.cpp index d47d2bb0..4cb20944 100644 --- a/src/transfersavesdialog.cpp +++ b/src/transfersavesdialog.cpp @@ -18,12 +18,15 @@ along with Mod Organizer. If not, see . */ #include "transfersavesdialog.h" + #include "ui_transfersavesdialog.h" +#include "iplugingame.h" #include "savegamegamebyro.h" #include "utility.h" -#include + #include #include + #include #include diff --git a/src/transfersavesdialog.h b/src/transfersavesdialog.h index d9ea5b29..e2c556b4 100644 --- a/src/transfersavesdialog.h +++ b/src/transfersavesdialog.h @@ -22,11 +22,9 @@ along with Mod Organizer. If not, see . #include "tutorabledialog.h" #include "profile.h" -#include -namespace Ui { -class TransferSavesDialog; -} +namespace Ui { class TransferSavesDialog; } +namespace MOBase { class IPluginGame; } class SaveGame; -- cgit v1.3.1 From dd37152eae382ee95535b289b17b0a727e4038f5 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Thu, 26 Nov 2015 17:48:50 +0000 Subject: This removes getNexusPage from GameInfo and is currently in the game plugin. I'm looking to move it to the nexus interface though as it doesn't really relate to the game plugin. I've also removed the MananagementURL as - you can log into nexus without needing to specify the game - See above - it doesn't belong with the game plugin This gets rid of all dependencies bar game saving and logging in --- src/mainwindow.cpp | 25 ++++++++++++++----------- src/modinfodialog.cpp | 14 +++++++++++--- src/nexusinterface.cpp | 13 +++++++++---- src/nxmaccessmanager.cpp | 35 ++++++++++++----------------------- src/nxmaccessmanager.h | 6 ------ src/shared/fallout3info.cpp | 9 --------- src/shared/fallout3info.h | 2 -- src/shared/falloutnvinfo.cpp | 10 ---------- src/shared/falloutnvinfo.h | 2 -- src/shared/gameinfo.h | 2 -- src/shared/oblivioninfo.cpp | 14 -------------- src/shared/oblivioninfo.h | 2 -- src/shared/skyriminfo.cpp | 11 ----------- src/shared/skyriminfo.h | 4 ---- 14 files changed, 46 insertions(+), 103 deletions(-) (limited to 'src/nxmaccessmanager.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3a2da562..3f3d5286 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -19,6 +19,7 @@ along with Mod Organizer. If not, see . #include "mainwindow.h" #include "ui_mainwindow.h" + #include "spawn.h" #include "report.h" #include "modlist.h" @@ -68,7 +69,7 @@ along with Mod Organizer. If not, see . #include #include #include -#include "gameinfo.h" +#include #include #include @@ -95,10 +96,6 @@ along with Mod Organizer. If not, see . #include #include #include -#include -#include -#include -#include #include #include #include @@ -113,7 +110,6 @@ along with Mod Organizer. If not, see . #endif #include #include -#include #ifndef Q_MOC_RUN #include @@ -123,6 +119,11 @@ along with Mod Organizer. If not, see . #include #endif +#include +#include +#include +#include + #include #include #include @@ -2528,7 +2529,7 @@ void MainWindow::visitOnNexus_clicked() { int modID = m_OrganizerCore.modList()->data(m_OrganizerCore.modList()->index(m_ContextRow, 0), Qt::UserRole).toInt(); if (modID > 0) { - nexusLinkActivated(QString("%1/mods/%2").arg(ToQString(GameInfo::instance().getNexusPage(false))).arg(modID)); + nexusLinkActivated(QString("%1/mods/%2").arg(m_OrganizerCore.managedGame()->getNexusDisplayURL()).arg(modID)); } else { MessageDialog::showMessage(tr("Nexus ID for this Mod is unknown"), this); } @@ -3420,7 +3421,9 @@ void MainWindow::on_actionSettings_triggered() void MainWindow::on_actionNexus_triggered() { - ::ShellExecuteW(nullptr, L"open", GameInfo::instance().getNexusPage(false).c_str(), nullptr, nullptr, SW_SHOWNORMAL); + ::ShellExecuteW(nullptr, L"open", + m_OrganizerCore.managedGame()->getNexusDisplayURL().toStdWString().c_str(), + nullptr, nullptr, SW_SHOWNORMAL); } @@ -3814,11 +3817,11 @@ void MainWindow::on_actionUpdate_triggered() void MainWindow::on_actionEndorseMO_triggered() { if (QMessageBox::question(this, tr("Endorse Mod Organizer"), - tr("Do you want to endorse Mod Organizer on %1 now?").arg(ToQString(GameInfo::instance().getNexusPage())), + tr("Do you want to endorse Mod Organizer on %1 now?").arg( + m_OrganizerCore.managedGame()->getNexusDisplayURL()), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - //Why pass an empty variant if we're toggling an endorsement? NexusInterface::instance()->requestToggleEndorsement( - m_OrganizerCore.managedGame()->getNexusModOrganizerID(), true, this, QVariant(), ""); + m_OrganizerCore.managedGame()->getNexusModOrganizerID(), true, this, QVariant(), QString()); } } diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp index 35da228b..c4acb31e 100644 --- a/src/modinfodialog.cpp +++ b/src/modinfodialog.cpp @@ -20,6 +20,7 @@ along with Mod Organizer. If not, see . #include "modinfodialog.h" #include "ui_modinfodialog.h" +#include "iplugingame.h" #include "report.h" #include "utility.h" #include "messagedialog.h" @@ -36,9 +37,11 @@ along with Mod Organizer. If not, see . #include #include #include +#include + #include + #include -#include using namespace MOBase; @@ -688,7 +691,9 @@ void ModInfoDialog::on_visitNexusLabel_linkActivated(const QString &link) void ModInfoDialog::linkClicked(const QUrl &url) { - if (url.toString().startsWith(ToQString(GameInfo::instance().getNexusPage(false)))) { + //FIXME: See elsewhere. This needs to be a property of the installed mod. + IPluginGame *game = qApp->property("managed_game").value(); + if (game->isRelatedURL(url)) { this->close(); emit nexusLinkActivated(url.toString()); } else { @@ -832,7 +837,10 @@ void ModInfoDialog::activateNexusTab() QLineEdit *modIDEdit = findChild("modIDEdit"); int modID = modIDEdit->text().toInt(); if (modID != 0) { - QString nexusLink = QString("%1/downloads/file.php?id=%2").arg(ToQString(GameInfo::instance().getNexusPage(false))).arg(modID); + //FIXME: We should remember the game for which this mod was installed in the + //modInfo and get the web page via that. + IPluginGame *game = qApp->property("managed_game").value(); + QString nexusLink = QString("%1/downloads/file.php?id=%2").arg(game->getNexusDisplayURL()).arg(modID); QLabel *visitNexusLabel = findChild("visitNexusLabel"); visitNexusLabel->setText(tr("Visit on Nexus").arg(nexusLink)); visitNexusLabel->setToolTip(nexusLink); diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index 8a7c88b6..b6843c57 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -555,9 +555,14 @@ void NexusInterface::requestTimeout() void NexusInterface::managedGameChanged(IPluginGame const *game) { m_Game = game; - m_AccessManager->managedGameChanged(game); } +namespace { + QString get_management_url(MOBase::IPluginGame const *game) + { + return "http://nmm.nexusmods.com/" + game->getNexusName().toLower(); + } +} NexusInterface::NXMRequestInfo::NXMRequestInfo(int modID , NexusInterface::NXMRequestInfo::Type type @@ -573,7 +578,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo(int modID , m_Timeout(nullptr) , m_Reroute(false) , m_ID(s_NextID.fetchAndAddAcquire(1)) - , m_URL(game->getNexusManagementURL()) + , m_URL(get_management_url(game)) , m_SubModule(subModule) , m_NexusGameID(game->getNexusGameID()) , m_Endorse(false) @@ -594,7 +599,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo(std::vector modIDList , m_Timeout(nullptr) , m_Reroute(false) , m_ID(s_NextID.fetchAndAddAcquire(1)) - , m_URL(game->getNexusManagementURL()) + , m_URL(get_management_url(game)) , m_SubModule(subModule) , m_NexusGameID(game->getNexusGameID()) , m_Endorse(false) @@ -615,7 +620,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo(int modID , m_Timeout(nullptr) , m_Reroute(false) , m_ID(s_NextID.fetchAndAddAcquire(1)) - , m_URL(game->getNexusManagementURL()) + , m_URL(get_management_url(game)) , m_SubModule(subModule) , m_NexusGameID(game->getNexusGameID()) , m_Endorse(false) diff --git a/src/nxmaccessmanager.cpp b/src/nxmaccessmanager.cpp index 08572d50..c37131eb 100644 --- a/src/nxmaccessmanager.cpp +++ b/src/nxmaccessmanager.cpp @@ -26,7 +26,6 @@ along with Mod Organizer. If not, see . #include "selfupdater.h" #include "persistentcookiejar.h" #include "settings.h" -#include #include #include @@ -42,10 +41,11 @@ along with Mod Organizer. If not, see . #include #include - using namespace MOBase; -using namespace MOShared; +namespace { + QString const Nexus_Management_URL("http://nmm.nexusmods.com"); +} // unfortunately Nexus doesn't seem to document these states, all I know is all these listed // are considered premium (27 should be lifetime premium) @@ -99,8 +99,7 @@ QNetworkReply *NXMAccessManager::createRequest( void NXMAccessManager::showCookies() const { - QUrl url(ToQString(GameInfo::instance().getNexusPage()) + "/"); - + QUrl url(Nexus_Management_URL + "/"); for (const QNetworkCookie &cookie : cookieJar()->cookiesForUrl(url)) { qDebug("%s - %s (expires: %s)", cookie.name().constData(), cookie.value().constData(), @@ -113,7 +112,7 @@ void NXMAccessManager::startLoginCheck() { if (hasLoginCookies()) { qDebug("validating login cookies"); - QNetworkRequest request(ToQString(GameInfo::instance().getNexusPage()) + "/Sessions/?Validate"); + QNetworkRequest request(Nexus_Management_URL + "/Sessions/?Validate"); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); request.setRawHeader("User-Agent", userAgent().toUtf8()); @@ -131,12 +130,7 @@ void NXMAccessManager::retrieveCredentials() { qDebug("retrieving credentials"); - //This may be overkill as - //www.nexusmods.com/Core/Libs/Flamework/Entities/User?GetCredentials - //seems to work fine. - QNetworkRequest request(m_Game->getNexusManagementURL() - + QString("/Core/Libs/Flamework/Entities/User?GetCredentials&game_id=%1" - ).arg(m_Game->getNexusGameID())); + QNetworkRequest request(Nexus_Management_URL + "/Core/Libs/Flamework/Entities/User?GetCredentials"); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); request.setRawHeader("User-Agent", userAgent().toUtf8()); @@ -231,8 +225,9 @@ QString NXMAccessManager::userAgent(const QString &subModule) const void NXMAccessManager::pageLogin() { qDebug("logging %s in on Nexus", qPrintable(m_Username)); - QString requestString = (ToQString(GameInfo::instance().getNexusPage()) + "/Sessions/?Login&uri=%1") - .arg(QString(QUrl::toPercentEncoding(ToQString(GameInfo::instance().getNexusPage())))); + + QString requestString = (Nexus_Management_URL + "/Sessions/?Login&uri=%1") + .arg(QString(QUrl::toPercentEncoding(Nexus_Management_URL))); QNetworkRequest request(requestString); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); @@ -296,15 +291,14 @@ void NXMAccessManager::loginError(QNetworkReply::NetworkError) bool NXMAccessManager::hasLoginCookies() const { - bool sidCookie = false; - QUrl url(ToQString(GameInfo::instance().getNexusPage()) + "/"); + QUrl url(Nexus_Management_URL + "/"); QList cookies = cookieJar()->cookiesForUrl(url); for (const QNetworkCookie &cookie : cookies) { if (cookie.name() == "sid") { - sidCookie = true; + return true; } } - return sidCookie; + return false; } @@ -345,8 +339,3 @@ void NXMAccessManager::loginChecked() m_LoginReply->deleteLater(); m_LoginReply = nullptr; } - -void NXMAccessManager::managedGameChanged(MOBase::IPluginGame const *game) -{ - m_Game = game; -} diff --git a/src/nxmaccessmanager.h b/src/nxmaccessmanager.h index 2a016cad..82bd2bd5 100644 --- a/src/nxmaccessmanager.h +++ b/src/nxmaccessmanager.h @@ -85,10 +85,6 @@ private slots: void loginError(QNetworkReply::NetworkError errorCode); void loginTimeout(); -public: - //This would be a slot but the NexusInterface code calls this - void managedGameChanged(MOBase::IPluginGame const *game); - protected: virtual QNetworkReply *createRequest( @@ -130,8 +126,6 @@ private: LOGIN_VALID } m_LoginState = LOGIN_NOT_CHECKED; - MOBase::IPluginGame const *m_Game; - }; #endif // NXMACCESSMANAGER_H diff --git a/src/shared/fallout3info.cpp b/src/shared/fallout3info.cpp index cb2a3adf..043a25dc 100644 --- a/src/shared/fallout3info.cpp +++ b/src/shared/fallout3info.cpp @@ -78,15 +78,6 @@ std::wstring Fallout3Info::getReferenceDataFile() return L"Fallout - Meshes.bsa"; } -std::wstring Fallout3Info::getNexusPage(bool nmmScheme) -{ - if (nmmScheme) { - return L"http://nmm.nexusmods.com/fallout3"; - } else { - return L"http://www.nexusmods.com/fallout3"; - } -} - bool Fallout3Info::rerouteToProfile(const wchar_t *fileName, const wchar_t*) { static LPCWSTR profileFiles[] = { L"fallout.ini", L"falloutprefs.ini", L"plugins.txt", nullptr }; diff --git a/src/shared/fallout3info.h b/src/shared/fallout3info.h index e6064825..ed525588 100644 --- a/src/shared/fallout3info.h +++ b/src/shared/fallout3info.h @@ -49,8 +49,6 @@ public: virtual std::wstring getReferenceDataFile(); - virtual std::wstring getNexusPage(bool nmmScheme = true); - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); // get a list of executables (game binary and known-to-work 3rd party tools). All of these are relative to diff --git a/src/shared/falloutnvinfo.cpp b/src/shared/falloutnvinfo.cpp index bfc31c0b..88985ad6 100644 --- a/src/shared/falloutnvinfo.cpp +++ b/src/shared/falloutnvinfo.cpp @@ -78,16 +78,6 @@ std::wstring FalloutNVInfo::getReferenceDataFile() return L"Fallout - Meshes.bsa"; } -std::wstring FalloutNVInfo::getNexusPage(bool nmmScheme) -{ - if (nmmScheme) { - return L"http://nmm.nexusmods.com/newvegas"; - } else { - return L"http://www.nexusmods.com/newvegas"; - } -} - - bool FalloutNVInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*) { static LPCWSTR profileFiles[] = { L"fallout.ini", L"falloutprefs.ini", L"plugins.txt", nullptr }; diff --git a/src/shared/falloutnvinfo.h b/src/shared/falloutnvinfo.h index aa187fb3..ee67ac17 100644 --- a/src/shared/falloutnvinfo.h +++ b/src/shared/falloutnvinfo.h @@ -49,8 +49,6 @@ public: virtual std::wstring getReferenceDataFile(); - virtual std::wstring getNexusPage(bool nmmScheme = true); - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); // get a list of executables (game binary and known-to-work 3rd party tools). All of these are relative to diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h index b6a4f142..de3af8b4 100644 --- a/src/shared/gameinfo.h +++ b/src/shared/gameinfo.h @@ -82,8 +82,6 @@ public: //**USED ONLY IN HOOKDLL virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) = 0; - virtual std::wstring getNexusPage(bool nmmScheme = true) = 0; - //**USED IN HOOKDLL and everywhere that uses GameInfo static GameInfo& instance(); diff --git a/src/shared/oblivioninfo.cpp b/src/shared/oblivioninfo.cpp index 9bd5f4b1..a3dc3986 100644 --- a/src/shared/oblivioninfo.cpp +++ b/src/shared/oblivioninfo.cpp @@ -77,20 +77,6 @@ std::vector OblivionInfo::getIniFileNames() return boost::assign::list_of(L"oblivion.ini")(L"oblivionprefs.ini"); } - - - - -std::wstring OblivionInfo::getNexusPage(bool nmmScheme) -{ - if (nmmScheme) { - return L"http://nmm.nexusmods.com/oblivion"; - } else { - return L"http://www.nexusmods.com/oblivion"; - } -} - - bool OblivionInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*) { static LPCWSTR profileFiles[] = { L"oblivion.ini", L"oblivionprefs.ini", L"plugins.txt", nullptr }; diff --git a/src/shared/oblivioninfo.h b/src/shared/oblivioninfo.h index f9045703..00048930 100644 --- a/src/shared/oblivioninfo.h +++ b/src/shared/oblivioninfo.h @@ -47,8 +47,6 @@ public: virtual std::wstring getReferenceDataFile(); - virtual std::wstring getNexusPage(bool nmmScheme = true); - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); // get a list of executables (game binary and known-to-work 3rd party tools). All of these are relative to diff --git a/src/shared/skyriminfo.cpp b/src/shared/skyriminfo.cpp index 9b192902..869ac47d 100644 --- a/src/shared/skyriminfo.cpp +++ b/src/shared/skyriminfo.cpp @@ -88,17 +88,6 @@ std::wstring SkyrimInfo::getReferenceDataFile() return L"Skyrim - Meshes.bsa"; } - -std::wstring SkyrimInfo::getNexusPage(bool nmmScheme) -{ - if (nmmScheme) { - return L"http://nmm.nexusmods.com/skyrim"; - } else { - return L"http://www.nexusmods.com/skyrim"; - } -} - - bool SkyrimInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) { static LPCWSTR profileFiles[] = { L"skyrim.ini", L"skyrimprefs.ini", L"loadorder.txt", nullptr }; diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h index 47a35b3e..afba1974 100644 --- a/src/shared/skyriminfo.h +++ b/src/shared/skyriminfo.h @@ -49,10 +49,6 @@ public: virtual std::wstring getReferenceDataFile(); - virtual std::wstring getNexusPage(bool nmmScheme = true); - - static int getNexusGameIDStatic() { return 110; } - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); private: -- cgit v1.3.1