16 #define GETTEXT_DOMAIN "wesnoth-lib"
28 using namespace std::chrono_literals;
37 if(connection_->finished()) {
40 size_t completed, total;
41 completed = connection_->current();
42 total = connection_->total();
45 .set_percentage((completed * 100.) / total);
51 window_.ptr()->find_widget<
label>(
"numeric_progress")
53 window_->invalidate_layout();
60 const std::string& title,
61 const std::string& subtitle)
63 , connection_(&connection)
64 , pump_monitor_(connection_)
75 = find_widget<label>(
"subtitle");
83 find_widget<label>(
"numeric_progress").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.
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() override
Actions to be taken before showing the window.
connection_data * connection_
virtual void post_show() override
Actions to be taken after the window has been shown.
static std::string _(const char *str)
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.