diff options
| author | Silarn <jrim@rimpo.org> | 2019-12-11 14:02:33 -0600 |
|---|---|---|
| committer | Silarn <jrim@rimpo.org> | 2019-12-11 14:02:33 -0600 |
| commit | 19bb86a870a88b65cce0eca2b6b71348d2769f51 (patch) | |
| tree | bfa905db915061a3744d75af62e0120d68f242ac /src | |
| parent | 5a266b8e268163f3f25063aa823dd1fc72ee7c56 (diff) | |
Update installer status handling
Diffstat (limited to 'src')
| -rw-r--r-- | src/installationmanager.cpp | 52 | ||||
| -rw-r--r-- | src/installationmanager.h | 4 | ||||
| -rw-r--r-- | src/organizer_en.ts | 123 | ||||
| -rw-r--r-- | src/organizercore.cpp | 16 |
4 files changed, 107 insertions, 88 deletions
diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index 8ea2bac7..1bfc846e 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -328,14 +328,9 @@ IPluginInstaller::EInstallResult InstallationManager::installArchive(GuessedValu // a problem if this is called by the bundle installer and the bundled installer adds additional names that then end up being used, // because the caller will then not have the right name. bool iniTweaks; - if (install(archiveName, modName, iniTweaks, modId)) { - return IPluginInstaller::RESULT_SUCCESS; - } else { - return IPluginInstaller::RESULT_FAILED; - } + return install(archiveName, modName, iniTweaks, modId); } - DirectoryTree *InstallationManager::createFilesTree() { FileData* const *data; @@ -573,18 +568,18 @@ bool InstallationManager::ensureValidModName(GuessedValue<QString> &name) const return true; } -bool InstallationManager::doInstall(GuessedValue<QString> &modName, QString gameName, int modID, +IPluginInstaller::EInstallResult InstallationManager::doInstall(GuessedValue<QString> &modName, QString gameName, int modID, const QString &version, const QString &newestVersion, int categoryID, int fileCategoryID, const QString &repository) { if (!ensureValidModName(modName)) { - return false; + return IPluginInstaller::RESULT_FAILED; } bool merge = false; // determine target directory if (!testOverwrite(modName, &merge)) { - return false; + return IPluginInstaller::RESULT_FAILED; } QString targetDirectory = QDir(m_ModsDirectory + "/" + modName).canonicalPath(); @@ -627,7 +622,7 @@ bool InstallationManager::doInstall(GuessedValue<QString> &modName, QString game if (!m_ErrorMessage.isEmpty()) { throw MyException(tr("Extraction failed: %1").arg(m_ErrorMessage)); } else { - return false; + return IPluginInstaller::RESULT_CANCELED; } } else { throw MyException(tr("Extraction failed: %1").arg(m_ArchiveHandler->getLastError())); @@ -671,7 +666,7 @@ bool InstallationManager::doInstall(GuessedValue<QString> &modName, QString game settingsFile.endGroup(); } - return true; + return IPluginInstaller::RESULT_SUCCESS; } @@ -721,7 +716,7 @@ void InstallationManager::postInstallCleanup() } } -bool InstallationManager::install(const QString &fileName, +IPluginInstaller::EInstallResult InstallationManager::install(const QString &fileName, GuessedValue<QString> &modName, bool &hasIniTweaks, int modID) @@ -732,7 +727,7 @@ bool InstallationManager::install(const QString &fileName, QFileInfo fileInfo(fileName); if (m_SupportedExtensions.find(fileInfo.suffix()) == m_SupportedExtensions.end()) { reportError(tr("File format \"%1\" not supported").arg(fileInfo.suffix())); - return false; + return IPluginInstaller::RESULT_FAILED; } modName.setFilter(&fixDirectoryName); @@ -840,10 +835,7 @@ bool InstallationManager::install(const QString &fileName, mapToArchive(filesTree.data()); // the simple installer only prepares the installation, the rest // works the same for all installers - if (!doInstall(modName, gameName, modID, version, newestVersion, categoryID, - fileCategoryID, repository)) { - installResult = IPluginInstaller::RESULT_FAILED; - } + installResult = doInstall(modName, gameName, modID, version, newestVersion, categoryID, fileCategoryID, repository); } } } @@ -876,28 +868,34 @@ bool InstallationManager::install(const QString &fileName, // act upon the installation result. at this point the files have already been // extracted to the correct location switch (installResult) { - case IPluginInstaller::RESULT_CANCELED: case IPluginInstaller::RESULT_FAILED: { - return false; + QMessageBox::information(qApp->activeWindow(), tr("Installation failed"), + tr("Something went wrong while installing this mod."), + QMessageBox::Ok); + return installResult; } break; case IPluginInstaller::RESULT_SUCCESS: case IPluginInstaller::RESULT_SUCCESSCANCEL: { if (filesTree != nullptr) { DirectoryTree::node_iterator iniTweakNode = filesTree->nodeFind(DirectoryTreeInformation("INI Tweaks")); hasIniTweaks = (iniTweakNode != filesTree->nodesEnd()) && - ((*iniTweakNode)->numLeafs() != 0); - return true; - } else { - return false; + ((*iniTweakNode)->numLeafs() != 0); } + return installResult; } break; + case IPluginInstaller::RESULT_NOTATTEMPTED: { + continue; + } + default: + return installResult; } } + if (installResult == IPluginInstaller::RESULT_NOTATTEMPTED) { + reportError(tr("None of the available installer plugins were able to handle that archive.\n" + "This is likely due to a corrupted or incompatible download or unrecognized archive format.")); + } - reportError(tr("None of the available installer plugins were able to handle that archive.\n" - "This is likely due to a corrupted or incompatible download or unrecognized archive format.")); - - return false; + return installResult; } diff --git a/src/installationmanager.h b/src/installationmanager.h index 6e4f5925..199a0f82 100644 --- a/src/installationmanager.h +++ b/src/installationmanager.h @@ -82,7 +82,7 @@ public: * @return true if the archive was installed, false if installation failed or was refused * @exception std::exception an exception may be thrown if the archive can't be opened (maybe the format is invalid or the file is damaged) **/ - bool install(const QString &fileName, MOBase::GuessedValue<QString> &modName, bool &hasIniTweaks, int modID = 0); + MOBase::IPluginInstaller::EInstallResult install(const QString &fileName, MOBase::GuessedValue<QString> &modName, bool &hasIniTweaks, int modID = 0); /** * @return true if the installation was canceled @@ -175,7 +175,7 @@ private: bool isSimpleArchiveTopLayer(const MOBase::DirectoryTree::Node *node, bool bainStyle); MOBase::DirectoryTree::Node *getSimpleArchiveBase(MOBase::DirectoryTree *dataTree); - bool doInstall(MOBase::GuessedValue<QString> &modName, QString gameName, + MOBase::IPluginInstaller::EInstallResult doInstall(MOBase::GuessedValue<QString> &modName, QString gameName, int modID, const QString &version, const QString &newestVersion, int categoryID, int fileCategoryID, const QString &repository); //QString generateBackupName(const QString &directoryName) const; diff --git a/src/organizer_en.ts b/src/organizer_en.ts index d8995973..95854200 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -1529,89 +1529,100 @@ Right now the only case I know of where this needs to be overwritten is for the <message> <location filename="installationmanager.cpp" line="312"/> <location filename="installationmanager.cpp" line="318"/> + <location filename="installationmanager.cpp" line="623"/> <location filename="installationmanager.cpp" line="628"/> - <location filename="installationmanager.cpp" line="633"/> <source>Extraction failed: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="503"/> + <location filename="installationmanager.cpp" line="498"/> <source>Failed to create backup</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="512"/> + <location filename="installationmanager.cpp" line="507"/> <source>Mod Name</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="512"/> + <location filename="installationmanager.cpp" line="507"/> <source>Name</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="565"/> + <location filename="installationmanager.cpp" line="560"/> <source>Invalid name</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="566"/> + <location filename="installationmanager.cpp" line="561"/> <source>The name you entered is invalid, please enter a different one.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="734"/> + <location filename="installationmanager.cpp" line="729"/> <source>File format "%1" not supported</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="897"/> + <location filename="installationmanager.cpp" line="872"/> + <source>Installation failed</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="installationmanager.cpp" line="873"/> + <source>Something went wrong while installing this mod.</source> + <oldsource>The mod was not installed completely.</oldsource> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="installationmanager.cpp" line="894"/> <source>None of the available installer plugins were able to handle that archive. This is likely due to a corrupted or incompatible download or unrecognized archive format.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="909"/> + <location filename="installationmanager.cpp" line="907"/> <source>no error</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="912"/> + <location filename="installationmanager.cpp" line="910"/> <source>7z.dll not found</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="915"/> + <location filename="installationmanager.cpp" line="913"/> <source>7z.dll isn't valid</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="918"/> + <location filename="installationmanager.cpp" line="916"/> <source>archive not found</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="921"/> + <location filename="installationmanager.cpp" line="919"/> <source>failed to open archive</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="924"/> + <location filename="installationmanager.cpp" line="922"/> <source>unsupported archive type</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="927"/> + <location filename="installationmanager.cpp" line="925"/> <source>internal library error</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="930"/> + <location filename="installationmanager.cpp" line="928"/> <source>archive invalid</source> <translation type="unfinished"></translation> </message> <message> - <location filename="installationmanager.cpp" line="934"/> + <location filename="installationmanager.cpp" line="932"/> <source>unknown archive error</source> <translation type="unfinished"></translation> </message> @@ -4600,170 +4611,174 @@ p, li { white-space: pre-wrap; } </message> <message> <location filename="organizercore.cpp" line="701"/> - <location filename="organizercore.cpp" line="738"/> - <location filename="organizercore.cpp" line="749"/> - <location filename="organizercore.cpp" line="807"/> + <location filename="organizercore.cpp" line="752"/> <source>Installation cancelled</source> <translation type="unfinished"></translation> </message> <message> <location filename="organizercore.cpp" line="702"/> - <location filename="organizercore.cpp" line="750"/> + <location filename="organizercore.cpp" line="753"/> <source>Another installation is currently in progress.</source> <translation type="unfinished"></translation> </message> <message> <location filename="organizercore.cpp" line="714"/> - <location filename="organizercore.cpp" line="779"/> + <location filename="organizercore.cpp" line="782"/> <source>Installation successful</source> <translation type="unfinished"></translation> </message> <message> <location filename="organizercore.cpp" line="722"/> - <location filename="organizercore.cpp" line="789"/> + <location filename="organizercore.cpp" line="792"/> <source>Configure Mod</source> <translation type="unfinished"></translation> </message> <message> <location filename="organizercore.cpp" line="723"/> - <location filename="organizercore.cpp" line="790"/> + <location filename="organizercore.cpp" line="793"/> <source>This mod contains ini tweaks. Do you want to configure them now?</source> <translation type="unfinished"></translation> </message> <message> <location filename="organizercore.cpp" line="735"/> - <location filename="organizercore.cpp" line="800"/> + <location filename="organizercore.cpp" line="803"/> <source>mod not found: %1</source> <translation type="unfinished"></translation> </message> <message> + <location filename="organizercore.cpp" line="738"/> + <location filename="organizercore.cpp" line="809"/> + <source>Extraction cancelled</source> + <translation type="unfinished"></translation> + </message> + <message> <location filename="organizercore.cpp" line="739"/> - <location filename="organizercore.cpp" line="808"/> - <source>The mod was not installed completely.</source> + <location filename="organizercore.cpp" line="810"/> + <source>The installation was cancelled while extracting files. If this was prior to a FOMOD setup, this warning may be ignored. However, if this was during installation, the mod will likely be missing files.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="976"/> + <location filename="organizercore.cpp" line="982"/> <source>file not found: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="990"/> + <location filename="organizercore.cpp" line="996"/> <source>failed to generate preview for %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1042"/> + <location filename="organizercore.cpp" line="1048"/> <source>Sorry</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1043"/> + <location filename="organizercore.cpp" line="1049"/> <source>Sorry, can't preview anything. This function currently does not support extracting from bsas.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1053"/> + <location filename="organizercore.cpp" line="1059"/> <source>File '%1' not found.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1061"/> + <location filename="organizercore.cpp" line="1067"/> <source>Failed to generate preview for %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1127"/> + <location filename="organizercore.cpp" line="1133"/> <source>Failed to refresh list of esps: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1236"/> + <location filename="organizercore.cpp" line="1242"/> <source>Multiple esps/esls activated, please check that they don't conflict.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1300"/> + <location filename="organizercore.cpp" line="1306"/> <source>You need to be logged in with Nexus</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1339"/> + <location filename="organizercore.cpp" line="1345"/> <source>Download?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1340"/> + <location filename="organizercore.cpp" line="1346"/> <source>A download has been started but no installed page plugin recognizes it. If you download anyway no information (i.e. version) will be associated with the download. Continue?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1477"/> - <location filename="organizercore.cpp" line="1526"/> + <location filename="organizercore.cpp" line="1483"/> + <location filename="organizercore.cpp" line="1532"/> <source>failed to update mod list: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1533"/> - <location filename="organizercore.cpp" line="1550"/> + <location filename="organizercore.cpp" line="1539"/> + <location filename="organizercore.cpp" line="1556"/> <source>login successful</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1560"/> + <location filename="organizercore.cpp" line="1566"/> <source>Login failed</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1561"/> + <location filename="organizercore.cpp" line="1567"/> <source>Login failed, try again?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1570"/> + <location filename="organizercore.cpp" line="1576"/> <source>login failed: %1. Download will not be associated with an account</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1578"/> + <location filename="organizercore.cpp" line="1584"/> <source>login failed: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1588"/> + <location filename="organizercore.cpp" line="1594"/> <source>login failed: %1. You need to log-in with Nexus to update MO.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1641"/> + <location filename="organizercore.cpp" line="1647"/> <source>MO1 "Script Extender" load mechanism has left hook.dll in your game folder</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1644"/> - <location filename="organizercore.cpp" line="1660"/> + <location filename="organizercore.cpp" line="1650"/> + <location filename="organizercore.cpp" line="1666"/> <source>Description missing</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1653"/> + <location filename="organizercore.cpp" line="1659"/> <source><a href="%1">hook.dll</a> has been found in your game folder (right click to copy the full path). This is most likely a leftover of setting the ModOrganizer 1 load mechanism to "Script Extender", in which case you must remove this file either by changing the load mechanism in ModOrganizer 1 or manually removing the file, otherwise the game is likely to crash and burn.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1687"/> + <location filename="organizercore.cpp" line="1693"/> <source>failed to save load order: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1765"/> + <location filename="organizercore.cpp" line="1771"/> <source>Error</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1839"/> + <location filename="organizercore.cpp" line="1845"/> <source>The designated write target "%1" is not enabled.</source> <translation type="unfinished"></translation> </message> diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 55cb82ff..4ba38dbb 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -735,9 +735,12 @@ MOBase::IModInterface *OrganizerCore::installMod(const QString &fileName, reportError(tr("mod not found: %1").arg(qUtf8Printable(modName))); } } else if (m_InstallationManager.wasCancelled()) { - QMessageBox::information(qApp->activeWindow(), tr("Installation cancelled"), - tr("The mod was not installed completely."), + QMessageBox::information(qApp->activeWindow(), tr("Extraction cancelled"), + tr("The installation was cancelled while extracting files. " + "If this was prior to a FOMOD setup, this warning may be ignored. " + "However, if this was during installation, the mod will likely be missing files."), QMessageBox::Ok); + refreshModList(); } return nullptr; } @@ -803,9 +806,12 @@ void OrganizerCore::installDownload(int index) emit modInstalled(modName); } else if (m_InstallationManager.wasCancelled()) { - QMessageBox::information( - qApp->activeWindow(), tr("Installation cancelled"), - tr("The mod was not installed completely."), QMessageBox::Ok); + QMessageBox::information(qApp->activeWindow(), tr("Extraction cancelled"), + tr("The installation was cancelled while extracting files. " + "If this was prior to a FOMOD setup, this warning may be ignored. " + "However, if this was during installation, the mod will likely be missing files."), + QMessageBox::Ok); + refreshModList(); } } catch (const std::exception &e) { reportError(e.what()); |
