The Battle for Wesnoth
1.17.12+dev
gui
dialogs
multiplayer
match_history.cpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2021 - 2022
3
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY.
11
12
See the COPYING file for more details.
13
*/
14
15
#include "
gui/dialogs/multiplayer/match_history.hpp
"
16
17
#include "
formula/string_utils.hpp
"
18
#include "
game_initialization/lobby_data.hpp
"
19
#include "
gettext.hpp
"
20
#include "
gui/widgets/window.hpp
"
21
#include "
wesnothd_connection.hpp
"
22
23
namespace
gui2::dialogs
24
{
25
REGISTER_DIALOG
(mp_match_history)
26
27
mp_match_history
::
mp_match_history
(
mp
::user_info&
info
,
wesnothd_connection
& connection)
28
:
modal_dialog
(window_id())
29
, info_(info)
30
, connection_(connection)
31
{
32
register_label(
"title"
,
true
,
VGETTEXT
(
"Match History — $player"
, {{
"player"
, info_.name}}));
33
}
34
35
void
mp_match_history::pre_show
(
window
&
/*window*/
)
36
{
37
request_history
(0);
38
}
39
40
void
mp_match_history::request_history
(
int
offset)
41
{
42
connection_
.
send_data
({
"game_history_request"
,
config
{
"offset"
, offset } });
43
}
44
45
}
// namespace dialogs
wesnothd_connection::send_data
void send_data(const configr_of &request)
Queues the given data to be sent to the server.
Definition:
wesnothd_connection.cpp:323
REGISTER_DIALOG
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
Definition:
modal_dialog.hpp:89
gettext.hpp
gui2::dialogs::mp_match_history::connection_
wesnothd_connection & connection_
Definition:
match_history.hpp:50
gui2::dialogs::mp_match_history
Definition:
match_history.hpp:29
lg::info
logger & info()
Definition:
log.cpp:182
window.hpp
This file contains the window object, this object is a top level container which has the event manage...
lobby_data.hpp
wesnothd_connection.hpp
mp
Main entry points of multiplayer mode.
Definition:
lobby_data.cpp:52
gui2::dialogs
Definition:
achievements_dialog.cpp:26
wesnothd_connection
A class that represents a TCP/IP connection to the wesnothd server.
Definition:
wesnothd_connection.hpp:53
gui2::dialogs::mp_match_history::request_history
void request_history(int offset)
Definition:
match_history.cpp:40
match_history.hpp
VGETTEXT
#define VGETTEXT(msgid,...)
Handy wrappers around interpolate_variables_into_string and gettext.
Definition:
string_utils.hpp:127
gui2::dialogs::modal_dialog
Abstract base class for all modal dialogs.
Definition:
modal_dialog.hpp:145
string_utils.hpp
config
A config object defines a single node in a WML file, with access to child nodes.
Definition:
config.hpp:60
gui2::dialogs::mp_match_history::pre_show
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
Definition:
match_history.cpp:35
gui2::window
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition:
window.hpp:66
Generated by
1.8.13