mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-05-29 05:10:20 +02:00
Merge pull request #1526 from Trial97/disablemods
feat:Removed update disabled warning
This commit is contained in:
commit
b77dc47c6c
@ -251,7 +251,7 @@ Task* ModFolderModel::createParseTask(Resource& resource)
|
|||||||
bool ModFolderModel::uninstallMod(const QString& filename, bool preserve_metadata)
|
bool ModFolderModel::uninstallMod(const QString& filename, bool preserve_metadata)
|
||||||
{
|
{
|
||||||
for (auto mod : allMods()) {
|
for (auto mod : allMods()) {
|
||||||
if (mod->fileinfo().fileName() == filename) {
|
if (mod->getOriginalFileName() == filename) {
|
||||||
auto index_dir = indexDir();
|
auto index_dir = indexDir();
|
||||||
mod->destroy(index_dir, preserve_metadata, false);
|
mod->destroy(index_dir, preserve_metadata, false);
|
||||||
|
|
||||||
|
@ -197,3 +197,11 @@ bool Resource::isMoreThanOneHardLink() const
|
|||||||
{
|
{
|
||||||
return FS::hardLinkCount(m_file_info.absoluteFilePath()) > 1;
|
return FS::hardLinkCount(m_file_info.absoluteFilePath()) > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto Resource::getOriginalFileName() const -> QString
|
||||||
|
{
|
||||||
|
auto fileName = m_file_info.fileName();
|
||||||
|
if (!m_enabled)
|
||||||
|
fileName.chop(9);
|
||||||
|
return fileName;
|
||||||
|
}
|
@ -80,6 +80,7 @@ class Resource : public QObject {
|
|||||||
[[nodiscard]] auto internal_id() const -> QString { return m_internal_id; }
|
[[nodiscard]] auto internal_id() const -> QString { return m_internal_id; }
|
||||||
[[nodiscard]] auto type() const -> ResourceType { return m_type; }
|
[[nodiscard]] auto type() const -> ResourceType { return m_type; }
|
||||||
[[nodiscard]] bool enabled() const { return m_enabled; }
|
[[nodiscard]] bool enabled() const { return m_enabled; }
|
||||||
|
[[nodiscard]] auto getOriginalFileName() const -> QString;
|
||||||
[[nodiscard]] QString sizeStr() const { return m_size_str; }
|
[[nodiscard]] QString sizeStr() const { return m_size_str; }
|
||||||
[[nodiscard]] qint64 sizeInfo() const { return m_size_info; }
|
[[nodiscard]] qint64 sizeInfo() const { return m_size_info; }
|
||||||
|
|
||||||
|
@ -124,11 +124,6 @@ void FlameCheckUpdate::executeTask()
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (auto* mod : m_mods) {
|
for (auto* mod : m_mods) {
|
||||||
if (!mod->enabled()) {
|
|
||||||
emit checkFailed(mod, tr("Disabled mods won't be updated, to prevent mod duplication issues!"));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
setStatus(tr("Getting API response from CurseForge for '%1'...").arg(mod->name()));
|
setStatus(tr("Getting API response from CurseForge for '%1'...").arg(mod->name()));
|
||||||
setProgress(i++, m_mods.size());
|
setProgress(i++, m_mods.size());
|
||||||
|
|
||||||
@ -177,7 +172,7 @@ void FlameCheckUpdate::executeTask()
|
|||||||
auto download_task = makeShared<ResourceDownloadTask>(pack, latest_ver.value(), m_mods_folder);
|
auto download_task = makeShared<ResourceDownloadTask>(pack, latest_ver.value(), m_mods_folder);
|
||||||
m_updatable.emplace_back(pack->name, mod->metadata()->hash, old_version, latest_ver->version, latest_ver->version_type,
|
m_updatable.emplace_back(pack->name, mod->metadata()->hash, old_version, latest_ver->version, latest_ver->version_type,
|
||||||
api.getModFileChangelog(latest_ver->addonId.toInt(), latest_ver->fileId.toInt()),
|
api.getModFileChangelog(latest_ver->addonId.toInt(), latest_ver->fileId.toInt()),
|
||||||
ModPlatform::ResourceProvider::FLAME, download_task);
|
ModPlatform::ResourceProvider::FLAME, download_task, mod->enabled());
|
||||||
}
|
}
|
||||||
m_deps.append(std::make_shared<GetModDependenciesTask::PackDependency>(pack, latest_ver.value()));
|
m_deps.append(std::make_shared<GetModDependenciesTask::PackDependency>(pack, latest_ver.value()));
|
||||||
}
|
}
|
||||||
|
@ -42,11 +42,6 @@ void ModrinthCheckUpdate::executeTask()
|
|||||||
auto hashing_task =
|
auto hashing_task =
|
||||||
makeShared<ConcurrentTask>(this, "MakeModrinthHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
makeShared<ConcurrentTask>(this, "MakeModrinthHashesTask", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
||||||
for (auto* mod : m_mods) {
|
for (auto* mod : m_mods) {
|
||||||
if (!mod->enabled()) {
|
|
||||||
emit checkFailed(mod, tr("Disabled mods won't be updated, to prevent mod duplication issues!"));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto hash = mod->metadata()->hash;
|
auto hash = mod->metadata()->hash;
|
||||||
|
|
||||||
// Sadly the API can only handle one hash type per call, se we
|
// Sadly the API can only handle one hash type per call, se we
|
||||||
@ -95,8 +90,7 @@ void ModrinthCheckUpdate::checkVersionsResponse(std::shared_ptr<QByteArray> resp
|
|||||||
// If the returned project is empty, but we have Modrinth metadata,
|
// If the returned project is empty, but we have Modrinth metadata,
|
||||||
// it means this specific version is not available
|
// it means this specific version is not available
|
||||||
if (project_obj.isEmpty()) {
|
if (project_obj.isEmpty()) {
|
||||||
qDebug() << "Mod " << m_mappings.find(hash).value()->name() << " got an empty response."
|
qDebug() << "Mod " << m_mappings.find(hash).value()->name() << " got an empty response." << "Hash: " << hash;
|
||||||
<< "Hash: " << hash;
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -153,7 +147,7 @@ void ModrinthCheckUpdate::checkVersionsResponse(std::shared_ptr<QByteArray> resp
|
|||||||
auto download_task = makeShared<ResourceDownloadTask>(pack, project_ver, m_mods_folder);
|
auto download_task = makeShared<ResourceDownloadTask>(pack, project_ver, m_mods_folder);
|
||||||
|
|
||||||
m_updatable.emplace_back(pack->name, hash, mod->version(), project_ver.version_number, project_ver.version_type,
|
m_updatable.emplace_back(pack->name, hash, mod->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, mod->enabled());
|
||||||
}
|
}
|
||||||
m_deps.append(std::make_shared<GetModDependenciesTask::PackDependency>(pack, project_ver));
|
m_deps.append(std::make_shared<GetModDependenciesTask::PackDependency>(pack, project_ver));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user