Try to make getchoo requested changes

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2025-03-27 00:37:39 +00:00
parent e2b85a2e2b
commit 910febeeb0
No known key found for this signature in database
GPG key ID: 5E39D70B4C93C38E
8 changed files with 266 additions and 300 deletions

View file

@ -17,18 +17,6 @@
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
@ -49,8 +37,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>535</width>
<height>606</height>
<width>523</width>
<height>594</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -65,15 +53,9 @@
</widget>
<widget class="QWidget" name="management">
<attribute name="title">
<string>Management</string>
<string>Installations</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Downloaded Java Versions</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@ -124,9 +106,6 @@
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

View file

@ -44,13 +44,14 @@ CustomCommands::~CustomCommands()
CustomCommands::CustomCommands(QWidget* parent) : QWidget(parent), ui(new Ui::CustomCommands)
{
ui->setupUi(this);
connect(ui->overrideCheckBox, &QCheckBox::toggled, ui->customCommandsWidget, &QWidget::setEnabled);
}
void CustomCommands::initialize(bool checkable, bool checked, const QString& prelaunch, const QString& wrapper, const QString& postexit)
{
ui->customCommandsGroupBox->setCheckable(checkable);
ui->overrideCheckBox->setVisible(checkable);
if (checkable) {
ui->customCommandsGroupBox->setChecked(checked);
ui->overrideCheckBox->setChecked(checked);
}
ui->preLaunchCmdTextBox->setText(prelaunch);
ui->wrapperCmdTextBox->setText(wrapper);
@ -64,9 +65,9 @@ void CustomCommands::retranslate()
bool CustomCommands::checked() const
{
if (!ui->customCommandsGroupBox->isCheckable())
if (!ui->overrideCheckBox->isVisible())
return true;
return ui->customCommandsGroupBox->isChecked();
return ui->overrideCheckBox->isChecked();
}
QString CustomCommands::prelaunchCommand() const

View file

@ -24,20 +24,30 @@
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="customCommandsGroupBox">
<widget class="QCheckBox" name="overrideCheckBox">
<property name="text">
<string>Override &amp;Global Settings</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="customCommandsWidget" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>&amp;Custom Commands</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelPreLaunchCmd">
<property name="text">
@ -48,9 +58,25 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="wrapperCmdTextBox"/>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="preLaunchCmdTextBox"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelPostExitCmd">
<property name="text">
<string>P&amp;ost-exit command:</string>
</property>
<property name="buddy">
<cstring>labelPostExitCmd</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="postExitCmdTextBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelWrapperCmd">
<property name="text">
@ -61,22 +87,6 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="wrapperCmdTextBox"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelPostExitCmd">
<property name="text">
<string>P&amp;ost-exit command:</string>
</property>
<property name="buddy">
<cstring>postExitCmdTextBox</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="postExitCmdTextBox"/>
</item>
</layout>
</widget>
</item>

View file

@ -50,6 +50,8 @@ EnvironmentVariables::EnvironmentVariables(QWidget* parent) : QWidget(parent), u
});
connect(ui->clear, &QPushButton::clicked, this, [this] { ui->list->clear(); });
connect(ui->overrideCheckBox, &QCheckBox::toggled, ui->settingsWidget, &QWidget::setEnabled);
}
EnvironmentVariables::~EnvironmentVariables()
@ -60,8 +62,8 @@ EnvironmentVariables::~EnvironmentVariables()
void EnvironmentVariables::initialize(bool instance, bool override, const QMap<QString, QVariant>& value)
{
// update widgets to settings
ui->groupBox->setCheckable(instance);
ui->groupBox->setChecked(override);
ui->overrideCheckBox->setVisible(instance);
ui->overrideCheckBox->setChecked(override);
// populate
ui->list->clear();
@ -94,9 +96,9 @@ void EnvironmentVariables::retranslate()
bool EnvironmentVariables::override() const
{
if (!ui->groupBox->isCheckable())
if (!ui->overrideCheckBox->isVisible())
return false;
return ui->groupBox->isChecked();
return ui->overrideCheckBox->isChecked();
}
QMap<QString, QVariant> EnvironmentVariables::value() const

View file

@ -14,6 +14,22 @@
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="overrideCheckBox">
<property name="text">
<string>Override &amp;Global Settings</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="settingsWidget" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
@ -26,15 +42,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>&amp;Environment Variables</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="buttons">
<item>

View file

@ -27,6 +27,95 @@
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="javaInstallationGroupBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Java Insta&amp;llation</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Java &amp;Executable</string>
</property>
<property name="buddy">
<cstring>javaPathTextBox</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLineEdit" name="javaPathTextBox"/>
</item>
<item>
<widget class="QPushButton" name="javaDetectBtn">
<property name="text">
<string>&amp;Detect</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="javaBrowseBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="autodownloadJavaCheckBox">
<property name="toolTip">
<string>Automatically downloads and selects the Java build recommended by Mojang.</string>
</property>
<property name="text">
<string>Auto-download &amp;Mojang Java</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="skipWizardCheckBox">
<property name="toolTip">
<string>If enabled, the launcher won't prompt you to choose a Java version if one is not found on startup.</string>
</property>
<property name="text">
<string>Skip Java setup prompt on startup</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="autodetectJavaCheckBox">
<property name="text">
<string>Auto-&amp;detect Java version</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="skipCompatibilityCheckBox">
<property name="toolTip">
<string>If enabled, the launcher will not check if an instance is compatible with the selected Java version.</string>
</property>
<property name="text">
<string>Skip Java compatibility checks</string>
</property>
</widget>
</item>
<item row="8" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="javaTestBtn">
@ -57,95 +146,6 @@
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="javaInstallationGroupBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Java Insta&amp;llation</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLineEdit" name="javaPathTextBox"/>
</item>
<item>
<widget class="QPushButton" name="javaDetectBtn">
<property name="text">
<string>&amp;Detect</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="javaBrowseBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="skipCompatibilityCheckBox">
<property name="toolTip">
<string>If enabled, the launcher will not check if an instance is compatible with the selected Java version.</string>
</property>
<property name="text">
<string>Skip Java compatibility checks</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="autodetectJavaCheckBox">
<property name="text">
<string>Auto-&amp;detect Java version</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="autodownloadJavaCheckBox">
<property name="toolTip">
<string>Automatically downloads and selects the Java build recommended by Mojang.</string>
</property>
<property name="text">
<string>Auto-download &amp;Mojang Java</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="skipWizardCheckBox">
<property name="toolTip">
<string>If enabled, the launcher won't prompt you to choose a Java version if one is not found on startup.</string>
</property>
<property name="text">
<string>Skip Java setup prompt on startup</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Java &amp;Executable</string>
</property>
<property name="buddy">
<cstring>javaPathTextBox</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View file

@ -50,14 +50,11 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(MinecraftInstancePtr instance,
m_ui->setupUi(this);
if (m_instance == nullptr) {
for (int i = m_ui->settingsTabs->count() - 1; i >= 0; --i) {
const QString name = m_ui->settingsTabs->widget(i)->objectName();
if (name == "javaPage" || name == "launchPage")
m_ui->settingsTabs->removeTab(i);
}
m_ui->settingsTabs->removeTab(1);
m_ui->openGlobalSettingsButton->setVisible(false);
m_ui->instanceAccountGroupBox->hide();
m_ui->serverJoinGroupBox->hide();
} else {
m_javaSettings = new JavaSettingsWidget(m_instance, this);
m_ui->javaScrollArea->setWidget(m_javaSettings);

View file

@ -58,9 +58,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>610</width>
<height>610</height>
<y>-125</y>
<width>603</width>
<height>786</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@ -203,6 +203,79 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="instanceAccountGroupBox">
<property name="title">
<string>&amp;Override Default Account</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_15">
<item>
<widget class="QLabel" name="instanceAccountNameLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Account</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="instanceAccountSelector">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="serverJoinGroupBox">
<property name="title">
<string>Enable &amp;Auto-join</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QRadioButton" name="serverJoinAddressButton">
<property name="text">
<string>Server address</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="serverJoinAddress"/>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="worldJoinButton">
<property name="text">
<string>Singleplayer world</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="worldsCb"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gameTimeGroupBox">
<property name="enabled">
@ -352,7 +425,7 @@
<x>0</x>
<y>0</y>
<width>624</width>
<height>291</height>
<height>287</height>
</rect>
</property>
</widget>
@ -375,8 +448,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>610</width>
<height>501</height>
<width>603</width>
<height>470</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
@ -564,118 +637,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="launchPage">
<attribute name="title">
<string>Launch</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QScrollArea" name="scrollArea_3">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_5">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>624</width>
<height>291</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_14">
<item>
<widget class="QGroupBox" name="instanceAccountGroupBox">
<property name="title">
<string>Override default &amp;account</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_15">
<item>
<widget class="QLabel" name="instanceAccountNameLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Account</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="instanceAccountSelector">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="serverJoinGroupBox">
<property name="title">
<string>Set a &amp;target to join on launch</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QRadioButton" name="serverJoinAddressButton">
<property name="text">
<string>Server address</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="serverJoinAddress"/>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="worldJoinButton">
<property name="text">
<string>Singleplayer world</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="worldsCb"/>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="customCommandsPage">
<attribute name="title">
<string>Custom Commands</string>
@ -691,6 +652,18 @@
<string>Environment Variables</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_16">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="EnvironmentVariables" name="environmentVariables" native="true"/>
</item>
@ -737,9 +710,6 @@
<tabstop>enableMangoHud</tabstop>
<tabstop>useDiscreteGpuCheck</tabstop>
<tabstop>useZink</tabstop>
<tabstop>scrollArea_3</tabstop>
<tabstop>instanceAccountGroupBox</tabstop>
<tabstop>serverJoinGroupBox</tabstop>
<tabstop>serverJoinAddressButton</tabstop>
<tabstop>serverJoinAddress</tabstop>
<tabstop>worldJoinButton</tabstop>