From 49fe120d9530682cf539d562c4ffcae3e195b9ab Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 17 Sep 2017 15:04:14 -0700 Subject: DC download: show info messages on Mac For some reason the progress bar on macOS doesn't show the progress text. This creates a label below the progress bar and shows the text there instead. Signed-off-by: Dirk Hohndel --- desktop-widgets/downloadfromdivecomputer.cpp | 33 ++++++++++++++++++++++++++-- desktop-widgets/downloadfromdivecomputer.ui | 7 ++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index 5eaee68b7..424cf277a 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -112,11 +112,24 @@ void DownloadFromDCWidget::updateProgressBar() } if (!same_string(progress_bar_text , "")) { ui.progressBar->setFormat(progress_bar_text); +#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)) + if (IS_FP_SAME(progress_bar_fraction, 0.0)) { ui.progressBar->setFormat(tr("Connecting to dive computer")); - else +#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 { ui.progressBar->setFormat("%p%"); +#if defined(Q_OS_MAC) + // on mac the progress bar doesn't show its text + ui.progressText->setText(QString("%1%").arg(lrint(progress_bar_fraction * 100))); +#endif + } } ui.progressBar->setValue(lrint(progress_bar_fraction * 100)); free(last_text); @@ -134,6 +147,10 @@ void DownloadFromDCWidget::updateState(states state) markChildrenAsEnabled(); timer->stop(); progress_bar_text = ""; +#if defined(Q_OS_MAC) + // on mac we show the text in a label + ui.progressText->setText(progress_bar_text); +#endif } // tries to cancel an on going download @@ -156,6 +173,10 @@ void DownloadFromDCWidget::updateState(states state) ui.progressBar->hide(); markChildrenAsEnabled(); progress_bar_text = ""; +#if defined(Q_OS_MAC) + // on mac we show the text in a label + ui.progressText->setText(progress_bar_text); +#endif } // DOWNLOAD is finally done, but we don't know if there was an error as libdivecomputer doesn't pass @@ -173,6 +194,10 @@ void DownloadFromDCWidget::updateState(states state) ui.progressBar->setValue(100); markChildrenAsEnabled(); } +#if defined(Q_OS_MAC) + // on mac we show the text in a label + ui.progressText->setText(progress_bar_text); +#endif } // DOWNLOAD is started. @@ -192,6 +217,10 @@ void DownloadFromDCWidget::updateState(states state) markChildrenAsEnabled(); progress_bar_text = ""; ui.progressBar->hide(); +#if defined(Q_OS_MAC) + // on mac we show the text in a label + ui.progressText->setText(progress_bar_text); +#endif } // properly updating the widget state diff --git a/desktop-widgets/downloadfromdivecomputer.ui b/desktop-widgets/downloadfromdivecomputer.ui index b1f152034..10d654b46 100644 --- a/desktop-widgets/downloadfromdivecomputer.ui +++ b/desktop-widgets/downloadfromdivecomputer.ui @@ -189,6 +189,13 @@ + + + + + + + -- cgit v1.2.3-70-g09d2