Merge pull request #5125 from arthomnix/feature/singleplayer-quickplay

NOISSUE Add support for launching worlds directly via Quick Play
This commit is contained in:
Petr Mrázek
2023-05-16 21:12:28 +02:00
committed by GitHub
33 changed files with 566 additions and 166 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022 arthomnix
* Copyright 2022-2023 arthomnix
*
* This source is subject to the Microsoft Public License (MS-PL).
* Please see the COPYING.md file for more information.
@@ -13,6 +13,8 @@
#include "Application.h"
#include "minecraft/auth/AccountList.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/WorldList.h"
#include "minecraft/VersionFilterData.h"
#include "minecraft/PackProfile.h"
#include "icons/IconList.h"
@@ -43,6 +45,23 @@ CreateShortcutDialog::CreateShortcutDialog(QWidget *parent, InstancePtr instance
// TODO: check if version is affected by crashing when joining servers on launch, ideally in meta
auto mcInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
mcInstance->getPackProfile()->reload(Net::Mode::Offline);
if (mcInstance && mcInstance->getPackProfile()->getComponent("net.minecraft")->getReleaseDateTime() >= g_VersionFilterData.quickPlayBeginsDate)
{
mcInstance->worldList()->update();
for (const auto &world : mcInstance->worldList()->allWorlds())
{
ui->joinSingleplayer->addItem(world.folderName());
}
}
else
{
ui->joinServerRadioButton->setChecked(true);
ui->joinSingleplayerRadioButton->setVisible(false);
ui->joinSingleplayer->setVisible(false);
}
// Macs don't have any concept of a desktop shortcut, so force-enable the option to generate a shell script instead
#if defined(Q_OS_UNIX) && !defined(Q_OS_LINUX)
ui->createScriptCheckBox->setEnabled(false);
@@ -90,16 +109,16 @@ void CreateShortcutDialog::accept()
void CreateShortcutDialog::updateDialogState()
{
ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(
!ui->shortcutPath->text().isEmpty()
&& (!ui->joinServerCheckBox->isChecked() || !ui->joinServer->text().isEmpty())
&& (!ui->joinWorldCheckBox->isChecked() || ui->joinServerRadioButton->isChecked() || ui->joinSingleplayerRadioButton->isChecked())
&& (!ui->joinServerRadioButton->isChecked() || !ui->joinServer->text().isEmpty())
&& (!ui->joinSingleplayerRadioButton->isChecked() || !ui->joinSingleplayer->currentText().isEmpty())
&& (!ui->offlineUsernameCheckBox->isChecked() || !ui->offlineUsername->text().isEmpty())
&& (!ui->useProfileCheckBox->isChecked() || !ui->profileComboBox->currentText().isEmpty())
);
ui->joinServer->setEnabled(ui->joinServerCheckBox->isChecked());
ui->profileComboBox->setEnabled(ui->useProfileCheckBox->isChecked());
ui->offlineUsernameCheckBox->setEnabled(ui->launchOfflineCheckBox->isChecked());
ui->joinServer->setEnabled(ui->joinWorldCheckBox->isChecked() && ui->joinServerRadioButton->isChecked());
ui->joinSingleplayer->setEnabled(ui->joinWorldCheckBox->isChecked() && ui->joinSingleplayerRadioButton->isChecked());
ui->offlineUsername->setEnabled(ui->launchOfflineCheckBox->isChecked() && ui->offlineUsernameCheckBox->isChecked());
if (!ui->launchOfflineCheckBox->isChecked())
{
@@ -117,7 +136,8 @@ QString CreateShortcutDialog::getLaunchArgs(bool escapeQuotesTwice)
{
return " -d \"" + QDir::toNativeSeparators(QDir::currentPath()).replace('"', escapeQuotesTwice ? "\\\\\"" : "\\\"") + "\""
+ " -l \"" + m_instance->id() + "\""
+ (ui->joinServerCheckBox->isChecked() ? " -s \"" + ui->joinServer->text() + "\"" : "")
+ (ui->joinServerRadioButton->isChecked() ? " -s \"" + ui->joinServer->text() + "\"" : "")
+ (ui->joinSingleplayerRadioButton->isChecked() ? " -w \"" + ui->joinSingleplayer->currentText() + "\"" : "")
+ (ui->useProfileCheckBox->isChecked() ? " -a \"" + ui->profileComboBox->currentText() + "\"" : "")
+ (ui->launchOfflineCheckBox->isChecked() ? " -o" : "")
+ (ui->offlineUsernameCheckBox->isChecked() ? " -n \"" + ui->offlineUsername->text() + "\"" : "");

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2022 arthomnix
Copyright 2022-2023 arthomnix
This source is subject to the Microsoft Public License (MS-PL).
Please see the COPYING.md file for more information.
-->
@@ -12,7 +12,7 @@
<x>0</x>
<y>0</y>
<width>796</width>
<height>232</height>
<height>330</height>
</rect>
</property>
<property name="minimumSize">
@@ -30,17 +30,82 @@
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item row="3" column="0">
<item row="0" column="0">
<widget class="QLabel" name="shortcutPathLabel">
<property name="text">
<string>Shortcut path:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="useProfileCheckBox">
<property name="text">
<string>Use specific profile:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="joinSingleplayer">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="launchOfflineCheckBox">
<property name="text">
<string>Launch in offline mode</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="shortcutPathLabel">
<item row="6" column="1">
<widget class="QLineEdit" name="offlineUsername">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="joinWorldCheckBox">
<property name="text">
<string>Shortcut path:</string>
<string>Join world on launch:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="joinServer">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="profileComboBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="shortcutPath"/>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="offlineUsernameCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Set offline mode username:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QRadioButton" name="joinSingleplayerRadioButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Singleplayer world:</string>
</property>
</widget>
</item>
@@ -51,39 +116,16 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="shortcutPath"/>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="profileComboBox"/>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="offlineUsername"/>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="offlineUsernameCheckBox">
<property name="text">
<string>Set offline mode username:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="joinServerCheckBox">
<property name="text">
<string>Join server on launch:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="useProfileCheckBox">
<widget class="QRadioButton" name="joinServerRadioButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Use specific profile:</string>
<string>Server address:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="joinServer"/>
</item>
</layout>
</item>
<item>
@@ -173,18 +215,18 @@
</hints>
</connection>
<connection>
<sender>joinServerCheckBox</sender>
<signal>stateChanged(int)</signal>
<receiver>CreateShortcutDialog</receiver>
<slot>updateDialogState()</slot>
<sender>joinWorldCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>joinServerRadioButton</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>122</x>
<y>61</y>
</hint>
<hint type="destinationlabel">
<x>397</x>
<y>114</y>
<x>140</x>
<y>93</y>
</hint>
</hints>
</connection>
@@ -284,5 +326,136 @@
</hint>
</hints>
</connection>
<connection>
<sender>joinWorldCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>joinSingleplayerRadioButton</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>140</x>
<y>59</y>
</hint>
<hint type="destinationlabel">
<x>140</x>
<y>132</y>
</hint>
</hints>
</connection>
<connection>
<sender>joinServerRadioButton</sender>
<signal>toggled(bool)</signal>
<receiver>joinServer</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>140</x>
<y>93</y>
</hint>
<hint type="destinationlabel">
<x>489</x>
<y>93</y>
</hint>
</hints>
</connection>
<connection>
<sender>joinSingleplayerRadioButton</sender>
<signal>toggled(bool)</signal>
<receiver>joinSingleplayer</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>140</x>
<y>132</y>
</hint>
<hint type="destinationlabel">
<x>489</x>
<y>132</y>
</hint>
</hints>
</connection>
<connection>
<sender>useProfileCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>profileComboBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>140</x>
<y>171</y>
</hint>
<hint type="destinationlabel">
<x>489</x>
<y>171</y>
</hint>
</hints>
</connection>
<connection>
<sender>launchOfflineCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>offlineUsernameCheckBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>140</x>
<y>205</y>
</hint>
<hint type="destinationlabel">
<x>140</x>
<y>239</y>
</hint>
</hints>
</connection>
<connection>
<sender>joinSingleplayer</sender>
<signal>currentTextChanged(QString)</signal>
<receiver>CreateShortcutDialog</receiver>
<slot>updateDialogState()</slot>
<hints>
<hint type="sourcelabel">
<x>489</x>
<y>132</y>
</hint>
<hint type="destinationlabel">
<x>397</x>
<y>164</y>
</hint>
</hints>
</connection>
<connection>
<sender>joinServerRadioButton</sender>
<signal>toggled(bool)</signal>
<receiver>CreateShortcutDialog</receiver>
<slot>updateDialogState()</slot>
<hints>
<hint type="sourcelabel">
<x>140</x>
<y>93</y>
</hint>
<hint type="destinationlabel">
<x>397</x>
<y>164</y>
</hint>
</hints>
</connection>
<connection>
<sender>joinSingleplayerRadioButton</sender>
<signal>toggled(bool)</signal>
<receiver>CreateShortcutDialog</receiver>
<slot>updateDialogState()</slot>
<hints>
<hint type="sourcelabel">
<x>140</x>
<y>132</y>
</hint>
<hint type="destinationlabel">
<x>397</x>
<y>164</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>updateDialogState()</slot>
</slots>
</ui>

View File

@@ -16,6 +16,10 @@
#include "java/JavaInstallList.h"
#include "FileSystem.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/PackProfile.h"
#include "minecraft/VersionFilterData.h"
#include "minecraft/WorldList.h"
InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
: QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst)
@@ -27,6 +31,23 @@ InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
connect(ui->openGlobalJavaSettingsButton, &QCommandLinkButton::clicked, this, &InstanceSettingsPage::globalSettingsButtonClicked);
connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::applySettings);
connect(APPLICATION, &Application::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings);
auto *mcInst = dynamic_cast<MinecraftInstance *>(inst);
if (mcInst && mcInst->getPackProfile()->getComponent("net.minecraft")->getReleaseDateTime() >= g_VersionFilterData.quickPlayBeginsDate)
{
mcInst->worldList()->update();
for (const auto &world : mcInst->worldList()->allWorlds())
{
ui->worldsComboBox->addItem(world.folderName());
}
}
else
{
ui->worldRadioButton->setVisible(false);
ui->worldsComboBox->setVisible(false);
ui->serverAddressRadioButton->setChecked(true);
}
loadSettings();
}
@@ -195,8 +216,12 @@ void InstanceSettingsPage::applySettings()
}
// Join server on launch
bool joinServerOnLaunch = ui->serverJoinGroupBox->isChecked();
bool joinWorldOnLaunch = ui->quickPlayGroupBox->isChecked();
m_settings->set("JoinWorldOnLaunch", joinWorldOnLaunch);
bool joinServerOnLaunch = ui->serverAddressRadioButton->isChecked();
m_settings->set("JoinServerOnLaunch", joinServerOnLaunch);
if (joinServerOnLaunch)
{
m_settings->set("JoinServerOnLaunchAddress", ui->serverJoinAddress->text());
@@ -205,6 +230,18 @@ void InstanceSettingsPage::applySettings()
{
m_settings->reset("JoinServerOnLaunchAddress");
}
bool joinSingleplayerWorldOnLaunch = ui->worldRadioButton->isChecked();
m_settings->set("JoinSingleplayerWorldOnLaunch", joinSingleplayerWorldOnLaunch);
if (joinSingleplayerWorldOnLaunch)
{
m_settings->set("JoinSingleplayerWorldOnLaunchName", ui->worldsComboBox->currentText());
}
else
{
m_settings->reset("JoinSingleplayerWorldOnLaunchName");
}
}
void InstanceSettingsPage::loadSettings()
@@ -272,8 +309,23 @@ void InstanceSettingsPage::loadSettings()
ui->showGameTime->setChecked(m_settings->get("ShowGameTime").toBool());
ui->recordGameTime->setChecked(m_settings->get("RecordGameTime").toBool());
ui->serverJoinGroupBox->setChecked(m_settings->get("JoinServerOnLaunch").toBool());
ui->serverJoinAddress->setText(m_settings->get("JoinServerOnLaunchAddress").toString());
if (!m_settings->contains("JoinWorldOnLaunch"))
{
ui->quickPlayGroupBox->setChecked(m_settings->get("JoinServerOnLaunch").toBool());
ui->serverAddressRadioButton->setChecked(m_settings->get("JoinServerOnLaunch").toBool());
ui->worldRadioButton->setChecked(false);
}
else
{
ui->quickPlayGroupBox->setChecked(m_settings->get("JoinWorldOnLaunch").toBool());
ui->serverAddressRadioButton->setChecked(m_settings->get("JoinServerOnLaunch").toBool());
ui->serverJoinAddress->setEnabled(m_settings->get("JoinServerOnLaunch").toBool());
ui->serverJoinAddress->setText(m_settings->get("JoinServerOnLaunchAddress").toString());
ui->worldRadioButton->setChecked(m_settings->get("JoinSingleplayerWorldOnLaunch").toBool());
ui->worldsComboBox->setEnabled(m_settings->get("JoinSingleplayerWorldOnLaunch").toBool());
ui->worldsComboBox->setCurrentText(m_settings->get("JoinSingleplayerWorldOnLaunchName").toString());
}
}
void InstanceSettingsPage::on_javaDetectBtn_clicked()
@@ -334,6 +386,16 @@ void InstanceSettingsPage::on_javaTestBtn_clicked()
checker->run();
}
void InstanceSettingsPage::on_serverAddressRadioButton_toggled(bool checked)
{
ui->serverJoinAddress->setEnabled(checked);
}
void InstanceSettingsPage::on_worldRadioButton_toggled(bool checked)
{
ui->worldsComboBox->setEnabled(checked);
}
void InstanceSettingsPage::checkerFinished()
{
checker.reset();

View File

@@ -1,4 +1,4 @@
/* Copyright 2013-2021 MultiMC Contributors
/* Copyright 2013-2023 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
#include <QObjectPtr.h>
#include "ui/pages/BasePage.h"
#include "JavaCommon.h"
#include "minecraft/WorldList.h"
#include "Application.h"
class JavaChecker;
@@ -60,6 +61,8 @@ private slots:
void on_javaDetectBtn_clicked();
void on_javaTestBtn_clicked();
void on_javaBrowseBtn_clicked();
void on_serverAddressRadioButton_toggled(bool checked);
void on_worldRadioButton_toggled(bool checked);
void applySettings();
void loadSettings();

View File

@@ -454,9 +454,9 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="serverJoinGroupBox">
<widget class="QGroupBox" name="quickPlayGroupBox">
<property name="title">
<string>Set a server to join on launch</string>
<string>Set a world to join on launch</string>
</property>
<property name="checkable">
<bool>true</bool>
@@ -466,15 +466,9 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<layout class="QGridLayout" name="serverJoinLayout">
<layout class="QGridLayout" name="quickPlayLayout">
<item row="0" column="0">
<widget class="QLabel" name="serverJoinAddressLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QRadioButton" name="serverAddressRadioButton">
<property name="text">
<string>Server address:</string>
</property>
@@ -483,6 +477,16 @@
<item row="0" column="1">
<widget class="QLineEdit" name="serverJoinAddress"/>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="worldRadioButton">
<property name="text">
<string>Singleplayer world:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="worldsComboBox"/>
</item>
</layout>
</item>
</layout>

View File

@@ -762,7 +762,8 @@ void ServersPage::on_actionMove_Down_triggered()
void ServersPage::on_actionJoin_triggered()
{
const auto &address = m_model->at(currentServer)->m_address;
APPLICATION->launch(m_inst, true, nullptr, std::make_shared<MinecraftServerTarget>(MinecraftServerTarget::parse(address)));
APPLICATION->launch(m_inst, true, nullptr, std::make_shared<QuickPlayTarget>(
QuickPlayTarget::parseMultiplayer(address)));
}
#include "ServersPage.moc"

View File

@@ -1,4 +1,4 @@
/* Copyright 2015-2021 MultiMC Contributors
/* Copyright 2015-2023 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@
#include <QMessageBox>
#include <QTreeView>
#include <QInputDialog>
#include <QProcess>
#include "tools/MCEditTool.h"
#include "FileSystem.h"
@@ -32,6 +31,9 @@
#include "ui/GuiUtil.h"
#include "DesktopServices.h"
#include "minecraft/PackProfile.h"
#include "minecraft/VersionFilterData.h"
#include "Application.h"
@@ -62,7 +64,7 @@ public:
};
WorldListPage::WorldListPage(BaseInstance *inst, std::shared_ptr<WorldList> worlds, QWidget *parent)
WorldListPage::WorldListPage(InstancePtr inst, std::shared_ptr<WorldList> worlds, QWidget *parent)
: QMainWindow(parent), m_inst(inst), ui(new Ui::WorldListPage), m_worlds(worlds)
{
ui->setupUi(this);
@@ -311,8 +313,15 @@ void WorldListPage::mceditState(LoggedProcess::State state)
void WorldListPage::worldChanged(const QModelIndex &current, const QModelIndex &previous)
{
auto mcInst = std::dynamic_pointer_cast<MinecraftInstance>(m_inst);
bool enableJoinActions = mcInst && mcInst->getPackProfile()->getComponent("net.minecraft")->getReleaseDateTime() >= g_VersionFilterData.quickPlayBeginsDate;
QModelIndex index = getSelectedWorld();
bool enable = index.isValid();
ui->actionJoin->setVisible(enableJoinActions);
ui->actionJoinOffline->setVisible(enableJoinActions);
ui->actionJoin->setEnabled(enable && enableJoinActions);
ui->actionJoinOffline->setEnabled(enable && enableJoinActions);
ui->actionCopy_Seed->setEnabled(enable);
ui->actionMCEdit->setEnabled(enable);
ui->actionRemove->setEnabled(enable);
@@ -409,4 +418,29 @@ void WorldListPage::on_actionRefresh_triggered()
m_worlds->update();
}
void WorldListPage::joinSelectedWorld(bool online)
{
auto index = getSelectedWorld();
if (!index.isValid())
{
return;
}
auto worldVariant = m_worlds->data(index, WorldList::ObjectRole);
auto world = (World *) worldVariant.value<void *>();
auto name = world->folderName();
APPLICATION->launch(m_inst, online, nullptr, std::make_shared<QuickPlayTarget>(QuickPlayTarget::parseSingleplayer(name)));
}
void WorldListPage::on_actionJoin_triggered()
{
joinSelectedWorld(true);
}
void WorldListPage::on_actionJoinOffline_triggered()
{
joinSelectedWorld(false);
}
#include "WorldListPage.moc"

View File

@@ -1,4 +1,4 @@
/* Copyright 2015-2021 MultiMC Contributors
/* Copyright 2015-2023 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ class WorldListPage : public QMainWindow, public BasePage
public:
explicit WorldListPage(
BaseInstance *inst,
InstancePtr inst,
std::shared_ptr<WorldList> worlds,
QWidget *parent = 0
);
@@ -67,13 +67,14 @@ protected:
QMenu * createPopupMenu() override;
protected:
BaseInstance *m_inst;
InstancePtr m_inst;
private:
QModelIndex getSelectedWorld();
bool isWorldSafe(QModelIndex index);
bool worldSafetyNagQuestion();
void mceditError();
void joinSelectedWorld(bool online);
private:
Ui::WorldListPage *ui;
@@ -92,6 +93,8 @@ private slots:
void on_actionView_Folder_triggered();
void on_actionDatapacks_triggered();
void on_actionReset_Icon_triggered();
void on_actionJoin_triggered();
void on_actionJoinOffline_triggered();
void worldChanged(const QModelIndex &current, const QModelIndex &previous);
void mceditState(LoggedProcess::State state);

View File

@@ -81,6 +81,8 @@
</attribute>
<addaction name="actionAdd"/>
<addaction name="separator"/>
<addaction name="actionJoin"/>
<addaction name="actionJoinOffline"/>
<addaction name="actionRename"/>
<addaction name="actionCopy"/>
<addaction name="actionRemove"/>
@@ -97,6 +99,22 @@
<string>Add</string>
</property>
</action>
<action name="actionJoin">
<property name="text">
<string>Join</string>
</property>
<property name="toolTip">
<string>Launch the instance directly into the selected world</string>
</property>
</action>
<action name="actionJoinOffline">
<property name="text">
<string>Join offline</string>
</property>
<property name="toolTip">
<string>Launch the instance in offline mode directly into the selected world</string>
</property>
</action>
<action name="actionRename">
<property name="text">
<string>Rename</string>

View File

@@ -20,7 +20,6 @@ private slots:
setText(m_action->text());
setIcon(m_action->icon());
setToolTip(m_action->toolTip());
setHidden(!m_action->isVisible());
setFocusPolicy(Qt::NoFocus);
}
private:
@@ -63,6 +62,9 @@ void WideBar::addAction(QAction* action)
{
auto entry = new BarEntry();
entry->qAction = addWidget(new ActionButton(action, this));
connect(action, &QAction::changed, entry->qAction, [entry, action](){
entry->qAction->setVisible(action->isVisible());
});
entry->wideAction = action;
entry->type = BarEntry::Action;
m_entries.push_back(entry);