From 55edaa203962a3369644a19d4c53ab1f35d64a0a Mon Sep 17 00:00:00 2001 From: arthomnix Date: Sun, 9 Apr 2023 13:49:24 +0100 Subject: [PATCH] NOISSUE Hide join world buttons on pre-23w14a instances --- launcher/ui/pages/instance/WorldListPage.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/launcher/ui/pages/instance/WorldListPage.cpp b/launcher/ui/pages/instance/WorldListPage.cpp index 908b464d..92bf4e04 100644 --- a/launcher/ui/pages/instance/WorldListPage.cpp +++ b/launcher/ui/pages/instance/WorldListPage.cpp @@ -318,8 +318,14 @@ void WorldListPage::worldChanged(const QModelIndex ¤t, const QModelIndex & QModelIndex index = getSelectedWorld(); bool enable = index.isValid(); - // FIXME: Hide the join buttons if the Minecraft version is too old instead of just disabling them. - // ui->actionJoin->setVisible(false) had no effect for some reason, at least on my machine -arthomnix + ui->actionJoin->setVisible(enableJoinActions); + ui->actionJoinOffline->setVisible(enableJoinActions); + // The above lines will only hide the actions from the right click menu, to hide them from the toolbar we need to do this. + // If any more actions are added above the Join/Join Offline actions, these indices will need to be updated! + ui->toolBar->actions().at(2)->setVisible(enableJoinActions); + ui->toolBar->actions().at(3)->setVisible(enableJoinActions); + // Also disable the separator so there aren't 2 separators in a row + ui->toolBar->actions().at(4)->setVisible(enableJoinActions); ui->actionJoin->setEnabled(enable && enableJoinActions); ui->actionJoinOffline->setEnabled(enable && enableJoinActions); ui->actionCopy_Seed->setEnabled(enable);