Minor cleanup of netplay main menu.
This commit is contained in:
parent
e032d65811
commit
9f8310bbe1
|
@ -1697,20 +1697,13 @@ void consoleWin_t::createMainMenu(void)
|
|||
|
||||
netPlayMenu->addAction(act);
|
||||
|
||||
// NetPlay -> End Game / Disconnect
|
||||
act = new QAction(tr("&Disconnect/End Game"), this);
|
||||
//act->setShortcut( QKeySequence(tr("Shift+F7")));
|
||||
act->setStatusTip(tr("Disconnect Netplay Game"));
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(closeNetPlaySession(void)) );
|
||||
netPlayDiscAct = act;
|
||||
|
||||
netPlayMenu->addAction(act);
|
||||
|
||||
// NetPlay -> Client Status Dialog
|
||||
act = new QAction(tr("Host &Status"), this);
|
||||
//act->setShortcut( QKeySequence(tr("Shift+F7")));
|
||||
act->setStatusTip(tr("Open Netplay Host Status Dialog"));
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(openNetPlayStatusWindow(void)) );
|
||||
act->setEnabled(false);
|
||||
act->setVisible(false);
|
||||
netPlayHostStatAct = act;
|
||||
|
||||
netPlayMenu->addAction(act);
|
||||
|
@ -1720,10 +1713,27 @@ void consoleWin_t::createMainMenu(void)
|
|||
//act->setShortcut( QKeySequence(tr("Shift+F7")));
|
||||
act->setStatusTip(tr("Open Netplay Client Status Dialog"));
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(openNetPlayStatusWindow(void)) );
|
||||
act->setEnabled(false);
|
||||
act->setVisible(false);
|
||||
netPlayClientStatAct = act;
|
||||
|
||||
netPlayMenu->addAction(act);
|
||||
|
||||
netPlayMenu->addSeparator();
|
||||
act = new QAction(tr(""), this);
|
||||
act->setEnabled(false);
|
||||
netPlayMenu->addAction(act);
|
||||
|
||||
// NetPlay -> End Game / Disconnect
|
||||
act = new QAction(tr("&Disconnect/End Game"), this);
|
||||
//act->setShortcut( QKeySequence(tr("Shift+F7")));
|
||||
act->setStatusTip(tr("Disconnect Netplay Game"));
|
||||
connect(act, SIGNAL(triggered()), this, SLOT(closeNetPlaySession(void)) );
|
||||
act->setEnabled(false);
|
||||
netPlayDiscAct = act;
|
||||
|
||||
netPlayMenu->addAction(act);
|
||||
|
||||
|
||||
//netPlayMenu->setEnabled(false);
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -4821,28 +4831,6 @@ void consoleWin_t::updatePeriodic(void)
|
|||
recAsWavAct->setEnabled( FCEU_IsValidUI( FCEUI_RECORDMOVIE ) && !FCEUI_WaveRecordRunning() );
|
||||
stopWavAct->setEnabled( FCEUI_WaveRecordRunning() );
|
||||
tasEditorAct->setEnabled( FCEU_IsValidUI(FCEUI_TASEDITOR) );
|
||||
|
||||
const bool netPlayactv = NetPlayActive();
|
||||
|
||||
netPlayHostAct->setEnabled( !netPlayactv );
|
||||
netPlayJoinAct->setEnabled( !netPlayactv );
|
||||
netPlayDiscAct->setEnabled( netPlayactv );
|
||||
|
||||
if (netPlayactv)
|
||||
{
|
||||
const bool isHost = isNetPlayHost();
|
||||
netPlayHostStatAct->setEnabled(isHost);
|
||||
netPlayHostStatAct->setVisible(isHost);
|
||||
netPlayClientStatAct->setEnabled(!isHost);
|
||||
netPlayClientStatAct->setVisible(!isHost);
|
||||
}
|
||||
else
|
||||
{
|
||||
netPlayHostStatAct->setEnabled(false);
|
||||
netPlayHostStatAct->setVisible(false);
|
||||
netPlayClientStatAct->setEnabled(false);
|
||||
netPlayClientStatAct->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
if ( errorMsgValid )
|
||||
|
@ -4875,6 +4863,31 @@ void consoleWin_t::updatePeriodic(void)
|
|||
return;
|
||||
}
|
||||
|
||||
void consoleWin_t::onNetPlayChange(void)
|
||||
{
|
||||
const bool netPlayactv = NetPlayActive();
|
||||
|
||||
netPlayHostAct->setEnabled( !netPlayactv );
|
||||
netPlayJoinAct->setEnabled( !netPlayactv );
|
||||
netPlayDiscAct->setEnabled( netPlayactv );
|
||||
|
||||
if (netPlayactv)
|
||||
{
|
||||
const bool isHost = isNetPlayHost();
|
||||
netPlayHostStatAct->setEnabled(isHost);
|
||||
netPlayHostStatAct->setVisible(isHost);
|
||||
netPlayClientStatAct->setEnabled(!isHost);
|
||||
netPlayClientStatAct->setVisible(!isHost);
|
||||
}
|
||||
else
|
||||
{
|
||||
netPlayHostStatAct->setEnabled(false);
|
||||
netPlayHostStatAct->setVisible(false);
|
||||
netPlayClientStatAct->setEnabled(false);
|
||||
netPlayClientStatAct->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
emulatorThread_t::emulatorThread_t( QObject *parent )
|
||||
: QThread(parent)
|
||||
{
|
||||
|
|
|
@ -340,6 +340,7 @@ class consoleWin_t : public QMainWindow
|
|||
void toggleMenuVis(void);
|
||||
void recordMovie(void);
|
||||
void winResizeIx(int iScale);
|
||||
void onNetPlayChange(void);
|
||||
private slots:
|
||||
void closeApp(void);
|
||||
void openROMFile(void);
|
||||
|
|
|
@ -220,6 +220,11 @@ int NetPlayServer::Create(QObject *parent)
|
|||
traceRegistrationHandle = FCEUI_TraceInstructionRegister( NetPlayTraceInstruction );
|
||||
}
|
||||
FCEU_WRAPPER_UNLOCK();
|
||||
|
||||
if (consoleWindow != nullptr)
|
||||
{
|
||||
consoleWindow->onNetPlayChange();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -241,6 +246,11 @@ int NetPlayServer::Destroy()
|
|||
traceRegistrationHandle = nullptr;
|
||||
}
|
||||
FCEU_WRAPPER_UNLOCK();
|
||||
|
||||
if (consoleWindow != nullptr)
|
||||
{
|
||||
consoleWindow->onNetPlayChange();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1153,6 +1163,11 @@ int NetPlayClient::Create(QObject *parent)
|
|||
traceRegistrationHandle = FCEUI_TraceInstructionRegister( NetPlayTraceInstruction );
|
||||
}
|
||||
FCEU_WRAPPER_UNLOCK();
|
||||
|
||||
if (consoleWindow != nullptr)
|
||||
{
|
||||
consoleWindow->onNetPlayChange();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1174,6 +1189,11 @@ int NetPlayClient::Destroy()
|
|||
traceRegistrationHandle = nullptr;
|
||||
}
|
||||
FCEU_WRAPPER_UNLOCK();
|
||||
|
||||
if (consoleWindow != nullptr)
|
||||
{
|
||||
consoleWindow->onNetPlayChange();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue