Filter for datapack loader in datapack update too
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
221365f05b
commit
1d1480f470
7 changed files with 18 additions and 26 deletions
|
@ -32,17 +32,12 @@ static std::list<Version> mcVersions(BaseInstance* inst)
|
|||
return { static_cast<MinecraftInstance*>(inst)->getPackProfile()->getComponent("net.minecraft")->getVersion() };
|
||||
}
|
||||
|
||||
static QList<ModPlatform::ModLoaderType> mcLoadersList(BaseInstance* inst)
|
||||
{
|
||||
return static_cast<MinecraftInstance*>(inst)->getPackProfile()->getModLoadersList();
|
||||
}
|
||||
|
||||
ResourceUpdateDialog::ResourceUpdateDialog(QWidget* parent,
|
||||
BaseInstance* instance,
|
||||
const std::shared_ptr<ResourceFolderModel> resource_model,
|
||||
QList<Resource*>& search_for,
|
||||
bool include_deps,
|
||||
bool filter_loaders)
|
||||
QList<ModPlatform::ModLoaderType> loadersList)
|
||||
: ReviewMessageBox(parent, tr("Confirm resources to update"), "")
|
||||
, m_parent(parent)
|
||||
, m_resource_model(resource_model)
|
||||
|
@ -50,7 +45,7 @@ ResourceUpdateDialog::ResourceUpdateDialog(QWidget* parent,
|
|||
, m_second_try_metadata(new ConcurrentTask("Second Metadata Search", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()))
|
||||
, m_instance(instance)
|
||||
, m_include_deps(include_deps)
|
||||
, m_filter_loaders(filter_loaders)
|
||||
, m_loadersList(std::move(loadersList))
|
||||
{
|
||||
ReviewMessageBox::setGeometry(0, 0, 800, 600);
|
||||
|
||||
|
@ -89,12 +84,10 @@ void ResourceUpdateDialog::checkCandidates()
|
|||
}
|
||||
|
||||
auto versions = mcVersions(m_instance);
|
||||
auto loadersList = m_filter_loaders ? mcLoadersList(m_instance) : QList<ModPlatform::ModLoaderType>();
|
||||
|
||||
SequentialTask check_task(tr("Checking for updates"));
|
||||
|
||||
if (!m_modrinth_to_update.empty()) {
|
||||
m_modrinth_check_task.reset(new ModrinthCheckUpdate(m_modrinth_to_update, versions, loadersList, m_resource_model));
|
||||
m_modrinth_check_task.reset(new ModrinthCheckUpdate(m_modrinth_to_update, versions, m_loadersList, m_resource_model));
|
||||
connect(m_modrinth_check_task.get(), &CheckUpdateTask::checkFailed, this,
|
||||
[this](Resource* resource, QString reason, QUrl recover_url) {
|
||||
m_failed_check_update.append({ resource, reason, recover_url });
|
||||
|
@ -103,7 +96,7 @@ void ResourceUpdateDialog::checkCandidates()
|
|||
}
|
||||
|
||||
if (!m_flame_to_update.empty()) {
|
||||
m_flame_check_task.reset(new FlameCheckUpdate(m_flame_to_update, versions, loadersList, m_resource_model));
|
||||
m_flame_check_task.reset(new FlameCheckUpdate(m_flame_to_update, versions, m_loadersList, m_resource_model));
|
||||
connect(m_flame_check_task.get(), &CheckUpdateTask::checkFailed, this,
|
||||
[this](Resource* resource, QString reason, QUrl recover_url) {
|
||||
m_failed_check_update.append({ resource, reason, recover_url });
|
||||
|
|
|
@ -21,7 +21,7 @@ class ResourceUpdateDialog final : public ReviewMessageBox {
|
|||
std::shared_ptr<ResourceFolderModel> resource_model,
|
||||
QList<Resource*>& search_for,
|
||||
bool include_deps,
|
||||
bool filter_loaders);
|
||||
QList<ModPlatform::ModLoaderType> loadersList = {});
|
||||
|
||||
void checkCandidates();
|
||||
|
||||
|
@ -64,5 +64,5 @@ class ResourceUpdateDialog final : public ReviewMessageBox {
|
|||
bool m_no_updates = false;
|
||||
bool m_aborted = false;
|
||||
bool m_include_deps = false;
|
||||
bool m_filter_loaders = false;
|
||||
QList<ModPlatform::ModLoaderType> m_loadersList;
|
||||
};
|
||||
|
|
|
@ -96,7 +96,6 @@ void DataPackPage::downloadDataPacks()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void DataPackPage::updateDataPacks()
|
||||
{
|
||||
if (m_instance->typeName() != "Minecraft")
|
||||
|
@ -108,13 +107,13 @@ void DataPackPage::updateDataPacks()
|
|||
return;
|
||||
}
|
||||
if (m_instance != nullptr && m_instance->isRunning()) {
|
||||
auto response = CustomMessageBox::selectable(
|
||||
this, tr("Confirm Update"),
|
||||
tr("Updating data packs while the game is running may cause pack duplication and game crashes.\n"
|
||||
"The old files may not be deleted as they are in use.\n"
|
||||
"Are you sure you want to do this?"),
|
||||
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
|
||||
->exec();
|
||||
auto response =
|
||||
CustomMessageBox::selectable(this, tr("Confirm Update"),
|
||||
tr("Updating data packs while the game is running may cause pack duplication and game crashes.\n"
|
||||
"The old files may not be deleted as they are in use.\n"
|
||||
"Are you sure you want to do this?"),
|
||||
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
|
||||
->exec();
|
||||
|
||||
if (response != QMessageBox::Yes)
|
||||
return;
|
||||
|
@ -126,7 +125,7 @@ void DataPackPage::updateDataPacks()
|
|||
if (use_all)
|
||||
mods_list = m_model->allResources();
|
||||
|
||||
ResourceUpdateDialog update_dialog(this, m_instance, m_model, mods_list, false, false);
|
||||
ResourceUpdateDialog update_dialog(this, m_instance, m_model, mods_list, false, { ModPlatform::ModLoaderType::DataPack });
|
||||
update_dialog.checkCandidates();
|
||||
|
||||
if (update_dialog.aborted()) {
|
||||
|
|
|
@ -210,7 +210,7 @@ void ModFolderPage::updateMods(bool includeDeps)
|
|||
if (use_all)
|
||||
mods_list = m_model->allResources();
|
||||
|
||||
ResourceUpdateDialog update_dialog(this, m_instance, m_model, mods_list, includeDeps, true);
|
||||
ResourceUpdateDialog update_dialog(this, m_instance, m_model, mods_list, includeDeps, profile->getModLoadersList());
|
||||
update_dialog.checkCandidates();
|
||||
|
||||
if (update_dialog.aborted()) {
|
||||
|
|
|
@ -144,7 +144,7 @@ void ResourcePackPage::updateResourcePacks()
|
|||
if (use_all)
|
||||
mods_list = m_model->allResources();
|
||||
|
||||
ResourceUpdateDialog update_dialog(this, m_instance, m_model, mods_list, false, false);
|
||||
ResourceUpdateDialog update_dialog(this, m_instance, m_model, mods_list, false);
|
||||
update_dialog.checkCandidates();
|
||||
|
||||
if (update_dialog.aborted()) {
|
||||
|
|
|
@ -141,7 +141,7 @@ void ShaderPackPage::updateShaderPacks()
|
|||
if (use_all)
|
||||
mods_list = m_model->allResources();
|
||||
|
||||
ResourceUpdateDialog update_dialog(this, m_instance, m_model, mods_list, false, false);
|
||||
ResourceUpdateDialog update_dialog(this, m_instance, m_model, mods_list, false);
|
||||
update_dialog.checkCandidates();
|
||||
|
||||
if (update_dialog.aborted()) {
|
||||
|
|
|
@ -150,7 +150,7 @@ void TexturePackPage::updateTexturePacks()
|
|||
if (use_all)
|
||||
mods_list = m_model->allResources();
|
||||
|
||||
ResourceUpdateDialog update_dialog(this, m_instance, m_model, mods_list, false, false);
|
||||
ResourceUpdateDialog update_dialog(this, m_instance, m_model, mods_list, false);
|
||||
update_dialog.checkCandidates();
|
||||
|
||||
if (update_dialog.aborted()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue