From 66b20c990fc354576c52784b09fa1e2357e98d4e Mon Sep 17 00:00:00 2001 From: Ice Yeti <101294194+IceYetiWins@users.noreply.github.com> Date: Tue, 26 May 2026 21:31:34 -0400 Subject: [PATCH] fix ui/miscellanous issues --- launcher/minecraft/MultiWorldList.cpp | 4 ++-- launcher/minecraft/MultiWorldList.h | 3 ++- launcher/ui/MultiWorldListPage.cpp | 12 ++++++------ launcher/ui/MultiWorldListPage.h | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/launcher/minecraft/MultiWorldList.cpp b/launcher/minecraft/MultiWorldList.cpp index 48d3a3c18..4851f63b7 100644 --- a/launcher/minecraft/MultiWorldList.cpp +++ b/launcher/minecraft/MultiWorldList.cpp @@ -46,7 +46,7 @@ #include #include -MultiWorldList::MultiWorldList(const QList dirs, QList instances) : QAbstractListModel(), m_instances(instances) +MultiWorldList::MultiWorldList(const QList& dirs, QList instances) : QAbstractListModel(), m_instances(instances) { for (int i = 0; i < dirs.length(); i++) { // better way to do this? iy m_dirs[i] = dirs[i]; @@ -413,7 +413,7 @@ bool MultiWorldList::dropMimeData(const QMimeData* data, return false; } -int64_t calculateWorldSize(const QFileInfo& file) +int64_t MultiWorldList::calculateWorldSize(const QFileInfo& file) { if (file.isFile() && file.suffix() == "zip") { return file.size(); diff --git a/launcher/minecraft/MultiWorldList.h b/launcher/minecraft/MultiWorldList.h index eff3bfe22..1e0a7e60e 100644 --- a/launcher/minecraft/MultiWorldList.h +++ b/launcher/minecraft/MultiWorldList.h @@ -32,7 +32,7 @@ class MultiWorldList : public QAbstractListModel { enum Roles { ObjectRole = Qt::UserRole + 1, FolderRole, SeedRole, NameRole, GameModeRole, LastPlayedRole, SizeRole, IconFileRole }; - MultiWorldList(const QList dirs, QList instances); + MultiWorldList(const QList& dirs, QList instances); virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; @@ -68,6 +68,7 @@ class MultiWorldList : public QAbstractListModel { /// process data from drop action virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent); /// what drag actions do we support? + int64_t calculateWorldSize(const QFileInfo& file); virtual Qt::DropActions supportedDragActions() const; /// what drop actions do we support? diff --git a/launcher/ui/MultiWorldListPage.cpp b/launcher/ui/MultiWorldListPage.cpp index 3698e9356..768ab4a08 100644 --- a/launcher/ui/MultiWorldListPage.cpp +++ b/launcher/ui/MultiWorldListPage.cpp @@ -38,7 +38,7 @@ #include "MultiWorldListPage.h" #include "minecraft/MultiWorldList.h" #include "ui/dialogs/CustomMessageBox.h" -#include "ui_WorldListPage.h" //fix this iy +#include "ui_MultiWorldListPage.h" //fix this iy #include #include @@ -62,11 +62,11 @@ #include "Application.h" #include "pages/instance/DataPackPage.h" -class WorldListProxyModel : public QSortFilterProxyModel { +class MultiWorldListProxyModel : public QSortFilterProxyModel { Q_OBJECT public: - WorldListProxyModel(QObject* parent) : QSortFilterProxyModel(parent) {} + MultiWorldListProxyModel(QObject* parent) : QSortFilterProxyModel(parent) {} virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const { @@ -87,13 +87,13 @@ class WorldListProxyModel : public QSortFilterProxyModel { }; MultiWorldListPage::MultiWorldListPage(MinecraftInstance* inst, MultiWorldList* worlds, QWidget* parent) - : QMainWindow(parent), m_inst(inst), ui(new Ui::WorldListPage), m_worlds(worlds) //use MultiWorldListPage.ui to have separate ui from normal world list page iy + : QMainWindow(parent), m_inst(inst), ui(new Ui::MultiWorldListPage), m_worlds(worlds) //use MultiWorldListPage.ui to have separate ui from normal world list page iy { ui->setupUi(this); ui->toolBar->insertSpacer(ui->actionRefresh); - WorldListProxyModel* proxy = new WorldListProxyModel(this); + MultiWorldListProxyModel* proxy = new MultiWorldListProxyModel(this); proxy->setSortCaseSensitivity(Qt::CaseInsensitive); proxy->setSourceModel(m_worlds); proxy->setSortRole(Qt::UserRole); @@ -474,4 +474,4 @@ void MultiWorldListPage::on_actionJoin_triggered() APPLICATION->launch(m_inst, LaunchMode::Normal, std::make_shared(MinecraftTarget::parse(world->folderName(), true))); } -#include "WorldListPage.moc" //change this iy +#include "MultiWorldListPage.moc" //change this iy diff --git a/launcher/ui/MultiWorldListPage.h b/launcher/ui/MultiWorldListPage.h index e9c9dd530..91cc088cf 100644 --- a/launcher/ui/MultiWorldListPage.h +++ b/launcher/ui/MultiWorldListPage.h @@ -80,7 +80,7 @@ class MultiWorldListPage : public QMainWindow, public BasePage { void mceditError(); private: - Ui::WorldListPage* ui; + Ui::MultiWorldListPage* ui; MultiWorldList* m_worlds; unique_qobject_ptr m_mceditProcess; bool m_mceditStarting = false;