Renamed PrintBase::Status to SlicingStatusEvent

Hopefully it will fix compilation on Linux (some forgotten Status macro?)
This commit is contained in:
bubnikv 2018-11-20 16:27:30 +01:00
parent 8ecb2163b6
commit 22a7afabba
3 changed files with 9 additions and 9 deletions

View file

@ -236,8 +236,8 @@ public:
virtual void process() = 0; virtual void process() = 0;
struct Status { struct SlicingStatus {
Status(int percent, const std::string &text, unsigned int flags = 0) : percent(percent), text(text), flags(flags) {} SlicingStatus(int percent, const std::string &text, unsigned int flags = 0) : percent(percent), text(text), flags(flags) {}
int percent; int percent;
std::string text; std::string text;
// Bitmap of flags. // Bitmap of flags.
@ -247,16 +247,16 @@ public:
// Bitmap of FlagBits // Bitmap of FlagBits
unsigned int flags; unsigned int flags;
}; };
typedef std::function<void(const Status&)> status_callback_type; typedef std::function<void(const SlicingStatus&)> status_callback_type;
// Default status console print out in the form of percent => message. // Default status console print out in the form of percent => message.
void set_status_default() { m_status_callback = nullptr; } void set_status_default() { m_status_callback = nullptr; }
// No status output or callback whatsoever, useful mostly for automatic tests. // No status output or callback whatsoever, useful mostly for automatic tests.
void set_status_silent() { m_status_callback = [](const Status&){}; } void set_status_silent() { m_status_callback = [](const SlicingStatus&){}; }
// Register a custom status callback. // Register a custom status callback.
void set_status_callback(status_callback_type cb) { m_status_callback = cb; } void set_status_callback(status_callback_type cb) { m_status_callback = cb; }
// Calls a registered callback to update the status, or print out the default message. // Calls a registered callback to update the status, or print out the default message.
void set_status(int percent, const std::string &message, unsigned int flags = 0) { void set_status(int percent, const std::string &message, unsigned int flags = 0) {
if (m_status_callback) m_status_callback(Status(percent, message, flags)); if (m_status_callback) m_status_callback(SlicingStatus(percent, message, flags));
else printf("%d => %s\n", percent, message.c_str()); else printf("%d => %s\n", percent, message.c_str());
} }

View file

@ -20,11 +20,11 @@ class SLAPrint;
class SlicingStatusEvent : public wxEvent class SlicingStatusEvent : public wxEvent
{ {
public: public:
SlicingStatusEvent(wxEventType eventType, int winid, const PrintBase::Status &status) : SlicingStatusEvent(wxEventType eventType, int winid, const PrintBase::SlicingStatus &status) :
wxEvent(winid, eventType), status(std::move(status)) {} wxEvent(winid, eventType), status(std::move(status)) {}
virtual wxEvent *Clone() const { return new SlicingStatusEvent(*this); } virtual wxEvent *Clone() const { return new SlicingStatusEvent(*this); }
PrintBase::Status status; PrintBase::SlicingStatus status;
}; };
wxDEFINE_EVENT(EVT_SLICING_UPDATE, SlicingStatusEvent); wxDEFINE_EVENT(EVT_SLICING_UPDATE, SlicingStatusEvent);

View file

@ -1022,7 +1022,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
background_process.select_technology(this->printer_technology); background_process.select_technology(this->printer_technology);
// Register progress callback from the Print class to the Platter. // Register progress callback from the Print class to the Platter.
auto statuscb = [this](const Slic3r::PrintBase::Status &status) { auto statuscb = [this](const Slic3r::PrintBase::SlicingStatus &status) {
wxQueueEvent(this->q, new Slic3r::SlicingStatusEvent(EVT_SLICING_UPDATE, 0, status)); wxQueueEvent(this->q, new Slic3r::SlicingStatusEvent(EVT_SLICING_UPDATE, 0, status));
}; };
print.set_status_callback(statuscb); print.set_status_callback(statuscb);
@ -1883,7 +1883,7 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
{ {
this->statusbar()->set_progress(evt.status.percent); this->statusbar()->set_progress(evt.status.percent);
this->statusbar()->set_status_text(_(L(evt.status.text)) + wxString::FromUTF8("")); this->statusbar()->set_status_text(_(L(evt.status.text)) + wxString::FromUTF8(""));
if (evt.status.flags & PrintBase::Status::RELOAD_SCENE) { if (evt.status.flags & PrintBase::SlicingStatus::RELOAD_SCENE) {
switch (this->printer_technology) { switch (this->printer_technology) {
case ptFFF: case ptFFF:
if (this->preview != nullptr) if (this->preview != nullptr)