@@ -139,8 +139,8 @@ void NetPlayDialog::CreateMainLayout()
139139 m_player_buffer_size_box = new QSpinBox;
140140 m_player_buffer_label = new QLabel (tr (" Player Buffer:" ));
141141 m_quit_button = new QPushButton (tr (" Quit" ));
142- m_is_spectator = new QCheckBox (tr (" Spectator" ));
143142 m_brawlmusic_off = new QCheckBox (tr (" Client Side Music Off" ));
143+ m_is_spectator = new QCheckBox (tr (" Spectator" ));
144144 m_splitter = new QSplitter (Qt::Horizontal);
145145 m_menu_bar = new QMenuBar (this );
146146
@@ -267,10 +267,10 @@ void NetPlayDialog::CreateMainLayout()
267267 options_widget->addWidget (m_minimum_buffer_size_box, 0 , 2 , Qt::AlignVCenter);
268268 options_widget->addWidget (m_player_buffer_label, 0 , 3 , Qt::AlignVCenter);
269269 options_widget->addWidget (m_player_buffer_size_box, 0 , 4 , Qt::AlignVCenter);
270+ options_widget->addWidget (m_brawlmusic_off, 0 , 5 , Qt::AlignVCenter);
270271 options_widget->addWidget (m_is_spectator, 0 , 6 , Qt::AlignVCenter);
271- options_widget->addWidget (m_brawlmusic_off, 0 , 7 , Qt::AlignVCenter);
272272 options_widget->addWidget (m_quit_button, 0 , 8 , Qt::AlignVCenter | Qt::AlignRight);
273- options_widget->setColumnStretch (5 , 1000 );
273+ options_widget->setColumnStretch (7 , 1000 );
274274
275275 m_main_layout->addLayout (options_widget, 2 , 0 , 1 , -1 , Qt::AlignRight);
276276 m_main_layout->setRowStretch (1 , 1000 );
@@ -405,6 +405,8 @@ void NetPlayDialog::ConnectWidgets()
405405 connect (m_start_button, &QPushButton::clicked, this , &NetPlayDialog::OnStart);
406406 connect (m_quit_button, &QPushButton::clicked, this , &NetPlayDialog::reject);
407407
408+ connect (m_is_spectator, &QCheckBox::toggled, this , &NetPlayDialog::IsSpectatorEnabled);
409+
408410 connect (m_game_button, &QPushButton::clicked, [this ] {
409411 GameListDialog gld (m_game_list_model, this );
410412 SetQWidgetWindowDecorations (&gld);
@@ -493,6 +495,17 @@ void NetPlayDialog::OnChat()
493495 });
494496}
495497
498+ void NetPlayDialog::IsSpectatorEnabled (bool enabled)
499+ {
500+ auto client = Settings::Instance ().GetNetPlayClient ();
501+ if (!client)
502+ return ;
503+ sf::Packet packet;
504+ packet << static_cast <u8 >(NetPlay::MessageID::PadSpectator);
505+ packet << enabled;
506+ client->SendAsync (std::move (packet));
507+ }
508+
496509void NetPlayDialog::OnIndexAdded (bool success, const std::string error)
497510{
498511 DisplayMessage (success ? tr (" Successfully added to the NetPlay index" ) :
@@ -913,8 +926,8 @@ void NetPlayDialog::SetOptionsEnabled(bool enabled)
913926 m_host_input_authority_action->setEnabled (enabled);
914927 m_golf_mode_action->setEnabled (enabled);
915928 m_fixed_delay_action->setEnabled (enabled);
916- m_is_spectator->setEnabled (enabled);
917929 m_brawlmusic_off->setEnabled (enabled);
930+ m_is_spectator->setEnabled (enabled);
918931 }
919932
920933 m_record_input_action->setEnabled (enabled);
@@ -1201,8 +1214,8 @@ void NetPlayDialog::LoadSettings()
12011214 const bool strict_settings_sync = Config::Get (Config::NETPLAY_STRICT_SETTINGS_SYNC);
12021215 const bool golf_mode_overlay = Config::Get (Config::NETPLAY_GOLF_MODE_OVERLAY);
12031216 const bool hide_remote_gbas = Config::Get (Config::NETPLAY_HIDE_REMOTE_GBAS);
1204- const bool is_spectator = Config::Get (Config::NETPLAY_IS_SPECTATOR);
12051217 const bool brawlmusic_off = Config::Get (Config::NETPLAY_BRAWL_MUSIC_OFF);
1218+ const bool is_spectator = Config::Get (Config::NETPLAY_IS_SPECTATOR);
12061219
12071220 m_minimum_buffer_size_box->setValue (minimum_buffer_size);
12081221 m_player_buffer_size_box->setValue (player_buffer_size);
@@ -1221,8 +1234,8 @@ void NetPlayDialog::LoadSettings()
12211234 m_golf_mode_overlay_action->setChecked (golf_mode_overlay);
12221235 m_hide_remote_gbas_action->setChecked (hide_remote_gbas);
12231236
1224- m_is_spectator->setChecked (is_spectator);
12251237 m_brawlmusic_off->setChecked (brawlmusic_off);
1238+ m_is_spectator->setChecked (is_spectator);
12261239
12271240 const std::string network_mode = Config::Get (Config::NETPLAY_NETWORK_MODE);
12281241
@@ -1266,8 +1279,8 @@ void NetPlayDialog::SaveSettings()
12661279 Config::SetBase (Config::NETPLAY_STRICT_SETTINGS_SYNC, m_strict_settings_sync_action->isChecked ());
12671280 Config::SetBase (Config::NETPLAY_GOLF_MODE_OVERLAY, m_golf_mode_overlay_action->isChecked ());
12681281 Config::SetBase (Config::NETPLAY_HIDE_REMOTE_GBAS, m_hide_remote_gbas_action->isChecked ());
1269- Config::SetBase (Config::NETPLAY_IS_SPECTATOR, m_is_spectator->isChecked ());
12701282 Config::SetBase (Config::NETPLAY_BRAWL_MUSIC_OFF, m_brawlmusic_off->isChecked ());
1283+ Config::SetBase (Config::NETPLAY_IS_SPECTATOR, m_is_spectator->isChecked ());
12711284
12721285 std::string network_mode;
12731286 if (m_fixed_delay_action->isChecked ())
0 commit comments