Added basic dialog definitions for the Match History viewer
This commit is contained in:
parent
3ff0b7f081
commit
e3f8b68796
4 changed files with 218 additions and 0 deletions
124
data/gui/window/mp_match_history.cfg
Normal file
124
data/gui/window/mp_match_history.cfg
Normal file
|
@ -0,0 +1,124 @@
|
|||
#textdomain wesnoth-lib
|
||||
|
||||
#define _GUI_MATCH_HISTORY_LIST
|
||||
[listbox]
|
||||
id = "history"
|
||||
definition = "default"
|
||||
|
||||
vertical_scrollbar_mode = "auto"
|
||||
horizontal_scrollbar_mode = "never"
|
||||
|
||||
[list_definition]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
horizontal_grow = true
|
||||
|
||||
[toggle_panel]
|
||||
definition = "default"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
[spacer]
|
||||
[/spacer]
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/toggle_panel]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/list_definition]
|
||||
|
||||
[/listbox]
|
||||
#enddef
|
||||
|
||||
[window]
|
||||
id = "mp_match_history"
|
||||
description = "Shows a player's multiplayer game history."
|
||||
|
||||
[resolution]
|
||||
definition = "default"
|
||||
|
||||
automatic_placement = true
|
||||
vertical_placement = "center"
|
||||
horizontal_placement = "center"
|
||||
|
||||
maximum_width = 800
|
||||
maximum_height = 600
|
||||
|
||||
[tooltip]
|
||||
id = "tooltip"
|
||||
[/tooltip]
|
||||
|
||||
[helptip]
|
||||
id = "tooltip"
|
||||
[/helptip]
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
horizontal_grow = true
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "title"
|
||||
definition = "title"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = true
|
||||
|
||||
{_GUI_MATCH_HISTORY_LIST}
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_alignment = right
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[button]
|
||||
id = "ok"
|
||||
definition = "default"
|
||||
label = _ "Close"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/resolution]
|
||||
|
||||
[/window]
|
||||
|
||||
#undef _GUI_MATCH_HISTORY_LIST
|
|
@ -210,6 +210,7 @@ gui/dialogs/modal_dialog.cpp
|
|||
gui/dialogs/modeless_dialog.cpp
|
||||
gui/dialogs/multiplayer/faction_select.cpp
|
||||
gui/dialogs/multiplayer/lobby.cpp
|
||||
gui/dialogs/multiplayer/match_history.cpp
|
||||
gui/dialogs/multiplayer/mp_alerts_options.cpp
|
||||
gui/dialogs/multiplayer/mp_change_control.cpp
|
||||
gui/dialogs/multiplayer/mp_connect.cpp
|
||||
|
|
40
src/gui/dialogs/multiplayer/match_history.cpp
Normal file
40
src/gui/dialogs/multiplayer/match_history.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
Copyright (C) 2021 by the Battle for Wesnoth Project https://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#include "gui/dialogs/multiplayer/match_history.hpp"
|
||||
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "game_initialization/lobby_data.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "wesnothd_connection.hpp"
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
REGISTER_DIALOG(mp_match_history)
|
||||
|
||||
mp_match_history::mp_match_history(mp::user_info& info, wesnothd_connection& connection)
|
||||
: info_(info)
|
||||
, connection_(connection)
|
||||
{
|
||||
register_label("title", true, VGETTEXT("Match History — $player", {{"player", info.name}}));
|
||||
}
|
||||
|
||||
void mp_match_history::pre_show(window& /*window*/)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
53
src/gui/dialogs/multiplayer/match_history.hpp
Normal file
53
src/gui/dialogs/multiplayer/match_history.hpp
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
Copyright (C) 2021 by the Battle for Wesnoth Project https://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gui/dialogs/modal_dialog.hpp"
|
||||
|
||||
namespace mp { struct user_info; }
|
||||
|
||||
class wesnothd_connection;
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
class window;
|
||||
|
||||
namespace dialogs
|
||||
{
|
||||
class mp_match_history : public modal_dialog
|
||||
{
|
||||
public:
|
||||
mp_match_history(mp::user_info& info, wesnothd_connection& connection);
|
||||
|
||||
/**
|
||||
* The display function.
|
||||
*
|
||||
* See @ref modal_dialog for more information.
|
||||
*/
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(mp_match_history)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const override;
|
||||
|
||||
/** Inherited from modal_dialog. */
|
||||
virtual void pre_show(window& window) override;
|
||||
|
||||
mp::user_info& info_;
|
||||
|
||||
wesnothd_connection& connection_;
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
Loading…
Add table
Reference in a new issue