The Battle for Wesnoth  1.15.0-dev
Enumerations | Functions
desktop::notifications Namespace Reference


enum  type { CHAT, TURN_CHANGED, OTHER }


bool available ()
 Returns whether we were compiled with support for desktop notifications. More...
void send (const std::string &owner, const std::string &message, type t)
 Displays a desktop notification message, from owner, of type t. More...

Enumeration Type Documentation

◆ type


Definition at line 23 of file notifications.hpp.

Function Documentation

◆ available()

bool desktop::notifications::available ( )

Returns whether we were compiled with support for desktop notifications.

Whether wesnoth was compiled with support for a clipboard.

Definition at line 40 of file notifications.cpp.

Referenced by mp_ui_alerts::get_def_pref_notif(), gui2::dialogs::mp_alerts_options::pre_show(), send(), and gui2::dialogs::setup_item().

◆ send()

void desktop::notifications::send ( const std::string &  owner,
const std::string &  message,
type  t 

Displays a desktop notification message, from owner, of type t.

If it is an appropriate time to send a desktop notification (i.e. the window does not have focus and the feature is not disabled by the preferences), and wesnoth was compiled with support for this feature, a notification will be issued. If there is no support for notifications, this fcn is a no-op.

Currently we have support for dbus (linux), windows tray notifications, and NSUserNotification (Apple). To enable one of these, the corresponding compilation unit dbus_notification.cpp, apple_notification.cpp, windows_tray_notification.cpp, must be compiled, and the corresponding C++ symbol HAVE_LIBDBUS, WIN32 must be defined for that compilation unit _and for this one.

Definition at line 42 of file notifications.cpp.

References _(), apple_notifications::available(), available(), CHAT, CVideo::get_singleton(), OTHER, apple_notifications::send_notification(), dbus::send_notification(), windows_tray_notification::show(), t, TURN_CHANGED, and CVideo::window_has_flags().

Referenced by mp_ui_alerts::friend_message(), mp_ui_alerts::game_has_begun(), mp_ui_alerts::player_joins(), mp_ui_alerts::player_leaves(), mp_ui_alerts::private_message(), mp_ui_alerts::public_message(), mp_ui_alerts::ready_for_start(), mp_ui_alerts::server_message(), and mp_ui_alerts::turn_changed().