diff --git a/ui/qt/iax2_analysis_dialog.cpp b/ui/qt/iax2_analysis_dialog.cpp index 52101f0720..617454dae3 100644 --- a/ui/qt/iax2_analysis_dialog.cpp +++ b/ui/qt/iax2_analysis_dialog.cpp @@ -922,7 +922,7 @@ void Iax2AnalysisDialog::saveAudio(Iax2AnalysisDialog::StreamDirection direction } ui->hintLabel->setText(tr("Saving %1" UTF8_HORIZONTAL_ELLIPSIS).arg(save_file.fileName())); - ui->progressFrame->showProgress(true, true, &stop_flag); + ui->progressFrame->showProgress(tr("Analyzing IAX2"), true, true, &stop_flag); if (save_format == save_audio_au_) { /* au format; https://pubs.opengroup.org/external/auformat.html */ /* First we write the .au header. All values in the header are diff --git a/ui/qt/progress_frame.cpp b/ui/qt/progress_frame.cpp index e405956000..94d079c417 100644 --- a/ui/qt/progress_frame.cpp +++ b/ui/qt/progress_frame.cpp @@ -28,27 +28,32 @@ // - Don't complain so loudly when the user stops a capture. progdlg_t * -create_progress_dlg(gpointer top_level_window, const gchar *, const gchar *, +create_progress_dlg(gpointer top_level_window, const gchar *task_title, const gchar *item_title, gboolean terminate_is_stop, gboolean *stop_flag) { ProgressFrame *pf; QWidget *main_window; if (!top_level_window) { - return NULL; + return nullptr; } main_window = qobject_cast((QObject *)top_level_window); if (!main_window) { - return NULL; + return nullptr; } pf = main_window->findChild(); if (!pf) { - return NULL; + return nullptr; } - return pf->showProgress(true, terminate_is_stop, stop_flag, 0); + + QString title = task_title; + if (item_title && strlen(item_title) > 0) { + title.append(" ").append(item_title); + } + return pf->showProgress(title, true, terminate_is_stop, stop_flag, 0); } progdlg_t * @@ -69,7 +74,7 @@ update_progress_dlg(progdlg_t *dlg, gfloat percentage, const gchar *) { if (!dlg) return; - dlg->progress_frame->setValue(percentage * 100); + dlg->progress_frame->setValue((int)(percentage * 100)); /* * Flush out the update and process any input events. @@ -90,10 +95,10 @@ ProgressFrame::ProgressFrame(QWidget *parent) : QFrame(parent), ui(new Ui::ProgressFrame) , terminate_is_stop_(false) - , stop_flag_(NULL) + , stop_flag_(nullptr) , show_timer_(-1) - , effect_(NULL) - , animation_(NULL) + , effect_(nullptr) + , animation_(nullptr) #ifdef QWINTASKBARPROGRESS_H , update_taskbar_(false) , taskbar_progress_(NULL) @@ -104,6 +109,15 @@ ProgressFrame::ProgressFrame(QWidget *parent) : progress_dialog_.progress_frame = this; progress_dialog_.top_level_window = window(); +#ifdef Q_OS_MAC + ui->label->setAttribute(Qt::WA_MacSmallSize, true); +#endif + + ui->label->setStyleSheet(QString( + "QLabel {" + " background: transparent;" + "}")); + ui->progressBar->setStyleSheet(QString( "QProgressBar {" " max-width: 20em;" @@ -141,10 +155,17 @@ ProgressFrame::~ProgressFrame() delete ui; } -struct progdlg *ProgressFrame::showProgress(bool animate, bool terminate_is_stop, gboolean *stop_flag, int value) +struct progdlg *ProgressFrame::showProgress(const QString &title, bool animate, bool terminate_is_stop, gboolean *stop_flag, int value) { setMaximumValue(100); ui->progressBar->setValue(value); + QString elided_title = title; + int max_w = fontMetrics().height() * 20; // em-widths, arbitrary + if (fontMetrics().width(title) > max_w) { + elided_title = fontMetrics().elidedText(title, Qt::ElideRight, max_w); + } + // If we're in the main status bar, should we push this as a status message instead? + ui->label->setText(elided_title); emit showRequested(animate, terminate_is_stop, stop_flag); return &progress_dialog_; } diff --git a/ui/qt/progress_frame.h b/ui/qt/progress_frame.h index 3fc3c7e16d..22395c835a 100644 --- a/ui/qt/progress_frame.h +++ b/ui/qt/progress_frame.h @@ -50,7 +50,7 @@ public: void captureFileClosing(); public slots: - struct progdlg *showProgress(bool animate, bool terminate_is_stop, gboolean *stop_flag, int value = 0); + struct progdlg *showProgress(const QString &title, bool animate, bool terminate_is_stop, gboolean *stop_flag, int value = 0); struct progdlg *showBusy(bool animate, bool terminate_is_stop, gboolean *stop_flag); void setValue(int value); void hide(); diff --git a/ui/qt/progress_frame.ui b/ui/qt/progress_frame.ui index d064cb0420..ab895d62c6 100644 --- a/ui/qt/progress_frame.ui +++ b/ui/qt/progress_frame.ui @@ -29,6 +29,13 @@ 0 + + + + TextLabel + + + diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp index ad71572dd3..8fcb757fc3 100644 --- a/ui/qt/rtp_analysis_dialog.cpp +++ b/ui/qt/rtp_analysis_dialog.cpp @@ -1460,7 +1460,7 @@ void RtpAnalysisDialog::saveAudio(RtpAnalysisDialog::StreamDirection direction, } ui->hintLabel->setText(tr("Saving %1" UTF8_HORIZONTAL_ELLIPSIS).arg(save_file.fileName())); - ui->progressFrame->showProgress(true, true, &stop_flag); + ui->progressFrame->showProgress(tr("Analyzing RTP"), true, true, &stop_flag); clearSAEErrors(); if (save_format == save_audio_au_) { /* au format */