mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 14:43:37 +00:00
GUI2 network transmission dialog improvements:
Added feedback on whether it's connecting/downloading and made strings translatable.
This commit is contained in:
parent
cb77683a2f
commit
882bed8c8b
@ -39,6 +39,23 @@
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[label]
|
||||
id = "subtitle"
|
||||
definition = "default"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
|
@ -1126,13 +1126,14 @@ namespace {
|
||||
try {
|
||||
if(gui2::new_widgets) {
|
||||
network_asio::connection connection(remote_host, lexical_cast<std::string>(remote_port));
|
||||
gui2::tnetwork_transmission network_connect(connection, "WIP network transmission dialog");
|
||||
gui2::tnetwork_transmission network_connect(connection, _("Requesting list of add-ons"), _("Connecting..."));
|
||||
bool result = network_connect.show(disp.video());
|
||||
if(!result)
|
||||
return;
|
||||
config cfg, response;
|
||||
cfg.add_child("request_campaign_list");
|
||||
connection.transfer(cfg, response);
|
||||
network_connect.set_subtitle(_("Downloading..."));
|
||||
result = network_connect.show(disp.video());
|
||||
if(!result)
|
||||
return;
|
||||
|
@ -52,12 +52,20 @@ void tnetwork_transmission::pump_monitor::process(events::pump_info&)
|
||||
}
|
||||
}
|
||||
|
||||
void tnetwork_transmission::set_subtitle(const std::string& subtitle)
|
||||
{
|
||||
subtitle_ = subtitle;
|
||||
}
|
||||
|
||||
void tnetwork_transmission::pre_show(CVideo& /*video*/, twindow& window)
|
||||
{
|
||||
// ***** ***** ***** ***** Set up the widgets ***** ***** ***** *****
|
||||
if(!title_.empty()) {
|
||||
find_widget<tlabel>(&window, "title", false).set_label(title_);
|
||||
}
|
||||
if(!subtitle_.empty()) {
|
||||
find_widget<tlabel>(&window, "subtitle", false).set_label(subtitle_);
|
||||
}
|
||||
|
||||
pump_monitor.window_ = window;
|
||||
|
||||
|
@ -49,10 +49,12 @@ class tnetwork_transmission : public tdialog
|
||||
boost::optional<twindow&> window_;
|
||||
} pump_monitor;
|
||||
public:
|
||||
tnetwork_transmission(network_asio::connection& connection, const std::string& title)
|
||||
: connection_(connection), pump_monitor(connection), title_(title)
|
||||
tnetwork_transmission(network_asio::connection& connection, const std::string& title, const std::string& subtitle)
|
||||
: connection_(connection), pump_monitor(connection), title_(title), subtitle_(subtitle)
|
||||
{}
|
||||
|
||||
void set_subtitle(const std::string&);
|
||||
|
||||
protected:
|
||||
/** Inherited from tdialog. */
|
||||
void pre_show(CVideo& video, twindow& window);
|
||||
@ -63,6 +65,7 @@ protected:
|
||||
private:
|
||||
/** The title for the dialog. */
|
||||
std::string title_;
|
||||
std::string subtitle_;
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user