From 49de6e8d2555234c5da132c5fc35287083fe7ef7 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Fri, 20 Nov 2015 18:07:06 +0000 Subject: Get rid of `GameIfo::getOrganizerDirectory` and associated member variable qApp->getProperty("dataPath") can be used instead (and is pretty much everywhere else) so it's unnecessary --- src/organizerproxy.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/organizerproxy.cpp') diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index 095cb0bb..9e85929f 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -1,7 +1,9 @@ #include "organizerproxy.h" + #include #include +#include using namespace MOBase; using namespace MOShared; @@ -40,7 +42,7 @@ QString OrganizerProxy::downloadsPath() const QString OrganizerProxy::overwritePath() const { - return QDir::fromNativeSeparators(ToQString(GameInfo::instance().getOrganizerDirectory())) + return QDir::fromNativeSeparators(qApp->property("dataPath").toString()) + "/" + ToQString(AppConfig::overwritePath()); } -- cgit v1.3.1 From efb54100dcfe8ac83284ec59e6706c488ecb10e7 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 21 Nov 2015 12:30:33 +0000 Subject: Removal of (get)BinaryName --- src/gameinfoimpl.cpp | 5 +++-- src/gameinfoimpl.h | 2 +- src/organizer.pro | 6 +++--- src/organizercore.cpp | 8 ++------ src/organizercore.h | 2 +- src/organizerproxy.cpp | 13 +++++++++---- src/organizerproxy.h | 9 +++++---- src/shared/fallout3info.h | 1 - src/shared/falloutnvinfo.h | 1 - src/shared/gameinfo.h | 1 - src/shared/oblivioninfo.h | 1 - src/shared/skyriminfo.h | 1 - 12 files changed, 24 insertions(+), 26 deletions(-) (limited to 'src/organizerproxy.cpp') diff --git a/src/gameinfoimpl.cpp b/src/gameinfoimpl.cpp index 025ce4e6..a0dd832e 100644 --- a/src/gameinfoimpl.cpp +++ b/src/gameinfoimpl.cpp @@ -47,8 +47,9 @@ QString GameInfoImpl::path() const { return QDir::fromNativeSeparators(ToQString(GameInfo::instance().getGameDirectory())); } - +/* QString GameInfoImpl::binaryName() const { - return ToQString(GameInfo::instance().getBinaryName()); + return ToQString(GameInfo::instance().getgetBinaryName()); } +*/ diff --git a/src/gameinfoimpl.h b/src/gameinfoimpl.h index 3ed7be6b..b78321c4 100644 --- a/src/gameinfoimpl.h +++ b/src/gameinfoimpl.h @@ -32,7 +32,7 @@ public: virtual Type type() const; virtual QString path() const; - virtual QString binaryName() const; +// virtual QString binaryName() const; }; diff --git a/src/organizer.pro b/src/organizer.pro index 261e3c1c..65c1e4d3 100644 --- a/src/organizer.pro +++ b/src/organizer.pro @@ -355,10 +355,10 @@ CONFIG(debug, debug|release) { } OTHER_FILES += \ - SConscript + SConscript \ + CMakeLists.txt DISTFILES += \ tutorials/tutorial_primer_main.js \ tutorials/Tooltip.qml \ - tutorials/TooltipArea.qml \ - SConscript + tutorials/TooltipArea.qml diff --git a/src/organizercore.cpp b/src/organizercore.cpp index c1f091d9..d56f64cb 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -594,14 +594,10 @@ MOBase::VersionInfo OrganizerCore::appVersion() const return m_Updater.getVersion(); } -MOBase::IModInterface *OrganizerCore::getMod(const QString &name) +MOBase::IModInterface *OrganizerCore::getMod(const QString &name) const { unsigned int index = ModInfo::getIndex(name); - if (index == UINT_MAX) { - return nullptr; - } else { - return ModInfo::getByIndex(index).data(); - } + return index == UINT_MAX ? nullptr : ModInfo::getByIndex(index).data(); } MOBase::IModInterface *OrganizerCore::createMod(GuessedValue &name) diff --git a/src/organizercore.h b/src/organizercore.h index 85f0e0c4..3524dcb5 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -132,7 +132,7 @@ public: QString profilePath() const; QString downloadsPath() const; MOBase::VersionInfo appVersion() const; - MOBase::IModInterface *getMod(const QString &name); + MOBase::IModInterface *getMod(const QString &name) const; MOBase::IModInterface *createMod(MOBase::GuessedValue &name); bool removeMod(MOBase::IModInterface *mod); void modDataChanged(MOBase::IModInterface *mod); diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index 9e85929f..17c5a16f 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -52,7 +52,7 @@ VersionInfo OrganizerProxy::appVersion() const return m_Proxied->appVersion(); } -IModInterface *OrganizerProxy::getMod(const QString &name) +IModInterface *OrganizerProxy::getMod(const QString &name) const { return m_Proxied->getMod(name); } @@ -157,17 +157,22 @@ QList OrganizerProxy::findFileInfos(const QString return m_Proxied->findFileInfos(path, filter); } -MOBase::IDownloadManager *OrganizerProxy::downloadManager() +MOBase::IDownloadManager *OrganizerProxy::downloadManager() const { return m_Proxied->downloadManager(); } -MOBase::IPluginList *OrganizerProxy::pluginList() +MOBase::IPluginList *OrganizerProxy::pluginList() const { return m_Proxied->pluginList(); } -MOBase::IModList *OrganizerProxy::modList() +MOBase::IModList *OrganizerProxy::modList() const { return m_Proxied->modList(); } + +MOBase::IPluginGame *OrganizerProxy::managedGame() const +{ + return m_Proxied->managedGame(); +} diff --git a/src/organizerproxy.h b/src/organizerproxy.h index fb502a7f..31009c8a 100644 --- a/src/organizerproxy.h +++ b/src/organizerproxy.h @@ -19,7 +19,7 @@ public: virtual QString downloadsPath() const; virtual QString overwritePath() const; virtual MOBase::VersionInfo appVersion() const; - virtual MOBase::IModInterface *getMod(const QString &name); + virtual MOBase::IModInterface *getMod(const QString &name) const; virtual MOBase::IModInterface *createMod(MOBase::GuessedValue &name); virtual bool removeMod(MOBase::IModInterface *mod); virtual void modDataChanged(MOBase::IModInterface *mod); @@ -35,9 +35,9 @@ public: virtual QStringList getFileOrigins(const QString &fileName) const; virtual QList findFileInfos(const QString &path, const std::function &filter) const; - virtual MOBase::IDownloadManager *downloadManager(); - virtual MOBase::IPluginList *pluginList(); - virtual MOBase::IModList *modList(); + virtual MOBase::IDownloadManager *downloadManager() const; + virtual MOBase::IPluginList *pluginList() const; + virtual MOBase::IModList *modList() const; virtual HANDLE startApplication(const QString &executable, const QStringList &args = QStringList(), const QString &cwd = "", const QString &profile = ""); virtual bool waitForApplication(HANDLE handle, LPDWORD exitCode = nullptr) const; virtual void refreshModList(bool saveChanges); @@ -46,6 +46,7 @@ public: virtual bool onFinishedRun(const std::function &func); virtual bool onModInstalled(const std::function &func); + virtual MOBase::IPluginGame *managedGame() const; private: diff --git a/src/shared/fallout3info.h b/src/shared/fallout3info.h index 51abe073..90bb6ec0 100644 --- a/src/shared/fallout3info.h +++ b/src/shared/fallout3info.h @@ -37,7 +37,6 @@ public: static std::wstring getRegPathStatic(); virtual std::wstring getRegPath() { return getRegPathStatic(); } - virtual std::wstring getBinaryName() { return L"Fallout3.exe"; } virtual GameInfo::Type getType() { return TYPE_FALLOUT3; } diff --git a/src/shared/falloutnvinfo.h b/src/shared/falloutnvinfo.h index 59b52323..613694b2 100644 --- a/src/shared/falloutnvinfo.h +++ b/src/shared/falloutnvinfo.h @@ -37,7 +37,6 @@ public: static std::wstring getRegPathStatic(); virtual std::wstring getRegPath() { return getRegPathStatic(); } - virtual std::wstring getBinaryName() { return L"FalloutNV.exe"; } virtual GameInfo::Type getType() { return TYPE_FALLOUTNV; } diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h index 47a5e767..57613e5e 100644 --- a/src/shared/gameinfo.h +++ b/src/shared/gameinfo.h @@ -58,7 +58,6 @@ public: //**USED IN HOOKDLL virtual std::wstring getRegPath() = 0; - virtual std::wstring getBinaryName() = 0; virtual GameInfo::Type getType() = 0; diff --git a/src/shared/oblivioninfo.h b/src/shared/oblivioninfo.h index ac10b80a..fcdac6bd 100644 --- a/src/shared/oblivioninfo.h +++ b/src/shared/oblivioninfo.h @@ -35,7 +35,6 @@ public: static std::wstring getRegPathStatic(); virtual std::wstring getRegPath() { return getRegPathStatic(); } - virtual std::wstring getBinaryName() { return L"Oblivion.exe"; } virtual GameInfo::Type getType() { return TYPE_OBLIVION; } diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h index 65977a69..f26cd065 100644 --- a/src/shared/skyriminfo.h +++ b/src/shared/skyriminfo.h @@ -37,7 +37,6 @@ public: static std::wstring getRegPathStatic(); virtual std::wstring getRegPath() { return getRegPathStatic(); } - virtual std::wstring getBinaryName() { return L"TESV.exe"; } virtual GameInfo::Type getType() { return TYPE_SKYRIM; } -- cgit v1.3.1 From efaba9070639dbdc77955784b5de3365c9271738 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sun, 22 Nov 2015 21:18:56 +0000 Subject: Final eradication of igameinfo and adding python wrappers for IPluginGame --- src/CMakeLists.txt | 2 -- src/gameinfoimpl.cpp | 55 -------------------------------------------------- src/gameinfoimpl.h | 39 ----------------------------------- src/mainwindow.cpp | 1 - src/organizer.pro | 2 -- src/organizercore.cpp | 10 +-------- src/organizercore.h | 3 --- src/organizerproxy.cpp | 5 ----- src/organizerproxy.h | 1 - 9 files changed, 1 insertion(+), 117 deletions(-) delete mode 100644 src/gameinfoimpl.cpp delete mode 100644 src/gameinfoimpl.h (limited to 'src/organizerproxy.cpp') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 22b725de..8a2964d4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -61,7 +61,6 @@ SET(organizer_SRCS moapplication.cpp profileinputdialog.cpp icondelegate.cpp - gameinfoimpl.cpp csvbuilder.cpp savetextasdialog.cpp qtgroupingproxy.cpp @@ -150,7 +149,6 @@ SET(organizer_HDRS moapplication.h profileinputdialog.h icondelegate.h - gameinfoimpl.h csvbuilder.h savetextasdialog.h qtgroupingproxy.h diff --git a/src/gameinfoimpl.cpp b/src/gameinfoimpl.cpp deleted file mode 100644 index 580ee02c..00000000 --- a/src/gameinfoimpl.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#include "gameinfoimpl.h" -#include -#include -#include - - -using namespace MOBase; -using namespace MOShared; - - -GameInfoImpl::GameInfoImpl() -{ -} - -/* -IGameInfo::Type GameInfoImpl::type() const -{ - switch (GameInfo::instance().getType()) { - case GameInfo::TYPE_OBLIVION: return IGameInfo::TYPE_OBLIVION; - case GameInfo::TYPE_FALLOUT3: return IGameInfo::TYPE_FALLOUT3; - case GameInfo::TYPE_FALLOUTNV: return IGameInfo::TYPE_FALLOUTNV; - case GameInfo::TYPE_SKYRIM: return IGameInfo::TYPE_SKYRIM; - default: throw MyException(QObject::tr("invalid game type %1").arg(GameInfo::instance().getType())); - } -} - -QString GameInfoImpl::path() const -{ - return QDir::fromNativeSeparators(ToQString(GameInfo::instance().getGameDirectory())); -} - -QString GameInfoImpl::binaryName() const -{ - return ToQString(GameInfo::instance().getgetBinaryName()); -} -*/ diff --git a/src/gameinfoimpl.h b/src/gameinfoimpl.h deleted file mode 100644 index f3a21669..00000000 --- a/src/gameinfoimpl.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see . -*/ - -#ifndef GAMEINFOIMPL_H -#define GAMEINFOIMPL_H - - -#include -#include - - -class GameInfoImpl : public MOBase::IGameInfo -{ -public: - GameInfoImpl(); - -// virtual Type type() const; -// virtual QString path() const; -// virtual QString binaryName() const; - -}; - -#endif // GAMEINFOIMPL_H diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 84a51b62..7142bcb1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -52,7 +52,6 @@ along with Mod Organizer. If not, see . #include "credentialsdialog.h" #include "selectiondialog.h" #include "csvbuilder.h" -#include "gameinfoimpl.h" #include "savetextasdialog.h" #include "problemsdialog.h" #include "previewdialog.h" diff --git a/src/organizer.pro b/src/organizer.pro index 65c1e4d3..2869fda5 100644 --- a/src/organizer.pro +++ b/src/organizer.pro @@ -70,7 +70,6 @@ SOURCES += \ moapplication.cpp \ profileinputdialog.cpp \ icondelegate.cpp \ - gameinfoimpl.cpp \ csvbuilder.cpp \ savetextasdialog.cpp \ qtgroupingproxy.cpp \ @@ -145,7 +144,6 @@ HEADERS += \ moapplication.h \ profileinputdialog.h \ icondelegate.h \ - gameinfoimpl.h \ csvbuilder.h \ savetextasdialog.h \ qtgroupingproxy.h \ diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 704dc734..826d5bea 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1,7 +1,6 @@ #include "organizercore.h" #include "mainwindow.h" -#include "gameinfoimpl.h" #include "messagedialog.h" #include "logbuffer.h" #include "credentialsdialog.h" @@ -119,8 +118,7 @@ QStringList toStringList(InputIterator current, InputIterator end) OrganizerCore::OrganizerCore(const QSettings &initSettings) - : m_GameInfo(new GameInfoImpl()) - , m_UserInterface(nullptr) + : m_UserInterface(nullptr) , m_PluginContainer(nullptr) , m_GameName() , m_CurrentProfile(nullptr) @@ -187,7 +185,6 @@ OrganizerCore::~OrganizerCore() m_ModList.setProfile(nullptr); NexusInterface::instance()->cleanup(); - delete m_GameInfo; delete m_DirectoryStructure; } @@ -556,11 +553,6 @@ void OrganizerCore::setCurrentProfile(const QString &profileName) refreshDirectoryStructure(); } -MOBase::IGameInfo &OrganizerCore::gameInfo() const -{ - return *m_GameInfo; -} - MOBase::IModRepositoryBridge *OrganizerCore::createNexusBridge() const { return new NexusBridge(); diff --git a/src/organizercore.h b/src/organizercore.h index 00cf6934..6075eb18 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -126,7 +126,6 @@ public: MOBase::DelayedFileWriter &pluginsWriter() { return m_PluginListsWriter; } public: - MOBase::IGameInfo &gameInfo() const; MOBase::IModRepositoryBridge *createNexusBridge() const; QString profileName() const; QString profilePath() const; @@ -231,8 +230,6 @@ private: private: - MOBase::IGameInfo *m_GameInfo; - IUserInterface *m_UserInterface; PluginContainer *m_PluginContainer; QString m_GameName; diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index 17c5a16f..3c103ff0 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -15,11 +15,6 @@ OrganizerProxy::OrganizerProxy(OrganizerCore *organizer, const QString &pluginNa { } -IGameInfo &OrganizerProxy::gameInfo() const -{ - return m_Proxied->gameInfo(); -} - IModRepositoryBridge *OrganizerProxy::createNexusBridge() const { return new NexusBridge(m_PluginName); diff --git a/src/organizerproxy.h b/src/organizerproxy.h index 31009c8a..2f5e0970 100644 --- a/src/organizerproxy.h +++ b/src/organizerproxy.h @@ -12,7 +12,6 @@ public: OrganizerProxy(OrganizerCore *organizer, const QString &pluginName); - virtual MOBase::IGameInfo &gameInfo() const; virtual MOBase::IModRepositoryBridge *createNexusBridge() const; virtual QString profileName() const; virtual QString profilePath() const; -- cgit v1.3.1 From b9b12ca765d1703ac2e3852746e7acc3a20949a9 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Wed, 25 Nov 2015 14:23:58 +0000 Subject: Bunch of const correctness changes. There shouldn't be any update of plugin games once MO has started --- src/downloadmanager.cpp | 2 +- src/downloadmanager.h | 4 ++-- src/executableslist.cpp | 2 +- src/executableslist.h | 2 +- src/modinfo.cpp | 5 ++++- src/modinfo.h | 5 ++++- src/organizercore.h | 2 +- src/organizerproxy.cpp | 2 +- src/organizerproxy.h | 2 +- src/pluginlist.cpp | 2 +- src/pluginlist.h | 4 ++-- src/settings.cpp | 2 +- src/settings.h | 4 ++-- 13 files changed, 22 insertions(+), 16 deletions(-) (limited to 'src/organizerproxy.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 588b8bb9..4a6769b1 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -1465,7 +1465,7 @@ void DownloadManager::directoryChanged(const QString&) refreshList(); } -void DownloadManager::managedGameChanged(MOBase::IPluginGame *managedGame) +void DownloadManager::managedGameChanged(MOBase::IPluginGame const *managedGame) { m_ManagedGame = managedGame; } diff --git a/src/downloadmanager.h b/src/downloadmanager.h index faa4267e..54db4648 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -417,7 +417,7 @@ public slots: void nxmRequestFailed(int modID, int fileID, QVariant userData, int requestID, const QString &errorString); - void managedGameChanged(MOBase::IPluginGame *gamePlugin); + void managedGameChanged(MOBase::IPluginGame const *gamePlugin); private slots: @@ -506,7 +506,7 @@ private: QRegExp m_DateExpression; - MOBase::IPluginGame *m_ManagedGame; + MOBase::IPluginGame const *m_ManagedGame; }; diff --git a/src/executableslist.cpp b/src/executableslist.cpp index 12e3d7aa..2182a425 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -38,7 +38,7 @@ ExecutablesList::~ExecutablesList() { } -void ExecutablesList::init(IPluginGame *game) +void ExecutablesList::init(IPluginGame const *game) { Q_ASSERT(game != nullptr); m_Executables.clear(); diff --git a/src/executableslist.h b/src/executableslist.h index b4054bcc..833829c8 100644 --- a/src/executableslist.h +++ b/src/executableslist.h @@ -78,7 +78,7 @@ public: /** * @brief initialise the list with the executables preconfigured for this game **/ - void init(MOBase::IPluginGame *game); + void init(MOBase::IPluginGame const *game); /** * @brief find an executable by its name diff --git a/src/modinfo.cpp b/src/modinfo.cpp index d79a7919..df34c00f 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -203,7 +203,10 @@ unsigned int ModInfo::findMod(const boost::function &filter } -void ModInfo::updateFromDisc(const QString &modDirectory, DirectoryEntry **directoryStructure, bool displayForeign, MOBase::IPluginGame const *game) +void ModInfo::updateFromDisc(const QString &modDirectory, + DirectoryEntry **directoryStructure, + bool displayForeign, + MOBase::IPluginGame const *game) { QMutexLocker lock(&s_Mutex); s_Collection.clear(); diff --git a/src/modinfo.h b/src/modinfo.h index 6de4123b..f6484707 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -107,7 +107,10 @@ public: /** * @brief read the mod directory and Mod ModInfo objects for all subdirectories **/ - static void updateFromDisc(const QString &modDirectory, MOShared::DirectoryEntry **directoryStructure, bool displayForeign, const MOBase::IPluginGame *game); + static void updateFromDisc(const QString &modDirectory, + MOShared::DirectoryEntry **directoryStructure, + bool displayForeign, + MOBase::IPluginGame const *game); static void clear() { s_Collection.clear(); s_ModsByName.clear(); s_ModsByModID.clear(); } diff --git a/src/organizercore.h b/src/organizercore.h index 6075eb18..a673065a 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -193,7 +193,7 @@ signals: */ void modInstalled(const QString &modName); - void managedGameChanged(MOBase::IPluginGame *gamePlugin); + void managedGameChanged(MOBase::IPluginGame const *gamePlugin); private: diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index 3c103ff0..fdc60a27 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -167,7 +167,7 @@ MOBase::IModList *OrganizerProxy::modList() const return m_Proxied->modList(); } -MOBase::IPluginGame *OrganizerProxy::managedGame() const +MOBase::IPluginGame const *OrganizerProxy::managedGame() const { return m_Proxied->managedGame(); } diff --git a/src/organizerproxy.h b/src/organizerproxy.h index 2f5e0970..62a35498 100644 --- a/src/organizerproxy.h +++ b/src/organizerproxy.h @@ -45,7 +45,7 @@ public: virtual bool onFinishedRun(const std::function &func); virtual bool onModInstalled(const std::function &func); - virtual MOBase::IPluginGame *managedGame() const; + virtual MOBase::IPluginGame const *managedGame() const; private: diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 6f883645..48b27f05 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -1211,7 +1211,7 @@ PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, } } -void PluginList::managedGameChanged(IPluginGame *gamePlugin) +void PluginList::managedGameChanged(IPluginGame const *gamePlugin) { m_GamePlugin = gamePlugin; } diff --git a/src/pluginlist.h b/src/pluginlist.h index 01d4bfbe..9fe6eeac 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -261,7 +261,7 @@ public slots: * @brief The currently managed game has changed * @param gamePlugin */ - void managedGameChanged(MOBase::IPluginGame *gamePlugin); + void managedGameChanged(MOBase::IPluginGame const *gamePlugin); signals: @@ -347,7 +347,7 @@ private: QTemporaryFile m_TempFile; - MOBase::IPluginGame *m_GamePlugin; + MOBase::IPluginGame const *m_GamePlugin; }; diff --git a/src/settings.cpp b/src/settings.cpp index 61d6aaa3..95462c82 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -116,7 +116,7 @@ void Settings::registerAsNXMHandler(bool force) } } -void Settings::managedGameChanged(IPluginGame *gamePlugin) +void Settings::managedGameChanged(IPluginGame const *gamePlugin) { m_GamePlugin = gamePlugin; } diff --git a/src/settings.h b/src/settings.h index def1dc5c..b6f25a6d 100644 --- a/src/settings.h +++ b/src/settings.h @@ -299,7 +299,7 @@ public: public slots: - void managedGameChanged(MOBase::IPluginGame *gamePlugin); + void managedGameChanged(MOBase::IPluginGame const *gamePlugin); private: @@ -420,7 +420,7 @@ private: static Settings *s_Instance; - MOBase::IPluginGame *m_GamePlugin; + MOBase::IPluginGame const *m_GamePlugin; QSettings m_Settings; -- 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/organizerproxy.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