From cb105b720b130e5341983ce03918309301e5335c Mon Sep 17 00:00:00 2001 From: Ice Yeti <101294194+IceYetiWins@users.noreply.github.com> Date: Sun, 14 Jun 2026 15:47:04 -0400 Subject: [PATCH] join offline + icon for all worlds toggle --- launcher/ui/MainWindow.ui | 2 +- launcher/ui/MultiWorldListPage.cpp | 17 ++++++++++++----- launcher/ui/MultiWorldListPage.h | 3 ++- launcher/ui/MultiWorldListPage.ui | 6 ++++++ 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/launcher/ui/MainWindow.ui b/launcher/ui/MainWindow.ui index 2e7d210dd..d2ac79f2f 100644 --- a/launcher/ui/MainWindow.ui +++ b/launcher/ui/MainWindow.ui @@ -786,7 +786,7 @@ true - + &All Worlds diff --git a/launcher/ui/MultiWorldListPage.cpp b/launcher/ui/MultiWorldListPage.cpp index 4f0d41614..7a08d046c 100644 --- a/launcher/ui/MultiWorldListPage.cpp +++ b/launcher/ui/MultiWorldListPage.cpp @@ -397,6 +397,7 @@ void MultiWorldListPage::worldChanged([[maybe_unused]] const QModelIndex& curren ui->actionData_Packs->setEnabled(enable); ui->actionView_Folder->setEnabled(enable); ui->actionJoin->setEnabled(enable); + ui->actionJoin_Offline->setEnabled(enable); ui->actionInstance_Settings->setEnabled(enable); bool hasIcon = !index.data(MultiWorldList::IconFileRole).isNull(); ui->actionReset_Icon->setEnabled(enable && hasIcon); @@ -463,8 +464,8 @@ void MultiWorldListPage::on_actionCopy_triggered() } } +// TODO: Make this a separate dialog class Q_DECLARE_METATYPE(BaseInstance*); - MinecraftInstance* MultiWorldListPage::selectInstance(const QString& message, BaseInstance* preselectedInstance) { auto *dialog = new QDialog(this); @@ -559,7 +560,7 @@ void MultiWorldListPage::on_actionRefresh_triggered() void MultiWorldListPage::worldDoubleClicked(const QModelIndex& index) { auto proxy = (QSortFilterProxyModel*)ui->worldTreeView->model(); - join(proxy->mapToSource(index)); + join(proxy->mapToSource(index), LaunchMode::Normal); } void MultiWorldListPage::fileDropped(const QFileInfo& worldInfo) @@ -576,17 +577,23 @@ void MultiWorldListPage::fileDropped(const QFileInfo& worldInfo) void MultiWorldListPage::on_actionJoin_triggered() { QModelIndex index = getSelectedWorld(); - join(index); + join(index, LaunchMode::Normal); } -void MultiWorldListPage::join(QModelIndex index) +void MultiWorldListPage::on_actionJoin_Offline_triggered() +{ + QModelIndex index = getSelectedWorld(); + join(index, LaunchMode::Offline); +} + +void MultiWorldListPage::join(const QModelIndex& index, const LaunchMode launchMode) { if (!index.isValid()) { return; } auto worldVariant = m_worlds->data(index, MultiWorldList::ObjectRole); auto *world = static_cast(worldVariant.value()); - APPLICATION->launch(world->instance, LaunchMode::Normal, std::make_shared(MinecraftTarget::parse(world->world.folderName(), true))); + APPLICATION->launch(world->instance, launchMode, std::make_shared(MinecraftTarget::parse(world->world.folderName(), true))); emit worldJoined(world->instance); } diff --git a/launcher/ui/MultiWorldListPage.h b/launcher/ui/MultiWorldListPage.h index 4af09503b..b2ef3e080 100644 --- a/launcher/ui/MultiWorldListPage.h +++ b/launcher/ui/MultiWorldListPage.h @@ -78,7 +78,7 @@ class MultiWorldListPage : public QMainWindow, public BasePage { bool isWorldSafe(QModelIndex index); bool worldSafetyNagQuestion(const QString& actionType); void mceditError(); - void join(QModelIndex index); + void join(const QModelIndex& index, LaunchMode launchMode); MinecraftInstance* selectInstance(const QString& message, BaseInstance* instance = nullptr); private: @@ -105,6 +105,7 @@ class MultiWorldListPage : public QMainWindow, public BasePage { void worldChanged(const QModelIndex& current, const QModelIndex& previous); void mceditState(LoggedProcess::State state); void on_actionJoin_triggered(); + void on_actionJoin_Offline_triggered(); void worldDoubleClicked(const QModelIndex& index); void fileDropped(const QFileInfo& worldInfo); diff --git a/launcher/ui/MultiWorldListPage.ui b/launcher/ui/MultiWorldListPage.ui index aa89840aa..5c1a86b75 100644 --- a/launcher/ui/MultiWorldListPage.ui +++ b/launcher/ui/MultiWorldListPage.ui @@ -85,6 +85,7 @@ + @@ -107,6 +108,11 @@ Join + + + Join Offline + + Rename