Bluetooth: show the user that we are waiting to connect to DC

Previously nothing was shown while we were trying to connect; now we show a busy
indication in the progress bar and ensure that the 'waiting to connect' text is
displayed. The progress bar switches back to showing actual progress once we have
connected and are downloading data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-09-25 20:34:25 -07:00
parent 497c1248d4
commit ef0e76bc69

View file

@ -170,19 +170,25 @@ void DownloadFromDCWidget::updateProgressBar()
progress_bar_text = "";
}
if (!empty_string(progress_bar_text)) {
// once the progress bar text is set, setup the maximum so the user sees actual progress
ui.progressBar->setFormat(progress_bar_text);
ui.progressBar->setMaximum(100);
#if defined(Q_OS_MAC)
// on mac the progress bar doesn't show its text
ui.progressText->setText(progress_bar_text);
#endif
} else {
if (IS_FP_SAME(progress_bar_fraction, 0.0)) {
// while we are waiting to connect, set the maximum to 0 so we get a busy indication
ui.progressBar->setMaximum(0);
ui.progressBar->setFormat(tr("Connecting to dive computer"));
#if defined(Q_OS_MAC)
// on mac the progress bar doesn't show its text
ui.progressText->setText(tr("Connecting to dive computer"));
#endif
} else {
// we have some progress - reset the maximum so the user sees actual progress
ui.progressBar->setMaximum(100);
ui.progressBar->setFormat("%p%");
#if defined(Q_OS_MAC)
// on mac the progress bar doesn't show its text