16 #define GETTEXT_DOMAIN "wesnoth-lib"
29 using namespace std::chrono_literals;
38 if(connection_->finished()) {
41 size_t completed, total;
42 completed = connection_->current();
43 total = connection_->total();
45 find_widget<progress_bar>(window_.ptr(),
"progress",
false)
46 .set_percentage((completed * 100.) / total);
52 find_widget<label>(window_.ptr(),
"numeric_progress",
false)
54 window_->invalidate_layout();
61 const std::string& title,
62 const std::string& subtitle)
64 , connection_(&connection)
65 , pump_monitor_(connection_)
76 = find_widget<label>(&
window,
"subtitle",
false);
84 find_widget<label>(&
window,
"numeric_progress",
false).set_label(
" ");
Abstract base class for all modal dialogs.
field_label * register_label(const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false)
Registers a new styled_widget as a label.
int get_retval() const
Returns the cached window exit code.
A wrapper of either a wesnothd_connection or a network_asio::connection.
utils::optional_reference< window > window_
Dialog that tracks network transmissions.
std::string subtitle_
The subtitle for the dialog.
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
network_transmission(connection_data &connection, const std::string &title, const std::string &subtitle)
gui2::dialogs::network_transmission::pump_monitor pump_monitor_
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
connection_data * connection_
A label displays text that can be wrapped but no scrollbars are provided.
base class of top level items, the only item which needs to store the final canvases to draw on.
static std::string _(const char *str)
Handling of system events.
REGISTER_DIALOG(editor_edit_unit)
@ OK
Dialog was closed with the OK button.
@ CANCEL
Dialog was closed with the CANCEL button.
std::string si_string(double input, bool base2, const std::string &unit)
Convert into a string with an SI-postfix.