Fixing GCC warnings 3

This commit is contained in:
Lukas Matena 2021-01-29 07:39:27 +01:00
parent 2d32c80b75
commit d9c9de8eee
15 changed files with 68 additions and 61 deletions

View file

@ -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).
@ -214,18 +213,27 @@ 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();
}
}
}