Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make some mythcommflag strings translatable and while at it
modify the translation context.

Closes # 11135
  • Loading branch information
Nicolas Riendeau committed Jan 22, 2013
1 parent 811faaf commit 64c896b
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 23 deletions.
20 changes: 13 additions & 7 deletions mythtv/programs/mythcommflag/ClassicCommDetector.cpp
Expand Up @@ -12,6 +12,7 @@ using namespace std;

// Qt headers
#include <QString>
#include <QCoreApplication>

// MythTV headers
#include "mythmiscutil.h"
Expand Down Expand Up @@ -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))
{
Expand All @@ -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))
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
12 changes: 7 additions & 5 deletions mythtv/programs/mythcommflag/CommDetector2.cpp
Expand Up @@ -12,6 +12,7 @@ using namespace std;
// Qt headers
#include <QDir>
#include <QFileInfo>
#include <QCoreApplication>

// MythTV headers
#include "compat.h"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down
19 changes: 13 additions & 6 deletions mythtv/programs/mythcommflag/PrePostRollFlagger.cpp
Expand Up @@ -2,6 +2,9 @@

#include "PrePostRollFlagger.h"

// Qt headers
#include <QCoreApplication>

// MythTV headers
#include "mythcorecontext.h"
#include "programinfo.h"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down
16 changes: 11 additions & 5 deletions mythtv/programs/mythcommflag/main.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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"))
{
Expand Down

0 comments on commit 64c896b

Please sign in to comment.