Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
It's redundant to wrap tr() in QString() since it returns a QString()
  • Loading branch information
stuartm committed Jul 31, 2012
1 parent 1a14842 commit 2961d1f
Show file tree
Hide file tree
Showing 26 changed files with 89 additions and 96 deletions.
36 changes: 18 additions & 18 deletions mythplugins/mythgallery/mythgallery/galleryfilterdlg.cpp
Expand Up @@ -202,36 +202,36 @@ void GalleryFilterDialog::updateFilter()
m_scanning = false;

if (dir_count + img_count + mov_count == 0)
m_numImagesText->SetText(QString(tr("No files / folders found")));
m_numImagesText->SetText(tr("No files / folders found"));
else if (dir_count > 0)
{
if (img_count + mov_count == 0)
m_numImagesText->SetText(QString(tr(
"Filter result : %1 folder(s) found but no files"))
m_numImagesText->SetText(tr(
"Filter result : %1 folder(s) found but no files")
.arg(dir_count));
else if (img_count == 0)
m_numImagesText->SetText(QString(tr(
"Filter result : %1 folder(s), %2 movie(s) found"))
.arg(dir_count) .arg(mov_count));
m_numImagesText->SetText(tr(
"Filter result : %1 folder(s), %2 movie(s) found")
.arg(dir_count).arg(mov_count));
else if (mov_count == 0)
m_numImagesText->SetText(QString(tr(
"Filter result : %1 folder(s), %2 image(s) found"))
.arg(dir_count) .arg(img_count));
m_numImagesText->SetText(tr(
"Filter result : %1 folder(s), %2 image(s) found")
.arg(dir_count).arg(img_count));
else
m_numImagesText->SetText(QString(tr(
m_numImagesText->SetText(tr(
"Filter result : %1 folder(s), %2 image(s) and %3 movie(s) "
"found")) .arg(dir_count) .arg(img_count) .arg(mov_count));
"found").arg(dir_count).arg(img_count).arg(mov_count));
}
else if (img_count > 0 && mov_count > 0)
m_numImagesText->SetText(QString(tr(
"Filter result : %1 image(s) and %2 movie(s) found"))
.arg(img_count) .arg(mov_count));
m_numImagesText->SetText(tr(
"Filter result : %1 image(s) and %2 movie(s) found")
.arg(img_count).arg(mov_count));
else if (mov_count == 0)
m_numImagesText->SetText(QString(tr(
"Filter result : %1 image(s) found")) .arg(img_count));
m_numImagesText->SetText(tr(
"Filter result : %1 image(s) found").arg(img_count));
else
m_numImagesText->SetText(QString(tr(
"Filter result : %1 movie(s) found")) .arg(mov_count));
m_numImagesText->SetText(tr(
"Filter result : %1 movie(s) found").arg(mov_count));
}

void GalleryFilterDialog::setDirFilter(void)
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythgallery/mythgallery/iconview.cpp
Expand Up @@ -387,7 +387,7 @@ void IconView::UpdateText(MythUIButtonListItem *item)
}

