fix build

also fixed some warninigs of unused vars and formated the code again

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2026-01-17 02:28:56 +02:00
parent 78bc6657f4
commit d05b996c8a
21 changed files with 27 additions and 63 deletions

View File

@@ -159,7 +159,7 @@ int InstanceList::rowCount(const QModelIndex& parent) const
QModelIndex InstanceList::index(int row, int column, const QModelIndex& parent) const
{
Q_UNUSED(parent);
if (row < 0 || row >= m_instances.size())
if (row < 0 || static_cast<std::size_t>(row) >= m_instances.size())
return QModelIndex();
return createIndex(row, column, m_instances.at(row).get());
}
@@ -508,7 +508,6 @@ InstanceList::InstListError InstanceList::loadList()
for (auto& id : discoverInstances()) {
if (existingIds.contains(id)) {
auto instPair = existingIds[id];
existingIds.remove(id);
qInfo() << "Should keep and soft-reload" << id;
} else {
@@ -1035,7 +1034,6 @@ bool InstanceList::commitStagedInstance(const QString& path,
groupName = QString();
QString instID;
BaseInstance* inst;
auto should_override = commiting.shouldOverride();

View File

@@ -19,7 +19,8 @@ bool VanillaCreationTask::createInstance()
{
setStatus(tr("Creating instance from version %1").arg(m_version->name()));
MinecraftInstance inst(m_globalSettings, std::make_unique<INISettingsObject>(FS::PathCombine(m_stagingPath, "instance.cfg")), m_stagingPath);
MinecraftInstance inst(m_globalSettings, std::make_unique<INISettingsObject>(FS::PathCombine(m_stagingPath, "instance.cfg")),
m_stagingPath);
SettingsObject::Lock lock(inst.settings());
auto components = inst.getPackProfile();

View File

@@ -168,7 +168,8 @@ void AccountList::removeAccount(QModelIndex index)
}
}
void AccountList::moveAccount(QModelIndex index, int delta) {
void AccountList::moveAccount(QModelIndex index, int delta)
{
const int row = index.row();
const int newRow = row + delta;
if (index.isValid() && row < m_accounts.size() && newRow >= 0 && newRow < m_accounts.size()) {
@@ -181,7 +182,8 @@ void AccountList::moveAccount(QModelIndex index, int delta) {
onListChanged();
} else {
qCritical().noquote() << "AccountList: failed to move account from" << row << "to" << newRow << QString("(%1 accounts in total)").arg(this->count());
qCritical().noquote() << "AccountList: failed to move account from" << row << "to" << newRow
<< QString("(%1 accounts in total)").arg(this->count());
}
}
}

View File

@@ -65,7 +65,6 @@ void ExtractNatives::executeTask()
emitSucceeded();
return;
}
auto settings = instance->settings();
auto outputPath = instance->getNativePath();
FS::ensureFolderPathExists(outputPath);

View File

@@ -36,8 +36,8 @@
#include "CapeChange.h"
#include <memory>
#include <net/DummySink.h>
#include <memory>
#include "net/RawHeaderProxy.h"
CapeChange::CapeChange(QString cape) : NetRequest(), m_capeId(cape)

View File

@@ -15,11 +15,7 @@ class CheckUpdateTask : public Task {
std::list<Version>& mcVersions,
QList<ModPlatform::ModLoaderType> loadersList,
ResourceFolderModel* resourceModel)
: Task()
, m_resources(resources)
, m_gameVersions(mcVersions)
, m_loadersList(std::move(loadersList))
, m_resourceModel(resourceModel)
: Task(), m_resources(resources), m_gameVersions(mcVersions), m_loadersList(std::move(loadersList)), m_resourceModel(resourceModel)
{}
struct Update {

View File

@@ -31,4 +31,4 @@ class DummySink : public Sink {
auto hasLocalData() -> bool override { return false; }
};
} // namespace Net
} // namespace Net

View File

@@ -44,8 +44,7 @@
#include "ui/dialogs/CustomMessageBox.h"
#endif
NetJob::NetJob(QString job_name, QNetworkAccessManager* network, int max_concurrent)
: ConcurrentTask(job_name), m_network(network)
NetJob::NetJob(QString job_name, QNetworkAccessManager* network, int max_concurrent) : ConcurrentTask(job_name), m_network(network)
{
#if defined(LAUNCHER_APPLICATION)
if (APPLICATION_DYN && max_concurrent < 0)

View File

@@ -33,11 +33,7 @@
class InstallLoaderPage : public VersionSelectWidget, public BasePage {
Q_OBJECT
public:
InstallLoaderPage(const QString& id,
const QString& iconName,
const QString& name,
const Version& oldestVersion,
PackProfile* profile)
InstallLoaderPage(const QString& id, const QString& iconName, const QString& name, const Version& oldestVersion, PackProfile* profile)
: VersionSelectWidget(nullptr), uid(id), iconName(iconName), name(name)
{
const QString minecraftVersion = profile->getComponentVersion("net.minecraft");

View File

@@ -28,7 +28,8 @@ class HideCheckboxProxyModel : public QIdentityProxyModel {
public:
using QIdentityProxyModel::QIdentityProxyModel;
QVariant data(const QModelIndex& index, int role) const override {
QVariant data(const QModelIndex& index, int role) const override
{
if (role == Qt::CheckStateRole) {
return {};
}
@@ -45,7 +46,7 @@ ProfileSelectDialog::ProfileSelectDialog(const QString& message, int flags, QWid
m_accounts = APPLICATION->accounts();
auto proxy = new HideCheckboxProxyModel(ui->view);
proxy->setSourceModel(m_accounts.get());
proxy->setSourceModel(m_accounts);
ui->view->setModel(proxy);
// Set the message label.

View File

@@ -310,9 +310,7 @@ GetModDependenciesTask::Ptr ModDownloadDialog::getModDependenciesTask()
return nullptr;
}
ResourcePackDownloadDialog::ResourcePackDownloadDialog(QWidget* parent,
ResourcePackFolderModel* resource_packs,
BaseInstance* instance)
ResourcePackDownloadDialog::ResourcePackDownloadDialog(QWidget* parent, ResourcePackFolderModel* resource_packs, BaseInstance* instance)
: ResourceDownloadDialog(parent, resource_packs), m_instance(instance)
{
setWindowTitle(dialogTitle());
@@ -335,9 +333,7 @@ QList<BasePage*> ResourcePackDownloadDialog::getPages()
return pages;
}
TexturePackDownloadDialog::TexturePackDownloadDialog(QWidget* parent,
TexturePackFolderModel* resource_packs,
BaseInstance* instance)
TexturePackDownloadDialog::TexturePackDownloadDialog(QWidget* parent, TexturePackFolderModel* resource_packs, BaseInstance* instance)
: ResourceDownloadDialog(parent, resource_packs), m_instance(instance)
{
setWindowTitle(dialogTitle());
@@ -360,9 +356,7 @@ QList<BasePage*> TexturePackDownloadDialog::getPages()
return pages;
}
ShaderPackDownloadDialog::ShaderPackDownloadDialog(QWidget* parent,
ShaderPackFolderModel* shaders,
BaseInstance* instance)
ShaderPackDownloadDialog::ShaderPackDownloadDialog(QWidget* parent, ShaderPackFolderModel* shaders, BaseInstance* instance)
: ResourceDownloadDialog(parent, shaders), m_instance(instance)
{
setWindowTitle(dialogTitle());
@@ -400,9 +394,7 @@ void ResourceDownloadDialog::setResourceMetadata(const std::shared_ptr<Metadata:
page->openProject(meta->project_id);
}
DataPackDownloadDialog::DataPackDownloadDialog(QWidget* parent,
DataPackFolderModel* data_packs,
BaseInstance* instance)
DataPackDownloadDialog::DataPackDownloadDialog(QWidget* parent, DataPackFolderModel* data_packs, BaseInstance* instance)
: ResourceDownloadDialog(parent, data_packs), m_instance(instance)
{
setWindowTitle(dialogTitle());

View File

@@ -118,9 +118,7 @@ class ResourcePackDownloadDialog final : public ResourceDownloadDialog {
Q_OBJECT
public:
explicit ResourcePackDownloadDialog(QWidget* parent,
ResourcePackFolderModel* resource_packs,
BaseInstance* instance);
explicit ResourcePackDownloadDialog(QWidget* parent, ResourcePackFolderModel* resource_packs, BaseInstance* instance);
~ResourcePackDownloadDialog() override = default;
//: String that gets appended to the resource pack download dialog title ("Download " + resourcesString())
@@ -137,9 +135,7 @@ class TexturePackDownloadDialog final : public ResourceDownloadDialog {
Q_OBJECT
public:
explicit TexturePackDownloadDialog(QWidget* parent,
TexturePackFolderModel* resource_packs,
BaseInstance* instance);
explicit TexturePackDownloadDialog(QWidget* parent, TexturePackFolderModel* resource_packs, BaseInstance* instance);
~TexturePackDownloadDialog() override = default;
//: String that gets appended to the texture pack download dialog title ("Download " + resourcesString())

View File

@@ -67,8 +67,6 @@ void DataPackPage::downloadDataPacks()
if (m_instance->typeName() != "Minecraft")
return; // this is a null instance or a legacy instance
auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile();
m_downloadDialog = new ResourceDownload::DataPackDownloadDialog(this, m_model, m_instance);
connect(this, &QObject::destroyed, m_downloadDialog, &QDialog::close);
connect(m_downloadDialog, &QDialog::finished, this, &DataPackPage::downloadDialogFinished);
@@ -119,7 +117,6 @@ void DataPackPage::updateDataPacks()
if (m_instance->typeName() != "Minecraft")
return; // this is a null instance or a legacy instance
auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile();
if (APPLICATION->settings()->get("ModMetadataDisabled").toBool()) {
QMessageBox::critical(this, tr("Error"), tr("Data pack updates are unavailable when metadata is disabled!"));
return;

View File

@@ -44,8 +44,7 @@ class InstanceSettingsPage : public MinecraftSettingsWidget, public BasePage {
Q_OBJECT
public:
explicit InstanceSettingsPage(MinecraftInstance* instance, QWidget* parent = nullptr)
: MinecraftSettingsWidget(instance, parent)
explicit InstanceSettingsPage(MinecraftInstance* instance, QWidget* parent = nullptr) : MinecraftSettingsWidget(instance, parent)
{
connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::saveSettings);
connect(APPLICATION, &Application::globalSettingsApplied, this, &InstanceSettingsPage::loadSettings);

View File

@@ -341,8 +341,7 @@ void ModFolderPage::exportModMetadata()
dlg.exec();
}
CoreModFolderPage::CoreModFolderPage(BaseInstance* inst, ModFolderModel* mods, QWidget* parent)
: ModFolderPage(inst, mods, parent)
CoreModFolderPage::CoreModFolderPage(BaseInstance* inst, ModFolderModel* mods, QWidget* parent) : ModFolderPage(inst, mods, parent)
{
auto mcInst = dynamic_cast<MinecraftInstance*>(m_instance);
if (mcInst) {
@@ -381,9 +380,7 @@ bool CoreModFolderPage::shouldDisplay() const
return false;
}
NilModFolderPage::NilModFolderPage(BaseInstance* inst, ModFolderModel* mods, QWidget* parent)
: ModFolderPage(inst, mods, parent)
{}
NilModFolderPage::NilModFolderPage(BaseInstance* inst, ModFolderModel* mods, QWidget* parent) : ModFolderPage(inst, mods, parent) {}
bool NilModFolderPage::shouldDisplay() const
{

View File

@@ -134,7 +134,6 @@ void ResourcePackPage::updateResourcePacks()
if (m_instance->typeName() != "Minecraft")
return; // this is a null instance or a legacy instance
auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile();
if (APPLICATION->settings()->get("ModMetadataDisabled").toBool()) {
QMessageBox::critical(this, tr("Error"), tr("Resource pack updates are unavailable when metadata is disabled!"));
return;

View File

@@ -131,7 +131,6 @@ void ShaderPackPage::updateShaderPacks()
if (m_instance->typeName() != "Minecraft")
return; // this is a null instance or a legacy instance
auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile();
if (APPLICATION->settings()->get("ModMetadataDisabled").toBool()) {
QMessageBox::critical(this, tr("Error"), tr("Shader pack updates are unavailable when metadata is disabled!"));
return;

View File

@@ -139,7 +139,6 @@ void TexturePackPage::updateTexturePacks()
if (m_instance->typeName() != "Minecraft")
return; // this is a null instance or a legacy instance
auto profile = static_cast<MinecraftInstance*>(m_instance)->getPackProfile();
if (APPLICATION->settings()->get("ModMetadataDisabled").toBool()) {
QMessageBox::critical(this, tr("Error"), tr("Texture pack updates are unavailable when metadata is disabled!"));
return;

View File

@@ -239,9 +239,7 @@ void WorldListPage::on_actionData_Packs_triggered()
bool isIndexed = !APPLICATION->settings()->get("ModMetadataDisabled").toBool();
m_datapackModel.reset(new DataPackFolderModel(folder, m_inst, isIndexed, true));
provider.addPageCreator([this] {
return new DataPackPage(m_inst, m_datapackModel.get(), this);
});
provider.addPageCreator([this] { return new DataPackPage(m_inst, m_datapackModel.get(), this); });
auto layout = new QVBoxLayout(dialog);

View File

@@ -112,9 +112,7 @@ QMap<QString, QString> ModPage::urlHandlers() const
/******** Make changes to the UI ********/
void ModPage::addResourceToPage(ModPlatform::IndexedPack::Ptr pack,
ModPlatform::IndexedVersion& version,
ResourceFolderModel* base_model)
void ModPage::addResourceToPage(ModPlatform::IndexedPack::Ptr pack, ModPlatform::IndexedVersion& version, ResourceFolderModel* base_model)
{
bool is_indexed = !APPLICATION->settings()->get("ModMetadataDisabled").toBool();
m_model->addPack(pack, version, base_model, is_indexed);

View File

@@ -370,9 +370,7 @@ void ResourcePage::removeResourceFromDialog(const QString& pack_name)
m_parentDialog->removeResource(pack_name);
}
void ResourcePage::addResourceToPage(ModPlatform::IndexedPack::Ptr pack,
ModPlatform::IndexedVersion& ver,
ResourceFolderModel* base_model)
void ResourcePage::addResourceToPage(ModPlatform::IndexedPack::Ptr pack, ModPlatform::IndexedVersion& ver, ResourceFolderModel* base_model)
{
bool is_indexed = !APPLICATION->settings()->get("ModMetadataDisabled").toBool();
m_model->addPack(pack, ver, base_model, is_indexed);