Fixed assert
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
8dc3267925
commit
10aac4fe17
@ -1,41 +1,46 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* Prism Launcher - Minecraft Launcher
|
* Prism Launcher - Minecraft Launcher
|
||||||
* Copyright (c) 2022-2023 flowln <flowlnlnln@gmail.com>
|
* Copyright (c) 2022-2023 flowln <flowlnlnln@gmail.com>
|
||||||
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "net/NetJob.h"
|
#include "net/NetJob.h"
|
||||||
#include "tasks/SequentialTask.h"
|
#include "tasks/SequentialTask.h"
|
||||||
|
|
||||||
#include "modplatform/ModIndex.h"
|
|
||||||
#include "minecraft/mod/tasks/LocalModUpdateTask.h"
|
#include "minecraft/mod/tasks/LocalModUpdateTask.h"
|
||||||
|
#include "modplatform/ModIndex.h"
|
||||||
|
|
||||||
class ResourceFolderModel;
|
class ResourceFolderModel;
|
||||||
|
|
||||||
class ResourceDownloadTask : public SequentialTask {
|
class ResourceDownloadTask : public SequentialTask {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ResourceDownloadTask(ModPlatform::IndexedPack pack, ModPlatform::IndexedVersion version, const std::shared_ptr<ResourceFolderModel> packs, bool is_indexed = true);
|
explicit ResourceDownloadTask(ModPlatform::IndexedPack pack,
|
||||||
|
ModPlatform::IndexedVersion version,
|
||||||
|
const std::shared_ptr<ResourceFolderModel> packs,
|
||||||
|
bool is_indexed = true);
|
||||||
const QString& getFilename() const { return m_pack_version.fileName; }
|
const QString& getFilename() const { return m_pack_version.fileName; }
|
||||||
const QString& getCustomPath() const { return m_pack_version.custom_target_folder; }
|
const QString& getCustomPath() const { return m_pack_version.custom_target_folder; }
|
||||||
const QVariant& getVersionID() const { return m_pack_version.fileId; }
|
const QVariant& getVersionID() const { return m_pack_version.fileId; }
|
||||||
|
ModPlatform::IndexedPack& getPack() { return m_pack; }
|
||||||
|
const ModPlatform::ResourceProvider& getProvider() const { return m_pack.provider; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ModPlatform::IndexedPack m_pack;
|
ModPlatform::IndexedPack m_pack;
|
||||||
ModPlatform::IndexedVersion m_pack_version;
|
ModPlatform::IndexedVersion m_pack_version;
|
||||||
const std::shared_ptr<ResourceFolderModel> m_pack_model;
|
const std::shared_ptr<ResourceFolderModel> m_pack_model;
|
||||||
@ -47,11 +52,8 @@ private:
|
|||||||
void downloadFailed(QString reason);
|
void downloadFailed(QString reason);
|
||||||
void downloadSucceeded();
|
void downloadSucceeded();
|
||||||
|
|
||||||
std::tuple<QString, QString> to_delete {"", ""};
|
std::tuple<QString, QString> to_delete{ "", "" };
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void hasOldResource(QString name, QString filename);
|
void hasOldResource(QString name, QString filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
#include "minecraft/mod/ModFolderModel.h"
|
#include "minecraft/mod/ModFolderModel.h"
|
||||||
#include "minecraft/mod/ResourcePackFolderModel.h"
|
#include "minecraft/mod/ResourcePackFolderModel.h"
|
||||||
#include "minecraft/mod/TexturePackFolderModel.h"
|
|
||||||
#include "minecraft/mod/ShaderPackFolderModel.h"
|
#include "minecraft/mod/ShaderPackFolderModel.h"
|
||||||
|
#include "minecraft/mod/TexturePackFolderModel.h"
|
||||||
|
|
||||||
#include "ui/dialogs/ReviewMessageBox.h"
|
#include "ui/dialogs/ReviewMessageBox.h"
|
||||||
|
|
||||||
@ -41,7 +41,10 @@
|
|||||||
namespace ResourceDownload {
|
namespace ResourceDownload {
|
||||||
|
|
||||||
ResourceDownloadDialog::ResourceDownloadDialog(QWidget* parent, const std::shared_ptr<ResourceFolderModel> base_model)
|
ResourceDownloadDialog::ResourceDownloadDialog(QWidget* parent, const std::shared_ptr<ResourceFolderModel> base_model)
|
||||||
: QDialog(parent), m_base_model(base_model), m_buttons(QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel), m_vertical_layout(this)
|
: QDialog(parent)
|
||||||
|
, m_base_model(base_model)
|
||||||
|
, m_buttons(QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel)
|
||||||
|
, m_vertical_layout(this)
|
||||||
{
|
{
|
||||||
setObjectName(QStringLiteral("ResourceDownloadDialog"));
|
setObjectName(QStringLiteral("ResourceDownloadDialog"));
|
||||||
|
|
||||||
@ -102,7 +105,8 @@ void ResourceDownloadDialog::initializeContainer()
|
|||||||
void ResourceDownloadDialog::connectButtons()
|
void ResourceDownloadDialog::connectButtons()
|
||||||
{
|
{
|
||||||
auto OkButton = m_buttons.button(QDialogButtonBox::Ok);
|
auto OkButton = m_buttons.button(QDialogButtonBox::Ok);
|
||||||
OkButton->setToolTip(tr("Opens a new popup to review your selected %1 and confirm your selection. Shortcut: Ctrl+Return").arg(resourcesString()));
|
OkButton->setToolTip(
|
||||||
|
tr("Opens a new popup to review your selected %1 and confirm your selection. Shortcut: Ctrl+Return").arg(resourcesString()));
|
||||||
connect(OkButton, &QPushButton::clicked, this, &ResourceDownloadDialog::confirm);
|
connect(OkButton, &QPushButton::clicked, this, &ResourceDownloadDialog::confirm);
|
||||||
|
|
||||||
auto CancelButton = m_buttons.button(QDialogButtonBox::Cancel);
|
auto CancelButton = m_buttons.button(QDialogButtonBox::Cancel);
|
||||||
@ -169,8 +173,10 @@ void ResourceDownloadDialog::removeResource(ModPlatform::IndexedPack& pack, ModP
|
|||||||
auto selected_task = *selected_task_it;
|
auto selected_task = *selected_task_it;
|
||||||
auto old_version_id = selected_task->getVersionID();
|
auto old_version_id = selected_task->getVersionID();
|
||||||
|
|
||||||
// If the new and old version IDs don't match, search for the old one and deselect it.
|
if (selected_task->getProvider() != pack.provider) // If the pack name matches but they are different providers search for the
|
||||||
if (ver.fileId != old_version_id)
|
// old one(in the actual pack) and deselect it.
|
||||||
|
getVersionWithID(selected_task->getPack(), old_version_id).is_currently_selected = false;
|
||||||
|
else if (ver.fileId != old_version_id) // If the new and old version IDs don't match, search for the old one and deselect it.
|
||||||
getVersionWithID(pack, old_version_id).is_currently_selected = false;
|
getVersionWithID(pack, old_version_id).is_currently_selected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,8 +211,6 @@ void ResourceDownloadDialog::selectedPageChanged(BasePage* previous, BasePage* s
|
|||||||
m_selectedPage->setSearchTerm(prev_page->getSearchTerm());
|
m_selectedPage->setSearchTerm(prev_page->getSearchTerm());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ModDownloadDialog::ModDownloadDialog(QWidget* parent, const std::shared_ptr<ModFolderModel>& mods, BaseInstance* instance)
|
ModDownloadDialog::ModDownloadDialog(QWidget* parent, const std::shared_ptr<ModFolderModel>& mods, BaseInstance* instance)
|
||||||
: ResourceDownloadDialog(parent, mods), m_instance(instance)
|
: ResourceDownloadDialog(parent, mods), m_instance(instance)
|
||||||
{
|
{
|
||||||
@ -232,7 +236,6 @@ QList<BasePage*> ModDownloadDialog::getPages()
|
|||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ResourcePackDownloadDialog::ResourcePackDownloadDialog(QWidget* parent,
|
ResourcePackDownloadDialog::ResourcePackDownloadDialog(QWidget* parent,
|
||||||
const std::shared_ptr<ResourcePackFolderModel>& resource_packs,
|
const std::shared_ptr<ResourcePackFolderModel>& resource_packs,
|
||||||
BaseInstance* instance)
|
BaseInstance* instance)
|
||||||
@ -258,7 +261,6 @@ QList<BasePage*> ResourcePackDownloadDialog::getPages()
|
|||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TexturePackDownloadDialog::TexturePackDownloadDialog(QWidget* parent,
|
TexturePackDownloadDialog::TexturePackDownloadDialog(QWidget* parent,
|
||||||
const std::shared_ptr<TexturePackFolderModel>& resource_packs,
|
const std::shared_ptr<TexturePackFolderModel>& resource_packs,
|
||||||
BaseInstance* instance)
|
BaseInstance* instance)
|
||||||
@ -284,7 +286,6 @@ QList<BasePage*> TexturePackDownloadDialog::getPages()
|
|||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ShaderPackDownloadDialog::ShaderPackDownloadDialog(QWidget* parent,
|
ShaderPackDownloadDialog::ShaderPackDownloadDialog(QWidget* parent,
|
||||||
const std::shared_ptr<ShaderPackFolderModel>& shaders,
|
const std::shared_ptr<ShaderPackFolderModel>& shaders,
|
||||||
BaseInstance* instance)
|
BaseInstance* instance)
|
||||||
|
Loading…
Reference in New Issue
Block a user