summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosep LlodrĂ  <jlg.hrtc@gmail.com>2018-03-31 18:28:52 +0200
committerJosep LlodrĂ  Grimalt <jlg.hrtc@gmail.com>2018-04-09 22:40:41 +0000
commit03923b27ebf982629d2dd936b8597964cc464bfe (patch)
treed6d7aa7ce1cddf6b822fb9c1fdfd06b95884aab5
parent04e7f6668dae79a402e2c2ff2f415a90399b295f (diff)
downloadqttools-03923b27ebf982629d2dd936b8597964cc464bfe.tar.gz
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>
-rw-r--r--src/linguist/linguist/mainwindow.cpp11
-rw-r--r--src/linguist/linguist/messagemodel.cpp6
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;