From 9b5c238938461f8c811555647e459259b8aca2b3 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sat, 3 Jan 2015 12:35:25 +0100 Subject: - repository info is now stored with the mod --- src/installationmanager.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/installationmanager.cpp') diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index 26329729..880587b7 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -513,7 +513,8 @@ bool InstallationManager::ensureValidModName(GuessedValue &name) const } bool InstallationManager::doInstall(GuessedValue &modName, int modID, - const QString &version, const QString &newestVersion, int categoryID) + const QString &version, const QString &newestVersion, + int categoryID, const QString &repository) { if (!ensureValidModName(modName)) { return false; @@ -568,6 +569,7 @@ bool InstallationManager::doInstall(GuessedValue &modName, int modID, settingsFile.setValue("category", QString::number(categoryID)); } settingsFile.setValue("installationFile", m_CurrentFile); + settingsFile.setValue("repository", repository); if (!merge) { // this does not clear the list we have in memory but the mod is going to have to be re-read anyway @@ -631,6 +633,7 @@ bool InstallationManager::install(const QString &fileName, GuessedValue QString version = ""; QString newestVersion = ""; int categoryID = 0; + QString repository = "Nexus"; QString metaName = fileName.mid(0).append(".meta"); if (QFile(metaName).exists()) { @@ -643,6 +646,7 @@ bool InstallationManager::install(const QString &fileName, GuessedValue newestVersion = metaFile.value("newestVersion", "").toString(); unsigned int categoryIndex = CategoryFactory::instance().resolveNexusID(metaFile.value("category", 0).toInt()); categoryID = CategoryFactory::instance().getCategoryID(categoryIndex); + repository = metaFile.value("repository", "").toString(); } if (version.isEmpty()) { @@ -707,7 +711,7 @@ bool InstallationManager::install(const QString &fileName, GuessedValue if (installResult == IPluginInstaller::RESULT_SUCCESS) { mapToArchive(filesTree.data()); // the simple installer only prepares the installation, the rest works the same for all installers - if (!doInstall(modName, modID, version, newestVersion, categoryID)) { + if (!doInstall(modName, modID, version, newestVersion, categoryID, repository)) { installResult = IPluginInstaller::RESULT_FAILED; } } @@ -722,6 +726,11 @@ bool InstallationManager::install(const QString &fileName, GuessedValue std::set installerExtensions = installerCustom->supportedExtensions(); if (installerExtensions.find(fileInfo.suffix()) != installerExtensions.end()) { installResult = installerCustom->install(modName, fileName, version, modID); + unsigned int idx = ModInfo::getIndex(modName); + if (idx != UINT_MAX) { + ModInfo::Ptr info = ModInfo::getByIndex(idx); + info->setRepository(repository); + } } } } -- cgit v1.3.1