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(-) 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