Made ProgressBar destruction behavior configurable

This commit is contained in:
Daniel Wolf 2017-09-09 21:41:50 +02:00
parent 1511f0a9e0
commit f0d3364213
2 changed files with 12 additions and 1 deletions

View File

@ -87,7 +87,9 @@ void ProgressBar::updateLoop() {
std::this_thread::sleep_for(animationInterval);
}
if (clearOnDestruction) {
updateText("");
}
}
void ProgressBar::updateText(const string& text) {

View File

@ -48,6 +48,14 @@ public:
~ProgressBar();
void reportProgress(double value) override;
bool getClearOnDestruction() const {
return clearOnDestruction;
}
void setClearOnDestruction(bool value) {
clearOnDestruction = value;
}
private:
void updateLoop();
void updateText(const std::string& text);
@ -59,4 +67,5 @@ private:
std::ostream& stream;
std::string currentText;
int animationIndex = 0;
bool clearOnDestruction = true;
};