Merge pull request #2762 from cold-brewed/pause-icon-fix-3

qt: Rework ui pause update into a slot
This commit is contained in:
Miran Grča
2022-10-30 03:05:48 +01:00
committed by GitHub
3 changed files with 5 additions and 5 deletions

View File

@@ -2052,9 +2052,9 @@ void MainWindow::setSendKeyboardInput(bool enabled)
send_keyboard_input = enabled; send_keyboard_input = enabled;
} }
void MainWindow::setUiPauseState(bool paused) { void MainWindow::updateUiPauseState() {
auto pause_icon = paused ? QIcon(":/menuicons/win/icons/run.ico") : QIcon(":/menuicons/win/icons/pause.ico"); auto pause_icon = dopause ? QIcon(":/menuicons/win/icons/run.ico") : QIcon(":/menuicons/win/icons/pause.ico");
auto tooltip_text = paused ? QString(tr("Resume execution")) : QString(tr("Pause execution")); auto tooltip_text = dopause ? QString(tr("Resume execution")) : QString(tr("Pause execution"));
ui->actionPause->setIcon(pause_icon); ui->actionPause->setIcon(pause_icon);
ui->actionPause->setToolTip(tooltip_text); ui->actionPause->setToolTip(tooltip_text);
} }

View File

@@ -33,7 +33,6 @@ public:
void blitToWidget(int x, int y, int w, int h, int monitor_index); void blitToWidget(int x, int y, int w, int h, int monitor_index);
QSize getRenderWidgetSize(); QSize getRenderWidgetSize();
void setSendKeyboardInput(bool enabled); void setSendKeyboardInput(bool enabled);
void setUiPauseState(bool paused);
std::array<std::unique_ptr<RendererStack>, 8> renderers; std::array<std::unique_ptr<RendererStack>, 8> renderers;
signals: signals:
@@ -65,6 +64,7 @@ public slots:
void togglePause(); void togglePause();
void initRendererMonitorSlot(int monitor_index); void initRendererMonitorSlot(int monitor_index);
void destroyRendererMonitorSlot(int monitor_index); void destroyRendererMonitorSlot(int monitor_index);
void updateUiPauseState();
private slots: private slots:
void on_actionFullscreen_triggered(); void on_actionFullscreen_triggered();
void on_actionSettings_triggered(); void on_actionSettings_triggered();

View File

@@ -366,7 +366,7 @@ plat_pause(int p)
ui_window_title(oldtitle); ui_window_title(oldtitle);
} }
discord_update_activity(dopause); discord_update_activity(dopause);
main_window->setUiPauseState(p); QTimer::singleShot(0, main_window, &MainWindow::updateUiPauseState);
#ifdef Q_OS_WINDOWS #ifdef Q_OS_WINDOWS
if (source_hwnd) if (source_hwnd)