Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_copy_and_paste

This commit is contained in:
Enrico Turri 2019-05-13 11:59:29 +02:00
commit 9b8323389e
2 changed files with 24 additions and 14 deletions

View file

@ -60,7 +60,7 @@ void PreferencesDialog::build()
// Please keep in sync with ConfigWizard // Please keep in sync with ConfigWizard
def.label = L("Check for application updates"); def.label = L("Check for application updates");
def.type = coBool; def.type = coBool;
def.tooltip = L("If enabled, Slic3r checks for new versions of " SLIC3R_APP_NAME " online. When a new version becomes available a notification is displayed at the next application startup (never during program usage). This is only a notification mechanisms, no automatic installation is done."); def.tooltip = L("If enabled, PrusaSlicer will check for the new versions of itself online. When a new version becomes available a notification is displayed at the next application startup (never during program usage). This is only a notification mechanisms, no automatic installation is done.");
def.set_default_value(new ConfigOptionBool(app_config->get("version_check") == "1")); def.set_default_value(new ConfigOptionBool(app_config->get("version_check") == "1"));
option = Option (def, "version_check"); option = Option (def, "version_check");
m_optgroup->append_single_option_line(option); m_optgroup->append_single_option_line(option);

View file

@ -67,16 +67,18 @@ ProgressStatusBar::ProgressStatusBar(wxWindow *parent, int id):
} }
ProgressStatusBar::~ProgressStatusBar() { ProgressStatusBar::~ProgressStatusBar() {
if(m_timer->IsRunning()) m_timer->Stop(); if(m_timer && m_timer->IsRunning()) m_timer->Stop();
} }
int ProgressStatusBar::get_progress() const int ProgressStatusBar::get_progress() const
{ {
return m_prog->GetValue(); return m_prog ? m_prog->GetValue() : 0;
} }
void ProgressStatusBar::set_progress(int val) void ProgressStatusBar::set_progress(int val)
{ {
if(!m_prog) return;
if(!m_prog->IsShown()) show_progress(true); if(!m_prog->IsShown()) show_progress(true);
if(val < 0) return; if(val < 0) return;
@ -91,24 +93,28 @@ void ProgressStatusBar::set_progress(int val)
int ProgressStatusBar::get_range() const int ProgressStatusBar::get_range() const
{ {
return m_prog->GetRange(); return m_prog ? m_prog->GetRange() : 0;
} }
void ProgressStatusBar::set_range(int val) void ProgressStatusBar::set_range(int val)
{ {
if(val != m_prog->GetRange()) { if(m_prog && val != m_prog->GetRange()) {
m_prog->SetRange(val); m_prog->SetRange(val);
} }
} }
void ProgressStatusBar::show_progress(bool show) void ProgressStatusBar::show_progress(bool show)
{ {
m_prog->Show(show); if(m_prog) {
m_prog->Pulse(); m_prog->Show(show);
m_prog->Pulse();
}
} }
void ProgressStatusBar::start_busy(int rate) void ProgressStatusBar::start_busy(int rate)
{ {
if(!m_prog) return;
m_busy = true; m_busy = true;
show_progress(true); show_progress(true);
if (!m_timer->IsRunning()) { if (!m_timer->IsRunning()) {
@ -118,6 +124,8 @@ void ProgressStatusBar::start_busy(int rate)
void ProgressStatusBar::stop_busy() void ProgressStatusBar::stop_busy()
{ {
if(!m_timer || !m_prog) return;
m_timer->Stop(); m_timer->Stop();
show_progress(false); show_progress(false);
m_prog->SetValue(0); m_prog->SetValue(0);
@ -126,13 +134,15 @@ void ProgressStatusBar::stop_busy()
void ProgressStatusBar::set_cancel_callback(ProgressStatusBar::CancelFn ccb) { void ProgressStatusBar::set_cancel_callback(ProgressStatusBar::CancelFn ccb) {
m_cancel_cb = ccb; m_cancel_cb = ccb;
if(ccb) m_cancelbutton->Show(); if(m_cancelbutton) {
else m_cancelbutton->Hide(); if(ccb) m_cancelbutton->Show();
else m_cancelbutton->Hide();
}
} }
void ProgressStatusBar::run(int rate) void ProgressStatusBar::run(int rate)
{ {
if(!m_timer->IsRunning()) { if(m_timer && !m_timer->IsRunning()) {
m_timer->Start(rate); m_timer->Start(rate);
} }
} }
@ -140,12 +150,12 @@ void ProgressStatusBar::run(int rate)
void ProgressStatusBar::embed(wxFrame *frame) void ProgressStatusBar::embed(wxFrame *frame)
{ {
wxFrame* mf = frame ? frame : GUI::wxGetApp().mainframe; wxFrame* mf = frame ? frame : GUI::wxGetApp().mainframe;
mf->SetStatusBar(self); if(mf) mf->SetStatusBar(self);
} }
void ProgressStatusBar::set_status_text(const wxString& txt) void ProgressStatusBar::set_status_text(const wxString& txt)
{ {
self->SetStatusText(txt); if(self) self->SetStatusText(txt);
} }
void ProgressStatusBar::set_status_text(const std::string& txt) void ProgressStatusBar::set_status_text(const std::string& txt)
@ -160,12 +170,12 @@ void ProgressStatusBar::set_status_text(const char *txt)
void ProgressStatusBar::show_cancel_button() void ProgressStatusBar::show_cancel_button()
{ {
m_cancelbutton->Show(); if(m_cancelbutton) m_cancelbutton->Show();
} }
void ProgressStatusBar::hide_cancel_button() void ProgressStatusBar::hide_cancel_button()
{ {
m_cancelbutton->Hide(); if(m_cancelbutton) m_cancelbutton->Hide();
} }
} }