Merge branch 'more_notificiations'
This commit is contained in:
commit
d9482fbfc9
8 changed files with 78 additions and 68 deletions
|
@ -143,6 +143,8 @@ Version 1.13.0-dev:
|
|||
* Fixed bug #22337: Bug in inspect long arrays
|
||||
* Added a new "Alerts" configuration screen under Preferences > Multiplayer,
|
||||
refactored all of the mp alerts / desktop notifications for customizability
|
||||
* Removed "desktop_notifications" and "lobby_sounds" advanced preferences,
|
||||
as they are subsumed by the Preferences > Multiplayer > Alerts screen now.
|
||||
* WML engine:
|
||||
* Added customizable recall costs for unit types and individual units,
|
||||
using the new recall_cost attribute in [unit_type] and [unit].
|
||||
|
|
|
@ -108,14 +108,6 @@
|
|||
default=yes
|
||||
[/advanced_preference]
|
||||
|
||||
[advanced_preference]
|
||||
field=desktop_notifications
|
||||
name= _ "Desktop notifications"
|
||||
description= _ "Shows desktop/system tray notifications for turn change events or conversations when the game window is inactive"
|
||||
type=boolean
|
||||
default=yes
|
||||
[/advanced_preference]
|
||||
|
||||
[advanced_preference]
|
||||
field=flip_time
|
||||
name= _ "Reverse time graphics"
|
||||
|
|
|
@ -1,67 +1,67 @@
|
|||
#textdomain wesnoth-lib
|
||||
|
||||
#define __GUI_LOBBY_SOUNDS_ENTRY ID LABEL TOOLTIP
|
||||
[row]
|
||||
[column]
|
||||
grow_factor = 0
|
||||
[row]
|
||||
[column]
|
||||
grow_factor = 0
|
||||
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[label]
|
||||
definition = "default"
|
||||
[label]
|
||||
definition = "default"
|
||||
|
||||
id = {ID} + "_label"
|
||||
label = {LABEL}
|
||||
tooltip = {TOOLTIP}
|
||||
[/label]
|
||||
[/column]
|
||||
id = {ID} + "_label"
|
||||
label = {LABEL}
|
||||
tooltip = {TOOLTIP}
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
[column]
|
||||
grow_factor = 0
|
||||
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[toggle_button]
|
||||
id = {ID} + "_sound"
|
||||
definition = "default"
|
||||
label = ""
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
[toggle_button]
|
||||
id = {ID} + "_sound"
|
||||
definition = "default"
|
||||
label = ""
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
[column]
|
||||
grow_factor = 0
|
||||
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[toggle_button]
|
||||
id = {ID} + "_notif"
|
||||
definition = "default"
|
||||
label = ""
|
||||
tooltip = ""
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
[toggle_button]
|
||||
id = {ID} + "_notif"
|
||||
definition = "default"
|
||||
label = ""
|
||||
tooltip = ""
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
[column]
|
||||
grow_factor = 0
|
||||
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[toggle_button]
|
||||
id = {ID} + "_lobby"
|
||||
definition = "default"
|
||||
label = ""
|
||||
tooltip = ""
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
[/row]
|
||||
[toggle_button]
|
||||
id = {ID} + "_lobby"
|
||||
definition = "default"
|
||||
label = ""
|
||||
tooltip = ""
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
[/row]
|
||||
#enddef
|
||||
|
||||
[window]
|
||||
|
@ -138,6 +138,7 @@
|
|||
definition = "default"
|
||||
|
||||
label = _ "Play Sound:"
|
||||
tooltip = _ "Play a sound for the event, specified in data/game_config.cfg"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
|
@ -153,6 +154,7 @@
|
|||
definition = "default"
|
||||
|
||||
label = _ "Desktop Notification:"
|
||||
tooltip = _ "Shows desktop/system tray notifications for turn change events or conversations when the game window is inactive"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
|
@ -167,6 +169,7 @@
|
|||
definition = "default"
|
||||
|
||||
label = _ "Also in main lobby:"
|
||||
tooltip = _ "Also take these actions in response to events in the main multiplayer lobby"
|
||||
[/label]
|
||||
[/column]
|
||||
[/row]
|
||||
|
@ -179,6 +182,7 @@
|
|||
{__GUI_LOBBY_SOUNDS_ENTRY "server_message" _"Server message:" _"When a server message is recieved"}
|
||||
{__GUI_LOBBY_SOUNDS_ENTRY "ready_for_start" _"Ready to start game:" _"When the game you are hosting is ready to start"}
|
||||
{__GUI_LOBBY_SOUNDS_ENTRY "game_has_begun" _"Game has begun:" _"When the host (not you) has started the game"}
|
||||
{__GUI_LOBBY_SOUNDS_ENTRY "turn_changed" _"Turn changed:" _"When a new turn has begun"}
|
||||
|
||||
[/grid]
|
||||
|
||||
|
|
|
@ -55,8 +55,6 @@ bool available() { return true; }
|
|||
|
||||
void send(const std::string& owner, const std::string& message, type t)
|
||||
{
|
||||
if (!preferences::get("desktop_notifications", true)) { return; }
|
||||
|
||||
Uint8 app_state = SDL_GetAppState();
|
||||
|
||||
// Do not show notifications when the window is visible...
|
||||
|
|
|
@ -142,6 +142,12 @@ void tmp_alerts_options::pre_show(CVideo& /*video*/, twindow& window)
|
|||
in_lobby = &find_widget<ttoggle_button>(&window,"game_has_begun_lobby", false);
|
||||
in_lobby->set_visible(twidget::tvisible::invisible);
|
||||
|
||||
in_lobby = &find_widget<ttoggle_button>(&window,"turn_changed_sound", false); // If we get a sound for this then don't remove this button
|
||||
in_lobby->set_visible(twidget::tvisible::invisible);
|
||||
|
||||
in_lobby = &find_widget<ttoggle_button>(&window,"turn_changed_lobby", false);
|
||||
in_lobby->set_visible(twidget::tvisible::invisible);
|
||||
|
||||
tbutton * defaults;
|
||||
defaults = &find_widget<tbutton>(&window,"revert_to_defaults", false);
|
||||
connect_signal_mouse_left_click(*defaults, boost::bind(&revert_to_default_pref_values, boost::ref(window)));
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "global.hpp"
|
||||
|
||||
#include "desktop/notifications.hpp"
|
||||
#include "formula_string_utils.hpp"
|
||||
#include "game_config.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "preferences.hpp"
|
||||
|
@ -53,7 +54,7 @@ bool notif_pref(std::string id)
|
|||
} // end anonymous namespace
|
||||
|
||||
// Note: This list must agree with data/gui/.../lobby_sound_options.cfg
|
||||
const std::vector<std::string> items = boost::assign::list_of("player_joins")("player_leaves")("private_message")("friend_message")("public_message")("server_message")("ready_for_start")("game_has_begun");
|
||||
const std::vector<std::string> items = boost::assign::list_of("player_joins")("player_leaves")("private_message")("friend_message")("public_message")("server_message")("ready_for_start")("game_has_begun")("turn_changed");
|
||||
|
||||
void player_joins(bool is_lobby)
|
||||
{
|
||||
|
@ -163,12 +164,22 @@ void game_has_begun()
|
|||
}
|
||||
}
|
||||
|
||||
void turn_changed(const std::string & player_name)
|
||||
{
|
||||
std::string id = "turn_changed";
|
||||
if (notif_pref(id)) {
|
||||
utils::string_map player;
|
||||
player["name"] = player_name;
|
||||
desktop::notifications::send(_("Turn changed"), vgettext("$name has taken control", player), desktop::notifications::TURN_CHANGED);
|
||||
}
|
||||
}
|
||||
|
||||
bool get_def_pref_sound(const std::string & id) {
|
||||
return (id != "public_message" && id != "friend_message");
|
||||
}
|
||||
|
||||
bool get_def_pref_notif(const std::string & id) {
|
||||
return (desktop::notifications::available() && (id == "private_message" || id == "ready_for_start" || id == "game_has_begun"));
|
||||
return (desktop::notifications::available() && (id == "private_message" || id == "ready_for_start" || id == "game_has_begun" || id == "turn_changed"));
|
||||
}
|
||||
|
||||
bool get_def_pref_lobby(const std::string & id) {
|
||||
|
|
|
@ -35,6 +35,8 @@ namespace mp_ui_alerts {
|
|||
void ready_for_start();
|
||||
void game_has_begun();
|
||||
|
||||
void turn_changed(const std::string & player);
|
||||
|
||||
// Functions to calculate what the default preference should be
|
||||
bool get_def_pref_sound(const std::string &);
|
||||
bool get_def_pref_notif(const std::string &);
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
#include "dialogs.hpp"
|
||||
|
||||
#include "actions/undo.hpp"
|
||||
#include "desktop/notifications.hpp"
|
||||
#include "display_chat_manager.hpp"
|
||||
#include "game_end_exceptions.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include "mp_ui_alerts.hpp"
|
||||
#include "playturn.hpp"
|
||||
#include "preferences.hpp"
|
||||
#include "resources.hpp"
|
||||
|
@ -100,12 +100,7 @@ void playmp_controller::stop_network(){
|
|||
|
||||
possible_end_play_signal playmp_controller::play_side()
|
||||
{
|
||||
utils::string_map player;
|
||||
player["name"] = current_team().current_player();
|
||||
std::string turn_notification_msg = _("$name has taken control");
|
||||
turn_notification_msg = utils::interpolate_variables_into_string(turn_notification_msg, &player);
|
||||
desktop::notifications::send(_("Turn changed"), turn_notification_msg, desktop::notifications::TURN_CHANGED);
|
||||
|
||||
mp_ui_alerts::turn_changed(current_team().current_player());
|
||||
// Proceed with the parent function.
|
||||
return playsingle_controller::play_side();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue