@@ -230,36 +230,28 @@ bool main_window::Init([[maybe_unused]] bool with_cli_boot)
230230
231231 // RPCS3 Updater
232232
233- QMenu* download_menu = new QMenu (tr (" Update Available!" ));
234-
235- QAction* download_action = new QAction (tr (" Download Update" ), download_menu);
236- connect (download_action, &QAction::triggered, this , [this ]
233+ connect (ui->actionDownload_Update , &QAction::triggered, this , [this ]
237234 {
238235 m_updater.update (false );
239236 });
240237
241- download_menu->addAction (download_action);
242-
243238#ifdef _WIN32
244239 // Use a menu at the top right corner to indicate the new version.
245- QMenuBar *corner_bar = new QMenuBar (ui->menuBar );
246- m_download_menu_action = corner_bar->addMenu (download_menu);
240+ // Some distros just can't handle corner widgets at the moment.
241+ QMenuBar* corner_bar = new QMenuBar (ui->menuBar );
242+ corner_bar->addMenu (ui->menuUpdate_Available );
247243 ui->menuBar ->setCornerWidget (corner_bar);
248244 ui->menuBar ->cornerWidget ()->setVisible (false );
249- #else
250- // Append a menu to the right of the regular menus to indicate the new version.
251- // Some distros just can't handle corner widgets at the moment.
252- m_download_menu_action = ui->menuBar ->addMenu (download_menu);
245+ ui->menuBar ->removeAction (ui->menuUpdate_Available ->menuAction ());
253246#endif
254247
255- ensure (m_download_menu_action);
256- m_download_menu_action->setVisible (false );
248+ ui->menuUpdate_Available ->setVisible (false );
257249
258250 connect (&m_updater, &update_manager::signal_update_available, this , [this ](bool update_available)
259251 {
260- if (m_download_menu_action )
252+ if (ui-> menuUpdate_Available )
261253 {
262- m_download_menu_action ->setVisible (update_available);
254+ ui-> menuUpdate_Available ->setVisible (update_available);
263255 }
264256 if (ui->menuBar && ui->menuBar ->cornerWidget ())
265257 {
@@ -1933,9 +1925,11 @@ void main_window::OnEmuRun(bool /*start_playtime*/)
19331925 EnableMenus (true );
19341926
19351927 update_gui_pad_thread ();
1928+
1929+ m_system_state = system_state::running;
19361930}
19371931
1938- void main_window::OnEmuResume () const
1932+ void main_window::OnEmuResume ()
19391933{
19401934 const QString title = GetCurrentTitle ();
19411935 const QString restart_tooltip = tr (" Restart %0" ).arg (title);
@@ -1948,9 +1942,11 @@ void main_window::OnEmuResume() const
19481942 ui->toolbar_start ->setText (tr (" Pause" ));
19491943 ui->toolbar_start ->setToolTip (pause_tooltip);
19501944 ui->toolbar_stop ->setToolTip (stop_tooltip);
1945+
1946+ m_system_state = system_state::starting; // Let's just use this state to distinguish between resumed and running
19511947}
19521948
1953- void main_window::OnEmuPause () const
1949+ void main_window::OnEmuPause ()
19541950{
19551951 const QString title = GetCurrentTitle ();
19561952 const QString resume_tooltip = tr (" Resume %0" ).arg (title);
@@ -1966,6 +1962,8 @@ void main_window::OnEmuPause() const
19661962 {
19671963 m_game_list_frame->Refresh ();
19681964 }
1965+
1966+ m_system_state = system_state::paused;
19691967}
19701968
19711969void main_window::OnEmuStop ()
@@ -2026,9 +2024,11 @@ void main_window::OnEmuStop()
20262024 }
20272025
20282026 update_gui_pad_thread ();
2027+
2028+ m_system_state = system_state::stopped;
20292029}
20302030
2031- void main_window::OnEmuReady () const
2031+ void main_window::OnEmuReady ()
20322032{
20332033 const QString title = GetCurrentTitle ();
20342034 const QString play_tooltip = tr (" Play %0" ).arg (title);
@@ -2054,6 +2054,8 @@ void main_window::OnEmuReady() const
20542054 ui->removeAllCachesAct ->setEnabled (false );
20552055 ui->removeSavestatesAct ->setEnabled (false );
20562056 ui->cleanUpGameListAct ->setEnabled (false );
2057+
2058+ m_system_state = system_state::ready;
20572059}
20582060
20592061void main_window::EnableMenus (bool enabled) const
@@ -2340,6 +2342,20 @@ void main_window::RetranslateUI(const QStringList& language_codes, const QString
23402342
23412343 ui->retranslateUi (this );
23422344
2345+ // Update menu bar size (needed if the corner widget changes its size)
2346+ ui->menuBar ->adjustSize ();
2347+
2348+ // Update toolbar elements
2349+ switch (m_system_state)
2350+ {
2351+ case system_state::running: OnEmuRun (false ); break ;
2352+ case system_state::stopped: OnEmuStop (); break ;
2353+ case system_state::paused: OnEmuPause (); break ;
2354+ case system_state::starting: OnEmuResume (); break ;
2355+ case system_state::ready: OnEmuReady (); break ;
2356+ default : break ;
2357+ }
2358+
23432359 if (m_game_list_frame)
23442360 {
23452361 m_game_list_frame->Refresh (true );
0 commit comments