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

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/slic3r/GUI/BonjourDialog.cpp')
-rw-r--r--src/slic3r/GUI/BonjourDialog.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/slic3r/GUI/BonjourDialog.cpp b/src/slic3r/GUI/BonjourDialog.cpp
index 8ee01c949..51f18dce7 100644
--- a/src/slic3r/GUI/BonjourDialog.cpp
+++ b/src/slic3r/GUI/BonjourDialog.cpp
@@ -108,8 +108,7 @@ bool BonjourDialog::show_and_lookup()
timer->SetOwner(this);
timer_state = 1;
timer->Start(1000);
- wxTimerEvent evt_dummy;
- on_timer(evt_dummy);
+ on_timer_process();
// The background thread needs to queue messages for this dialog
// and for that it needs a valid pointer to it (mandated by the wxWidgets API).
@@ -215,17 +214,26 @@ void BonjourDialog::on_reply(BonjourReplyEvent &e)
void BonjourDialog::on_timer(wxTimerEvent &)
{
+ on_timer_process();
+}
+
+// This is here so the function can be bound to wxEVT_TIMER and also called
+// explicitly (wxTimerEvent should not be created by user code).
+void BonjourDialog::on_timer_process()
+{
const auto search_str = _utf8(L("Searching for devices"));
- if (timer_state > 0) {
- const std::string dots(timer_state, '.');
+ if (timer_state > 0) {
+ const std::string dots(timer_state, '.');
label->SetLabel(GUI::from_u8((boost::format("%1% %2%") % search_str % dots).str()));
- timer_state = (timer_state) % 3 + 1;
- } else {
+ timer_state = (timer_state) % 3 + 1;
+ } else {
label->SetLabel(GUI::from_u8((boost::format("%1%: %2%") % search_str % (_utf8(L("Finished"))+".")).str()));
- timer->Stop();
- }
+ timer->Stop();
+ }
}
+
+
}