From 77df54947bb4a7eed2055f15faf08f075cc1330c Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Sat, 3 Aug 2019 08:51:03 +0200 Subject: [PATCH] Follow-up of c791ba776f96c8fa18c435c12dad2c726af46c3b -> Estimated times for color print layed-out as 'time for color (remaining time at color start)' --- src/libslic3r/GCodeTimeEstimator.cpp | 31 ++++++++++++++-------------- src/libslic3r/GCodeTimeEstimator.hpp | 8 +++---- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/libslic3r/GCodeTimeEstimator.cpp b/src/libslic3r/GCodeTimeEstimator.cpp index 87f8bca65d..8a2e1266a8 100644 --- a/src/libslic3r/GCodeTimeEstimator.cpp +++ b/src/libslic3r/GCodeTimeEstimator.cpp @@ -694,38 +694,39 @@ namespace Slic3r { return m_color_times; } - std::vector GCodeTimeEstimator::get_color_times_dhms(bool include_absolute) const + std::vector GCodeTimeEstimator::get_color_times_dhms(bool include_remaining) const { std::vector ret; float total_time = 0.0f; for (float t : m_color_times) { - total_time += t; - std::string time = ""; - if (include_absolute) - time += _get_time_dhms(total_time) + " ("; - time += _get_time_dhms(t); - if (include_absolute) + std::string time = _get_time_dhms(t); + if (include_remaining) + { + time += " ("; + time += _get_time_dhms(m_time - total_time); time += ")"; + } + total_time += t; ret.push_back(time); } return ret; } - std::vector GCodeTimeEstimator::get_color_times_minutes(bool include_absolute) const + std::vector GCodeTimeEstimator::get_color_times_minutes(bool include_remaining) const { std::vector ret; float total_time = 0.0f; for (float t : m_color_times) { - total_time += t; - std::string time = ""; - if (include_absolute) - time += _get_time_minutes(total_time) + " ("; - time += _get_time_minutes(t); - if (include_absolute) + std::string time = _get_time_minutes(t); + if (include_remaining) + { + time += " ("; + time += _get_time_minutes(m_time - total_time); time += ")"; - ret.push_back(time); + } + total_time += t; } return ret; } diff --git a/src/libslic3r/GCodeTimeEstimator.hpp b/src/libslic3r/GCodeTimeEstimator.hpp index 792fb72a51..8d794af1e4 100644 --- a/src/libslic3r/GCodeTimeEstimator.hpp +++ b/src/libslic3r/GCodeTimeEstimator.hpp @@ -350,12 +350,12 @@ namespace Slic3r { std::vector get_color_times() const; // Returns the estimated time, in format DDd HHh MMm SSs, for each color - // If include_absolute==true the strings will be formatted as: "absolute time (relative time)" - std::vector get_color_times_dhms(bool include_absolute) const; + // If include_remaining==true the strings will be formatted as: "time for color (remaining time at color start)" + std::vector get_color_times_dhms(bool include_remaining) const; // Returns the estimated time, in minutes (integer), for each color - // If include_absolute==true the strings will be formatted as: "absolute time (relative time)" - std::vector get_color_times_minutes(bool include_absolute) const; + // If include_remaining==true the strings will be formatted as: "time for color (remaining time at color start)" + std::vector get_color_times_minutes(bool include_remaining) const; // Return an estimate of the memory consumed by the time estimator. size_t memory_used() const;