Made ProgressBar destruction behavior configurable
This commit is contained in:
parent
1511f0a9e0
commit
f0d3364213
|
@ -87,7 +87,9 @@ void ProgressBar::updateLoop() {
|
|||
std::this_thread::sleep_for(animationInterval);
|
||||
}
|
||||
|
||||
updateText("");
|
||||
if (clearOnDestruction) {
|
||||
updateText("");
|
||||
}
|
||||
}
|
||||
|
||||
void ProgressBar::updateText(const string& text) {
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue