diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-09-17 15:04:14 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-09-17 15:04:14 -0700 |
commit | 49fe120d9530682cf539d562c4ffcae3e195b9ab (patch) | |
tree | f4a67800cd3ebd00eb484f795ccadfcbe4282022 | |
parent | d03fabd3732adb13e3229f4faa2883f45e15aa21 (diff) | |
download | subsurface-49fe120d9530682cf539d562c4ffcae3e195b9ab.tar.gz |
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 <dirk@hohndel.org>
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.cpp | 33 | ||||
-rw-r--r-- | 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 @@ -190,6 +190,13 @@ </widget> </item> <item> + <widget class="QLabel" name="progressText"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> <spacer name="aboveOKCancelSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> |