bugfix: 0000016: Join network game without giving address = crash

This commit is contained in:
doitux
2010-04-22 12:56:56 +00:00
parent a447ec927e
commit 1ae72aeb75
3 changed files with 39 additions and 21 deletions
+24 -20
View File
@@ -69,24 +69,28 @@
<string>Connect to Network Game</string> <string>Connect to Network Game</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_4"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="text"> <item>
<string>Profile Name:</string> <widget class="QLabel" name="label_4">
</property> <property name="text">
<property name="buddy"> <string>Profile Name:</string>
<cstring>lineEdit_profileName</cstring> </property>
</property> <property name="buddy">
</widget> <cstring>lineEdit_profileName</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_profileName">
<property name="text">
<string>myServerProfile1</string>
</property>
</widget>
</item>
</layout>
</item> </item>
<item row="0" column="1" colspan="2"> <item row="1" column="0" colspan="2">
<widget class="QLineEdit" name="lineEdit_profileName">
<property name="text">
<string>myServerProfile1</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
@@ -126,7 +130,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="2" column="0">
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
@@ -169,7 +173,7 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="2"> <item row="2" column="1">
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
@@ -212,7 +216,7 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0" colspan="3"> <item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="title"> <property name="title">
<string>Server Profiles</string> <string>Server Profiles</string>
@@ -44,7 +44,8 @@ joinNetworkGameDialogImpl::joinNetworkGameDialogImpl(QWidget *parent, ConfigFile
treeWidget->setDisabled(TRUE); treeWidget->setDisabled(TRUE);
} }
connect( lineEdit_ipAddress, SIGNAL( editingFinished ()), this, SLOT( checkIp() ) ); connect( lineEdit_ipAddress, SIGNAL( editingFinished()), this, SLOT( checkIp() ) );
connect( lineEdit_ipAddress, SIGNAL( textChanged(QString)), this, SLOT( connectButtonTest() ) );
connect( pushButton_connect, SIGNAL( clicked() ), this, SLOT( startClient() ) ); connect( pushButton_connect, SIGNAL( clicked() ), this, SLOT( startClient() ) );
connect( pushButton_save, SIGNAL( clicked() ), this, SLOT( saveServerProfile() ) ); connect( pushButton_save, SIGNAL( clicked() ), this, SLOT( saveServerProfile() ) );
@@ -98,6 +99,8 @@ void joinNetworkGameDialogImpl::exec() {
checkBox_ipv6->setEnabled(socket_has_ipv6()); checkBox_ipv6->setEnabled(socket_has_ipv6());
checkBox_sctp->setEnabled(socket_has_sctp()); checkBox_sctp->setEnabled(socket_has_sctp());
connectButtonTest();
QDialog::exec(); QDialog::exec();
} }
@@ -286,3 +289,13 @@ void joinNetworkGameDialogImpl::checkIp() {
QString tmp = lineEdit_ipAddress->text(); QString tmp = lineEdit_ipAddress->text();
lineEdit_ipAddress->setText(tmp.remove(" ")); lineEdit_ipAddress->setText(tmp.remove(" "));
} }
void joinNetworkGameDialogImpl::connectButtonTest() {
if(lineEdit_ipAddress->text().isEmpty()) {
pushButton_connect->setDisabled(TRUE);
}
else {
pushButton_connect->setDisabled(FALSE);
}
}
@@ -49,6 +49,7 @@ public slots:
void deleteServerProfile(); void deleteServerProfile();
void keyPressEvent ( QKeyEvent * event ); void keyPressEvent ( QKeyEvent * event );
void checkIp(); void checkIp();
void connectButtonTest();
}; };
#endif #endif