Skip to content

Commit

Permalink
RMG: add Netplay -> View Session
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Feb 6, 2025
1 parent f5bed2b commit 0dee590
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,15 @@ void NetplaySessionDialog::accept()

void NetplaySessionDialog::reject(void)
{
// when we're in-game we should keep
// the dialog alive so that the player
// can re-open the dialog and continue chatting
if (this->started)
{
this->hide();
return;
}

if (this->webSocket->isValid())
{
this->webSocket->close();
Expand Down
13 changes: 13 additions & 0 deletions Source/RMG/UserInterface/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ void MainWindow::updateActions(bool inEmulation, bool isPaused)
#ifdef NETPLAY
this->action_Netplay_CreateSession->setEnabled(!inEmulation && this->netplaySessionDialog == nullptr);
this->action_Netplay_JoinSession->setEnabled(!inEmulation && this->netplaySessionDialog == nullptr);
this->action_Netplay_ViewSession->setEnabled(inEmulation && this->netplaySessionDialog != nullptr);
#endif // NETPLAY

keyBinding = QString::fromStdString(CoreSettingsGetStringValue(SettingsID::KeyBinding_IncreaseVolume));
Expand Down Expand Up @@ -1176,6 +1177,7 @@ void MainWindow::connectActionSignals(void)

connect(this->action_Netplay_CreateSession, &QAction::triggered, this, &MainWindow::on_Action_Netplay_CreateSession);
connect(this->action_Netplay_JoinSession, &QAction::triggered, this, &MainWindow::on_Action_Netplay_JoinSession);
connect(this->action_Netplay_ViewSession, &QAction::triggered, this, &MainWindow::on_Action_Netplay_ViewSession);

connect(this->action_Help_Github, &QAction::triggered, this, &MainWindow::on_Action_Help_Github);
connect(this->action_Help_About, &QAction::triggered, this, &MainWindow::on_Action_Help_About);
Expand Down Expand Up @@ -1984,6 +1986,17 @@ void MainWindow::on_Action_Netplay_JoinSession(void)
#endif // NETPLAY
}

void MainWindow::on_Action_Netplay_ViewSession(void)
{
#ifdef NETPLAY
if (this->netplaySessionDialog != nullptr &&
this->netplaySessionDialog->isHidden())
{
this->netplaySessionDialog->show();
}
#endif
}

void MainWindow::on_Action_Help_Github(void)
{
QDesktopServices::openUrl(QUrl("https://github.com/Rosalie241/RMG"));
Expand Down
1 change: 1 addition & 0 deletions Source/RMG/UserInterface/MainWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow

void on_Action_Netplay_CreateSession(void);
void on_Action_Netplay_JoinSession(void);
void on_Action_Netplay_ViewSession(void);

void on_Action_Help_Github(void);
void on_Action_Help_About(void);
Expand Down
10 changes: 10 additions & 0 deletions Source/RMG/UserInterface/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@
</property>
<addaction name="action_Netplay_CreateSession"/>
<addaction name="action_Netplay_JoinSession"/>
<addaction name="separator"/>
<addaction name="action_Netplay_ViewSession"/>
</widget>
<addaction name="menuSystem"/>
<addaction name="menuSettings"/>
Expand Down Expand Up @@ -623,6 +625,14 @@
<string>&amp;Join Session</string>
</property>
</action>
<action name="action_Netplay_ViewSession">
<property name="icon">
<iconset theme="server-line"/>
</property>
<property name="text">
<string>View Session</string>
</property>
</action>
</widget>
<resources>
<include location="UIResources.qrc"/>
Expand Down

0 comments on commit 0dee590

Please sign in to comment.