Skip to content

Commit 2ff6084

Browse files
committed
Qt netplay host game UI dialog improvements.
1 parent 5a0898c commit 2ff6084

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

src/drivers/Qt/NetPlay.cpp

+24-4
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,7 @@ NetPlayHostDialog::NetPlayHostDialog(QWidget *parent)
15161516

15171517
passwordEntry = new QLineEdit();
15181518
grid->addWidget( passwordEntry, 4, 1 );
1519+
passwordEntry->setEnabled( passwordRequiredCBox->isChecked() );
15191520

15201521
// Misc Settings
15211522
grid = new QGridLayout();
@@ -1540,6 +1541,10 @@ NetPlayHostDialog::NetPlayHostDialog(QWidget *parent)
15401541
g_config->getOption("SDL.NetPlayHostAllowClientStateLoadReq", &stateLoadReqEna);
15411542
allowClientStateReqCBox->setChecked(stateLoadReqEna);
15421543

1544+
connect(passwordRequiredCBox, SIGNAL(stateChanged(int)), this, SLOT(passwordRequiredChanged(int)));
1545+
connect(allowClientRomReqCBox, SIGNAL(stateChanged(int)), this, SLOT(allowClientRomReqChanged(int)));
1546+
connect(allowClientStateReqCBox, SIGNAL(stateChanged(int)), this, SLOT(allowClientStateReqChanged(int)));
1547+
15431548
startButton = new QPushButton( tr("Start") );
15441549
startButton->setIcon(style()->standardIcon(QStyle::SP_DialogApplyButton));
15451550
connect(startButton, SIGNAL(clicked(void)), this, SLOT(onStartClicked(void)));
@@ -1578,6 +1583,21 @@ void NetPlayHostDialog::closeWindow(void)
15781583
deleteLater();
15791584
}
15801585
//-----------------------------------------------------------------------------
1586+
void NetPlayHostDialog::passwordRequiredChanged(int state)
1587+
{
1588+
passwordEntry->setEnabled( state != Qt::Unchecked );
1589+
}
1590+
//-----------------------------------------------------------------------------
1591+
void NetPlayHostDialog::allowClientRomReqChanged(int state)
1592+
{
1593+
g_config->setOption("SDL.NetPlayHostAllowClientRomLoadReq", state != Qt::Unchecked);
1594+
}
1595+
//-----------------------------------------------------------------------------
1596+
void NetPlayHostDialog::allowClientStateReqChanged(int state)
1597+
{
1598+
g_config->setOption("SDL.NetPlayHostAllowClientStateLoadReq", state != Qt::Unchecked);
1599+
}
1600+
//-----------------------------------------------------------------------------
15811601
void NetPlayHostDialog::onStartClicked(void)
15821602
{
15831603
NetPlayServer *server = NetPlayServer::GetInstance();
@@ -1593,14 +1613,14 @@ void NetPlayHostDialog::onStartClicked(void)
15931613
server = NetPlayServer::GetInstance();
15941614
server->setRole( playerRoleBox->currentData().toInt() );
15951615
server->sessionName = sessionNameEntry->text();
1596-
server->sessionPasswd = passwordEntry->text();
15971616
server->setMaxLeadFrames( frameLeadSpinBox->value() );
15981617
server->setAllowClientRomLoadRequest( allowClientRomReqCBox->isChecked() );
15991618
server->setAllowClientStateLoadRequest( allowClientStateReqCBox->isChecked() );
16001619

1601-
g_config->setOption("SDL.NetPlayHostAllowClientRomLoadReq", allowClientRomReqCBox->isChecked() );
1602-
g_config->setOption("SDL.NetPlayHostAllowClientStateLoadReq", allowClientStateReqCBox->isChecked() );
1603-
1620+
if (passwordRequiredCBox->isChecked())
1621+
{
1622+
server->sessionPasswd = passwordEntry->text();
1623+
}
16041624
bool listenSucceeded = server->listen( QHostAddress::Any, netPort );
16051625

16061626
if (listenSucceeded)

src/drivers/Qt/NetPlay.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@ class NetPlayHostDialog : public QDialog
341341
public slots:
342342
void closeWindow(void);
343343
void onStartClicked(void);
344-
344+
void passwordRequiredChanged(int state);
345+
void allowClientRomReqChanged(int state);
346+
void allowClientStateReqChanged(int state);
345347
};
346348

347349
class NetPlayJoinDialog : public QDialog

0 commit comments

Comments
 (0)