mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-20 16:05:19 +00:00
mark pending messages in new lobby
This commit is contained in:
parent
d8ce2fd6b6
commit
6fdf076253
@ -337,6 +337,13 @@
|
|||||||
definition = "default"
|
definition = "default"
|
||||||
[grid]
|
[grid]
|
||||||
[row]
|
[row]
|
||||||
|
[column]
|
||||||
|
[image]
|
||||||
|
definition = "default"
|
||||||
|
id = "pending_messages"
|
||||||
|
label = "lobby/sort-friend.png"
|
||||||
|
[/image]
|
||||||
|
[/column]
|
||||||
[column]
|
[column]
|
||||||
grow_factor = 1
|
grow_factor = 1
|
||||||
horizontal_grow = "true"
|
horizontal_grow = "true"
|
||||||
|
@ -56,6 +56,7 @@ static lg::log_domain log_lobby("lobby");
|
|||||||
#define LOG_LB LOG_STREAM(info, log_lobby)
|
#define LOG_LB LOG_STREAM(info, log_lobby)
|
||||||
#define ERR_LB LOG_STREAM(err, log_lobby)
|
#define ERR_LB LOG_STREAM(err, log_lobby)
|
||||||
|
|
||||||
|
|
||||||
namespace gui2 {
|
namespace gui2 {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -88,7 +89,8 @@ namespace {
|
|||||||
}
|
}
|
||||||
void set_playerlist_single_group(bool v) {
|
void set_playerlist_single_group(bool v) {
|
||||||
return preferences::set(prefkey_playerlist_single_group, lexical_cast<std::string>(v));
|
return preferences::set(prefkey_playerlist_single_group, lexical_cast<std::string>(v));
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void tsub_player_list::init(gui2::twindow &w, const std::string &id)
|
void tsub_player_list::init(gui2::twindow &w, const std::string &id)
|
||||||
{
|
{
|
||||||
@ -660,6 +662,16 @@ void tlobby_main::increment_waiting_whsipers(const std::string& name)
|
|||||||
{
|
{
|
||||||
if (tlobby_chat_window* t = whisper_window_open(name, false)) {
|
if (tlobby_chat_window* t = whisper_window_open(name, false)) {
|
||||||
t->pending_messages++;
|
t->pending_messages++;
|
||||||
|
if (t->pending_messages == 1) {
|
||||||
|
DBG_LB << "do whisper pending mark row "
|
||||||
|
<< (t - &open_windows_[0]) << " with " << t->name << "\n";
|
||||||
|
tgrid* grid = roomlistbox_->get_row_grid(t - &open_windows_[0]);
|
||||||
|
//this breaks for some reason
|
||||||
|
//tlabel& label = grid->get_widget<tlabel>("room", false);
|
||||||
|
//label.set_markup_mode(tcontrol::PANGO_MARKUP);
|
||||||
|
//label.set_label(colorize("<" + t->name + ">", "red"));
|
||||||
|
grid->get_widget<timage>("pending_messages", false).set_visible(twidget::VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,6 +679,17 @@ void tlobby_main::increment_waiting_messages(const std::string& room)
|
|||||||
{
|
{
|
||||||
if (tlobby_chat_window* t = room_window_open(room, false)) {
|
if (tlobby_chat_window* t = room_window_open(room, false)) {
|
||||||
t->pending_messages++;
|
t->pending_messages++;
|
||||||
|
if (t->pending_messages == 1) {
|
||||||
|
int idx = t - &open_windows_[0];
|
||||||
|
DBG_LB << "do room pending mark row "
|
||||||
|
<< idx << " with " << t->name << "\n";
|
||||||
|
tgrid* grid = roomlistbox_->get_row_grid(idx);
|
||||||
|
//this breaks for some reason
|
||||||
|
//tlabel& label = grid->get_widget<tlabel>("room", false);
|
||||||
|
//label.set_markup_mode(tcontrol::PANGO_MARKUP);
|
||||||
|
//label.set_label(colorize(t->name, "red"));
|
||||||
|
grid->get_widget<timage>("pending_messages", false).set_visible(twidget::VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -738,19 +761,30 @@ void tlobby_main::active_window_changed()
|
|||||||
{
|
{
|
||||||
tlabel& header = chat_log_container_->
|
tlabel& header = chat_log_container_->
|
||||||
page_grid(active_window_).get_widget<tlabel>("log_header", false);
|
page_grid(active_window_).get_widget<tlabel>("log_header", false);
|
||||||
const tlobby_chat_window& t = open_windows_[active_window_];
|
tlobby_chat_window& t = open_windows_[active_window_];
|
||||||
|
std::string expected_label;
|
||||||
if (t.whisper) {
|
if (t.whisper) {
|
||||||
if (header.label() != ("<" + t.name + ">")) {
|
expected_label = "<" + t.name + ">";
|
||||||
ERR_NG << "Chat log header not what it should be! "
|
|
||||||
<< header.label() << " vs " << ("<" + t.name + ">") << "\n";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (header.label() != (t.name)) {
|
expected_label = t.name;
|
||||||
|
}
|
||||||
|
if (header.label() != expected_label) {
|
||||||
ERR_NG << "Chat log header not what it should be! "
|
ERR_NG << "Chat log header not what it should be! "
|
||||||
<< header.label() << " vs " << t.name << "\n";
|
<< header.label() << " vs " << expected_label << "\n";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DBG_LB << "active window changed to " << active_window_ << " "
|
||||||
|
<< (t.whisper ? "w" : "r") << " "
|
||||||
|
<< t.name << " " << t.pending_messages << " : " << expected_label << "\n";
|
||||||
|
|
||||||
|
//clear pending messages notification in room listbox
|
||||||
|
tgrid* grid = roomlistbox_->get_row_grid(active_window_);
|
||||||
|
//this breaks for some reason
|
||||||
|
//tlabel& label = grid->get_widget<tlabel>("room", false);
|
||||||
|
//label.set_label(expected_label);
|
||||||
|
grid->get_widget<timage>("pending_messages", false).set_visible(twidget::HIDDEN);
|
||||||
|
t.pending_messages = 0;
|
||||||
|
|
||||||
window_->get_widget<tbutton>("close_window", false).set_active(t.whisper || t.name != "lobby");
|
window_->get_widget<tbutton>("close_window", false).set_active(t.whisper || t.name != "lobby");
|
||||||
update_playerlist();
|
update_playerlist();
|
||||||
}
|
}
|
||||||
|
@ -331,6 +331,10 @@ private:
|
|||||||
|
|
||||||
boost::function<void ()> preferences_callback_;
|
boost::function<void ()> preferences_callback_;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This represents the open chat windows (rooms and whispers at the moment)
|
||||||
|
* with 1 to 1 correspondence to what the user sees in the interface
|
||||||
|
*/
|
||||||
std::vector<tlobby_chat_window> open_windows_;
|
std::vector<tlobby_chat_window> open_windows_;
|
||||||
|
|
||||||
size_t active_window_;
|
size_t active_window_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user