Add API for another info string for progress bars

Adds a "subtitle" text that is shown below the progress
bar if it is set, similar to how it is done manually for
the search result "Found 123." counter.

Optionally also shown in the status bar if the details are
not open (like for the search result counter).

Task-number: QTCREATORBUG-21584
Change-Id: I0b3bf52567227f7c07de51520079c0b12a265be3
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2019-03-27 16:48:28 +01:00
parent a78655e521
commit d2242babeb
6 changed files with 99 additions and 20 deletions

View File

@@ -457,6 +457,8 @@ FutureProgress *ProgressManagerPrivate::doAddTask(const QFuture<void> &future, c
this, &ProgressManagerPrivate::updateSummaryProgressBar);
connect(progress, &FutureProgress::statusBarWidgetChanged,
this, &ProgressManagerPrivate::updateStatusDetailsWidget);
connect(progress, &FutureProgress::subtitleInStatusBarChanged,
this, &ProgressManagerPrivate::updateStatusDetailsWidget);
updateStatusDetailsWidget();
emit taskStarted(type);
@@ -657,9 +659,22 @@ void ProgressManagerPrivate::updateStatusDetailsWidget()
QList<FutureProgress *>::iterator i = m_taskList.end();
while (i != m_taskList.begin()) {
--i;
candidateWidget = (*i)->statusBarWidget();
FutureProgress *progress = *i;
candidateWidget = progress->statusBarWidget();
if (candidateWidget) {
m_currentStatusDetailsProgress = *i;
m_currentStatusDetailsProgress = progress;
break;
} else if (progress->isSubtitleVisibleInStatusBar() && !progress->subtitle().isEmpty()) {
if (!m_statusDetailsLabel) {
m_statusDetailsLabel = new QLabel(m_summaryProgressWidget);
QFont font(m_statusDetailsLabel->font());
font.setPointSizeF(StyleHelper::sidebarFontSize());
font.setBold(true);
m_statusDetailsLabel->setFont(font);
}
m_statusDetailsLabel->setText(progress->subtitle());
candidateWidget = m_statusDetailsLabel;
m_currentStatusDetailsProgress = progress;
break;
}
}