From 5c39a762e68c3559438a622dbf747eb8bddec7ed Mon Sep 17 00:00:00 2001 From: Al12rs Date: Fri, 6 Apr 2018 21:35:15 +0200 Subject: Allow MO2 shortcuts that open the indicated MO2 instance in the argument if the executable name is omitted. This should be added after the MO2 exe path: ' "moshortcut://myInstanceName:" '. If there are caracters after the ":" then MO2 will assume that is an execuatble and will try to run it. --- src/organizercore.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/organizercore.cpp') diff --git a/src/organizercore.cpp b/src/organizercore.cpp index b84488da..0398e9ac 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -602,8 +602,9 @@ void OrganizerCore::downloadRequestedNXM(const QString &url) void OrganizerCore::externalMessage(const QString &message) { - if (MOShortcut moshortcut{ message }) { - runShortcut(moshortcut); + if (MOShortcut moshortcut{ message } ) { + if(moshortcut.hasExecutable()) + runShortcut(moshortcut); } else if (isNxmLink(message)) { MessageDialog::showMessage(tr("Download started"), qApp->activeWindow()); -- cgit v1.3.1 From 208eaccbf7f1fc0441861d55c68c4b66e5c7d387 Mon Sep 17 00:00:00 2001 From: Silarn Date: Sun, 8 Apr 2018 14:56:46 -0500 Subject: Updates to allow a full plugin data refresh in certain circumstances --- src/mainwindow.cpp | 5 ++--- src/organizercore.cpp | 16 ++++++++-------- src/organizercore.h | 2 +- src/pluginlist.cpp | 9 ++++++++- src/pluginlist.h | 3 ++- 5 files changed, 21 insertions(+), 14 deletions(-) (limited to 'src/organizercore.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 48a09718..85e96993 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1980,7 +1980,6 @@ void MainWindow::directory_refreshed() refreshDataTree(); updateProblemsButton(); statusBar()->hide(); - m_OrganizerCore.refreshESPList(); } void MainWindow::modorder_changed() @@ -4811,7 +4810,7 @@ void MainWindow::on_bossButton_clicked() } m_IntegratedBrowser.openUrl(url); } - m_OrganizerCore.refreshESPList(); + m_OrganizerCore.refreshESPList(false); m_OrganizerCore.savePluginList(); } } @@ -4888,7 +4887,7 @@ void MainWindow::on_restoreButton_clicked() QMessageBox::critical(this, tr("Restore failed"), tr("Failed to restore the backup. Errorcode: %1").arg(windowsErrorString(::GetLastError()))); } - m_OrganizerCore.refreshESPList(); + m_OrganizerCore.refreshESPList(true); } } diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 0398e9ac..895b3b9c 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1107,7 +1107,7 @@ void OrganizerCore::spawnBinary(const QFileInfo &binary, const QString &argument } refreshDirectoryStructure(); - refreshESPList(); + refreshESPList(true); savePluginList(); //These callbacks should not fiddle with directoy structure and ESPs. @@ -1559,13 +1559,13 @@ void OrganizerCore::refreshModList(bool saveChanges) refreshDirectoryStructure(); } -void OrganizerCore::refreshESPList() +void OrganizerCore::refreshESPList(bool force) { if (m_DirectoryUpdate) { // don't mess up the esp list if we're currently updating the directory // structure - m_PostRefreshTasks.append([this]() { - this->refreshESPList(); + m_PostRefreshTasks.append([=]() { + this->refreshESPList(force); }); return; } @@ -1574,7 +1574,7 @@ void OrganizerCore::refreshESPList() // clear list try { m_PluginList.refresh(m_CurrentProfile->name(), *m_DirectoryStructure, - m_CurrentProfile->getLockedOrderFileName()); + m_CurrentProfile->getLockedOrderFileName(), force); } catch (const std::exception &e) { reportError(tr("Failed to refresh list of esps: %1").arg(e.what())); } @@ -1615,7 +1615,7 @@ void OrganizerCore::refreshBSAList() void OrganizerCore::refreshLists() { if ((m_CurrentProfile != nullptr) && m_DirectoryStructure->isPopulated()) { - refreshESPList(); + refreshESPList(true); refreshBSAList(); } // no point in refreshing lists if no files have been added to the directory // tree @@ -1678,7 +1678,7 @@ void OrganizerCore::updateModInDirectoryStructure(unsigned int index, modInfo->stealFiles()); DirectoryRefresher::cleanStructure(m_DirectoryStructure); // need to refresh plugin list now so we can activate esps - refreshESPList(); + refreshESPList(true); // activate all esps of the specified mod so the bsas get activated along with // it updateModActiveState(index, true); @@ -1839,7 +1839,7 @@ void OrganizerCore::modStatusChanged(unsigned int index) updateModInDirectoryStructure(index, modInfo); } else { updateModActiveState(index, false); - refreshESPList(); + refreshESPList(true); if (m_DirectoryStructure->originExists(ToWString(modInfo->name()))) { FilesOrigin &origin = m_DirectoryStructure->getOriginByName(ToWString(modInfo->name())); diff --git a/src/organizercore.h b/src/organizercore.h index 9e81f0c3..54d9dd6d 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -130,7 +130,7 @@ public: void prepareStart(); - void refreshESPList(); + void refreshESPList(bool force = false); void refreshBSAList(); void refreshDirectoryStructure(); diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 8bf438f1..9bbcdc11 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -140,8 +140,15 @@ void PluginList::highlightPlugins(const QItemSelection &selected, const MOShared void PluginList::refresh(const QString &profileName , const DirectoryEntry &baseDirectory - , const QString &lockedOrderFile) + , const QString &lockedOrderFile + , bool force) { + if (force) { + m_ESPs.clear(); + m_ESPsByName.clear(); + m_ESPsByPriority.clear(); + } + ChangeBracket layoutChange(this); QStringList primaryPlugins = m_GamePlugin->primaryPlugins(); diff --git a/src/pluginlist.h b/src/pluginlist.h index 4762f79f..f9173810 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -116,7 +116,8 @@ public: **/ void refresh(const QString &profileName , const MOShared::DirectoryEntry &baseDirectory - , const QString &lockedOrderFile); + , const QString &lockedOrderFile + , bool refresh); /** * @brief enable a plugin based on its name -- cgit v1.3.1 From e037caf58e918c5bf4693e800069098d74ff5e96 Mon Sep 17 00:00:00 2001 From: Silarn Date: Wed, 11 Apr 2018 10:58:22 -0500 Subject: Fix both remove and reinstall updating hidden downloads --- src/downloadmanager.cpp | 21 +++++++++++++++++++-- src/downloadmanager.h | 2 ++ src/organizercore.cpp | 2 ++ 3 files changed, 23 insertions(+), 2 deletions(-) (limited to 'src/organizercore.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index c935d20b..569a7d31 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -902,6 +902,22 @@ void DownloadManager::markInstalled(int index) setState(m_ActiveDownloads.at(index), STATE_INSTALLED); } +void DownloadManager::markInstalled(QString fileName) +{ + int index = indexByName(fileName); + if (index >= 0) { + markInstalled(index); + } else { + DownloadInfo *info = getDownloadInfo(fileName); + if (info != nullptr) { + QSettings metaFile(info->m_Output.fileName() + ".meta", QSettings::IniFormat); + metaFile.setValue("installed", true); + metaFile.setValue("uninstalled", false); + } + delete info; + } +} + DownloadManager::DownloadInfo* DownloadManager::getDownloadInfo(QString fileName) { return DownloadInfo::createFromMeta(fileName, true); @@ -927,12 +943,13 @@ void DownloadManager::markUninstalled(QString fileName) if (index >= 0) { markUninstalled(index); } else { - DownloadInfo *info = getDownloadInfo(fileName); + QString filePath = QDir::fromNativeSeparators(m_OutputDirectory) + "/" + fileName; + DownloadInfo *info = getDownloadInfo(filePath); if (info != nullptr) { QSettings metaFile(info->m_Output.fileName() + ".meta", QSettings::IniFormat); metaFile.setValue("uninstalled", true); - setState(info, STATE_UNINSTALLED); } + delete info; } } diff --git a/src/downloadmanager.h b/src/downloadmanager.h index 059c6cb5..a6d3b20c 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -307,6 +307,8 @@ public: */ void markInstalled(int index); + void markInstalled(QString download); + /** * @brief mark a download as uninstalled * diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 895b3b9c..999c7732 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -895,6 +895,8 @@ MOBase::IModInterface *OrganizerCore::installMod(const QString &fileName, ModInfoDialog::TAB_INIFILES); } m_ModInstalled(modName); + m_DownloadManager.markInstalled(fileName); + emit modInstalled(modName); return modInfo.data(); } else { reportError(tr("mod \"%1\" not found").arg(modName)); -- cgit v1.3.1