The Battle for Wesnoth  1.19.7+dev
file_progress.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2021 - 2024
3  by Iris Morelle <shadowm@wesnoth.org>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
19 
20 #include <chrono>
21 
22 namespace gui2::dialogs {
23 
25 {
26 public:
27  file_progress(const std::string& title, const std::string& message);
28 
29  template<typename... T>
30  static auto display(T&&... args)
31  {
32  auto instance = std::make_unique<file_progress>(std::forward<T>(args)...);
33  instance->show(true);
34  return instance;
35  }
36 
37  void update_progress(unsigned value);
38 
39 private:
40  /** Inherited from modeless_dialog. */
41  virtual const std::string& window_id() const override;
42 
43  std::string title_;
44  std::string message_;
45 
46  using clock = std::chrono::steady_clock;
47 
48  std::chrono::time_point<clock> update_time_;
49 };
50 
51 }
void update_progress(unsigned value)
file_progress(const std::string &title, const std::string &message)
std::chrono::steady_clock clock
std::chrono::time_point< clock > update_time_
virtual const std::string & window_id() const override
Inherited from modeless_dialog.
static auto display(T &&... args)
Main class to show messages to the user.
Definition: message.hpp:36
The popup class shows windows that are shown non-modal.