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/settings.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/settings.cpp') diff --git a/src/settings.cpp b/src/settings.cpp index 4c2a34c8..b51ba71e 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -22,7 +22,6 @@ along with Mod Organizer. If not, see . #include "settingsdialog.h" #include "utility.h" #include "helper.h" -#include "json.h" #include #include #include -- cgit v1.3.1 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/downloadmanager.cpp | 11 +++++++++-- src/downloadmanager.h | 4 ++++ src/mainwindow.cpp | 18 +++++++++--------- src/organizercore.cpp | 1 + src/settings.cpp | 14 +++++--------- src/shared/fallout3info.h | 1 - src/shared/falloutnvinfo.h | 1 - src/shared/gameinfo.h | 1 - src/shared/oblivioninfo.h | 2 +- src/shared/skyriminfo.h | 1 - 10 files changed, 29 insertions(+), 25 deletions(-) (limited to 'src/settings.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index e0d76765..588b8bb9 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -18,10 +18,11 @@ along with Mod Organizer. If not, see . */ #include "downloadmanager.h" + #include "nxmurl.h" #include "nexusinterface.h" #include "nxmaccessmanager.h" -#include +#include "iplugingame.h" #include #include #include "utility.h" @@ -30,6 +31,7 @@ along with Mod Organizer. If not, see . #include "bbcode.h" #include #include + #include #include #include @@ -37,6 +39,7 @@ along with Mod Organizer. If not, see . #include #include #include + #include #include @@ -447,7 +450,7 @@ void DownloadManager::addNXMDownload(const QString &url) { NXMUrl nxmInfo(url); - QString managedGame = ToQString(MOShared::GameInfo::instance().getGameShortName()); + QString managedGame = m_ManagedGame->getNexusName(); 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())); @@ -1462,3 +1465,7 @@ void DownloadManager::directoryChanged(const QString&) refreshList(); } +void DownloadManager::managedGameChanged(MOBase::IPluginGame *managedGame) +{ + m_ManagedGame = managedGame; +} diff --git a/src/downloadmanager.h b/src/downloadmanager.h index f13cc65d..faa4267e 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -35,6 +35,7 @@ along with Mod Organizer. If not, see . #include #include +namespace MOBase { class IPluginGame; } class NexusInterface; @@ -416,6 +417,8 @@ public slots: void nxmRequestFailed(int modID, int fileID, QVariant userData, int requestID, const QString &errorString); + void managedGameChanged(MOBase::IPluginGame *gamePlugin); + private slots: void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); @@ -503,6 +506,7 @@ private: QRegExp m_DateExpression; + MOBase::IPluginGame *m_ManagedGame; }; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3c331c65..ceb118ea 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -58,10 +58,8 @@ along with Mod Organizer. If not, see . #include "browserdialog.h" #include "aboutdialog.h" #include "safewritefile.h" -#include "organizerproxy.h" #include "nxmaccessmanager.h" #include -#include #include #include #include @@ -70,15 +68,11 @@ along with Mod Organizer. If not, see . #include #include #include -#include -#include -#include -#include + #include #include #include #include -#include #include #include #include @@ -126,8 +120,14 @@ along with Mod Organizer. If not, see . #include #include #endif + +#include #include #include +#include +#include +#include +#include #ifdef TEST_MODELS #include "modeltest.h" @@ -4391,8 +4391,8 @@ void MainWindow::on_bossButton_clicked() parameters << "--unattended" << "--stdout" << "--noreport" - << "--game" << ToQString(GameInfo::instance().getGameShortName()) - << "--gamePath" << QString("\"%1\"").arg(ToQString(GameInfo::instance().getGameDirectory())) + << "--game" << m_OrganizerCore.managedGame()->getNexusName() + << "--gamePath" << QString("\"%1\"").arg(m_OrganizerCore.managedGame()->gameDirectory().absolutePath()) << "--out" << outPath; if (m_DidUpdateMasterList) { diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 7a2f95d3..c81a473c 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -159,6 +159,7 @@ OrganizerCore::OrganizerCore(const QSettings &initSettings) connect(NexusInterface::instance()->getAccessManager(), SIGNAL(loginFailed(QString)), this, SLOT(loginFailed(QString))); connect(this, SIGNAL(managedGameChanged(MOBase::IPluginGame*)), &m_Settings, SLOT(managedGameChanged(MOBase::IPluginGame*))); + connect(this, SIGNAL(managedGameChanged(MOBase::IPluginGame*)), &m_DownloadManager, SLOT(managedGameChanged(MOBase::IPluginGame*))); connect(&m_PluginList, &PluginList::writePluginsList, &m_PluginListsWriter, &DelayedFileWriterBase::write); 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"), diff --git a/src/shared/fallout3info.h b/src/shared/fallout3info.h index ae6a27c7..ed130e53 100644 --- a/src/shared/fallout3info.h +++ b/src/shared/fallout3info.h @@ -41,7 +41,6 @@ public: virtual GameInfo::Type getType() { return TYPE_FALLOUT3; } virtual std::wstring getGameName() const { return L"Fallout 3"; } - virtual std::wstring getGameShortName() const { return L"Fallout3"; } virtual std::vector getSavegameAttachmentExtensions(); diff --git a/src/shared/falloutnvinfo.h b/src/shared/falloutnvinfo.h index 2179bf2f..75febd4c 100644 --- a/src/shared/falloutnvinfo.h +++ b/src/shared/falloutnvinfo.h @@ -41,7 +41,6 @@ public: virtual GameInfo::Type getType() { return TYPE_FALLOUTNV; } virtual std::wstring getGameName() const { return L"New Vegas"; } - virtual std::wstring getGameShortName() const { return L"FalloutNV"; } virtual std::vector getSavegameAttachmentExtensions(); diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h index 9ae42159..9538a19c 100644 --- a/src/shared/gameinfo.h +++ b/src/shared/gameinfo.h @@ -62,7 +62,6 @@ public: virtual GameInfo::Type getType() = 0; virtual std::wstring getGameName() const = 0; - virtual std::wstring getGameShortName() const = 0; /// determine the load order mechanism used by this game. this may throw an /// exception if the mechanism can't be determined diff --git a/src/shared/oblivioninfo.h b/src/shared/oblivioninfo.h index 2a550e0e..a9808d77 100644 --- a/src/shared/oblivioninfo.h +++ b/src/shared/oblivioninfo.h @@ -39,7 +39,7 @@ public: virtual GameInfo::Type getType() { return TYPE_OBLIVION; } virtual std::wstring getGameName() const { return L"Oblivion"; } - virtual std::wstring getGameShortName() const { return L"Oblivion"; } + virtual std::vector getSavegameAttachmentExtensions(); // file name of this games ini (no path) diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h index 741f76c9..1bf67c11 100644 --- a/src/shared/skyriminfo.h +++ b/src/shared/skyriminfo.h @@ -41,7 +41,6 @@ public: virtual GameInfo::Type getType() { return TYPE_SKYRIM; } virtual std::wstring getGameName() const { return L"Skyrim"; } - virtual std::wstring getGameShortName() const { return L"Skyrim"; } virtual LoadOrderMechanism getLoadOrderMechanism() 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/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