Skip to content

Commit

Permalink
Make some transient messages transparent again
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aginor committed Mar 2, 2016
1 parent dfcdefe commit 8a5b4fe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/gui/dialogs/preferences_dialog.cpp
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion src/gui/dialogs/transient_message.cpp
Expand Up @@ -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);
}

Expand Down
5 changes: 4 additions & 1 deletion src/gui/dialogs/transient_message.hpp
Expand Up @@ -57,13 +57,16 @@ class ttransient_message : public tdialog
* @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.
Expand Down

0 comments on commit 8a5b4fe

Please sign in to comment.