All pastes #2109167 Raw Edit

Untitled

public text v1 · immutable
#2109167 ·published 2012-02-03 02:15 UTC
rendered paste body
diff --git a/mythtv/programs/mythfrontend/statusbox.cpp b/mythtv/programs/mythfrontend/statusbox.cpp
index ea16167..a8e3635 100644
--- a/mythtv/programs/mythfrontend/statusbox.cpp
+++ b/mythtv/programs/mythfrontend/statusbox.cpp
@@ -1014,20 +1014,20 @@ static const QString sm_str(long long sizeKB, int prec=1)
     if (sizeKB>1024*1024*1024) // Terabytes
     {
         double sizeGB = sizeKB/(1024*1024*1024.0);
-        return QString("%1 TB").arg(sizeGB, 0, 'f', (sizeGB>10)?0:prec);
+        return QString(QObject::tr("%1 TB")).arg(sizeGB, 0, 'f', (sizeGB>10)?0:prec);
     }
     else if (sizeKB>1024*1024) // Gigabytes
     {
         double sizeGB = sizeKB/(1024*1024.0);
-        return QString("%1 GB").arg(sizeGB, 0, 'f', (sizeGB>10)?0:prec);
+        return QString(QObject::tr("%1 GB")).arg(sizeGB, 0, 'f', (sizeGB>10)?0:prec);
     }
     else if (sizeKB>1024) // Megabytes
     {
         double sizeMB = sizeKB/1024.0;
-        return QString("%1 MB").arg(sizeMB, 0, 'f', (sizeMB>10)?0:prec);
+        return QString(QObject::tr("%1 MB")).arg(sizeMB, 0, 'f', (sizeMB>10)?0:prec);
     }
     // Kilobytes
-    return QString("%1 KB").arg(sizeKB);
+    return QString(QObject::tr("%1 KB")).arg(sizeKB);
 }
 
 static const QString usage_str_kb(long long total,
@@ -1038,7 +1038,7 @@ static const QString usage_str_kb(long long total,
     if (total > 0.0 && free > 0.0)
     {
         double percent = (100.0*free)/total;
-        ret = QObject::tr("%1 total, %2 used, %3 (or %4%) free.")
+        ret = StatusBox::tr("%1 total, %2 used, %3 (or %4%) free.")
             .arg(sm_str(total)).arg(sm_str(used))
             .arg(sm_str(free)).arg(percent, 0, 'f', (percent >= 10.0) ? 0 : 2);
     }
@@ -1055,7 +1055,7 @@ static void disk_usage_with_rec_time_kb(QStringList& out, long long total,
                                         long long used, long long free,
                                         const recprof2bps_t& prof2bps)
 {
-    const QString tail = QObject::tr(", using your %1 rate of %2 kb/s");
+    const QString tail = StatusBox::tr(", using your %1 rate of %2 kb/s");
 
     out<<usage_str_kb(total, used, free);
     if (free<0)
@@ -1071,13 +1071,13 @@ static void disk_usage_with_rec_time_kb(QStringList& out, long long total,
         uint minLeft = ((free<<5)/bytesPerMin)<<5;
         minLeft = (minLeft/15)*15;
         uint hoursLeft = minLeft/60;
-        QString hourstring = QObject::tr("%n hour(s)", "", hoursLeft);
-        QString minstring = QObject::tr("%n minute(s)", "", minLeft%60);
-        QString remainstring = QObject::tr("%1 remaining", "time");
+        QString hourstring = StatusBox::tr("%n hour(s)", "", hoursLeft);
+        QString minstring = StatusBox::tr("%n minute(s)", "", minLeft%60);
+        QString remainstring = StatusBox::tr("%1 remaining", "time");
         if (minLeft%60 == 0)
             out<<remainstring.arg(hourstring) + pro;
         else if (minLeft > 60)
-            out<<QObject::tr("%1 and %2 remaining", "time").arg(hourstring)
+            out<<StatusBox::tr("%1 and %2 remaining", "time").arg(hourstring)
                                                    .arg(minstring) + pro;
         else
             out<<remainstring.arg(minstring) + pro;
@@ -1089,7 +1089,7 @@ static const QString uptimeStr(time_t uptime)
     int     days, hours, min, secs;
     QString str;
 
-    str = QString("   " + QObject::tr("Uptime") + ": ");
+    str = QString("   " + StatusBox::tr("Uptime") + ": ");
 
     if (uptime == 0)
         return str + "unknown";
@@ -1104,7 +1104,7 @@ static const QString uptimeStr(time_t uptime)
     if (days > 0)
     {
         char    buff[6];
-        QString dayLabel = QObject::tr("%n day(s)", "", days);
+        QString dayLabel = StatusBox::tr("%n day(s)", "", days);
 
         sprintf(buff, "%d:%02d", hours, min);
 
@@ -1142,7 +1142,11 @@ void StatusBox::getActualRecordedBPS(QString hostnames)
     if (query.exec() && query.next() &&
         query.value(0).toDouble() > 0)
     {
-        recordingProfilesBPS[tr("average")] =
+        QString rateStr = tr("average", "average rate");
+
+        // Don't user a tr() directly here as the Qt tools will
+        // not be able to extract the string for translation.
+        recordingProfilesBPS[rateStr] =
             (int)(query.value(0).toDouble());
     }
 
@@ -1158,7 +1162,11 @@ void StatusBox::getActualRecordedBPS(QString hostnames)
     if (query.exec() && query.next() &&
         query.value(0).toDouble() > 0)
     {
-        recordingProfilesBPS[tr("maximum")] =
+        QString rateStr = tr("maximum", "maximum rate");
+
+        // Don't user a tr() directly here as the Qt tools will
+        // not be able to extract the string for translation.
+        recordingProfilesBPS[rateStr] =
             (int)(query.value(0).toDouble());
     }
 }