diff --git a/launcher/minecraft/mod/ResourceFolderModel.cpp b/launcher/minecraft/mod/ResourceFolderModel.cpp index 9bc9cd9a9..d349b2c56 100644 --- a/launcher/minecraft/mod/ResourceFolderModel.cpp +++ b/launcher/minecraft/mod/ResourceFolderModel.cpp @@ -166,7 +166,7 @@ bool ResourceFolderModel::installResource(QString original_path) return false; } -bool ResourceFolderModel::installResource(QString path, ModPlatform::IndexedVersion& vers) +bool ResourceFolderModel::installResourceWithFlameMetadata(QString path, ModPlatform::IndexedVersion& vers) { if (vers.addonId.isValid()) { ModPlatform::IndexedPack pack{ diff --git a/launcher/minecraft/mod/ResourceFolderModel.h b/launcher/minecraft/mod/ResourceFolderModel.h index 80698eac5..1da748e05 100644 --- a/launcher/minecraft/mod/ResourceFolderModel.h +++ b/launcher/minecraft/mod/ResourceFolderModel.h @@ -113,7 +113,7 @@ class ResourceFolderModel : public QAbstractListModel { */ virtual bool installResource(QString path); - virtual bool installResource(QString path, ModPlatform::IndexedVersion& vers); + virtual bool installResourceWithFlameMetadata(QString path, ModPlatform::IndexedVersion& vers); /** Uninstall (i.e. remove all data about it) a resource, given its file name. * diff --git a/launcher/modplatform/CheckUpdateTask.h b/launcher/modplatform/CheckUpdateTask.h index 9d0b1c51a..1ee820a63 100644 --- a/launcher/modplatform/CheckUpdateTask.h +++ b/launcher/modplatform/CheckUpdateTask.h @@ -17,7 +17,7 @@ class CheckUpdateTask : public Task { std::list& mcVersions, QList loadersList, std::shared_ptr resourceModel) - : Task(nullptr) + : Task() , m_resources(resources) , m_game_versions(mcVersions) , m_loaders_list(std::move(loadersList)) diff --git a/launcher/modplatform/ModIndex.h b/launcher/modplatform/ModIndex.h index 11a230798..d5ee12473 100644 --- a/launcher/modplatform/ModIndex.h +++ b/launcher/modplatform/ModIndex.h @@ -25,7 +25,6 @@ #include #include #include -#include class QIODevice; diff --git a/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp b/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp index ead8238ff..52db95077 100644 --- a/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp +++ b/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp @@ -148,7 +148,7 @@ void ModrinthCheckUpdate::checkVersionsResponse(std::shared_ptr resp } m_updates.emplace_back(pack->name, hash, old_version, project_ver.version_number, project_ver.version_type, - project_ver.changelog, ModPlatform::ResourceProvider::MODRINTH, download_task); + project_ver.changelog, ModPlatform::ResourceProvider::MODRINTH, download_task, resource->enabled()); } m_deps.append(std::make_shared(pack, project_ver)); @@ -177,7 +177,7 @@ void ModrinthCheckUpdate::checkNextLoader() if (m_loader_idx < m_loaders_list.size()) { getUpdateModsForLoader(m_loaders_list.at(m_loader_idx)); m_loader_idx++; - return; + return; } for (auto resource : m_mappings) { diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 96f1348d2..a0bc83171 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -1048,7 +1048,7 @@ void MainWindow::processURLs(QList urls) qWarning() << "Importing of Data Packs not supported at this time. Ignoring" << localFileName; break; case PackedResourceType::Mod: - minecraftInst->loaderModList()->installResource(localFileName, version); + minecraftInst->loaderModList()->installResourceWithFlameMetadata(localFileName, version); break; case PackedResourceType::ShaderPack: minecraftInst->shaderPackList()->installResource(localFileName); diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.cpp b/launcher/ui/pages/instance/ExternalResourcesPage.cpp index 0e6c5131b..d85726eb8 100644 --- a/launcher/ui/pages/instance/ExternalResourcesPage.cpp +++ b/launcher/ui/pages/instance/ExternalResourcesPage.cpp @@ -305,21 +305,10 @@ void ExternalResourcesPage::disableItem() void ExternalResourcesPage::viewHomepage() { auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()).indexes(); - bool openedAny = false; for (auto resource : m_model->selectedResources(selection)) { auto url = resource->homepage(); - if (!url.isEmpty()) { + if (!url.isEmpty()) DesktopServices::openUrl(url); - openedAny = true; - } - } - - // TODO: just disable button - // just doing this for now to prevent race conditions which may be worse with implementation changes - if (!openedAny) { - CustomMessageBox::selectable(this, tr("No homepages found"), tr("None of the selected resources had an available homepage."), - QMessageBox::Warning, QMessageBox::Ok, QMessageBox::Ok) - ->exec(); } } @@ -336,18 +325,20 @@ void ExternalResourcesPage::viewFolder() void ExternalResourcesPage::updateActions() { const bool hasSelection = ui->treeView->selectionModel()->hasSelection(); - const QModelIndexList rows = ui->treeView->selectionModel()->selectedRows(); + const QModelIndexList selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()).indexes(); + const QList selectedResources = m_model->selectedResources(selection); ui->actionUpdateItem->setEnabled(!m_model->empty()); ui->actionResetItemMetadata->setEnabled(hasSelection); - ui->actionChangeVersion->setEnabled(rows.count() == 1 && m_model->at(m_filterModel->mapToSource(rows[0]).row()).metadata() != nullptr); + ui->actionChangeVersion->setEnabled(selectedResources.size() == 1 && selectedResources[0]->metadata() != nullptr); ui->actionRemoveItem->setEnabled(hasSelection); ui->actionEnableItem->setEnabled(hasSelection); ui->actionDisableItem->setEnabled(hasSelection); - ui->actionViewHomepage->setEnabled(hasSelection); + ui->actionViewHomepage->setEnabled(hasSelection && std::any_of(selectedResources.begin(), selectedResources.end(), + [](Resource* resource) { return !resource->homepage().isEmpty() })); ui->actionExportMetadata->setEnabled(!m_model->empty()); }