diff --git a/client/fc_client.cpp b/client/fc_client.cpp index 294ca8b746..c1caa26026 100644 --- a/client/fc_client.cpp +++ b/client/fc_client.cpp @@ -227,10 +227,11 @@ void fc_client::switch_page(int new_pg) queen()->game_tab_widget->showFullScreen(); } menuBar()->setVisible(true); + queen()->chat->set_chat_visible(qt_settings.show_chat); queen()->mapview_wdg->setFocus(); + queen()->sw_message->setChecked(qt_settings.show_messages); queen()->sw_message->setIcon( fcIcons::instance()->getIcon(QStringLiteral("messages"))); - queen()->message->hide(); queen()->message->clr(); center_on_something(); voteinfo_gui_update(); @@ -451,6 +452,12 @@ void fc_client::read_settings() } else { qt_settings.show_battle_log = false; } + + qt_settings.show_chat = + s.value(QStringLiteral("show_chat"), true).toBool(); + qt_settings.show_messages = + s.value(QStringLiteral("show_messages"), false).toBool(); + if (s.contains(QStringLiteral("battlelog_x"))) { qt_settings.battlelog_x = s.value(QStringLiteral("battlelog_x")).toFloat(); @@ -521,6 +528,9 @@ void fc_client::write_settings() s.setValue(QStringLiteral("new_turn_text"), qt_settings.show_new_turn_text); s.setValue(QStringLiteral("show_battle_log"), qt_settings.show_battle_log); + s.setValue(QStringLiteral("show_chat"), queen()->chat->is_chat_visible()); + s.setValue(QStringLiteral("show_messages"), + queen()->sw_message->isChecked()); fc_shortcuts::sc()->write(); } diff --git a/client/fc_client.h b/client/fc_client.h index 6fdaa74809..50ae71c7b9 100644 --- a/client/fc_client.h +++ b/client/fc_client.h @@ -58,6 +58,8 @@ struct fc_settings { int player_repo_sort_col; bool show_new_turn_text; bool show_battle_log; + bool show_chat; // Only used when loading + bool show_messages; // Only used when loading Qt::SortOrder player_report_sort; int city_repo_sort_col; Qt::SortOrder city_report_sort; diff --git a/client/page_game.cpp b/client/page_game.cpp index 7aef1fdb8f..85726513c5 100644 --- a/client/page_game.cpp +++ b/client/page_game.cpp @@ -137,11 +137,12 @@ pageGame::pageGame(QWidget *parent) message = new message_widget(mapview_wdg); message->setAttribute(Qt::WA_NoMousePropagation); message->hide(); - sw_message = new top_bar_widget( - _("Messages"), QLatin1String(""), +[] { - const auto message = queen()->message; - if (message) { - message->setVisible(!message->isVisible()); + sw_message = new top_bar_widget(_("Messages"), QLatin1String(""), nullptr); + sw_message->setCheckable(true); + connect( + sw_message, &QToolButton::toggled, +[](bool checked) { + if (const auto message = queen()->message; message) { + message->setVisible(checked); // change icon to default if icon is notify const auto sw_message = queen()->sw_message;