mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-25 09:41:11 -06:00
working C++ status bar.
Signed-off-by: tamasmeszaros <meszaros.q@gmail.com>
This commit is contained in:
parent
9e2d48ff3b
commit
15ad0ef2f2
12 changed files with 75 additions and 201 deletions
|
|
@ -12,7 +12,7 @@ namespace Slic3r {
|
|||
*/
|
||||
class ProgressIndicator {
|
||||
public:
|
||||
using CancelFn = std::function<void(void)>; // Cancel functio signature.
|
||||
using CancelFn = std::function<void(void)>; // Cancel function signature.
|
||||
|
||||
private:
|
||||
float state_ = .0f, max_ = 1.f, step_;
|
||||
|
|
@ -28,14 +28,14 @@ public:
|
|||
/// Get the current progress state
|
||||
float state() const { return state_; }
|
||||
|
||||
/// Set the maximum of hte progress range
|
||||
/// Set the maximum of the progress range
|
||||
virtual void max(float maxval) { max_ = maxval; }
|
||||
|
||||
/// Set the current state of the progress.
|
||||
virtual void state(float val) { state_ = val; }
|
||||
|
||||
/**
|
||||
* @brief Number of states int the progress. Can be used insted of giving a
|
||||
* @brief Number of states int the progress. Can be used instead of giving a
|
||||
* maximum value.
|
||||
*/
|
||||
virtual void states(unsigned statenum) {
|
||||
|
|
@ -45,14 +45,14 @@ public:
|
|||
/// Message shown on the next status update.
|
||||
virtual void message(const string&) = 0;
|
||||
|
||||
/// Title of the operaton.
|
||||
/// Title of the operation.
|
||||
virtual void title(const string&) = 0;
|
||||
|
||||
/// Formatted message for the next status update. Works just like sprinf.
|
||||
/// Formatted message for the next status update. Works just like sprintf.
|
||||
virtual void message_fmt(const string& fmt, ...);
|
||||
|
||||
/// Set up a cancel callback for the operation if feasible.
|
||||
inline void on_cancel(CancelFn func) { cancelfunc_ = func; }
|
||||
virtual void on_cancel(CancelFn func = CancelFn()) { cancelfunc_ = func; }
|
||||
|
||||
/**
|
||||
* Explicitly shut down the progress indicator and call the associated
|
||||
|
|
@ -60,7 +60,7 @@ public:
|
|||
*/
|
||||
virtual void cancel() { cancelfunc_(); }
|
||||
|
||||
/// Convinience function to call message and status update in one function.
|
||||
/// Convenience function to call message and status update in one function.
|
||||
void update(float st, const string& msg) {
|
||||
message(msg); state(st);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue