Skip to content

Commit

Permalink
Removal of concatenations and translation context changes.
Browse files Browse the repository at this point in the history
These setting pages were making heavy use of concatenation and
overuse of the QObject tr method and translation context.
  • Loading branch information
Nicolas Riendeau committed Jul 7, 2012
1 parent 44f23ce commit 15d9bca
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 66 deletions.
13 changes: 6 additions & 7 deletions mythtv/programs/mythwelcome/welcomedialog.cpp
Expand Up @@ -355,21 +355,20 @@ void WelcomeDialog::updateScreen(void)

if (tuner.isRecording)
{
status = QObject::tr("Tuner %1 is recording:\n")
.arg(tuner.id);
status = tr("Tuner %1 is recording:").arg(tuner.id);
status += "\n";
status += tuner.channame;
status += "\n" + tuner.title;
if (!tuner.subtitle.isEmpty())
status += "\n("+tuner.subtitle+")";
status += "\n" +
QObject::tr("%1 to %2", "Time period, 'starttime to endtime'")
.arg(MythDate::toString(tuner.startTime, MythDate::kTime))
.arg(MythDate::toString(tuner.endTime, MythDate::kTime));
tr("%1 to %2", "Time period, 'starttime to endtime'")
.arg(MythDate::toString(tuner.startTime, MythDate::kTime))
.arg(MythDate::toString(tuner.endTime, MythDate::kTime));
}
else
{
status = QObject::tr("Tuner %1 is not recording")
.arg(tuner.id);
status = tr("Tuner %1 is not recording").arg(tuner.id);
}

if (m_screenTunerNo < m_tunerList.size() - 1)
Expand Down
118 changes: 59 additions & 59 deletions mythtv/programs/mythwelcome/welcomesettings.cpp
Expand Up @@ -11,77 +11,74 @@
static GlobalTimeBox *DailyWakeupStart1()
{
GlobalTimeBox *gc = new GlobalTimeBox("DailyWakeupStartPeriod1", "00:00");
gc->setLabel(QObject::tr("Period") + " 1 " + QObject::tr("start time"));
gc->setHelpText(QObject::tr("Period") + " 1 " + QObject::tr("start time") +
". " + QObject::tr("Defines a period the master backend should be awake") +
". " + QObject::tr("Set both Start & End times to 00:00 "
"to disable."));
gc->setLabel(MythWelcomeSettings::tr("Period %1 start time").arg("1"));
gc->setHelpText(MythWelcomeSettings::tr("Period %1 start time. "
"Defines a period the master backend should be awake. "
"Set both Start & End times to 00:00 to disable.").arg("1"));
return gc;
};

static GlobalTimeBox *DailyWakeupEnd1()
{
GlobalTimeBox *gc = new GlobalTimeBox("DailyWakeupEndPeriod1", "00:00");
gc->setLabel(QObject::tr("Period") + " 1 " + QObject::tr("end time"));
gc->setHelpText(QObject::tr("Period") + " 1 " + QObject::tr("end time") +
". " + QObject::tr("Defines a period the master backend should be awake") +
". " + QObject::tr("Set both Start & End times to 00:00 "
"to disable."));
gc->setLabel(MythWelcomeSettings::tr("Period %1 end time").arg("1"));
gc->setHelpText(MythWelcomeSettings::tr("Period %1 end time. "
"Defines a period the master backend should be awake. "
"Set both Start & End times to 00:00 to disable.").arg("1"));
return gc;
};

static GlobalTimeBox *DailyWakeupStart2()
{
GlobalTimeBox *gc = new GlobalTimeBox("DailyWakeupStartPeriod2", "00:00");
gc->setLabel(QObject::tr("Period") + " 2 " + QObject::tr("start time"));
gc->setHelpText(QObject::tr("Period") + " 2 " + QObject::tr("start time") +
". " + QObject::tr("Defines a period the master backend should be awake") +
". " + QObject::tr("Set both Start & End times to 00:00 "
"to disable."));
gc->setLabel(MythWelcomeSettings::tr("Period %1 start time").arg("2"));
gc->setHelpText(MythWelcomeSettings::tr("Period %1 start time. "
"Defines a period the master backend should be awake. "
"Set both Start & End times to 00:00 to disable.").arg("2"));
return gc;
};

static GlobalTimeBox *DailyWakeupEnd2()
{
GlobalTimeBox *gc = new GlobalTimeBox("DailyWakeupEndPeriod2", "00:00");
gc->setLabel(QObject::tr("Period") + " 2 " + QObject::tr("end time"));
gc->setHelpText(QObject::tr("Period") + " 2 " + QObject::tr("end time") +
". " + QObject::tr("Defines a period the master backend should be awake") +
". " + QObject::tr("Set both Start & End times to 00:00 "
"to disable."));
gc->setLabel(MythWelcomeSettings::tr("Period %1 end time").arg("2"));
gc->setHelpText(MythWelcomeSettings::tr("Period %1 end time. "
"Defines a period the master backend should be awake. "
"Set both Start & End times to 00:00 to disable.").arg("2"));
return gc;
};

static HostCheckBox *AutoStartFrontend()
{
HostCheckBox *gc = new HostCheckBox("AutoStartFrontend");
gc->setLabel(QObject::tr("Automatically Start mythfrontend"));
gc->setLabel(MythWelcomeSettings::tr("Automatically Start mythfrontend"));
gc->setValue(true);
gc->setHelpText(QObject::tr("Mythwelcome will automatically start "
"mythfrontend if it is determined that it was not started to "
"record a program."));
gc->setHelpText(MythWelcomeSettings::tr("Mythwelcome will automatically "
"start mythfrontend if it is determined that it was "
"not started to record a program."));
return gc;
};

static HostCheckBox *ShutdownWithBE()
{
HostCheckBox *gc = new HostCheckBox("ShutdownWithMasterBE");
gc->setLabel(QObject::tr("Shutdown with Master Backend"));
gc->setLabel(MythWelcomeSettings::tr("Shutdown with Master Backend"));
gc->setValue(false);
gc->setHelpText(QObject::tr("Mythwelcome will automatically shutdown "
"this computer when the master backend shuts down. "
"Should only be set on frontend only machines"));
gc->setHelpText(MythWelcomeSettings::tr("Mythwelcome will automatically "
"shutdown this computer when the master backend shuts "
"down. Should only be set on frontend only machines"));
return gc;
};

static HostLineEdit *MythWelcomeDateFormat()
{
HostLineEdit *gc = new HostLineEdit("MythWelcomeDateFormat");
gc->setLabel(QObject::tr("Date Format"));
gc->setLabel(MythWelcomeSettings::tr("Date Format"));
gc->setValue("dddd\ndd MMM yyyy");
gc->setHelpText(QObject::tr("This is the format to use to display the date. "
"See http://doc.trolltech.com/3.3/qdate.html#toString "
"for a list of valid format specifiers."));
gc->setHelpText(MythWelcomeSettings::tr("This is the format to use to "
"display the date. "
"See http://doc.trolltech.com/3.3/qdate.html#toString "
"for a list of valid format specifiers."));
return gc;
};

Expand All @@ -94,14 +91,14 @@ MythWelcomeSettings::MythWelcomeSettings()
VerticalConfigurationGroup* vcg =
new VerticalConfigurationGroup(false);

vcg->setLabel(QObject::tr("MythWelcome Settings"));
vcg->setLabel(tr("MythWelcome Settings"));

hcg1->setLabel(QObject::tr("Daily Wakeup/ShutDown Period") + " 1");
hcg1->setLabel(tr("Daily Wakeup/ShutDown Period %1").arg("1"));
hcg1->addChild(DailyWakeupStart1());
hcg1->addChild(DailyWakeupEnd1());
vcg->addChild(hcg1);

hcg2->setLabel(QObject::tr("Daily Wakeup/ShutDown Period") + " 2");
hcg2->setLabel(tr("Daily Wakeup/ShutDown Period %1").arg("2"));
hcg2->addChild(DailyWakeupStart2());
hcg2->addChild(DailyWakeupEnd2());
vcg->addChild(hcg2);
Expand All @@ -126,73 +123,76 @@ MythWelcomeSettings::MythWelcomeSettings()
static HostLineEdit *MythShutdownNvramCmd()
{
HostLineEdit *gc = new HostLineEdit("MythShutdownNvramCmd");
gc->setLabel(QObject::tr("Command to Set Wakeup Time"));
gc->setLabel(MythShutdownSettings::tr("Command to Set Wakeup Time"));
gc->setValue("/usr/bin/nvram-wakeup --settime $time");
gc->setHelpText(QObject::tr("Command to set the wakeup time in the BIOS. "
"See the README file for more examples."));
gc->setHelpText(MythShutdownSettings::tr("Command to set the wakeup time "
"in the BIOS. See the README file for more examples."));
return gc;
};

static HostComboBox *WakeupTimeFormat()
{
HostComboBox *gc = new HostComboBox("MythShutdownWakeupTimeFmt", true);
gc->setLabel(QObject::tr("Wakeup time format"));
gc->setLabel(MythShutdownSettings::tr("Wakeup time format"));
gc->addSelection("time_t");
gc->addSelection("yyyy-MM-dd hh:mm:ss");
gc->setHelpText(QObject::tr("The format of the time string passed to the "
"\'Set Wakeup Time Command\' as $time. See "
"QT::QDateTime.toString() for details. Set to 'time_t' for "
"seconds since epoch (use time_t for nvram_wakeup)."));
gc->setHelpText(MythShutdownSettings::tr("The format of the time string "
"passed to the \'Set Wakeup Time Command\' as $time. "
"See QT::QDateTime.toString() for details. Set to "
"'time_t' for seconds since epoch (use time_t for "
"nvram_wakeup)."));
return gc;
};

