Commit 03923b27 authored by Josep Llodrà's avatar Josep Llodrà Committed by Josep Llodrà Grimalt
Browse files

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: default avatarOswald Buddenhagen <oswald.buddenhagen@qt.io>
Showing with 12 additions and 5 deletions
......@@ -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);
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment