NOISSUE Fix shortcut dialog bugs

Fixes bugs in the create shortcut dialog where the OK button and server address text box were always disabled on instances that don't support Quick Play.
This commit is contained in:
arthomnix 2023-05-22 17:30:02 +01:00
parent bd95c3ea33
commit 44a4712e61
2 changed files with 21 additions and 8 deletions

View File

@ -111,9 +111,11 @@ void CreateShortcutDialog::updateDialogState()
{
ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(
!ui->shortcutPath->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->joinWorldCheckBox->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())
);

View File

@ -1,9 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2022-2023 arthomnix
This source is subject to the Microsoft Public License (MS-PL).
Please see the COPYING.md file for more information.
-->
<ui version="4.0">
<class>CreateShortcutDialog</class>
<widget class="QDialog" name="CreateShortcutDialog">
@ -454,6 +449,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>joinWorldCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>CreateShortcutDialog</receiver>
<slot>updateDialogState()</slot>
<hints>
<hint type="sourcelabel">
<x>140</x>
<y>59</y>
</hint>
<hint type="destinationlabel">
<x>397</x>
<y>164</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>updateDialogState()</slot>