Qt netplay host game UI dialog improvements.

This commit is contained in:
harry 2024-03-21 22:29:15 -04:00
parent 5a0898ccbe
commit 2ff6084935
2 changed files with 27 additions and 5 deletions

View File

@ -1516,6 +1516,7 @@ NetPlayHostDialog::NetPlayHostDialog(QWidget *parent)
passwordEntry = new QLineEdit(); passwordEntry = new QLineEdit();
grid->addWidget( passwordEntry, 4, 1 ); grid->addWidget( passwordEntry, 4, 1 );
passwordEntry->setEnabled( passwordRequiredCBox->isChecked() );
// Misc Settings // Misc Settings
grid = new QGridLayout(); grid = new QGridLayout();
@ -1540,6 +1541,10 @@ NetPlayHostDialog::NetPlayHostDialog(QWidget *parent)
g_config->getOption("SDL.NetPlayHostAllowClientStateLoadReq", &stateLoadReqEna); g_config->getOption("SDL.NetPlayHostAllowClientStateLoadReq", &stateLoadReqEna);
allowClientStateReqCBox->setChecked(stateLoadReqEna); allowClientStateReqCBox->setChecked(stateLoadReqEna);
connect(passwordRequiredCBox, SIGNAL(stateChanged(int)), this, SLOT(passwordRequiredChanged(int)));
connect(allowClientRomReqCBox, SIGNAL(stateChanged(int)), this, SLOT(allowClientRomReqChanged(int)));
connect(allowClientStateReqCBox, SIGNAL(stateChanged(int)), this, SLOT(allowClientStateReqChanged(int)));
startButton = new QPushButton( tr("Start") ); startButton = new QPushButton( tr("Start") );
startButton->setIcon(style()->standardIcon(QStyle::SP_DialogApplyButton)); startButton->setIcon(style()->standardIcon(QStyle::SP_DialogApplyButton));
connect(startButton, SIGNAL(clicked(void)), this, SLOT(onStartClicked(void))); connect(startButton, SIGNAL(clicked(void)), this, SLOT(onStartClicked(void)));
@ -1578,6 +1583,21 @@ void NetPlayHostDialog::closeWindow(void)
deleteLater(); deleteLater();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void NetPlayHostDialog::passwordRequiredChanged(int state)
{
passwordEntry->setEnabled( state != Qt::Unchecked );
}
//-----------------------------------------------------------------------------
void NetPlayHostDialog::allowClientRomReqChanged(int state)
{
g_config->setOption("SDL.NetPlayHostAllowClientRomLoadReq", state != Qt::Unchecked);
}
//-----------------------------------------------------------------------------
void NetPlayHostDialog::allowClientStateReqChanged(int state)
{
g_config->setOption("SDL.NetPlayHostAllowClientStateLoadReq", state != Qt::Unchecked);
}
//-----------------------------------------------------------------------------
void NetPlayHostDialog::onStartClicked(void) void NetPlayHostDialog::onStartClicked(void)
{ {
NetPlayServer *server = NetPlayServer::GetInstance(); NetPlayServer *server = NetPlayServer::GetInstance();
@ -1593,14 +1613,14 @@ void NetPlayHostDialog::onStartClicked(void)
server = NetPlayServer::GetInstance(); server = NetPlayServer::GetInstance();
server->setRole( playerRoleBox->currentData().toInt() ); server->setRole( playerRoleBox->currentData().toInt() );
server->sessionName = sessionNameEntry->text(); server->sessionName = sessionNameEntry->text();
server->sessionPasswd = passwordEntry->text();
server->setMaxLeadFrames( frameLeadSpinBox->value() ); server->setMaxLeadFrames( frameLeadSpinBox->value() );
server->setAllowClientRomLoadRequest( allowClientRomReqCBox->isChecked() ); server->setAllowClientRomLoadRequest( allowClientRomReqCBox->isChecked() );
server->setAllowClientStateLoadRequest( allowClientStateReqCBox->isChecked() ); server->setAllowClientStateLoadRequest( allowClientStateReqCBox->isChecked() );
g_config->setOption("SDL.NetPlayHostAllowClientRomLoadReq", allowClientRomReqCBox->isChecked() ); if (passwordRequiredCBox->isChecked())
g_config->setOption("SDL.NetPlayHostAllowClientStateLoadReq", allowClientStateReqCBox->isChecked() ); {
server->sessionPasswd = passwordEntry->text();
}
bool listenSucceeded = server->listen( QHostAddress::Any, netPort ); bool listenSucceeded = server->listen( QHostAddress::Any, netPort );
if (listenSucceeded) if (listenSucceeded)

View File

@ -341,7 +341,9 @@ protected:
public slots: public slots:
void closeWindow(void); void closeWindow(void);
void onStartClicked(void); void onStartClicked(void);
void passwordRequiredChanged(int state);
void allowClientRomReqChanged(int state);
void allowClientStateReqChanged(int state);
}; };
class NetPlayJoinDialog : public QDialog class NetPlayJoinDialog : public QDialog