diff --git a/client/diplodlg.cpp b/client/diplodlg.cpp index ecea97e83a..e074e6a3e7 100644 --- a/client/diplodlg.cpp +++ b/client/diplodlg.cpp @@ -843,11 +843,7 @@ void handle_diplomacy_accept_treaty(int counterpart, bool I_accepted, dw->treaty.accept0 = I_accepted; dw->treaty.accept1 = other_accepted; dw->update_wdg(); - if (dd->count() > 0) { - update_top_bar_diplomacy_status(true); - } else { - update_top_bar_diplomacy_status(false); - } + update_top_bar_diplomacy_status(dd->count() > 0); } /** @@ -894,11 +890,7 @@ void handle_diplomacy_init_meeting(int counterpart, int initiated_from) if (player_by_number(initiated_from) == client.conn.playing) { queen()->game_tab_widget->setCurrentIndex(i); } - if (dd->count() > 0) { - update_top_bar_diplomacy_status(true); - } else { - update_top_bar_diplomacy_status(false); - } + update_top_bar_diplomacy_status(dd->count() > 0); } /** @@ -944,11 +936,7 @@ void handle_diplomacy_cancel_meeting(int counterpart, int initiated_from) w = queen()->game_tab_widget->widget(i); dd = qobject_cast(w); dd->close_widget(counterpart); - if (dd->count() > 0) { - update_top_bar_diplomacy_status(true); - } else { - update_top_bar_diplomacy_status(false); - } + update_top_bar_diplomacy_status(dd->count() > 0); } /** diff --git a/client/plrdlg.cpp b/client/plrdlg.cpp index 7a212c1b8c..a21530770d 100644 --- a/client/plrdlg.cpp +++ b/client/plrdlg.cpp @@ -726,13 +726,10 @@ plr_report::plr_report() : QWidget() ui.plr_wdg->sortByColumn(king()->qt_settings.player_repo_sort_col, king()->qt_settings.player_report_sort); } - if (queen()->gimmeIndexOf(QStringLiteral("DDI")) > 0) { - ui.diplo_but->setEnabled(true); - update_top_bar_diplomacy_status(true); - } else { - ui.diplo_but->setEnabled(false); - update_top_bar_diplomacy_status(false); - } + const bool has_meeting = + (queen()->gimmeIndexOf(QStringLiteral("DDI")) > 0); + ui.diplo_but->setEnabled(has_meeting); + update_top_bar_diplomacy_status(has_meeting); queen()->updateSidebarTooltips(); ui.plr_wdg->set_pr_rep(this); } @@ -918,13 +915,10 @@ void plr_report::update_report(bool update_selection) if (can_meet_with_player(other_player)) { ui.meet_but->setEnabled(true); } - if (queen()->gimmeIndexOf(QStringLiteral("DDI")) > 0) { - ui.diplo_but->setEnabled(true); - update_top_bar_diplomacy_status(true); - } else { - ui.diplo_but->setEnabled(false); - update_top_bar_diplomacy_status(false); - } + const bool has_meeting = + (queen()->gimmeIndexOf(QStringLiteral("DDI")) > 0); + ui.diplo_but->setEnabled(has_meeting); + update_top_bar_diplomacy_status(has_meeting); ui.plr_wdg->restore_selection(); } @@ -1011,15 +1005,12 @@ void close_intel_dialog(struct player *p) { real_players_dialog_update(p); } */ void update_top_bar_diplomacy_status(bool blinker) { + queen()->sw_diplo->keep_blinking = blinker; if (blinker) { - queen()->sw_diplo->keep_blinking = true; queen()->sw_diplo->sblink(); - queen()->updateSidebarTooltips(); - queen()->reloadSidebarIcons(); } else { - queen()->sw_diplo->keep_blinking = false; queen()->sw_diplo->update(); - queen()->updateSidebarTooltips(); - queen()->reloadSidebarIcons(); } + queen()->updateSidebarTooltips(); + queen()->reloadSidebarIcons(); }