Removes bottom status bar.

StatusBar class calls are commented out and replaced with notifications.
SlicicingProgress notification shows progress of slicing, ProgressIndicator notification handles other progress information, like arrange objects etc.
This commit is contained in:
David Kocik 2021-09-10 14:31:31 +02:00
parent 3db4804e47
commit b9dab7540e
23 changed files with 908 additions and 292 deletions

View file

@ -9,6 +9,7 @@ namespace Slic3r {
class ModelInstance;
namespace GUI {
class NotificationManager;
class ArrangeJob : public PlaterJob
{
@ -39,8 +40,8 @@ protected:
void process() override;
public:
ArrangeJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater)
: PlaterJob{std::move(pri), plater}
ArrangeJob(std::shared_ptr<NotificationManager> nm, Plater *plater)
: PlaterJob{nm, plater}
{}
int status_range() const override

View file

@ -6,6 +6,7 @@
namespace Slic3r { namespace GUI {
class Plater;
class NotificationManager;
class FillBedJob : public PlaterJob
{
@ -27,8 +28,8 @@ protected:
void process() override;
public:
FillBedJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater)
: PlaterJob{std::move(pri), plater}
FillBedJob(std::shared_ptr<NotificationManager> nm, Plater *plater)
: PlaterJob{nm, plater}
{}
int status_range() const override

View file

@ -2,9 +2,11 @@
#include <exception>
#include "Job.hpp"
#include "../NotificationManager.hpp"
#include <libslic3r/Thread.hpp>
#include <boost/log/trivial.hpp>
namespace Slic3r {
void GUI::Job::run(std::exception_ptr &eptr)
@ -30,8 +32,8 @@ void GUI::Job::update_status(int st, const wxString &msg)
wxQueueEvent(this, evt);
}
GUI::Job::Job(std::shared_ptr<ProgressIndicator> pri)
: m_progress(std::move(pri))
GUI::Job::Job(std::shared_ptr<NotificationManager> nm)
: m_notifications(nm)
{
m_thread_evt_id = wxNewId();
@ -40,21 +42,21 @@ GUI::Job::Job(std::shared_ptr<ProgressIndicator> pri)
auto msg = evt.GetString();
if (!msg.empty() && !m_worker_error)
m_progress->set_status_text(msg.ToUTF8().data());
m_notifications->progress_indicator_set_status_text(msg.ToUTF8().data());
if (m_finalized) return;
m_progress->set_progress(evt.GetInt());
m_notifications->progress_indicator_set_progress(evt.GetInt());
if (evt.GetInt() == status_range() || m_worker_error) {
// set back the original range and cancel callback
m_progress->set_range(m_range);
m_progress->set_cancel_callback();
m_notifications->progress_indicator_set_range(m_range);
m_notifications->progress_indicator_set_cancel_callback();
wxEndBusyCursor();
if (m_worker_error) {
m_finalized = true;
m_progress->set_status_text("");
m_progress->set_progress(m_range);
m_notifications->progress_indicator_set_status_text("");
m_notifications->progress_indicator_set_progress(m_range);
on_exception(m_worker_error);
}
else {
@ -86,12 +88,12 @@ void GUI::Job::start()
prepare();
// Save the current status indicatior range and push the new one
m_range = m_progress->get_range();
m_progress->set_range(status_range());
m_range = m_notifications->progress_indicator_get_range();
m_notifications->progress_indicator_set_range(status_range());
// init cancellation flag and set the cancel callback
m_canceled.store(false);
m_progress->set_cancel_callback(
m_notifications->progress_indicator_set_cancel_callback(
[this]() { m_canceled.store(true); });
m_finalized = false;

View file

@ -8,14 +8,13 @@
#include <slic3r/GUI/I18N.hpp>
#include "ProgressIndicator.hpp"
#include <wx/event.h>
#include <boost/thread.hpp>
namespace Slic3r { namespace GUI {
class NotificationManager;
// A class to handle UI jobs like arranging and optimizing rotation.
// These are not instant jobs, the user has to be informed about their
// state in the status progress indicator. On the other hand they are
@ -33,7 +32,7 @@ class Job : public wxEvtHandler
boost::thread m_thread;
std::atomic<bool> m_running{false}, m_canceled{false};
bool m_finalized = false, m_finalizing = false;
std::shared_ptr<ProgressIndicator> m_progress;
std::shared_ptr<NotificationManager> m_notifications;
std::exception_ptr m_worker_error = nullptr;
void run(std::exception_ptr &);
@ -65,7 +64,7 @@ protected:
}
public:
Job(std::shared_ptr<ProgressIndicator> pri);
Job(std::shared_ptr<NotificationManager> nm);
bool is_finalized() const { return m_finalized; }

View file

@ -6,6 +6,7 @@
namespace Slic3r { namespace GUI {
class Plater;
class NotificationManager;
class PlaterJob : public Job {
protected:
@ -15,8 +16,8 @@ protected:
public:
PlaterJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater):
Job{std::move(pri)}, m_plater{plater} {}
PlaterJob(std::shared_ptr<NotificationManager> nm, Plater *plater):
Job{nm}, m_plater{plater} {}
};
}} // namespace Slic3r::GUI

View file

@ -10,6 +10,8 @@ namespace Slic3r {
namespace GUI {
class NotificationManager;
class RotoptimizeJob : public PlaterJob
{
using FindFn = std::function<Vec2d(const ModelObject & mo,
@ -52,8 +54,8 @@ protected:
public:
RotoptimizeJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater)
: PlaterJob{std::move(pri), plater}
RotoptimizeJob(std::shared_ptr<NotificationManager> nm, Plater *plater)
: PlaterJob{nm, plater}
{}
void finalize() override;

View file

@ -6,6 +6,7 @@
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/Plater.hpp"
#include "slic3r/GUI/GUI_ObjectList.hpp"
#include "slic3r/GUI/NotificationManager.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/PresetBundle.hpp"
@ -124,8 +125,8 @@ public:
priv(Plater *plt) : plater{plt} {}
};
SLAImportJob::SLAImportJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater)
: PlaterJob{std::move(pri), plater}, p{std::make_unique<priv>(plater)}
SLAImportJob::SLAImportJob(std::shared_ptr<NotificationManager> nm, Plater *plater)
: PlaterJob{nm, plater}, p{std::make_unique<priv>(plater)}
{}
SLAImportJob::~SLAImportJob() = default;

View file

@ -5,6 +5,8 @@
namespace Slic3r { namespace GUI {
class NotificationManager;
class SLAImportJob : public PlaterJob {
class priv;
@ -16,7 +18,7 @@ protected:
void finalize() override;
public:
SLAImportJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater);
SLAImportJob(std::shared_ptr<NotificationManager> nm, Plater *plater);
~SLAImportJob();
void reset();