Make some transient messages transparent again

The transient messages transparency relies on the restorer
pattern. This enables it for certain transient messages, making sure
that they are drawn properly. Enabling it across all messages will
cause breakage.

This is a bit of a workaround, it should be changed to not rely on the
background restore functionality.
This commit is contained in:
Andreas Löf 2016-03-02 20:58:48 +13:00
parent dfcdefeb2d
commit 8a5b4fed41
3 changed files with 11 additions and 4 deletions

View file

@ -385,7 +385,8 @@ void tpreferences::add_friend_list_entry(const bool is_friend,
add_ignore(username, reason) ;
if (!added_sucessfully) {
gui2::show_transient_error_message(window.video(), _("Invalid username"));
gui2::show_transient_message(window.video(), _("Error"), _("Invalid username"),
std::string(), false, false, true);
return;
}
@ -1003,7 +1004,8 @@ void tpreferences::add_hotkey_callback(tlistbox& hotkeys)
void tpreferences::default_hotkey_callback(twindow& window)
{
gui2::show_transient_message(window.video(), _("Hotkeys Reset"), _("All hotkeys have been reset to their default values."));
gui2::show_transient_message(window.video(), _("Hotkeys Reset"), _("All hotkeys have been reset to their default values."),
std::string(), false, false, true);
clear_hotkeys();
setup_hotkey_list(window);
window.invalidate_layout();

View file

@ -58,11 +58,13 @@ void show_transient_message(CVideo& video,
const std::string& message,
const std::string& image,
const bool message_use_markup,
const bool title_use_markup)
const bool title_use_markup,
const bool restore_background)
{
ttransient_message dlg(
title, title_use_markup, message, message_use_markup, image);
dlg.set_restore(restore_background);
dlg.show(video);
}

View file

@ -57,13 +57,16 @@ private:
* @param image An image to show in the dialog.
* @param message_use_markup Use markup for the message?
* @param title_use_markup Use markup for the title?
* @param restore_background Restore the background to the state it was before
* the message appeared
*/
void show_transient_message(CVideo& video,
const std::string& title,
const std::string& message,
const std::string& image = std::string(),
const bool message_use_markup = false,
const bool title_use_markup = false);
const bool title_use_markup = false,
const bool restore_background = false);
/**
* Shows a transient error message to the user.