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);
|
std::this_thread::sleep_for(animationInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (clearOnDestruction) {
|
||||||
updateText("");
|
updateText("");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ProgressBar::updateText(const string& text) {
|
void ProgressBar::updateText(const string& text) {
|
||||||
// Get length of common portion
|
// Get length of common portion
|
||||||
|
|
|
@ -48,6 +48,14 @@ public:
|
||||||
~ProgressBar();
|
~ProgressBar();
|
||||||
void reportProgress(double value) override;
|
void reportProgress(double value) override;
|
||||||
|
|
||||||
|
bool getClearOnDestruction() const {
|
||||||
|
return clearOnDestruction;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setClearOnDestruction(bool value) {
|
||||||
|
clearOnDestruction = value;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateLoop();
|
void updateLoop();
|
||||||
void updateText(const std::string& text);
|
void updateText(const std::string& text);
|
||||||
|
@ -59,4 +67,5 @@ private:
|
||||||
std::ostream& stream;
|
std::ostream& stream;
|
||||||
std::string currentText;
|
std::string currentText;
|
||||||
int animationIndex = 0;
|
int animationIndex = 0;
|
||||||
|
bool clearOnDestruction = true;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue