From 03923b27ebf982629d2dd936b8597964cc464bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llodr=C3=A0?= <jlg.hrtc@gmail.com> Date: Sat, 31 Mar 2018 18:28:52 +0200 Subject: [PATCH] linguist: Show remaining global&context translation counts in tooltips Linguist shows the number of finished units and the number of editable units in the lower right corner of the window (e.g.: 6714/6833). It also shows this completion progress number per context. With this change, it displays the difference between these numbers in a tooltip (i.e. hovering the mouse on the count 6714/6833), for both global progress count and per context progress count. While this change may be arguable, the remaining count is the number that a translator tracks and is constantly checking, other numbers are less relevant. This small change improves User Experience since the translator doesn't need to use a calculator or do a mental calculation, which takes time and may also lead to miscalculations. Change-Id: Icbb5e73bb4430d28f07eeff790b186579c48c8fb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> --- src/linguist/linguist/mainwindow.cpp | 11 +++++++---- src/linguist/linguist/messagemodel.cpp | 6 +++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/linguist/linguist/mainwindow.cpp b/src/linguist/linguist/mainwindow.cpp index 731ce44eb..8cc55d44b 100644 --- a/src/linguist/linguist/mainwindow.cpp +++ b/src/linguist/linguist/mainwindow.cpp @@ -2321,11 +2321,14 @@ void MainWindow::updateProgress() { int numEditable = m_dataModel->getNumEditable(); int numFinished = m_dataModel->getNumFinished(); - if (!m_dataModel->modelCount()) + if (!m_dataModel->modelCount()) { m_progressLabel->setText(QString(QLatin1String(" "))); - else - m_progressLabel->setText(QString(QLatin1String(" %1/%2 ")) - .arg(numFinished).arg(numEditable)); + m_progressLabel->setToolTip(QString()); + } else { + m_progressLabel->setText(QStringLiteral(" %1/%2 ").arg(numFinished).arg(numEditable)); + m_progressLabel->setToolTip(tr("%n unfinished message(s) left.", 0, + numEditable - numFinished)); + } bool enable = numFinished != numEditable; m_ui.actionPrevUnfinished->setEnabled(enable); m_ui.actionNextUnfinished->setEnabled(enable); diff --git a/src/linguist/linguist/messagemodel.cpp b/src/linguist/linguist/messagemodel.cpp index 7ceeed933..ecaf2109b 100644 --- a/src/linguist/linguist/messagemodel.cpp +++ b/src/linguist/linguist/messagemodel.cpp @@ -1351,7 +1351,7 @@ QVariant MessageModel::data(const QModelIndex &index, int role) const MultiContextItem *mci = m_data->multiContextItem(row); - if (role == Qt::DisplayRole || (role == Qt::ToolTipRole && column == numLangs)) { + if (role == Qt::DisplayRole || role == Qt::ToolTipRole) { switch (column - numLangs) { case 0: // Context { @@ -1361,6 +1361,10 @@ QVariant MessageModel::data(const QModelIndex &index, int role) const } case 1: { + if (role == Qt::ToolTipRole) { + return tr("%n unfinished message(s) left.", 0, + mci->getNumEditable() - mci->getNumFinished()); + } QString s; s.sprintf("%d/%d", mci->getNumFinished(), mci->getNumEditable()); return s; -- GitLab