Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortamasmeszaros <meszaros.q@gmail.com>2019-12-16 11:47:31 +0300
committertamasmeszaros <meszaros.q@gmail.com>2019-12-16 13:07:43 +0300
commita9403319b7767e920d7d993e91bf0623c91c7b4b (patch)
tree42efc2962f4992a229a15bd76772973e9f34ed6a /src/slic3r/GUI/ProgressIndicator.hpp
parentf60ff1c7ce02a577003910902a27414612b8de14 (diff)
Separate Job, ProgressStatusBar and ProgressIndicator
* Separate GUI::Job * make use of ProgressIndicator interface * make ProgressStatusbar independent from GUI::App
Diffstat (limited to 'src/slic3r/GUI/ProgressIndicator.hpp')
-rw-r--r--src/slic3r/GUI/ProgressIndicator.hpp63
1 files changed, 11 insertions, 52 deletions
diff --git a/src/slic3r/GUI/ProgressIndicator.hpp b/src/slic3r/GUI/ProgressIndicator.hpp
index 280ba63ac..674a81ba2 100644
--- a/src/slic3r/GUI/ProgressIndicator.hpp
+++ b/src/slic3r/GUI/ProgressIndicator.hpp
@@ -11,58 +11,17 @@ namespace Slic3r {
*/
class ProgressIndicator {
public:
- using CancelFn = std::function<void(void)>; // Cancel function signature.
-
-private:
- float m_state = .0f, m_max = 1.f, m_step;
- CancelFn m_cancelfunc = [](){};
-
-public:
-
- inline virtual ~ProgressIndicator() {}
-
- /// Get the maximum of the progress range.
- float max() const { return m_max; }
-
- /// Get the current progress state
- float state() const { return m_state; }
-
- /// Set the maximum of the progress range
- virtual void max(float maxval) { m_max = maxval; }
-
- /// Set the current state of the progress.
- virtual void state(float val) { m_state = val; }
-
- /**
- * @brief Number of states int the progress. Can be used instead of giving a
- * maximum value.
- */
- virtual void states(unsigned statenum) {
- m_step = m_max / statenum;
- }
-
- /// Message shown on the next status update.
- virtual void message(const std::string&) = 0;
-
- /// Title of the operation.
- virtual void title(const std::string&) = 0;
-
- /// Formatted message for the next status update. Works just like sprintf.
- virtual void message_fmt(const std::string& fmt, ...);
-
- /// Set up a cancel callback for the operation if feasible.
- virtual void on_cancel(CancelFn func = CancelFn()) { m_cancelfunc = func; }
-
- /**
- * Explicitly shut down the progress indicator and call the associated
- * callback.
- */
- virtual void cancel() { m_cancelfunc(); }
-
- /// Convenience function to call message and status update in one function.
- void update(float st, const std::string& msg) {
- message(msg); state(st);
- }
+
+ /// Cancel callback function type
+ using CancelFn = std::function<void()>;
+
+ virtual ~ProgressIndicator() = default;
+
+ virtual void set_range(int range) = 0;
+ virtual void set_cancel_callback(CancelFn = CancelFn()) = 0;
+ virtual void set_progress(int pr) = 0;
+ virtual void set_status_text(const char *) = 0; // utf8 char array
+ virtual int get_range() const = 0;
};
}