From 37c3bea7dd5a562a97c00b740103cc2868b3013b Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Tue, 24 Nov 2015 06:58:29 +0000 Subject: Removes all uses of GameInfo::getShortName, replaced by IPluginGame::getNexustName --- src/settings.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/settings.cpp') diff --git a/src/settings.cpp b/src/settings.cpp index 4c2a34c8..61d6aaa3 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -23,25 +23,21 @@ along with Mod Organizer. If not, see . #include "utility.h" #include "helper.h" #include "json.h" -#include #include #include #include #include -#include -#include -#include #include -#include #include +#include +#include +#include +#include #include - using namespace MOBase; -using namespace MOShared; - template class QListWidgetItemEx : public QListWidgetItem { @@ -112,7 +108,7 @@ void Settings::registerAsNXMHandler(bool force) std::wstring nxmPath = ToWString(QCoreApplication::applicationDirPath() + "/nxmhandler.exe"); std::wstring executable = ToWString(QCoreApplication::applicationFilePath()); std::wstring mode = force ? L"forcereg" : L"reg"; - std::wstring parameters = mode + L" " + GameInfo::instance().getGameShortName() + L" \"" + executable + L"\""; + std::wstring parameters = mode + L" " + m_GamePlugin->getNexusName().toStdWString() + L" \"" + executable + L"\""; HINSTANCE res = ::ShellExecuteW(nullptr, L"open", nxmPath.c_str(), parameters.c_str(), nullptr, SW_SHOWNORMAL); if ((int)res <= 32) { QMessageBox::critical(nullptr, tr("Failed"), -- 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/settings.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 ca54ee2e9a8f1d49d81d5c3b66a860b9b16992d6 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Thu, 26 Nov 2015 21:22:47 +0000 Subject: Renamed getNexusName to getGameShortName as previously because it hopefully isn't too nexus related. --- src/downloadmanager.cpp | 2 +- src/mainwindow.cpp | 2 +- src/nexusinterface.cpp | 6 +++--- src/organizercore.cpp | 4 ++-- src/settings.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/settings.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 4a6769b1..e95a315f 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -450,7 +450,7 @@ void DownloadManager::addNXMDownload(const QString &url) { NXMUrl nxmInfo(url); - QString managedGame = m_ManagedGame->getNexusName(); + QString managedGame = m_ManagedGame->getGameShortName(); qDebug("add nxm download: %s", qPrintable(url)); if (nxmInfo.game().compare(managedGame, Qt::CaseInsensitive) != 0) { qDebug("download requested for wrong game (game: %s, url: %s)", qPrintable(managedGame), qPrintable(nxmInfo.game())); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index dd5a1b01..152baee7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4401,7 +4401,7 @@ void MainWindow::on_bossButton_clicked() parameters << "--unattended" << "--stdout" << "--noreport" - << "--game" << m_OrganizerCore.managedGame()->getNexusName() + << "--game" << m_OrganizerCore.managedGame()->getGameShortName() << "--gamePath" << QString("\"%1\"").arg(m_OrganizerCore.managedGame()->gameDirectory().absolutePath()) << "--out" << outPath; diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index 7a0b0a17..aadfdc1e 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -244,12 +244,12 @@ bool NexusInterface::isURLGameRelated(const QUrl &url) const { QString const name(url.toString()); return name.startsWith(getGameURL() + "/") || - name.startsWith("http://" + m_Game->getNexusName().toLower() + ".nexusmods.com/mods/"); + name.startsWith("http://" + m_Game->getGameShortName().toLower() + ".nexusmods.com/mods/"); } QString NexusInterface::getGameURL() const { - return "http://www.nexusmods.com/" + m_Game->getNexusName().toLower(); + return "http://www.nexusmods.com/" + m_Game->getGameShortName().toLower(); } QString NexusInterface::getModURL(int modID) const @@ -576,7 +576,7 @@ void NexusInterface::managedGameChanged(IPluginGame const *game) namespace { QString get_management_url(MOBase::IPluginGame const *game) { - return "http://nmm.nexusmods.com/" + game->getNexusName().toLower(); + return "http://nmm.nexusmods.com/" + game->getGameShortName().toLower(); } } diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 66a3799a..042a9f1e 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -401,8 +401,8 @@ void OrganizerCore::connectPlugins(PluginContainer *container) } //Do this the hard way for (const IPluginGame * const game : container->plugins()) { - QString n = game->getNexusName(); - if (game->getNexusName() == "Skyrim") { + QString n = game->getGameShortName(); + if (game->getGameShortName() == "Skyrim") { m_Updater.setNexusDownload(game); break; } diff --git a/src/settings.cpp b/src/settings.cpp index 95462c82..e175b210 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -108,7 +108,7 @@ void Settings::registerAsNXMHandler(bool force) std::wstring nxmPath = ToWString(QCoreApplication::applicationDirPath() + "/nxmhandler.exe"); std::wstring executable = ToWString(QCoreApplication::applicationFilePath()); std::wstring mode = force ? L"forcereg" : L"reg"; - std::wstring parameters = mode + L" " + m_GamePlugin->getNexusName().toStdWString() + L" \"" + executable + L"\""; + std::wstring parameters = mode + L" " + m_GamePlugin->getGameShortName().toStdWString() + L" \"" + executable + L"\""; HINSTANCE res = ::ShellExecuteW(nullptr, L"open", nxmPath.c_str(), parameters.c_str(), nullptr, SW_SHOWNORMAL); if ((int)res <= 32) { QMessageBox::critical(nullptr, tr("Failed"), -- cgit v1.3.1