xoreos  0.0.5
loadprogress.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef ENGINES_AURORA_LOADPROGRESS_H
26 #define ENGINES_AURORA_LOADPROGRESS_H
27 
28 #include <boost/noncopyable.hpp>
29 
30 #include "src/common/scopedptr.h"
31 #include "src/common/ustring.h"
32 
33 namespace Graphics {
34  namespace Aurora {
35  class Text;
36  }
37 }
38 
39 namespace Engines {
40 
41 class LoadProgress : boost::noncopyable {
42 public:
57  LoadProgress(size_t steps);
58  ~LoadProgress();
59 
61  void step(const Common::UString &description);
62 
63 private:
65  static const int kBarLength = 50;
66 
67  size_t _steps;
68  size_t _currentStep;
69 
70  double _stepAmount;
71  double _currentAmount;
72 
74 
77 
78  // The progress bar, in three parts
82 
85 
86 
87  static Common::UString createProgressbar(size_t length, double filled);
88  static Common::UString createProgressbarUpper(size_t length);
89  static Common::UString createProgressbarLower(size_t length);
90 };
91 
92 } // End of namespace Engines
93 
94 #endif // ENGINES_AURORA_LOADPROGRESS_H
A class holding an UTF-8 string.
Definition: ustring.h:48
LoadProgress(size_t steps)
Create a load progress display.
double _currentAmount
The accumulated amount.
Definition: loadprogress.h:71
static Common::UString createProgressbarUpper(size_t length)
size_t _steps
The number of total steps.
Definition: loadprogress.h:67
size_t _currentStep
The current step we&#39;re on.
Definition: loadprogress.h:68
A simple scoped smart pointer template.
static Common::UString createProgressbarLower(size_t length)
Common::ScopedPtr< Graphics::Aurora::Text > _progressbar
The actual progress bar.
Definition: loadprogress.h:81
A text object.
Definition: text.h:42
uint32 _startTime
The timestamp the first step happened.
Definition: loadprogress.h:73
Common::ScopedPtr< Graphics::Aurora::Text > _barUpper
The upper border of the progress bar.
Definition: loadprogress.h:79
Unicode string handling.
static Common::UString createProgressbar(size_t length, double filled)
Common::ScopedPtr< Graphics::Aurora::Text > _percent
The text containing the current percentage of done-ness.
Definition: loadprogress.h:84
uint32_t uint32
Definition: types.h:204
void step(const Common::UString &description)
Take a step in advancing the progress.
Common::ScopedPtr< Graphics::Aurora::Text > _barLower
The lower border of the progress bar.
Definition: loadprogress.h:80
Common::ScopedPtr< Graphics::Aurora::Text > _description
The text containing the description of the current step.
Definition: loadprogress.h:76
static const int kBarLength
The length of the progress bar in characters.
Definition: loadprogress.h:65
double _stepAmount
The amount to step each time.
Definition: loadprogress.h:70