NOISSUE Improve new instance dialog

Better layout, showing more of the modpack URL
Fixed logic for enabling OK button
This commit is contained in:
Petr Mrázek 2015-04-11 12:30:18 +02:00
parent 8b4e22bbb8
commit 6775e3e72b
2 changed files with 54 additions and 42 deletions

View File

@ -98,11 +98,10 @@ NewInstanceDialog::~NewInstanceDialog()
void NewInstanceDialog::updateDialogState() void NewInstanceDialog::updateDialogState()
{ {
ui->buttonBox->button(QDialogButtonBox::Ok) bool allowOK = !instName().isEmpty() &&
->setEnabled(!instName().isEmpty() (ui->versionBox->isChecked() && m_selectedVersion ||
&& m_selectedVersion (ui->modpackBox->isChecked() && ui->modpackEdit->hasAcceptableInput()));
&& (!ui->modpackBox->isChecked() ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(allowOK);
|| ui->modpackEdit->hasAcceptableInput()));
} }
void NewInstanceDialog::setSelectedVersion(BaseVersionPtr version, bool initial) void NewInstanceDialog::setSelectedVersion(BaseVersionPtr version, bool initial)

View File

@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>345</width> <width>277</width>
<height>343</height> <height>404</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -83,15 +83,8 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item row="1" column="2"> <item>
<widget class="QToolButton" name="btnChangeVersion">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelVersion_3"> <widget class="QLabel" name="labelVersion_3">
<property name="text"> <property name="text">
<string>&amp;Group:</string> <string>&amp;Group:</string>
@ -101,7 +94,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" colspan="2"> <item>
<widget class="QComboBox" name="groupBox"> <widget class="QComboBox" name="groupBox">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -114,17 +107,11 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> </layout>
<widget class="QLineEdit" name="modpackEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>http://</string>
</property>
</widget>
</item> </item>
<item row="2" column="2"> <item>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="2">
<widget class="QToolButton" name="modpackBtn"> <widget class="QToolButton" name="modpackBtn">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -134,26 +121,43 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="4" column="0" colspan="2">
<widget class="QRadioButton" name="versionBox"> <widget class="QLineEdit" name="modpackEdit">
<property name="text"> <property name="enabled">
<string>&amp;Version:</string> <bool>false</bool>
</property> </property>
<property name="checked"> <property name="text">
<string>http://</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLineEdit" name="versionTextBox">
<property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="2">
<widget class="QRadioButton" name="modpackBox"> <widget class="QToolButton" name="btnChangeVersion">
<property name="text"> <property name="text">
<string>Import &amp;Modpack:</string> <string>...</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="3" column="0" colspan="3">
<widget class="QLineEdit" name="versionTextBox"> <widget class="QRadioButton" name="modpackBox">
<property name="readOnly"> <property name="text">
<string>Impor&amp;t Modpack (local file or link):</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QRadioButton" name="versionBox">
<property name="text">
<string>Vani&amp;lla Minecraft (select version):</string>
</property>
<property name="checked">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
@ -192,9 +196,18 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<resources> <tabstops>
<include location="../../graphics.qrc"/> <tabstop>instNameTextBox</tabstop>
</resources> <tabstop>groupBox</tabstop>
<tabstop>versionBox</tabstop>
<tabstop>versionTextBox</tabstop>
<tabstop>btnChangeVersion</tabstop>
<tabstop>modpackBox</tabstop>
<tabstop>modpackEdit</tabstop>
<tabstop>modpackBtn</tabstop>
<tabstop>iconButton</tabstop>
</tabstops>
<resources/>
<connections> <connections>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>