@@ -480,28 +480,23 @@ bool InstallationManager::ensureValidModName(GuessedValue<QString>& name) const
480480 return true ;
481481}
482482
483- InstallationResult InstallationManager::doInstall (GuessedValue<QString>& modName,
484- QString gameName, int modID,
485- const QString& version,
486- const QString& newestVersion,
487- int categoryID, int fileCategoryID,
488- const QString& repository)
483+ InstallationResult InstallationManager::doInstall (ModInstallationInfo& info)
489484{
490- if (!ensureValidModName (modName)) {
485+ if (!ensureValidModName (info. modName )) {
491486 return {IPluginInstaller::RESULT_FAILED };
492487 }
493488
494489 // determine target directory
495- InstallationResult result = testOverwrite (modName);
490+ InstallationResult result = testOverwrite (info. modName );
496491 if (!result) {
497492 return result;
498493 }
499494
500495 const bool merge = result.merged ();
501496
502- result.m_name = modName;
497+ result.m_name = info. modName ;
503498
504- QString targetDirectory = QDir (m_ModsDirectory + " /" + modName).canonicalPath ();
499+ QString targetDirectory = QDir (m_ModsDirectory + " /" + info. modName ).canonicalPath ();
505500 QString targetDirectoryNative = QDir::toNativeSeparators (targetDirectory);
506501
507502 log::debug (" installing to \" {}\" " , targetDirectoryNative);
@@ -532,28 +527,31 @@ InstallationResult InstallationManager::doInstall(GuessedValue<QString>& modName
532527
533528 // overwrite settings only if they are actually are available or haven't been set
534529 // before
535- if ((gameName != " " ) || !settingsFile.contains (" gameName" )) {
536- settingsFile.setValue (" gameName" , gameName);
530+ if ((info. gameName != " " ) || !settingsFile.contains (" gameName" )) {
531+ settingsFile.setValue (" gameName" , info. gameName );
537532 }
538- if ((modID != 0 ) || !settingsFile.contains (" modid" )) {
539- settingsFile.setValue (" modid" , modID);
533+ if ((info. modID != 0 ) || !settingsFile.contains (" modid" )) {
534+ settingsFile.setValue (" modid" , info. modID );
540535 }
541536 if (!settingsFile.contains (" version" ) ||
542- (!version.isEmpty () &&
543- (!merge || (VersionInfo (version) >=
537+ (!info. version .isEmpty () &&
538+ (!merge || (VersionInfo (info. version ) >=
544539 VersionInfo (settingsFile.value (" version" ).toString ()))))) {
545- settingsFile.setValue (" version" , version);
540+ settingsFile.setValue (" version" , info. version );
546541 }
547- if (!newestVersion.isEmpty () || !settingsFile.contains (" newestVersion" )) {
548- settingsFile.setValue (" newestVersion" , newestVersion);
542+ if (!info. newestVersion .isEmpty () || !settingsFile.contains (" newestVersion" )) {
543+ settingsFile.setValue (" newestVersion" , info. newestVersion );
549544 }
550545 // issue #51 used to overwrite the manually set categories
551546 if (!settingsFile.contains (" category" )) {
552- settingsFile.setValue (" category" , QString::number (categoryID));
547+ settingsFile.setValue (" category" , QString::number (info. categoryID ));
553548 }
554- settingsFile.setValue (" nexusFileStatus" , fileCategoryID);
549+ settingsFile.setValue (" nexusFileStatus" , info. fileCategoryID );
555550 settingsFile.setValue (" installationFile" , m_CurrentFile);
556- settingsFile.setValue (" repository" , repository);
551+ settingsFile.setValue (" repository" , info.repository );
552+ settingsFile.setValue (" author" , info.author );
553+ settingsFile.setValue (" uploader" , info.uploader );
554+ settingsFile.setValue (" uploaderUrl" , info.uploaderUrl );
557555
558556 if (!merge) {
559557 // this does not clear the list we have in memory but the mod is going to have to be
@@ -650,6 +648,9 @@ InstallationResult InstallationManager::install(const QString& fileName,
650648 int categoryID = 0 ;
651649 int fileCategoryID = 1 ;
652650 QString repository = " Nexus" ;
651+ QString author = " " ;
652+ QString uploader = " " ;
653+ QString uploaderUrl = " " ;
653654
654655 QString metaName = fileName + " .meta" ;
655656 if (QFile (metaName).exists ()) {
@@ -690,6 +691,9 @@ InstallationResult InstallationManager::install(const QString& fileName,
690691 }
691692 repository = metaFile.value (" repository" , " " ).toString ();
692693 fileCategoryID = metaFile.value (" fileCategory" , 1 ).toInt ();
694+ author = metaFile.value (" author" , " " ).toString ();
695+ uploader = metaFile.value (" uploader" , " " ).toString ();
696+ uploaderUrl = metaFile.value (" uploaderUrl" , " " ).toString ();
693697 }
694698
695699 if (version.isEmpty ()) {
@@ -807,8 +811,11 @@ InstallationResult InstallationManager::install(const QString& fileName,
807811
808812 // the simple installer only prepares the installation, the rest
809813 // works the same for all installers
810- installResult = doInstall (modName, gameName, modID, version, newestVersion,
811- categoryID, fileCategoryID, repository);
814+ ModInstallationInfo info{
815+ modName, gameName, modID, version, newestVersion, categoryID,
816+ fileCategoryID, repository, author, uploader, uploaderUrl};
817+
818+ installResult = doInstall (info);
812819 }
813820 }
814821 }
0 commit comments