From 1bfc91046badb609261c78b4b5e03bba4dcb61bd Mon Sep 17 00:00:00 2001 From: Tannin Date: Mon, 28 Dec 2015 14:33:30 +0100 Subject: removed get-prefix from many getters. removed const from managed_game variable. other fixes --- src/CMakeLists.txt | 2 +- src/directoryrefresher.cpp | 2 +- src/downloadmanager.cpp | 2 +- src/loadmechanism.cpp | 18 +++++++++--------- src/mainwindow.cpp | 21 ++++++++++++--------- src/modinfo.cpp | 8 ++++---- src/modinfoforeign.cpp | 2 +- src/nexusinterface.cpp | 12 ++++++------ src/organizercore.cpp | 10 +++++----- src/organizercore.h | 4 ++-- src/pluginlist.cpp | 6 +++--- src/profile.cpp | 2 +- src/selfupdater.cpp | 8 ++++---- src/settings.cpp | 2 +- src/settingsdialog.cpp | 2 +- 15 files changed, 52 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c55f9efe..7cd66739 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -321,7 +321,7 @@ TARGET_LINK_LIBRARIES(ModOrganizer SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES COMPILE_FLAGS /GL) SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES LINK_FLAGS_RELWITHDEBINFO - "/LTCG /INCREMENTAL:NO /LARGEADDRESSAWARE /OPT:REF /OPT:ICF") + "/LARGEADDRESSAWARE ${OPTIMIZE_LINK_FLAGS}") QT5_USE_MODULES(ModOrganizer Widgets Declarative Network WebKitWidgets) diff --git a/src/directoryrefresher.cpp b/src/directoryrefresher.cpp index f50a717e..4eac4103 100644 --- a/src/directoryrefresher.cpp +++ b/src/directoryrefresher.cpp @@ -144,7 +144,7 @@ void DirectoryRefresher::refresh() m_DirectoryStructure = new DirectoryEntry(L"data", nullptr, 0); - IPluginGame const *game = qApp->property("managed_game").value(); + IPluginGame *game = qApp->property("managed_game").value(); std::wstring dataDirectory = QDir::toNativeSeparators(game->dataDirectory().absolutePath()).toStdWString(); m_DirectoryStructure->addFromOrigin(L"data", dataDirectory, 0); diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index cbc1ba45..9d891475 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->getGameShortName(); + QString managedGame = m_ManagedGame->gameShortName(); 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/loadmechanism.cpp b/src/loadmechanism.cpp index 8ca8464e..e476c56d 100644 --- a/src/loadmechanism.cpp +++ b/src/loadmechanism.cpp @@ -65,7 +65,7 @@ void LoadMechanism::removeHintFile(QDir targetDirectory) bool LoadMechanism::isDirectLoadingSupported() { //FIXME: Seriously? isn't there a 'do i need steam' thing? - IPluginGame const *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); if (game->gameName().compare("oblivion", Qt::CaseInsensitive) == 0) { // oblivion can be loaded directly if it's not the steam variant return !game->gameDirectory().exists("steam_api.dll"); @@ -77,7 +77,7 @@ bool LoadMechanism::isDirectLoadingSupported() bool LoadMechanism::isScriptExtenderSupported() { - IPluginGame const *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); ScriptExtender *extender = game->feature(); // test if there even is an extender for the managed game and if so whether it's installed @@ -87,11 +87,11 @@ bool LoadMechanism::isScriptExtenderSupported() bool LoadMechanism::isProxyDLLSupported() { // using steam_api.dll as the proxy is way too game specific as many games will have different - // versions of that game. + // versions of that dll. // plus: the proxy dll hasn't been working for at least the whole 1.12.x versions of MO and // noone reported it so why maintain an unused feature? return false; -/* IPluginGame const *game = qApp->property("managed_game").value(); +/* IPluginGame const *game = qApp->property("managed_game").value(); return game->gameDirectory().exists(QString::fromStdWString(AppConfig::proxyDLLTarget()));*/ } @@ -123,7 +123,7 @@ bool LoadMechanism::hashIdentical(const QString &fileNameLHS, const QString &fil void LoadMechanism::deactivateScriptExtender() { try { - IPluginGame const *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); ScriptExtender *extender = game->feature(); if (extender == nullptr) { throw MyException(QObject::tr("game doesn't support a script extender")); @@ -131,7 +131,7 @@ void LoadMechanism::deactivateScriptExtender() QDir pluginsDir(game->gameDirectory().absolutePath() + "/data/" + extender->name() + "/plugins"); -#pragma "implement this for usvfs" +#pragma message("implement this for usvfs") /* QString hookDLLName = ToQString(AppConfig::hookDLLName()); @@ -153,7 +153,7 @@ void LoadMechanism::deactivateScriptExtender() void LoadMechanism::deactivateProxyDLL() { try { - IPluginGame const *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); QString targetPath = game->gameDirectory().absoluteFilePath(QString::fromStdWString(AppConfig::proxyDLLTarget())); @@ -182,7 +182,7 @@ void LoadMechanism::deactivateProxyDLL() void LoadMechanism::activateScriptExtender() { try { - IPluginGame const *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); ScriptExtender *extender = game->feature(); if (extender == nullptr) { throw MyException(QObject::tr("game doesn't support a script extender")); @@ -225,7 +225,7 @@ void LoadMechanism::activateScriptExtender() void LoadMechanism::activateProxyDLL() { try { - IPluginGame const *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); QString targetPath = game->gameDirectory().absoluteFilePath(QString::fromStdWString(AppConfig::proxyDLLTarget())); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1a7d1564..0c54fc8d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1259,7 +1259,7 @@ QDir MainWindow::currentSavesDir() const L"General", L"SLocalSavePath", L"Saves", path, MAX_PATH, ToWString(m_OrganizerCore.currentProfile()->absolutePath() + "/" + - m_OrganizerCore.managedGame()->getIniFiles()[0]).c_str()); + m_OrganizerCore.managedGame()->iniFiles()[0]).c_str()); savesDir.setPath(m_OrganizerCore.managedGame()->documentsDirectory().absoluteFilePath(QString::fromWCharArray(path))); } @@ -1927,11 +1927,14 @@ void MainWindow::addContentFilters() void MainWindow::addCategoryFilters(QTreeWidgetItem *root, const std::set &categoriesUsed, int targetID) { - for (size_t i = 1; i < m_CategoryFactory.numCategories(); ++i) { + for (unsigned int i = 1; + i < static_cast(m_CategoryFactory.numCategories()); ++i) { if ((m_CategoryFactory.getParentID(i) == targetID)) { int categoryID = m_CategoryFactory.getCategoryID(i); if (categoriesUsed.find(categoryID) != categoriesUsed.end()) { - QTreeWidgetItem *item = addFilterItem(root, m_CategoryFactory.getCategoryName(i), categoryID, ModListSortProxy::TYPE_CATEGORY); + QTreeWidgetItem *item = + addFilterItem(root, m_CategoryFactory.getCategoryName(i), + categoryID, ModListSortProxy::TYPE_CATEGORY); if (m_CategoryFactory.hasChildren(i)) { addCategoryFilters(item, categoriesUsed, categoryID); } @@ -3648,7 +3651,7 @@ void MainWindow::on_actionEndorseMO_triggered() NexusInterface::instance()->getGameURL()), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { NexusInterface::instance()->requestToggleEndorsement( - m_OrganizerCore.managedGame()->getNexusModOrganizerID(), true, this, QVariant(), QString()); + m_OrganizerCore.managedGame()->nexusModOrganizerID(), true, this, QVariant(), QString()); } } @@ -3707,11 +3710,11 @@ void MainWindow::modDetailsUpdated(bool) void MainWindow::nxmUpdatesAvailable(const std::vector &modIDs, QVariant userData, QVariant resultData, int) { - m_ModsToUpdate -= modIDs.size(); + m_ModsToUpdate -= static_cast(modIDs.size()); QVariantList resultList = resultData.toList(); for (auto iter = resultList.begin(); iter != resultList.end(); ++iter) { QVariantMap result = iter->toMap(); - if (result["id"].toInt() == m_OrganizerCore.managedGame()->getNexusModOrganizerID()) { + if (result["id"].toInt() == m_OrganizerCore.managedGame()->nexusModOrganizerID()) { if (!result["voted_by_user"].toBool()) { ui->actionEndorseMO->setVisible(true); } @@ -4201,7 +4204,7 @@ void MainWindow::on_bossButton_clicked() parameters << "--unattended" << "--stdout" << "--noreport" - << "--game" << m_OrganizerCore.managedGame()->getGameShortName() + << "--game" << m_OrganizerCore.managedGame()->gameShortName() << "--gamePath" << QString("\"%1\"").arg(m_OrganizerCore.managedGame()->gameDirectory().absolutePath()) << "--out" << outPath; @@ -4334,12 +4337,12 @@ void MainWindow::on_bossButton_clicked() // if the game specifies load order by file time, our own load order file needs to be removed because it's outdated. // refreshESPList will then use the file time as the load order. - if (m_OrganizerCore.managedGame()->getLoadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) { + if (m_OrganizerCore.managedGame()->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) { qDebug("removing loadorder.txt"); QFile::remove(m_OrganizerCore.currentProfile()->getLoadOrderFileName()); } m_OrganizerCore.refreshESPList(); - if (m_OrganizerCore.managedGame()->getLoadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) { + if (m_OrganizerCore.managedGame()->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) { // the load order should have been retrieved from file time, now save it to our own format m_OrganizerCore.savePluginList(); } diff --git a/src/modinfo.cpp b/src/modinfo.cpp index 8bc767c5..5593b0f0 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -220,8 +220,8 @@ void ModInfo::updateFromDisc(const QString &modDirectory, } { // list plugins in the data directory and make a foreign-managed mod out of each - QStringList dlcPlugins = game->getDLCPlugins(); - QStringList mainPlugins = game->getPrimaryPlugins(); + QStringList dlcPlugins = game->DLCPlugins(); + QStringList mainPlugins = game->primaryPlugins(); QDir dataDir(game->dataDirectory()); for (const QString &file : dataDir.entryList({ "*.esp", "*.esm" })) { if (std::find_if(mainPlugins.begin(), mainPlugins.end(), @@ -289,9 +289,9 @@ int ModInfo::checkAllForUpdate(QObject *receiver) std::vector modIDs; //I ought to store this, it's used elsewhere - IPluginGame const *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); - modIDs.push_back(game->getNexusModOrganizerID()); + modIDs.push_back(game->nexusModOrganizerID()); for (const ModInfo::Ptr &mod : s_Collection) { if (mod->canBeUpdated()) { diff --git a/src/modinfoforeign.cpp b/src/modinfoforeign.cpp index 4dbe034b..bf222166 100644 --- a/src/modinfoforeign.cpp +++ b/src/modinfoforeign.cpp @@ -21,7 +21,7 @@ QDateTime ModInfoForeign::creationTime() const QString ModInfoForeign::absolutePath() const { //I ought to store this, it's used elsewhere - IPluginGame const *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); return game->dataDirectory().absolutePath(); } diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index 79749523..b8326c80 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -250,12 +250,12 @@ bool NexusInterface::isURLGameRelated(const QUrl &url) const QString NexusInterface::getGameURL() const { - return "http://www.nexusmods.com/" + m_Game->getGameShortName().toLower(); + return "http://www.nexusmods.com/" + m_Game->gameShortName().toLower(); } QString NexusInterface::getOldModsURL() const { - return "http://" + m_Game->getGameShortName().toLower() + ".nexusmods.com/mods"; + return "http://" + m_Game->gameShortName().toLower() + ".nexusmods.com/mods"; } @@ -595,7 +595,7 @@ void NexusInterface::managedGameChanged(IPluginGame const *game) namespace { QString get_management_url(MOBase::IPluginGame const *game) { - return "http://nmm.nexusmods.com/" + game->getGameShortName().toLower(); + return "http://nmm.nexusmods.com/" + game->gameShortName().toLower(); } } @@ -615,7 +615,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo(int modID , m_ID(s_NextID.fetchAndAddAcquire(1)) , m_URL(get_management_url(game)) , m_SubModule(subModule) - , m_NexusGameID(game->getNexusGameID()) + , m_NexusGameID(game->nexusGameID()) , m_Endorse(false) {} @@ -636,7 +636,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo(std::vector modIDList , m_ID(s_NextID.fetchAndAddAcquire(1)) , m_URL(get_management_url(game)) , m_SubModule(subModule) - , m_NexusGameID(game->getNexusGameID()) + , m_NexusGameID(game->nexusGameID()) , m_Endorse(false) {} @@ -657,6 +657,6 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo(int modID , m_ID(s_NextID.fetchAndAddAcquire(1)) , m_URL(get_management_url(game)) , m_SubModule(subModule) - , m_NexusGameID(game->getNexusGameID()) + , m_NexusGameID(game->nexusGameID()) , m_Endorse(false) {} diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 6a8e148f..c1044c9d 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -399,8 +399,8 @@ void OrganizerCore::connectPlugins(PluginContainer *container) } //Do this the hard way for (const IPluginGame * const game : container->plugins()) { - QString n = game->getGameShortName(); - if (game->getGameShortName() == "Skyrim") { + QString n = game->gameShortName(); + if (game->gameShortName() == "Skyrim") { m_Updater.setNexusDownload(game); break; } @@ -420,7 +420,7 @@ void OrganizerCore::disconnectPlugins() m_PluginContainer = nullptr; } -void OrganizerCore::setManagedGame(MOBase::IPluginGame const *game) +void OrganizerCore::setManagedGame(MOBase::IPluginGame *game) { m_GameName = game->gameName(); m_GamePlugin = game; @@ -932,12 +932,12 @@ void OrganizerCore::spawnBinary(const QFileInfo &binary, const QString &argument refreshDirectoryStructure(); // need to remove our stored load order because it may be outdated if a foreign tool changed the // file time. After removing that file, refreshESPList will use the file time as the order - if (managedGame()->getLoadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) { + if (managedGame()->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) { qDebug("removing loadorder.txt"); QFile::remove(m_CurrentProfile->getLoadOrderFileName()); } refreshESPList(); - if (managedGame()->getLoadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) { + if (managedGame()->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) { // the load order should have been retrieved from file time, now save it to our own format savePluginList(); } diff --git a/src/organizercore.h b/src/organizercore.h index ff730c2b..d86033eb 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -74,7 +74,7 @@ public: void connectPlugins(PluginContainer *container); void disconnectPlugins(); - void setManagedGame(const MOBase::IPluginGame *game); + void setManagedGame(MOBase::IPluginGame *game); void updateExecutablesList(QSettings &settings); @@ -239,7 +239,7 @@ private: IUserInterface *m_UserInterface; PluginContainer *m_PluginContainer; QString m_GameName; - MOBase::IPluginGame const *m_GamePlugin; + MOBase::IPluginGame *m_GamePlugin; Profile *m_CurrentProfile; diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 7a609374..bf5a09dc 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -127,7 +127,7 @@ void PluginList::refresh(const QString &profileName m_ESPsByPriority.clear(); m_ESPs.clear(); - QStringList primaryPlugins = m_GamePlugin->getPrimaryPlugins(); + QStringList primaryPlugins = m_GamePlugin->primaryPlugins(); m_CurrentProfile = profileName; @@ -312,7 +312,7 @@ bool PluginList::readLoadOrder(const QString &fileName) int priority = 0; - QStringList primaryPlugins = m_GamePlugin->getPrimaryPlugins(); + QStringList primaryPlugins = m_GamePlugin->primaryPlugins(); for (const QString &plugin : primaryPlugins) { if (availableESPs.find(plugin) != availableESPs.end()) { m_ESPLoadOrder[plugin] = priority++; @@ -503,7 +503,7 @@ void PluginList::saveTo(const QString &pluginFileName bool PluginList::saveLoadOrder(DirectoryEntry &directoryStructure) { - if (m_GamePlugin->getLoadOrderMechanism() != IPluginGame::LoadOrderMechanism::FileTime) { + if (m_GamePlugin->loadOrderMechanism() != IPluginGame::LoadOrderMechanism::FileTime) { // nothing to do return true; } diff --git a/src/profile.cpp b/src/profile.cpp index 24f094f3..4b916a2f 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -676,7 +676,7 @@ QString Profile::getDeleterFileName() const QString Profile::getIniFileName() const { - return m_Directory.absoluteFilePath(m_GamePlugin->getIniFiles()[0]); + return m_Directory.absoluteFilePath(m_GamePlugin->iniFiles()[0]); } QString Profile::getProfileTweaks() const diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp index af1eb5b2..0cfd7f08 100644 --- a/src/selfupdater.cpp +++ b/src/selfupdater.cpp @@ -103,7 +103,7 @@ void SelfUpdater::testForUpdate() } if (m_UpdateRequestID == -1 && m_NexusDownload != nullptr) { m_UpdateRequestID = m_Interface->requestDescription( - m_NexusDownload->getNexusModOrganizerID(), this, QVariant(), + m_NexusDownload->nexusModOrganizerID(), this, QVariant(), QString(), m_NexusDownload); } } @@ -121,7 +121,7 @@ void SelfUpdater::startUpdate() if (QMessageBox::question(m_Parent, tr("Update"), tr("An update is available (newest version: %1), do you want to install it?").arg(m_NewestVersion), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - m_UpdateRequestID = m_Interface->requestFiles(m_NexusDownload->getNexusModOrganizerID(), + m_UpdateRequestID = m_Interface->requestFiles(m_NexusDownload->nexusModOrganizerID(), this, m_NewestVersion, "", m_NexusDownload); } @@ -415,7 +415,7 @@ void SelfUpdater::nxmFilesAvailable(int, QVariant userData, QVariant resultData, if (updateFileID != -1) { qDebug("update available: %d", updateFileID); - m_UpdateRequestID = m_Interface->requestDownloadURL(m_NexusDownload->getNexusModOrganizerID(), + m_UpdateRequestID = m_Interface->requestDownloadURL(m_NexusDownload->nexusModOrganizerID(), updateFileID, this, updateFileName, "", m_NexusDownload); } else if (mainFileID != -1) { @@ -424,7 +424,7 @@ void SelfUpdater::nxmFilesAvailable(int, QVariant userData, QVariant resultData, tr("No incremental update available for this version, " "the complete package needs to be downloaded (%1 kB)").arg(mainFileSize), QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) { - m_UpdateRequestID = m_Interface->requestDownloadURL(m_NexusDownload->getNexusModOrganizerID(), + m_UpdateRequestID = m_Interface->requestDownloadURL(m_NexusDownload->nexusModOrganizerID(), mainFileID, this, mainFileName, "", m_NexusDownload); } diff --git a/src/settings.cpp b/src/settings.cpp index 479dd3ab..25b58df7 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->getGameShortName().toStdWString() + L" \"" + executable + L"\""; + std::wstring parameters = mode + L" " + m_GamePlugin->gameShortName().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/settingsdialog.cpp b/src/settingsdialog.cpp index 8bc1dbc6..4e2f89a1 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -89,7 +89,7 @@ void SettingsDialog::on_categoriesBtn_clicked() void SettingsDialog::on_bsaDateBtn_clicked() { - IPluginGame const *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); QDir dir = game->dataDirectory(); Helper::backdateBSAs(qApp->property("dataPath").toString().toStdWString(), -- cgit v1.3.1