static HostLineEdit *MythShutdownNvramRestartCmd()
{
HostLineEdit *gc = new HostLineEdit("MythShutdownNvramRestartCmd");
gc->setLabel(QObject::tr("nvram-wakeup Restart Command"));
gc->setLabel(MythShutdownSettings::tr("nvram-wakeup Restart Command"));
gc->setValue("/sbin/grub-set-default 1");
gc->setHelpText(QObject::tr("Command to run if your bios requires you to "
"reboot to allow nvram-wakeup settings to "
"take effect. Leave blank if your bios does not "
"require a reboot. See the README file for more "
"examples."));
gc->setHelpText(MythShutdownSettings::tr("Command to run if your bios "
"requires you to reboot to allow nvram-wakeup settings "
"to take effect. Leave blank if your bios does not "
"require a reboot. See the README file for more "
"examples."));
return gc;
};

static HostLineEdit *MythShutdownReboot()
{
HostLineEdit *gc = new HostLineEdit("MythShutdownReboot");
gc->setLabel(QObject::tr("Command to reboot"));
gc->setLabel(MythShutdownSettings::tr("Command to reboot"));
gc->setValue("/sbin/reboot");
gc->setHelpText(QObject::tr("Command to reboot computer."));
gc->setHelpText(MythShutdownSettings::tr("Command to reboot computer."));
return gc;
};

static HostLineEdit *MythShutdownPowerOff()
{
HostLineEdit *gc = new HostLineEdit("MythShutdownPowerOff");
gc->setLabel(QObject::tr("Command to shutdown"));
gc->setLabel(MythShutdownSettings::tr("Command to shutdown"));
gc->setValue("/sbin/poweroff");
gc->setHelpText(QObject::tr("Command to shutdown computer."));
gc->setHelpText(MythShutdownSettings::tr("Command to shutdown computer."));
return gc;
};

static HostLineEdit *MythShutdownStartFECmd()
{
HostLineEdit *gc = new HostLineEdit("MythWelcomeStartFECmd");
gc->setLabel(QObject::tr("Command to run to start the Frontend"));
gc->setLabel(MythShutdownSettings::tr("Command to run to start the "
"Frontend"));
gc->setValue(GetInstallPrefix() + "/bin/mythfrontend");
gc->setHelpText(QObject::tr("Command to start mythfrontend."));
gc->setHelpText(MythShutdownSettings::tr("Command to start mythfrontend."));
return gc;
};

static HostLineEdit *MythShutdownXTermCmd()
{
HostLineEdit *gc = new HostLineEdit("MythShutdownXTermCmd");
gc->setLabel(QObject::tr("Command to run Xterm"));
gc->setLabel(MythShutdownSettings::tr("Command to run Xterm"));
gc->setValue("xterm");
gc->setHelpText(QObject::tr("Command to start an Xterm. Can be disabled by "
"leaving this setting blank."));
gc->setHelpText(MythShutdownSettings::tr("Command to start an Xterm. Can "
"be disabled by leaving this "
"setting blank."));
return gc;
};

Expand All @@ -202,7 +202,7 @@ MythShutdownSettings::MythShutdownSettings()
VerticalConfigurationGroup* vcg =
new VerticalConfigurationGroup(false);

vcg->setLabel(QObject::tr("MythShutdown/MythWelcome Settings"));
vcg->setLabel(tr("MythShutdown/MythWelcome Settings"));
vcg->addChild(MythShutdownNvramCmd());
vcg->addChild(WakeupTimeFormat());
vcg->addChild(MythShutdownNvramRestartCmd());
Expand Down
8 changes: 8 additions & 0 deletions mythtv/programs/mythwelcome/welcomesettings.h
@@ -1,16 +1,24 @@
#ifndef WELCOMESETTINGS_H
#define WELCOMESETTINGS_H

// Qt headers
#include <QCoreApplication>

// MythTV headers
#include <mythconfigdialogs.h>

class MythWelcomeSettings : public ConfigurationWizard
{
Q_DECLARE_TR_FUNCTIONS(MythWelcomeSettings)

public:
MythWelcomeSettings();
};

class MythShutdownSettings : public ConfigurationWizard
{
Q_DECLARE_TR_FUNCTIONS(MythShutdownSettings)

public:
MythShutdownSettings();
};
Expand Down

0 comments on commit 15d9bca

Please sign in to comment.