summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Tanner <trtanner@btinternet.com>2015-11-26 07:39:35 +0000
committerThomas Tanner <trtanner@btinternet.com>2015-11-26 07:39:35 +0000
commit82e6c98043bd18f5329e8b6d0a6f99c4d28cc0a2 (patch)
treeb0c18c1782b5d26ac9282cd11cc2f16df5f6b0f5 /src
parent29dadf52f1c217ddee7ef9e0873cb4e12797318b (diff)
Replace last occurrence of GameInfo::getNexusGameID and remove a whole load of gameinfo.h includes
Diffstat (limited to 'src')
-rw-r--r--src/browserdialog.cpp6
-rw-r--r--src/categories.cpp4
-rw-r--r--src/directoryrefresher.cpp1
-rw-r--r--src/executableslist.cpp8
-rw-r--r--src/executableslist.h5
-rw-r--r--src/installationmanager.cpp7
-rw-r--r--src/mainwindow.cpp2
-rw-r--r--src/modinfo.cpp1
-rw-r--r--src/modlist.cpp5
-rw-r--r--src/nexusinterface.cpp1
-rw-r--r--src/nexusinterface.h1
-rw-r--r--src/nxmaccessmanager.cpp15
-rw-r--r--src/nxmaccessmanager.h7
-rw-r--r--src/organizercore.cpp1
-rw-r--r--src/organizerproxy.cpp1
-rw-r--r--src/pluginlist.cpp1
-rw-r--r--src/settingsdialog.cpp3
-rw-r--r--src/shared/fallout3info.h1
-rw-r--r--src/shared/falloutnvinfo.h1
-rw-r--r--src/shared/gameinfo.h33
-rw-r--r--src/shared/oblivioninfo.h1
-rw-r--r--src/shared/skyriminfo.h1
-rw-r--r--src/spawn.cpp8
-rw-r--r--src/syncoverwritedialog.cpp3
-rw-r--r--src/transfersavesdialog.cpp5
-rw-r--r--src/transfersavesdialog.h6
26 files changed, 70 insertions, 58 deletions
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 <http://www.gnu.org/licenses/>.
*/
#include "browserdialog.h"
+
#include "ui_browserdialog.h"
#include "browserview.h"
-
#include "messagedialog.h"
#include "report.h"
#include "persistentcookiejar.h"
-
#include "json.h"
-
#include <utility.h>
-#include <gameinfo.h>
#include "settings.h"
+
#include <QNetworkCookieJar>
#include <QNetworkCookie>
#include <QMenu>
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 <http://www.gnu.org/licenses/>.
*/
#include "categories.h"
+
#include <utility.h>
#include <report.h>
-#include <gameinfo.h>
+
#include <QObject>
#include <QFile>
#include <QDir>
@@ -29,7 +30,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
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 <http://www.gnu.org/licenses/>.
#include "utility.h"
#include "report.h"
#include "modinfo.h"
-#include <gameinfo.h>
#include <QApplication>
#include <QDir>
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 <http://www.gnu.org/licenses/>.
*/
#include "executableslist.h"
-#include <gameinfo.h>
+
+#include "iplugingame.h"
+#include "utility.h"
+
#include <QFileInfo>
#include <QDir>
#include <QDebug>
-#include "utility.h"
+
#include <algorithm>
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 <http://www.gnu.org/licenses/>.
#ifndef EXECUTABLESLIST_H
#define EXECUTABLESLIST_H
+#include "executableinfo.h"
#include <vector>
+
#include <QFileInfo>
#include <QMetaType>
-#include <gameinfo.h>
-#include <iplugingame.h>
+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 <http://www.gnu.org/licenses/>.
*/
#include "installationmanager.h"
+
#include "utility.h"
#include "report.h"
#include "categories.h"
@@ -32,9 +33,9 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "modinfo.h"
#include <scopeguard.h>
#include <installationtester.h>
-#include <gameinfo.h>
#include <utility.h>
#include <scopeguard.h>
+
#include <QFileInfo>
#include <QLibrary>
#include <QInputDialog>
@@ -42,11 +43,13 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QDir>
#include <QMessageBox>
#include <QSettings>
-#include <Shellapi.h>
#include <QPushButton>
#include <QApplication>
#include <QDateTime>
#include <QDirIterator>
+
+#include <Shellapi.h>
+
#include <boost/assign.hpp>
#include <boost/scoped_ptr.hpp>
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 <http://www.gnu.org/licenses/>.
#include <questionboxmemory.h>
#include <taskprogressmanager.h>
#include <util.h>
+#include "gameinfo.h"
#include <QTime>
#include <QInputDialog>
@@ -113,6 +114,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QCoreApplication>
#include <QProgressDialog>
#include <scopeguard.h>
+
#ifndef Q_MOC_RUN
#include <boost/thread.hpp>
#include <boost/algorithm/string.hpp>
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 <http://www.gnu.org/licenses/>.
#include "messagedialog.h"
#include "filenamestring.h"
-#include <gameinfo.h>
#include <iplugingame.h>
#include <versioninfo.h>
#include <appconfig.h>
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 <http://www.gnu.org/licenses/>.
#include "qtgroupingproxy.h"
#include "viewmarkingscrollbar.h"
#include "modlistsortproxy.h"
-#include <gameinfo.h>
#include <appconfig.h>
#include <utility.h>
#include <report.h>
+
#include <QFileInfo>
#include <QDir>
#include <QDirIterator>
#include <QMimeData>
-#include <stdexcept>
#include <QStandardItemModel>
#include <QMessageBox>
#include <QStringList>
@@ -44,7 +43,9 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QAbstractItemView>
#include <QSortFilterProxyModel>
#include <QApplication>
+
#include <sstream>
+#include <stdexcept>
#include <algorithm>
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 <http://www.gnu.org/licenses/>.
#define NEXUSINTERFACE_H
#include <utility.h>
-#include <gameinfo.h>
#include <versioninfo.h>
#include <imodrepositorybridge.h>
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 <http://www.gnu.org/licenses/>.
*/
#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 <http://www.gnu.org/licenses/>.
#include "settings.h"
#include <gameinfo.h>
#include <json.h>
+
#include <QMessageBox>
#include <QPushButton>
#include <QNetworkProxy>
@@ -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 <http://www.gnu.org/licenses/>.
#include <QProgressDialog>
#include <set>
+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 <gameinfo.h>
#include <appconfig.h>
#include <QApplication>
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 <http://www.gnu.org/licenses/>.
#include "scopeguard.h"
#include "modinfo.h"
#include <utility.h>
-#include <gameinfo.h>
#include <iplugingame.h>
#include <espfile.h>
#include <report.h>
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 <http://www.gnu.org/licenses/>.
#include "helper.h"
#include "noeditdelegate.h"
#include "iplugingame.h"
-#include <gameinfo.h>
#include "settings.h"
#include <QDirIterator>
#include <QFileDialog>
#include <QMessageBox>
#include <QShortcut>
+
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
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<std::wstring> 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<std::wstring> 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 <http://www.gnu.org/licenses/>.
*/
#include "spawn.h"
+
#include "report.h"
#include "utility.h"
-#include <boost/scoped_array.hpp>
-#include <gameinfo.h>
#include <report.h>
#include <inject.h>
-#include <Shellapi.h>
#include <appconfig.h>
#include <windows_error.h>
+
#include <QApplication>
#include <QMessageBox>
+#include <Shellapi.h>
+
+#include <boost/scoped_array.hpp>
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 <http://www.gnu.org/licenses/>.
*/
#include "syncoverwritedialog.h"
+
#include "ui_syncoverwritedialog.h"
#include <utility.h>
#include <report.h>
-#include <gameinfo.h>
+
#include <QDir>
#include <QDirIterator>
#include <QComboBox>
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 <http://www.gnu.org/licenses/>.
*/
#include "transfersavesdialog.h"
+
#include "ui_transfersavesdialog.h"
+#include "iplugingame.h"
#include "savegamegamebyro.h"
#include "utility.h"
-#include <gameinfo.h>
+
#include <QDir>
#include <QMessageBox>
+
#include <Shlwapi.h>
#include <shlobj.h>
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 <http://www.gnu.org/licenses/>.
#include "tutorabledialog.h"
#include "profile.h"
-#include <iplugingame.h>
-namespace Ui {
-class TransferSavesDialog;
-}
+namespace Ui { class TransferSavesDialog; }
+namespace MOBase { class IPluginGame; }
class SaveGame;