From 9d88ca13b9b6a193dfb17a1ee3ea5e5cbed8a7e9 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Thu, 15 Oct 2015 13:34:01 +0100 Subject: Added functionality to use the web page link in a fomod to supply an optional web page. Also refactored modinfo into multiple files (as the actual types are opaque anyway) and cleaned up the headers a bit I also changed 'visit on nexus' from the menu not to open the downloads tab because it was a little confusing --- src/mainwindow.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 26ff4b98..1dca599d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2525,12 +2525,22 @@ void MainWindow::visitOnNexus_clicked() { int modID = m_OrganizerCore.modList()->data(m_OrganizerCore.modList()->index(m_ContextRow, 0), Qt::UserRole).toInt(); if (modID > 0) { - nexusLinkActivated(QString("%1/mods/%2").arg(ToQString(GameInfo::instance().getNexusPage(false))).arg(modID)); + linkClicked(QString("%1/mods/%2").arg(ToQString(GameInfo::instance().getNexusPage(false))).arg(modID)); } else { MessageDialog::showMessage(tr("Nexus ID for this Mod is unknown"), this); } } +void MainWindow::visitWebPage_clicked() +{ + ModInfo::Ptr info = ModInfo::getByIndex(m_ContextRow); + if (info->getURL() != "") { + linkClicked(info->getURL()); + } else { + MessageDialog::showMessage(tr("Web page for this mod is unknown"), this); + } +} + void MainWindow::openExplorer_clicked() { ModInfo::Ptr modInfo = ModInfo::getByIndex(m_ContextRow); @@ -3106,7 +3116,14 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos) menu->addAction(tr("Ignore missing data"), this, SLOT(ignoreMissingData_clicked())); } - menu->addAction(tr("Visit on Nexus"), this, SLOT(visitOnNexus_clicked())); + if (info->getNexusID() > 0) { + menu->addAction(tr("Visit on Nexus"), this, SLOT(visitOnNexus_clicked())); + } + + if (info->getURL() != "") { + menu->addAction(tr("Visit web page"), this, SLOT(visitWebPage_clicked())); + } + menu->addAction(tr("Open in explorer"), this, SLOT(openExplorer_clicked())); } -- cgit v1.3.1 From d4754f4d3ca7451d784e89ae1ddef240666dfdf8 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Thu, 15 Oct 2015 18:44:39 +0100 Subject: Fix for some nexus fomods having the old version of the mod link and not the new version. Also fixed a lot of const correctness things --- src/mainwindow.cpp | 4 ++- src/shared/SConscript | 10 +++---- src/shared/fallout3info.cpp | 17 ++++++++---- src/shared/fallout3info.h | 31 ++++++++++----------- src/shared/falloutnvinfo.cpp | 17 ++++++++---- src/shared/falloutnvinfo.h | 63 ++++++++++-------------------------------- src/shared/gameinfo.cpp | 13 +++++++++ src/shared/gameinfo.h | 30 +++++++++++--------- src/shared/oblivioninfo.cpp | 31 ++++++++------------- src/shared/oblivioninfo.h | 65 ++++++++++---------------------------------- src/shared/skyriminfo.cpp | 17 ++++++++---- src/shared/skyriminfo.h | 26 ++++++++++-------- 12 files changed, 138 insertions(+), 186 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1dca599d..9982e928 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3120,7 +3120,9 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos) menu->addAction(tr("Visit on Nexus"), this, SLOT(visitOnNexus_clicked())); } - if (info->getURL() != "") { + if (info->getURL() != "" && + !GameInfo::instance().isValidModURL(info->getNexusID(), + info->getURL().toStdWString())) { menu->addAction(tr("Visit web page"), this, SLOT(visitWebPage_clicked())); } diff --git a/src/shared/SConscript b/src/shared/SConscript index 69a95289..24ca5b19 100644 --- a/src/shared/SConscript +++ b/src/shared/SConscript @@ -1,8 +1,6 @@ -Import('qt_env') +Import('env') -env = qt_env.Clone() - -env.EnableQtModules('Core', 'Gui') +env = env.Clone() env.AppendUnique(CPPDEFINES = [ 'UNICODE', @@ -21,5 +19,5 @@ env.AppendUnique(CPPPATH = [ # Not sure if renaming this helps much as it's static env.StaticLibrary('mo_shared', env.Glob('*.cpp')) -res = env['QT_USED_MODULES'] -Return('res') +#res = env['QT_USED_MODULES'] +#Return('res') diff --git a/src/shared/fallout3info.cpp b/src/shared/fallout3info.cpp index 0b369b50..f0776a7d 100644 --- a/src/shared/fallout3info.cpp +++ b/src/shared/fallout3info.cpp @@ -63,7 +63,7 @@ std::wstring Fallout3Info::getRegPathStatic() } -std::vector Fallout3Info::getDLCPlugins() +std::vector Fallout3Info::getDLCPlugins() const { return boost::assign::list_of (L"ThePitt.esm") (L"Anchorage.esm") @@ -73,22 +73,22 @@ std::vector Fallout3Info::getDLCPlugins() ; } -std::vector Fallout3Info::getSavegameAttachmentExtensions() +std::vector Fallout3Info::getSavegameAttachmentExtensions() const { return std::vector(); } -std::vector Fallout3Info::getIniFileNames() +std::vector Fallout3Info::getIniFileNames() const { return boost::assign::list_of(L"fallout.ini")(L"falloutprefs.ini"); } -std::wstring Fallout3Info::getReferenceDataFile() +std::wstring Fallout3Info::getReferenceDataFile() const { return L"Fallout - Meshes.bsa"; } -std::wstring Fallout3Info::getNexusPage(bool nmmScheme) +std::wstring Fallout3Info::getNexusPage(bool nmmScheme) const { if (nmmScheme) { return L"http://nmm.nexusmods.com/fallout3"; @@ -107,7 +107,7 @@ int Fallout3Info::getNexusModIDStatic() return 16348; } -bool Fallout3Info::rerouteToProfile(const wchar_t *fileName, const wchar_t*) +bool Fallout3Info::rerouteToProfile(const wchar_t *fileName, const wchar_t*) const { static LPCWSTR profileFiles[] = { L"fallout.ini", L"falloutprefs.ini", L"plugins.txt", nullptr }; @@ -119,4 +119,9 @@ bool Fallout3Info::rerouteToProfile(const wchar_t *fileName, const wchar_t*) return false; } +bool Fallout3Info::isValidModURL(int modID, const std::wstring &url) const +{ + return GameInfo::isValidModURL(modID, url, L"http://fallout3.nexusmods.com"); +} + } // namespace MOShared diff --git a/src/shared/fallout3info.h b/src/shared/fallout3info.h index 0045581d..0a2b0ebe 100644 --- a/src/shared/fallout3info.h +++ b/src/shared/fallout3info.h @@ -20,7 +20,6 @@ along with Mod Organizer. If not, see . #ifndef FALLOUT3INFO_H #define FALLOUT3INFO_H - #include "gameinfo.h" namespace MOShared { @@ -36,36 +35,34 @@ public: virtual ~Fallout3Info() {} static std::wstring getRegPathStatic(); - virtual std::wstring getRegPath() { return getRegPathStatic(); } - virtual std::wstring getBinaryName() { return L"Fallout3.exe"; } + virtual std::wstring getRegPath() const { return getRegPathStatic(); } + virtual std::wstring getBinaryName() const { return L"Fallout3.exe"; } - virtual GameInfo::Type getType() { return TYPE_FALLOUT3; } + virtual GameInfo::Type getType() const { return TYPE_FALLOUT3; } virtual std::wstring getGameName() const { return L"Fallout 3"; } virtual std::wstring getGameShortName() const { return L"Fallout3"; } - virtual std::vector getDLCPlugins(); - virtual std::vector getSavegameAttachmentExtensions(); + virtual std::vector getDLCPlugins() const; + virtual std::vector getSavegameAttachmentExtensions() const; // file name of this games ini (no path) - virtual std::vector getIniFileNames(); + virtual std::vector getIniFileNames() const; - virtual std::wstring getReferenceDataFile(); + virtual std::wstring getReferenceDataFile() const; - virtual std::wstring getNexusPage(bool nmmScheme = true); + virtual std::wstring getNexusPage(bool nmmScheme = true) const; static std::wstring getNexusInfoUrlStatic(); - virtual std::wstring getNexusInfoUrl() { return getNexusInfoUrlStatic(); } + virtual std::wstring getNexusInfoUrl() const { return getNexusInfoUrlStatic(); } static int getNexusModIDStatic(); - virtual int getNexusModID() { return getNexusModIDStatic(); } - virtual int getNexusGameID() { return 120; } + virtual int getNexusModID() const { return getNexusModIDStatic(); } + virtual int getNexusGameID() const { return 120; } - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); + virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) const; - // get a list of executables (game binary and known-to-work 3rd party tools). All of these are relative to - // the game directory - //virtual std::vector getExecutables(); + virtual std::wstring archiveListKey() const { return L"SArchiveList"; } - virtual std::wstring archiveListKey() { return L"SArchiveList"; } + virtual bool isValidModURL(int modID, std::wstring const &url) const; private: diff --git a/src/shared/falloutnvinfo.cpp b/src/shared/falloutnvinfo.cpp index 1203bd25..f6de72e3 100644 --- a/src/shared/falloutnvinfo.cpp +++ b/src/shared/falloutnvinfo.cpp @@ -63,7 +63,7 @@ std::wstring FalloutNVInfo::getRegPathStatic() } } -std::vector FalloutNVInfo::getDLCPlugins() +std::vector FalloutNVInfo::getDLCPlugins() const { return boost::assign::list_of (L"DeadMoney.esm") (L"HonestHearts.esm") @@ -77,22 +77,22 @@ std::vector FalloutNVInfo::getDLCPlugins() ; } -std::vector FalloutNVInfo::getSavegameAttachmentExtensions() +std::vector FalloutNVInfo::getSavegameAttachmentExtensions() const { return std::vector(); } -std::vector FalloutNVInfo::getIniFileNames() +std::vector FalloutNVInfo::getIniFileNames() const { return boost::assign::list_of(L"fallout.ini")(L"falloutprefs.ini"); } -std::wstring FalloutNVInfo::getReferenceDataFile() +std::wstring FalloutNVInfo::getReferenceDataFile() const { return L"Fallout - Meshes.bsa"; } -std::wstring FalloutNVInfo::getNexusPage(bool nmmScheme) +std::wstring FalloutNVInfo::getNexusPage(bool nmmScheme) const { if (nmmScheme) { return L"http://nmm.nexusmods.com/newvegas"; @@ -114,7 +114,7 @@ int FalloutNVInfo::getNexusModIDStatic() } -bool FalloutNVInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*) +bool FalloutNVInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*) const { static LPCWSTR profileFiles[] = { L"fallout.ini", L"falloutprefs.ini", L"plugins.txt", nullptr }; @@ -126,4 +126,9 @@ bool FalloutNVInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*) return false; } +bool FalloutNVInfo::isValidModURL(int modID, std::wstring const &url) const +{ + return GameInfo::isValidModURL(modID, url, L"http://newvegas.nexusmods.com"); +} + } // namespace MOShared diff --git a/src/shared/falloutnvinfo.h b/src/shared/falloutnvinfo.h index e1a614d2..d03add9c 100644 --- a/src/shared/falloutnvinfo.h +++ b/src/shared/falloutnvinfo.h @@ -36,69 +36,34 @@ public: virtual ~FalloutNVInfo() {} static std::wstring getRegPathStatic(); - virtual std::wstring getRegPath() { return getRegPathStatic(); } - virtual std::wstring getBinaryName() { return L"FalloutNV.exe"; } + virtual std::wstring getRegPath() const { return getRegPathStatic(); } + virtual std::wstring getBinaryName() const { return L"FalloutNV.exe"; } - virtual GameInfo::Type getType() { return TYPE_FALLOUTNV; } + virtual GameInfo::Type getType() const { return TYPE_FALLOUTNV; } virtual std::wstring getGameName() const { return L"New Vegas"; } virtual std::wstring getGameShortName() const { return L"FalloutNV"; } -// virtual bool requiresSteam() const { return true; } - -/* virtual std::wstring getInvalidationBSA() - { - return L"Fallout - Invalidation.bsa"; - } - - virtual bool isInvalidationBSA(const std::wstring &bsaName) - { - static LPCWSTR invalidation[] = { L"Fallout - AI!.bsa", L"Fallout - Invalidation.bsa", nullptr }; - - for (int i = 0; invalidation[i] != nullptr; ++i) { - if (wcscmp(bsaName.c_str(), invalidation[i]) == 0) { - return true; - } - } - return false; - } - - virtual std::vector getVanillaBSAs() - { - return boost::assign::list_of (L"Fallout - Textures.bsa") - (L"Fallout - Textures2.bsa") - (L"Fallout - Meshes.bsa") - (L"Fallout - Voices1.bsa") - (L"Fallout - Sound.bsa") - (L"Fallout - Misc.bsa"); - } - - virtual std::vector getPrimaryPlugins() - { - return boost::assign::list_of(L"falloutnv.esm"); - }*/ - virtual std::vector getDLCPlugins(); - virtual std::vector getSavegameAttachmentExtensions(); + virtual std::vector getDLCPlugins() const; + virtual std::vector getSavegameAttachmentExtensions() const; // file name of this games ini (no path) - virtual std::vector getIniFileNames(); + virtual std::vector getIniFileNames() const; - virtual std::wstring getReferenceDataFile(); + virtual std::wstring getReferenceDataFile() const; - virtual std::wstring getNexusPage(bool nmmScheme = true); + virtual std::wstring getNexusPage(bool nmmScheme = true) const; static std::wstring getNexusInfoUrlStatic(); - virtual std::wstring getNexusInfoUrl() { return getNexusInfoUrlStatic(); } + virtual std::wstring getNexusInfoUrl() const { return getNexusInfoUrlStatic(); } static int getNexusModIDStatic(); - virtual int getNexusModID() { return getNexusModIDStatic(); } - virtual int getNexusGameID() { return 130; } + virtual int getNexusModID() const { return getNexusModIDStatic(); } + virtual int getNexusGameID() const { return 130; } - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); + virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) const; - // get a list of executables (game binary and known-to-work 3rd party tools). All of these are relative to - // the game directory - //virtual std::vector getExecutables(); + virtual std::wstring archiveListKey() const { return L"SArchiveList"; } - virtual std::wstring archiveListKey() { return L"SArchiveList"; } + virtual bool isValidModURL(int modID, const std::wstring &url) const; private: diff --git a/src/shared/gameinfo.cpp b/src/shared/gameinfo.cpp index 1f25cec1..5338c069 100644 --- a/src/shared/gameinfo.cpp +++ b/src/shared/gameinfo.cpp @@ -86,6 +86,19 @@ void GameInfo::identifyMyGamesDirectory(const std::wstring &file) } } +bool GameInfo::isValidModURL(int modID, const std::wstring &url, const std::wstring &alt) const +{ + std::wostringstream os; + os << getNexusPage(false) << "/mods/" << modID; + if (url == os.str()) { + return true; + } + os.clear(); + os.str(L""); + os << alt << "/mods/" << modID; + return url == os.str(); +} + bool GameInfo::identifyGame(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &searchPath) { diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h index a32b6b82..8caa5937 100644 --- a/src/shared/gameinfo.h +++ b/src/shared/gameinfo.h @@ -56,12 +56,12 @@ public: virtual ~GameInfo() {} - std::wstring getOrganizerDirectory() { return m_OrganizerDirectory; } + std::wstring getOrganizerDirectory() const { return m_OrganizerDirectory; } - virtual std::wstring getRegPath() = 0; - virtual std::wstring getBinaryName() = 0; + virtual std::wstring getRegPath() const = 0; + virtual std::wstring getBinaryName() const = 0; - virtual GameInfo::Type getType() = 0; + virtual GameInfo::Type getType() const = 0; virtual std::wstring getGameName() const = 0; virtual std::wstring getGameShortName() const = 0; @@ -75,22 +75,24 @@ public: virtual bool requiresSteam() const; // get a list of file extensions for additional files belonging to a save game - virtual std::vector getSavegameAttachmentExtensions() = 0; + virtual std::vector getSavegameAttachmentExtensions() const = 0; // get a set of esp/esm files that are part of known dlcs - virtual std::vector getDLCPlugins() = 0; + virtual std::vector getDLCPlugins() const = 0; // file name of this games ini file(s) - virtual std::vector getIniFileNames() = 0; + virtual std::vector getIniFileNames() const = 0; - virtual std::wstring getReferenceDataFile() = 0; + virtual std::wstring getReferenceDataFile() const = 0; - virtual std::wstring getNexusPage(bool nmmScheme = true) = 0; - virtual std::wstring getNexusInfoUrl() = 0; - virtual int getNexusModID() = 0; - virtual int getNexusGameID() = 0; + virtual std::wstring getNexusPage(bool nmmScheme = true) const = 0; + virtual std::wstring getNexusInfoUrl() const = 0; + virtual int getNexusModID() const = 0; + virtual int getNexusGameID() const = 0; - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) = 0; + virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) const = 0; + + virtual bool isValidModURL(int modID, std::wstring const &url) const = 0; public: @@ -108,6 +110,8 @@ protected: const std::wstring &getMyGamesDirectory() const { return m_MyGamesDirectory; } void identifyMyGamesDirectory(const std::wstring &file); + bool isValidModURL(int modID, const std::wstring &url, const std::wstring &alt) const; + private: static bool identifyGame(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &searchPath); diff --git a/src/shared/oblivioninfo.cpp b/src/shared/oblivioninfo.cpp index 16748f58..730c186b 100644 --- a/src/shared/oblivioninfo.cpp +++ b/src/shared/oblivioninfo.cpp @@ -63,17 +63,7 @@ std::wstring OblivionInfo::getRegPathStatic() } } - - - - - - - - - - -std::vector OblivionInfo::getDLCPlugins() +std::vector OblivionInfo::getDLCPlugins() const { return boost::assign::list_of (L"DLCShiveringIsles.esp") (L"Knights.esp") @@ -89,22 +79,18 @@ std::vector OblivionInfo::getDLCPlugins() } -std::vector OblivionInfo::getSavegameAttachmentExtensions() +std::vector OblivionInfo::getSavegameAttachmentExtensions() const { return boost::assign::list_of(L"obse"); } -std::vector OblivionInfo::getIniFileNames() +std::vector OblivionInfo::getIniFileNames() const { return boost::assign::list_of(L"oblivion.ini")(L"oblivionprefs.ini"); } - - - - -std::wstring OblivionInfo::getNexusPage(bool nmmScheme) +std::wstring OblivionInfo::getNexusPage(bool nmmScheme) const { if (nmmScheme) { return L"http://nmm.nexusmods.com/oblivion"; @@ -125,7 +111,7 @@ int OblivionInfo::getNexusModIDStatic() return 38277; } -bool OblivionInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*) +bool OblivionInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*) const { static LPCWSTR profileFiles[] = { L"oblivion.ini", L"oblivionprefs.ini", L"plugins.txt", nullptr }; @@ -137,9 +123,14 @@ bool OblivionInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*) return false; } -std::wstring OblivionInfo::getReferenceDataFile() +std::wstring OblivionInfo::getReferenceDataFile() const { return L"Oblivion - Meshes.bsa"; } +bool OblivionInfo::isValidModURL(int modID, const std::wstring &url) const +{ + return GameInfo::isValidModURL(modID, url, L"http://oblivion.nexusmods.com"); +} + } // namespace MOShared diff --git a/src/shared/oblivioninfo.h b/src/shared/oblivioninfo.h index 87ba26ff..1adf9cab 100644 --- a/src/shared/oblivioninfo.h +++ b/src/shared/oblivioninfo.h @@ -34,69 +34,34 @@ public: virtual ~OblivionInfo() {} static std::wstring getRegPathStatic(); - virtual std::wstring getRegPath() { return getRegPathStatic(); } - virtual std::wstring getBinaryName() { return L"Oblivion.exe"; } + virtual std::wstring getRegPath() const { return getRegPathStatic(); } + virtual std::wstring getBinaryName() const { return L"Oblivion.exe"; } - virtual GameInfo::Type getType() { return TYPE_OBLIVION; } + virtual GameInfo::Type getType() const { return TYPE_OBLIVION; } virtual std::wstring getGameName() const { return L"Oblivion"; } virtual std::wstring getGameShortName() const { return L"Oblivion"; } -/* - virtual std::wstring getInvalidationBSA() - { - return L"Oblivion - Invalidation.bsa"; - } - - virtual bool isInvalidationBSA(const std::wstring &bsaName) - { - static LPCWSTR invalidation[] = { L"Oblivion - Invalidation.bsa", L"ArchiveInvalidationInvalidated!.bsa", - L"BSARedirection.bsa", nullptr }; - - for (int i = 0; invalidation[i] != nullptr; ++i) { - if (wcscmp(bsaName.c_str(), invalidation[i]) == 0) { - return true; - } - } - return false; - } - - virtual std::vector getVanillaBSAs() - { - return boost::assign::list_of(L"Oblivion - Meshes.bsa") - (L"Oblivion - Textures - Compressed.bsa") - (L"Oblivion - Sounds.bsa") - (L"Oblivion - Voices1.bsa") - (L"Oblivion - Voices2.bsa") - (L"Oblivion - Misc.bsa"); - } - - virtual std::vector getPrimaryPlugins() - { - return boost::assign::list_of(L"oblivion.esm"); - }*/ - - virtual std::vector getDLCPlugins(); - virtual std::vector getSavegameAttachmentExtensions(); + + virtual std::vector getDLCPlugins() const; + virtual std::vector getSavegameAttachmentExtensions() const; // file name of this games ini (no path) - virtual std::vector getIniFileNames(); + virtual std::vector getIniFileNames() const; - virtual std::wstring getReferenceDataFile(); + virtual std::wstring getReferenceDataFile() const; - virtual std::wstring getNexusPage(bool nmmScheme = true); + virtual std::wstring getNexusPage(bool nmmScheme = true) const; static std::wstring getNexusInfoUrlStatic(); - virtual std::wstring getNexusInfoUrl() { return getNexusInfoUrlStatic(); } + virtual std::wstring getNexusInfoUrl() const { return getNexusInfoUrlStatic(); } static int getNexusModIDStatic(); - virtual int getNexusModID() { return getNexusModIDStatic(); } - virtual int getNexusGameID() { return 101; } + virtual int getNexusModID() const { return getNexusModIDStatic(); } + virtual int getNexusGameID() const { return 101; } - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); + virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) const; - // get a list of executables (game binary and known-to-work 3rd party tools). All of these are relative to - // the game directory - //virtual std::vector getExecutables(); + virtual std::wstring archiveListKey() const { return L"SArchiveList"; } - virtual std::wstring archiveListKey() { return L"SArchiveList"; } + virtual bool isValidModURL(int modID, std::wstring const &url) const; private: diff --git a/src/shared/skyriminfo.cpp b/src/shared/skyriminfo.cpp index f66fcef4..7c85fe10 100644 --- a/src/shared/skyriminfo.cpp +++ b/src/shared/skyriminfo.cpp @@ -91,7 +91,7 @@ GameInfo::LoadOrderMechanism SkyrimInfo::getLoadOrderMechanism() const } } -std::vector SkyrimInfo::getDLCPlugins() +std::vector SkyrimInfo::getDLCPlugins() const { return boost::assign::list_of (L"Dawnguard.esm") (L"Dragonborn.esm") @@ -102,23 +102,23 @@ std::vector SkyrimInfo::getDLCPlugins() ; } -std::vector SkyrimInfo::getSavegameAttachmentExtensions() +std::vector SkyrimInfo::getSavegameAttachmentExtensions() const { return boost::assign::list_of(L"skse"); } -std::vector SkyrimInfo::getIniFileNames() +std::vector SkyrimInfo::getIniFileNames() const { return boost::assign::list_of(L"skyrim.ini")(L"skyrimprefs.ini"); } -std::wstring SkyrimInfo::getReferenceDataFile() +std::wstring SkyrimInfo::getReferenceDataFile() const { return L"Skyrim - Meshes.bsa"; } -std::wstring SkyrimInfo::getNexusPage(bool nmmScheme) +std::wstring SkyrimInfo::getNexusPage(bool nmmScheme) const { if (nmmScheme) { return L"http://nmm.nexusmods.com/skyrim"; @@ -139,7 +139,7 @@ int SkyrimInfo::getNexusModIDStatic() return 1334; } -bool SkyrimInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) +bool SkyrimInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) const { static LPCWSTR profileFiles[] = { L"skyrim.ini", L"skyrimprefs.ini", L"loadorder.txt", nullptr }; @@ -157,5 +157,10 @@ bool SkyrimInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPa return false; } +bool SkyrimInfo::isValidModURL(int modID, const std::wstring &url) const +{ + return GameInfo::isValidModURL(modID, url, L"http://skyrim.nexusmods.com"); +} + } // namespace MOShared diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h index 5951f910..e2766688 100644 --- a/src/shared/skyriminfo.h +++ b/src/shared/skyriminfo.h @@ -36,35 +36,37 @@ public: virtual ~SkyrimInfo() {} static std::wstring getRegPathStatic(); - virtual std::wstring getRegPath() { return getRegPathStatic(); } - virtual std::wstring getBinaryName() { return L"TESV.exe"; } + virtual std::wstring getRegPath() const { return getRegPathStatic(); } + virtual std::wstring getBinaryName() const { return L"TESV.exe"; } - virtual GameInfo::Type getType() { return TYPE_SKYRIM; } + virtual GameInfo::Type getType() const { return TYPE_SKYRIM; } virtual std::wstring getGameName() const { return L"Skyrim"; } virtual std::wstring getGameShortName() const { return L"Skyrim"; } virtual LoadOrderMechanism getLoadOrderMechanism() const; - virtual std::vector getDLCPlugins(); + virtual std::vector getDLCPlugins() const; - virtual std::vector getSavegameAttachmentExtensions(); + virtual std::vector getSavegameAttachmentExtensions() const; // file name of this games ini (no path) - virtual std::vector getIniFileNames(); + virtual std::vector getIniFileNames() const; - virtual std::wstring getReferenceDataFile(); + virtual std::wstring getReferenceDataFile() const; - virtual std::wstring getNexusPage(bool nmmScheme = true); + virtual std::wstring getNexusPage(bool nmmScheme = true) const; static std::wstring getNexusInfoUrlStatic(); - virtual std::wstring getNexusInfoUrl() { return getNexusInfoUrlStatic(); } + virtual std::wstring getNexusInfoUrl() const { return getNexusInfoUrlStatic(); } static int getNexusModIDStatic(); - virtual int getNexusModID() { return getNexusModIDStatic(); } + virtual int getNexusModID() const { return getNexusModIDStatic(); } static int getNexusGameIDStatic() { return 110; } - virtual int getNexusGameID() { return getNexusGameIDStatic(); } + virtual int getNexusGameID() const { return getNexusGameIDStatic(); } - virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); + virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) const; + + virtual bool isValidModURL(int modID, std::wstring const &url) const; private: -- cgit v1.3.1