From 64c896bab0039e351e0107b818616080f83372b2 Mon Sep 17 00:00:00 2001 From: Nicolas Riendeau Date: Mon, 21 Jan 2013 20:59:15 -0500 Subject: [PATCH] Make some mythcommflag strings translatable and while at it modify the translation context. Closes # 11135 --- .../mythcommflag/ClassicCommDetector.cpp | 20 ++++++++++++------- .../programs/mythcommflag/CommDetector2.cpp | 12 ++++++----- .../mythcommflag/PrePostRollFlagger.cpp | 19 ++++++++++++------ mythtv/programs/mythcommflag/main.cpp | 16 ++++++++++----- 4 files changed, 44 insertions(+), 23 deletions(-) diff --git a/mythtv/programs/mythcommflag/ClassicCommDetector.cpp b/mythtv/programs/mythcommflag/ClassicCommDetector.cpp index 1485fe5b2d3..b1b2e0b6b29 100644 --- a/mythtv/programs/mythcommflag/ClassicCommDetector.cpp +++ b/mythtv/programs/mythcommflag/ClassicCommDetector.cpp @@ -12,6 +12,7 @@ using namespace std; // Qt headers #include +#include // MythTV headers #include "mythmiscutil.h" @@ -295,7 +296,8 @@ bool ClassicCommDetector::go() int requiredHeadStart = requiredBuffer; bool wereRecording = stillRecording; - emit statusUpdate(QObject::tr("Building Head Start Buffer")); + emit statusUpdate(QCoreApplication::translate("(mythcommflag)", + "Building Head Start Buffer")); secsSince = recordingStartedAt.secsTo(MythDate::current()); while (stillRecording && (secsSince < requiredHeadStart)) { @@ -320,7 +322,8 @@ bool ClassicCommDetector::go() requiredHeadStart += max(0,recordingStartedAt.secsTo(startedAt)); requiredHeadStart += logoDetector->getRequiredAvailableBufferForSearch(); - emit statusUpdate(QObject::tr("Building Logo Detection Buffer")); + emit statusUpdate(QCoreApplication::translate("(mythcommflag)", + "Building Logo Detection Buffer")); secsSince = recordingStartedAt.secsTo(MythDate::current()); while (stillRecording && (secsSince < requiredHeadStart)) { @@ -350,7 +353,8 @@ bool ClassicCommDetector::go() if (commDetectMethod & COMM_DETECT_LOGO) { - emit statusUpdate(QObject::tr("Searching for Logo")); + emit statusUpdate(QCoreApplication::translate("(mythcommflag)", + "Searching for Logo")); if (showProgress) { @@ -523,11 +527,13 @@ bool ClassicCommDetector::go() } if (myTotalFrames) - emit statusUpdate(QObject::tr("%1% Completed @ %2 fps.") - .arg(percentage).arg(flagFPS)); + emit statusUpdate(QCoreApplication::translate("(mythcommflag)", + "%1% Completed @ %2 fps.") + .arg(percentage).arg(flagFPS)); else - emit statusUpdate(QObject::tr("%1 Frames Completed @ %2 fps.") - .arg(currentFrameNumber).arg(flagFPS)); + emit statusUpdate(QCoreApplication::translate("(mythcommflag)", + "%1 Frames Completed @ %2 fps.") + .arg(currentFrameNumber).arg(flagFPS)); if (percentage % 10 == 0 && prevpercent != percentage) { diff --git a/mythtv/programs/mythcommflag/CommDetector2.cpp b/mythtv/programs/mythcommflag/CommDetector2.cpp index 5941e60b417..76a74c380d8 100644 --- a/mythtv/programs/mythcommflag/CommDetector2.cpp +++ b/mythtv/programs/mythcommflag/CommDetector2.cpp @@ -12,6 +12,7 @@ using namespace std; // Qt headers #include #include +#include // MythTV headers #include "compat.h" @@ -455,13 +456,13 @@ void CommDetector2::reportState(int elapsedms, long long frameno, if (nframes) { - emit statusUpdate(QObject::tr("%1% Completed @ %2 fps.") - .arg(percentage).arg(fps)); + emit statusUpdate(QCoreApplication::translate("(mythcommflag)", + "%1% Completed @ %2 fps.").arg(percentage).arg(fps)); } else { - emit statusUpdate(QObject::tr("%1 Frames Completed @ %2 fps.") - .arg(frameno).arg(fps)); + emit statusUpdate(QCoreApplication::translate("(mythcommflag)", + "%1 Frames Completed @ %2 fps.").arg(frameno).arg(fps)); } if (percentage % 10 == 0 && prevpercent != percentage) @@ -586,7 +587,8 @@ bool CommDetector2::go(void) player->ResetTotalDuration(); if (searchingForLogo(logoFinder, *currentPass)) - emit statusUpdate(QObject::tr("Performing Logo Identification")); + emit statusUpdate(QCoreApplication::translate("(mythcommflag)", + "Performing Logo Identification")); clock.start(); passTime.start(); diff --git a/mythtv/programs/mythcommflag/PrePostRollFlagger.cpp b/mythtv/programs/mythcommflag/PrePostRollFlagger.cpp index 71daee278d6..67c1db9e7c3 100644 --- a/mythtv/programs/mythcommflag/PrePostRollFlagger.cpp +++ b/mythtv/programs/mythcommflag/PrePostRollFlagger.cpp @@ -2,6 +2,9 @@ #include "PrePostRollFlagger.h" +// Qt headers +#include + // MythTV headers #include "mythcorecontext.h" #include "programinfo.h" @@ -38,7 +41,8 @@ bool PrePostRollFlagger::go() secsSince = startedAt.secsTo(MythDate::current()); while (stillRecording && (secsSince < requiredHeadStart)) { - emit statusUpdate(QObject::tr("Waiting to pass preroll + head start")); + emit statusUpdate(QCoreApplication::translate("(mythcommflag)", + "Waiting to pass preroll + head start")); emit breathe(); if (m_bStop) @@ -151,7 +155,8 @@ bool PrePostRollFlagger::go() emit breathe(); if (m_bStop) return false; - emit statusUpdate(QObject::tr("Waiting for recording to finish")); + emit statusUpdate(QCoreApplication::translate("(mythcommflag)", + "Waiting for recording to finish")); sleep(5); } stillRecording = false; @@ -325,11 +330,13 @@ long long PrePostRollFlagger::findBreakInrange(long long startFrame, } if (stopFrame) - emit statusUpdate(QObject::tr("%1% Completed @ %2 fps.") - .arg(percentage).arg(flagFPS)); + emit statusUpdate(QCoreApplication::translate("(mythcommflag)", + "%1% Completed @ %2 fps.") + .arg(percentage).arg(flagFPS)); else - emit statusUpdate(QObject::tr("%1 Frames Completed @ %2 fps.") - .arg((long)currentFrameNumber).arg(flagFPS)); + emit statusUpdate(QCoreApplication::translate("(mythcommflag)", + "%1 Frames Completed @ %2 fps.") + .arg((long)currentFrameNumber).arg(flagFPS)); if (percentage % 10 == 0 && prevpercent != percentage) { diff --git a/mythtv/programs/mythcommflag/main.cpp b/mythtv/programs/mythcommflag/main.cpp index 4f174fc52a2..44eb7098b62 100644 --- a/mythtv/programs/mythcommflag/main.cpp +++ b/mythtv/programs/mythcommflag/main.cpp @@ -433,14 +433,16 @@ static void commDetectorBreathe() case JOB_PAUSE: { JobQueue::ChangeJobStatus(jobID, JOB_PAUSED, - QObject::tr("Paused")); + QCoreApplication::translate("(mythcommflag)", + "Paused", "Job status")); commDetector->pause(); break; } case JOB_RESUME: { JobQueue::ChangeJobStatus(jobID, JOB_RUNNING, - QObject::tr("Running")); + QCoreApplication::translate("(mythcommflag)", + "Running", "Job status")); commDetector->resume(); break; } @@ -1208,11 +1210,15 @@ int main(int argc, char *argv[]) ret = FlagCommercials(chanid, starttime, jobID, "", jobQueueCPU != 0); if (ret > GENERIC_EXIT_NOT_OK) - JobQueue::ChangeJobStatus(jobID, JOB_ERRORED, - QString("Failed with exit status %1").arg(ret)); + JobQueue::ChangeJobStatus(jobID, JOB_ERRORED, + QCoreApplication::translate("(mythcommflag)", + "Failed with exit status %1", + "Job status").arg(ret)); else JobQueue::ChangeJobStatus(jobID, JOB_FINISHED, - QString("%1 commercial breaks").arg(ret)); + QCoreApplication::translate("(mythcommflag)", + "%1 commercial break(s)" + "Job status").arg(ret)); } else if (cmdline.toBool("video")) {