synfig-core  1.0.3
renderprogress.h
Go to the documentation of this file.
1 /* === S Y N F I G ========================================================= */
23 /* ========================================================================= */
24 
25 #ifndef __SYNFIG_RENDERPROGRESS_H
26 #define __SYNFIG_RENDERPROGRESS_H
27 
28 #include <string>
29 #include <iosfwd>
30 #include <boost/chrono.hpp>
31 #include <synfig/general.h>
32 #include "definitions.h"
33 
34 
37 {
38 public:
39 
41 
42  virtual bool task(const std::string& taskname);
43 
44  virtual bool error(const std::string& task);
45 
46  virtual bool warning(const std::string& task);
47 
48  virtual bool amount_complete(int scanline, int height);
49 private:
50  std::string taskname_;
51  int last_frame_;
52  size_t last_printed_line_length_;
53 
54  typedef boost::chrono::system_clock Clock;
55  typedef boost::chrono::duration<double> Duration;
56  Clock::time_point start_timepoint_;
57  Clock::time_point last_timepoint_;
58  double remaining_rendered_proportion_;
59 
60  void printRemainingTime(std::ostream& os, double remaining_seconds) const;
61 
62  void printRemainingTime(std::ostream& os,
63  const int seconds, const int minutes,
64  const int hours, const int days,
65  const int weeks) const;
66  std::string extendLineToClearRest(std::string line,
67  size_t last_line_length) const;
68 };
69 
70 #endif