if (m_positionText)
m_positionText->SetText(QString(tr("%1 of %2"))
m_positionText->SetText(tr("%1 of %2")
.arg(m_imageList->GetCurrentPos() + 1)
.arg(m_imageList->GetCount()));

Expand Down
8 changes: 4 additions & 4 deletions mythplugins/mythgallery/mythgallery/thumbview.cpp
Expand Up @@ -124,15 +124,15 @@ QString ThumbItem::GetDescription(const QString &status,
if (!status.isEmpty())
info += status;

info += "\n\n" + QString(tr("Folder: %1")).arg(fi.dir().dirName());
info += "\n\n" + tr("Folder: %1").arg(fi.dir().dirName());
//: %1 is the creation date
info += "\n" + QString(tr("Created: %1")).arg(fi.created().toString());
info += "\n" + tr("Created: %1").arg(fi.created().toString());
//: %1 is the modification date
info += "\n" + QString(tr("Modified: %1")).arg(fi.lastModified().toString());
info += "\n" + tr("Modified: %1").arg(fi.lastModified().toString());
info += "\n" + tr("Size: %n bytes", "", fi.size());
info += "\n" + tr("Width: %n pixel(s)", "", sz.width());
info += "\n" + tr("Height: %n pixel(s)", "", sz.height());
info += "\n" + QString(tr("Pixel Count: %1 megapixels"))
info += "\n" + tr("Pixel Count: %1 megapixels")
.arg((float) sz.width() * sz.height() * (1.0f/1000000.0f), 0, 'f', 2);
info += "\n" + tr("Rotation Angle: %n degree(s)", "", angle);

Expand Down
3 changes: 1 addition & 2 deletions mythplugins/mythgame/mythgame/gameui.cpp
Expand Up @@ -269,8 +269,7 @@ void GameUI::itemClicked(MythUIButtonListItem*)
else
{
//: %1 is the game name
QString msg = QString(tr("Choose System for:\n%1"))
.arg(node->getString());
QString msg = tr("Choose System for:\n%1").arg(node->getString());
MythScreenStack *popupStack = GetMythMainWindow()->
GetStack("popup stack");
MythDialogBox *chooseSystemPopup = new MythDialogBox(
Expand Down
8 changes: 4 additions & 4 deletions mythplugins/mythmusic/mythmusic/musiccommon.cpp
Expand Up @@ -1210,7 +1210,7 @@ void MusicCommon::customEvent(QEvent *event)

LOG(VB_GENERAL, LOG_ERR, QString("%1 %2").arg(statusString)
.arg(*aoe->errorMessage()));
ShowOkPopup(QString(tr("MythMusic has encountered the following error:\n%1"))
ShowOkPopup(tr("MythMusic has encountered the following error:\n%1")
.arg(*aoe->errorMessage()));
stopAll();
}
Expand Down Expand Up @@ -1252,7 +1252,7 @@ void MusicCommon::customEvent(QEvent *event)
LOG(VB_GENERAL, LOG_ERR, QString("%1 %2").arg(statusString)
.arg(*dxe->errorMessage()));

ShowOkPopup(QString(tr("MythMusic has encountered the following error:\n%1"))
ShowOkPopup(tr("MythMusic has encountered the following error:\n%1")
.arg(*dxe->errorMessage()));
}
else if (event->type() == DecoderHandlerEvent::Error)
Expand Down Expand Up @@ -1982,8 +1982,8 @@ void MusicCommon::updatePlaylistStats(void)
QString playlistcurrent = QLocale::system().toString(m_currentTrack + 1);
QString playlisttotal = QLocale::system().toString(trackCount);

map["playlistposition"] = QString(tr("%1 of %2")).arg(playlistcurrent)
.arg(playlisttotal);
map["playlistposition"] = tr("%1 of %2").arg(playlistcurrent)
.arg(playlisttotal);
map["playlistcurrent"] = playlistcurrent;
map["playlistcount"] = playlisttotal;
map["playlisttime"] = getTimeString(m_playlistPlayedTime + m_currentTime, m_playlistMaxTime);
Expand Down
5 changes: 2 additions & 3 deletions mythplugins/mythmusic/mythmusic/playlisteditorview.cpp
Expand Up @@ -822,9 +822,8 @@ void PlaylistEditorView::treeNodeChanged(MythGenericTree *node)

if (m_positionText)
{
m_positionText->SetText(QString(tr("%1 of %2"))
.arg(node->getPosition() + 1)
.arg(node->siblingCount()));
m_positionText->SetText(tr("%1 of %2").arg(node->getPosition() + 1)
.arg(node->siblingCount()));
}

if (mnode->childCount() > 0 || mnode->getAction() == "trackid")
Expand Down
5 changes: 2 additions & 3 deletions mythplugins/mythmusic/mythmusic/smartplaylist.cpp
Expand Up @@ -1773,9 +1773,8 @@ void SmartPLResultViewer::trackSelected(MythUIButtonListItem *item)
if (!item || !m_positionText)
return;

m_positionText->SetText(QString(tr("%1 of %2"))
.arg(m_trackList->GetCurrentPos() + 1)
.arg(m_trackList->GetCount()));
m_positionText->SetText(tr("%1 of %2").arg(m_trackList->GetCurrentPos() + 1)
.arg(m_trackList->GetCount()));
}
void SmartPLResultViewer::showTrackInfo(void)
{
Expand Down
8 changes: 4 additions & 4 deletions mythplugins/mythnetvision/mythnetvision/nettree.cpp
Expand Up @@ -592,7 +592,7 @@ void NetTree::fillTree()
// Add an upfolder
if (m_type != DLG_TREE)
{
m_rssGeneric->addNode(QString(tr("Back")), kUpFolder, true, false);
m_rssGeneric->addNode(tr("Back"), kUpFolder, true, false);
}

m_rssGeneric->SetData(QString("%1/mythnetvision/icons/rss.png")
Expand All @@ -611,7 +611,7 @@ void NetTree::fillTree()
// Add an upfolder
if (m_type != DLG_TREE)
{
ret->addNode(QString(tr("Back")), kUpFolder, true, false);
ret->addNode(tr("Back"), kUpFolder, true, false);
}

ResultItem::resultList::iterator it = items.begin();
Expand Down Expand Up @@ -649,7 +649,7 @@ void NetTree::fillTree()
// Add an upfolder
if (m_type != DLG_TREE)
{
ret->addNode(QString(tr("Back")), kUpFolder, true, false);
ret->addNode(tr("Back"), kUpFolder, true, false);
}

for (QList<QPair<QString, QString> >::iterator i = paths.begin();
Expand Down Expand Up @@ -693,7 +693,7 @@ void NetTree::buildGenericTree(MythGenericTree *dst, QStringList paths,
// Add an upfolder
if (m_type != DLG_TREE)
{
folder->addNode(QString(tr("Back")), kUpFolder, true, false);
folder->addNode(tr("Back"), kUpFolder, true, false);
}

if (paths.size())
Expand Down
7 changes: 3 additions & 4 deletions mythtv/libs/libmyth/mythdialogs.cpp
Expand Up @@ -942,10 +942,9 @@ MythThemedDialog::MythThemedDialog(MythMainWindow *parent,

if (!loadThemedWindow(window_name, theme_filename))
{
QString msg =
QString(tr("Could not locate '%1' in theme '%2'."
"\n\nReturning to the previous menu."))
.arg(window_name).arg(theme_filename);
QString msg = tr("Could not locate '%1' in theme '%2'."
"\n\nReturning to the previous menu.")
.arg(window_name).arg(theme_filename);
MythPopupBox::showOkPopup(GetMythMainWindow(),
tr("Missing UI Element"), msg);
reject();
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/channelscan/channelscanner.cpp
Expand Up @@ -263,10 +263,10 @@ DTVConfParser::return_t ChannelScanner::ImportDVBUtils(
if (DTVConfParser::OK != ret)
{
QString msg = (DTVConfParser::ERROR_PARSE == ret) ?
QString(tr("Failed to parse '%1'")).arg(file) :
tr("Failed to parse '%1'").arg(file) :
((DTVConfParser::ERROR_CARDTYPE == ret) ?
tr("Programmer Error : incorrect card type") :
QString(tr("Failed to open '%1'")).arg(file));
tr("Failed to open '%1'").arg(file));

InformUser(msg);
}
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/commbreakmap.cpp
Expand Up @@ -231,9 +231,9 @@ bool CommBreakMap::AutoCommercialSkip(uint64_t &jumpToFrame,
skipTime.sprintf("%d:%02d", skipped_seconds / 60,
abs(skipped_seconds) % 60);
if (kCommSkipOn == autocommercialskip)
comm_msg = QString(QObject::tr("Skip %1")).arg(skipTime);
comm_msg = QObject::tr("Skip %1").arg(skipTime);
else
comm_msg = QString(QObject::tr("Commercial: %1")).arg(skipTime);
comm_msg = QObject::tr("Commercial: %1").arg(skipTime);

if (kCommSkipOn == autocommercialskip)
{
Expand Down
15 changes: 7 additions & 8 deletions mythtv/libs/libmythtv/jobqueue.cpp
Expand Up @@ -2036,10 +2036,10 @@ void JobQueue::DoTranscodeThread(int jobID)
filesize = st.size();
/*: %1 is transcoder name, %2 is the original file size
and %3 is the current file size */
QString comment = QString(tr("%1: %2 => %3"))
.arg(transcoderName)
.arg(PrettyPrint(origfilesize))
.arg(PrettyPrint(filesize));
QString comment = tr("%1: %2 => %3")
.arg(transcoderName)
.arg(PrettyPrint(origfilesize))
.arg(PrettyPrint(filesize));
ChangeJobComment(jobID, comment);

if (filesize > 0)
Expand Down Expand Up @@ -2070,10 +2070,9 @@ void JobQueue::DoTranscodeThread(int jobID)
{
program_info->SaveTranscodeStatus(TRANSCODING_NOT_TRANSCODED);

QString comment =
QString(tr("exit status %1, job status was \"%2\""))
.arg(result)
.arg(StatusText(status));
QString comment = tr("exit status %1, job status was \"%2\"")
.arg(result)
.arg(StatusText(status));

ChangeJobStatus(jobID, JOB_ERRORED, comment);

Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -1378,7 +1378,7 @@ void MythPlayer::DisableCaptions(uint mode, bool osd_msg)
void MythPlayer::EnableCaptions(uint mode, bool osd_msg)
{
QMutexLocker locker(&osdLock);
QString msg = "";
QString msg;
if ((kDisplayCC608 & mode) || (kDisplayCC708 & mode) ||
(kDisplayAVSubtitle & mode) || kDisplayRawTextSubtitle & mode)
{
Expand All @@ -1394,7 +1394,7 @@ void MythPlayer::EnableCaptions(uint mode, bool osd_msg)
msg += tr("Text subtitles");
}
if (kDisplayNUVTeletextCaptions & mode)
msg += QString(tr("TXT %1")).arg(ttPageNum, 3, 16);
msg += tr("TXT %1").arg(ttPageNum, 3, 16);
if (kDisplayTeletextCaptions & mode)
{
msg += decoder->GetTrackDesc(kTrackTypeTeletextCaptions,
Expand Down Expand Up @@ -3957,13 +3957,13 @@ bool MythPlayer::HandleProgramEditorActions(QStringList &actions,
else if (handled && action == "UNDO")
{
//: %1 is the undo message
SetOSDMessage(QString(tr("Undo - %1")).arg(undoMessage),
SetOSDMessage(tr("Undo - %1").arg(undoMessage),
kOSDTimeout_Short);
}
else if (handled && action == "REDO")
{
//: %1 is the redo message
SetOSDMessage(QString(tr("Redo - %1")).arg(redoMessage),
SetOSDMessage(tr("Redo - %1").arg(redoMessage),
kOSDTimeout_Short);
}
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/profilegroup.cpp
Expand Up @@ -286,7 +286,7 @@ void ProfileGroupEditor::callDelete(void)

if (result.exec() && result.next())
{
QString message = QString(tr("Delete profile group:\n'%1'?"))
QString message = tr("Delete profile group:\n'%1'?")
.arg(ProfileGroup::getName(id));

DialogCode value = MythPopupBox::Show2ButtonPopup(
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/recordingprofile.cpp
Expand Up @@ -393,7 +393,7 @@ class AudioCompressionSettings : public TriggeredConfigurationGroup

QString labelName;
if (profName.isNull())
labelName = QString(QObject::tr("Audio Quality"));
labelName = QObject::tr("Audio Quality");
else
labelName = profName + "->" + QObject::tr("Audio Quality");
setName(labelName);
Expand Down Expand Up @@ -1199,7 +1199,7 @@ RecordingProfile::RecordingProfile(QString profName)
ConfigurationGroup* profile = new VerticalConfigurationGroup(false);
QString labelName;
if (profName.isNull())
labelName = QString(QObject::tr("Profile"));
labelName = QObject::tr("Profile");
else
labelName = profName + "->" + QObject::tr("Profile");
profile->setLabel(labelName);
Expand Down
18 changes: 9 additions & 9 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -6000,8 +6000,8 @@ bool TV::SeekHandleAction(PlayerContext *actx, const QStringList &actions,
actx->UnlockDeletePlayer(__FILE__, __LINE__);
float time = (flags & kAbsolute) ? direction :
direction * (1.001 / rate);
QString message = (flags & kRewind) ? QString(tr("Rewind")) :
QString(tr("Forward"));
QString message = (flags & kRewind) ? tr("Rewind") :
tr("Forward");
DoSeek(actx, time, message,
/*timeIsOffset*/true,
/*honorCutlist*/!(flags & kIgnoreCutlist));
Expand Down Expand Up @@ -6152,14 +6152,14 @@ void TV::ChangeSpeed(PlayerContext *ctx, int direction)

switch (ctx->ff_rew_speed)
{
case 4: speed = 16.0; mesg = QString(tr("Speed 16X")); break;
case 3: speed = 8.0; mesg = QString(tr("Speed 8X")); break;
case 2: speed = 3.0; mesg = QString(tr("Speed 3X")); break;
case 1: speed = 2.0; mesg = QString(tr("Speed 2X")); break;
case 4: speed = 16.0; mesg = tr("Speed 16X"); break;
case 3: speed = 8.0; mesg = tr("Speed 8X"); break;
case 2: speed = 3.0; mesg = tr("Speed 3X"); break;
case 1: speed = 2.0; mesg = tr("Speed 2X"); break;
case 0: speed = 1.0; mesg = ctx->GetPlayMessage(); break;
case -1: speed = 1.0 / 3; mesg = QString(tr("Speed 1/3X")); break;
case -2: speed = 1.0 / 8; mesg = QString(tr("Speed 1/8X")); break;
case -3: speed = 1.0 / 16; mesg = QString(tr("Speed 1/16X")); break;
case -1: speed = 1.0 / 3; mesg = tr("Speed 1/3X"); break;
case -2: speed = 1.0 / 8; mesg = tr("Speed 1/8X"); break;
case -3: speed = 1.0 / 16; mesg = tr("Speed 1/16X"); break;
case -4:
DoTogglePause(ctx, true);
return;
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythfilldatabase/filldata.cpp
Expand Up @@ -988,10 +988,10 @@ bool FillData::Run(SourceList &sourcelist)
{
if (nonewdata > 0 &&
(total_sources != externally_handled))
status = QString(QObject::tr(
status = QObject::tr(
"mythfilldatabase ran, but did not insert "
"any new data into the Guide for %1 of %2 sources. "
"This can indicate a potential grabber failure."))
"This can indicate a potential grabber failure.")
.arg(nonewdata)
.arg(total_sources);
else
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/editvideometadata.cpp
Expand Up @@ -348,7 +348,7 @@ void EditMetadataDialog::fillWidgets()
i <= ParentalLevel::plHigh && i.good(); ++i)
{
button = new MythUIButtonListItem(m_levelList,
QString(tr("Level %1")).arg(i.GetLevel()));
tr("Level %1").arg(i.GetLevel()));
button->SetData(i.GetLevel());
}
m_levelList->SetValueByData(m_workingMetadata->GetShowLevel());
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/progdetails.cpp
Expand Up @@ -285,7 +285,7 @@ void ProgDetails::loadPage(void)
QString attr;

if (partnumber > 0)
attr += QString(tr("Part %1 of %2, ")).arg(partnumber).arg(parttotal);
attr += tr("Part %1 of %2, ").arg(partnumber).arg(parttotal);

if (!rating.isEmpty() && rating != "NR")
attr += rating + ", ";
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythfrontend/programrecpriority.cpp
Expand Up @@ -1554,7 +1554,7 @@ void ProgramRecPriority::UpdateList()
progInfo->GetRecordingRuleType()));
}
else
matchInfo = QString(tr("Recording %1 of %2"))
matchInfo = tr("Recording %1 of %2")
.arg(m_recMatch[progInfo->GetRecordingRuleID()])
.arg(m_listMatch[progInfo->GetRecordingRuleID()]);

Expand Down Expand Up @@ -1665,7 +1665,7 @@ void ProgramRecPriority::updateInfo(MythUIButtonListItem *item)
pgRecInfo->GetRecordingRuleType()));
}
else
matchInfo = QString(tr("Recording %1 of %2"))
matchInfo = tr("Recording %1 of %2")
.arg(m_recMatch[pgRecInfo->GetRecordingRuleID()])
.arg(m_listMatch[pgRecInfo->GetRecordingRuleID()]);

Expand Down

0 comments on commit 2961d1f

Please sign in to comment.