Made ProgressBar destruction behavior configurable
This commit is contained in:
parent
1511f0a9e0
commit
f0d3364213
|
@ -87,8 +87,10 @@ void ProgressBar::updateLoop() {
|
|||
std::this_thread::sleep_for(animationInterval);
|
||||
}
|
||||
|
||||
if (clearOnDestruction) {
|
||||
updateText("");
|
||||
}
|
||||
}
|
||||
|
||||
void ProgressBar::updateText(const string& text) {
|
||||
// Get length of common portion
|
||||
|
|
|
@ -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