Commit bf980649 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

tr()-Fixes for 2.6.



- ProjectExplorer::Profile should appear as 'Target' in the UI.
- Fix messagebox title capitalization
- Fix Q_DECLARE_TR_FUNCTIONS to contain fully qualified class
  names, add where applicable to replace
  QCoreApplication::translate().
- Introduce message utility function for the commonly used
  'No tool chain set up for this profile' message to
  ToolChainProfileInformation.
- Introduce message utility functions related to adding files
  to version control to VcsManager to be shared by QmlJsEditor.
- Fix typos.
- Remove QObject::tr(), QCoreApplication::tr().
- Do not translate diagnostic console warnings of
  QmlProfiler.

Change-Id: I6cee717a504796ef39f6eae58f552c5c8630adf3
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 5635272b
......@@ -80,7 +80,7 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent)
QFormLayout *formLayout = new QFormLayout;
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
formLayout->addRow(tr("Profile:"), d->profileChooser);
formLayout->addRow(tr("Target:"), d->profileChooser);
formLayout->addRow(tr("Executable:"), d->executable);
formLayout->addRow(tr("Arguments:"), d->arguments);
formLayout->addRow(tr("Working directory:"), d->workingDirectory);
......
......@@ -44,7 +44,7 @@ AndroidDevice::AndroidDevice()
IDevice::Hardware,
Core::Id(Constants::ANDROID_DEVICE_ID))
{
setDisplayName(QCoreApplication::translate("ProjectExplorer::AndroidDevice", "Run on Android"));
setDisplayName(QCoreApplication::translate("Android::Internal::AndroidDevice", "Run on Android"));
setDeviceState(DeviceReadyToUse);
}
......@@ -60,7 +60,7 @@ IDevice::DeviceInfo AndroidDevice::deviceInformation() const
QString AndroidDevice::displayType() const
{
return QCoreApplication::translate("ProjectExplorer::AndroidDevice", "Android");
return QCoreApplication::translate("Android::Internal::AndroidDevice", "Android");
}
IDeviceWidget *AndroidDevice::createWidget()
......
......@@ -67,8 +67,7 @@ QList<Core::Id> AndroidPackageCreationFactory::availableCreationIds(ProjectExplo
QString AndroidPackageCreationFactory::displayNameForId(const Core::Id id) const
{
if (id == AndroidPackageCreationStep::CreatePackageId)
return QCoreApplication::translate("Qt4ProjectManager::Internal::AndroidPackageCreationFactory",
"Create Android (.apk) Package");
return tr("Create Android (.apk) Package");
return QString();
}
......
......@@ -38,6 +38,7 @@ namespace Internal {
class AndroidPackageCreationFactory : public ProjectExplorer::IBuildStepFactory
{
Q_OBJECT
public:
explicit AndroidPackageCreationFactory(QObject *parent = 0);
......
......@@ -65,8 +65,7 @@ QList<Core::Id> AndroidPackageInstallationFactory::availableCreationIds(BuildSte
QString AndroidPackageInstallationFactory::displayNameForId(const Core::Id id) const
{
if (id == AndroidPackageInstallationStep::Id)
return QCoreApplication::translate("Qt4ProjectManager::Internal::AndroidPackageInstallationFactory",
"Deploy to device");
return tr("Deploy to device");
return QString();
}
......
......@@ -34,8 +34,6 @@
#include <qtsupport/qtsupportconstants.h>
#include <QCoreApplication>
using namespace Android::Internal;
AndroidQtVersion::AndroidQtVersion()
......@@ -77,7 +75,7 @@ QString AndroidQtVersion::invalidReason() const
{
QString tmp = BaseQtVersion::invalidReason();
if (tmp.isEmpty() && qtAbis().isEmpty())
return QCoreApplication::translate("QtVersion", "Failed to detect the ABI(s) used by the Qt version.");
return tr("Failed to detect the ABI(s) used by the Qt version.");
return tmp;
}
......@@ -90,7 +88,7 @@ QList<ProjectExplorer::Abi> AndroidQtVersion::detectQtAbis() const
QString AndroidQtVersion::description() const
{
return QCoreApplication::translate("QtVersion", "Android", "Qt Version is meant for Android");
return tr("Android::Internal::AndroidQtVersion", "Qt Version is meant for Android");
}
Core::FeatureSet AndroidQtVersion::availableFeatures() const
......
......@@ -30,13 +30,17 @@
#ifndef ANDROIDQTVERSION_H
#define ANDROIDQTVERSION_H
#include <qtsupport/baseqtversion.h>
#include <QCoreApplication>
namespace Android {
namespace Internal {
class AndroidQtVersion : public QtSupport::BaseQtVersion
{
Q_DECLARE_TR_FUNCTIONS(Android::Internal::AndroidQtVersion)
public:
AndroidQtVersion();
AndroidQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString());
......
......@@ -304,7 +304,7 @@ void MakeStepConfigWidget::updateDetails()
param.setArguments(arguments);
m_summaryText = param.summary(displayName());
} else {
m_summaryText = tr("<b>No tool chain set up for this profile</b>");
m_summaryText = QLatin1String("<b>") + ProjectExplorer::ToolChainProfileInformation::msgNoToolChainInTarget() + QLatin1String("</b>");
}
emit updateSummary();
......
......@@ -322,7 +322,7 @@ void MakeStepConfigWidget::updateDetails()
param.setArguments(arguments);
m_summaryText = param.summary(displayName());
} else {
m_summaryText = tr("<b>No tool chain set for this target</b>");
m_summaryText = QLatin1String("<b>") + ProjectExplorer::ToolChainProfileInformation::msgNoToolChainInTarget() + QLatin1String("</b>");
}
emit updateSummary();
}
......
......@@ -326,17 +326,44 @@ bool VcsManager::promptToDelete(IVersionControl *vc, const QString &fileName)
return vc->vcsDelete(fileName);
}
QString VcsManager::msgAddToVcsTitle()
{
return tr("Add to Version Control");
}
QString VcsManager::msgPromptToAddToVcs(const QStringList &files, const IVersionControl *vc)
{
return files.size() == 1
? tr("Add the file\n%1\nto version control (%2)?")
.arg(files.front(), vc->displayName())
: tr("Add the files\n%1\nto version control (%2)?")
.arg(files.join(QString(QLatin1Char('\n'))), vc->displayName());
}
QString VcsManager::msgAddToVcsFailedTitle()
{
return tr("Adding to Version Control Failed");
}
QString VcsManager::msgToAddToVcsFailed(const QStringList &files, const IVersionControl *vc)
{
return files.size() == 1
? tr("Could not add the file\n%1\nto version control (%2)\n")
.arg(files.front(), vc->displayName())
: tr("Could not add the following files to version control (%1)\n%2")
.arg(vc->displayName(), files.join(QString(QLatin1Char('\n'))));
}
void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNames)
{
IVersionControl *vc = findVersionControlForDirectory(directory);
if (!vc || !vc->supportsOperation(Core::IVersionControl::AddOperation))
return;
const QString files = fileNames.join(QString(QLatin1Char('\n')));
QMessageBox::StandardButton button =
QMessageBox::question(Core::ICore::mainWindow(), tr("Add to Version Control"),
tr("Add files\n%1\nto version control (%2)?").arg(files, vc->displayName()),
QMessageBox::Yes | QMessageBox::No);
QMessageBox::question(Core::ICore::mainWindow(), VcsManager::msgAddToVcsTitle(),
VcsManager::msgPromptToAddToVcs(fileNames, vc),
QMessageBox::Yes | QMessageBox::No);
if (button == QMessageBox::Yes) {
QStringList notAddedToVc;
foreach (const QString &file, fileNames) {
......@@ -345,10 +372,8 @@ void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNa
}
if (!notAddedToVc.isEmpty()) {
const QString message = tr("Could not add following files to version control (%1)\n").arg(vc->displayName());
const QString filesNotAdded = notAddedToVc.join(QString(QLatin1Char('\n')));
QMessageBox::warning(Core::ICore::mainWindow(), tr("Adding to Version Control Failed"),
message + filesNotAdded);
QMessageBox::warning(Core::ICore::mainWindow(), VcsManager::msgAddToVcsFailedTitle(),
VcsManager::msgToAddToVcsFailed(notAddedToVc, vc));
}
}
}
......
......@@ -87,6 +87,12 @@ public:
// added to revision control. Calls vcsAdd for each file.
void promptToAdd(const QString &directory, const QStringList &fileNames);
// Utility messages for adding files
static QString msgAddToVcsTitle();
static QString msgPromptToAddToVcs(const QStringList &files, const IVersionControl *vc);
static QString msgAddToVcsFailedTitle();
static QString msgToAddToVcsFailed(const QStringList &files, const IVersionControl *vc);
signals:
void repositoryChanged(const QString &repository);
......
......@@ -77,7 +77,7 @@ private:
class FunctionDeclDefLink
{
Q_DECLARE_TR_FUNCTIONS(FunctionDeclDefLink)
Q_DECLARE_TR_FUNCTIONS(CppEditor::Internal::FunctionDeclDefLink)
Q_DISABLE_COPY(FunctionDeclDefLink)
public:
~FunctionDeclDefLink();
......
......@@ -1243,7 +1243,7 @@ StartRemoteEngineDialog::StartRemoteEngineDialog(QWidget *parent)
QFormLayout *formLayout = new QFormLayout();
formLayout->addRow(tr("&Host:"), d->host);
formLayout->addRow(tr("&Usename:"), d->username);
formLayout->addRow(tr("&Username:"), d->username);
formLayout->addRow(tr("&Password:"), d->password);
formLayout->addRow(tr("&Engine path:"), d->enginePath);
formLayout->addRow(tr("&Inferior path:"), d->inferiorPath);
......
......@@ -62,7 +62,7 @@ public:
quint64 address;
bool usable;
Q_DECLARE_TR_FUNCTIONS(StackHandler)
Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::StackHandler)
};
QDebug operator<<(QDebug d, const StackFrame &frame);
......
......@@ -127,8 +127,7 @@ QByteArray section(Core::Id deviceType) {
void raiseError(const QString &reason)
{
QMessageBox::critical(0, QCoreApplication::translate("Madde::DebianManager",
"Error creating debian project templates"), reason);
QMessageBox::critical(0, Madde::Internal::DebianManager::tr("Error Creating Debian Project Templates"), reason);
}
QString defaultPackageFileName(ProjectExplorer::Project *project)
......
......@@ -39,7 +39,7 @@ namespace Internal {
class MaddeDevice : public RemoteLinux::LinuxDeviceConfiguration
{
Q_DECLARE_TR_FUNCTIONS(MaddeDevice)
Q_DECLARE_TR_FUNCTIONS(Madde::Internal::MaddeDevice)
public:
typedef QSharedPointer<MaddeDevice> Ptr;
typedef QSharedPointer<const MaddeDevice> ConstPtr;
......
......@@ -312,8 +312,10 @@ void MaemoPublisherFremantleFree::handleProcessFinished(bool failedToStart)
// Toolchain might be null! (yes because this sucks)
ProjectExplorer::ToolChain *tc
= ProjectExplorer::ToolChainProfileInformation::toolChain(m_buildConfig->target()->profile());
if (!tc)
finishWithFailure(QString(), tr("Make distclean failed. No toolchain in profile."));
if (!tc) {
finishWithFailure(QString(), tr("Make distclean failed: %1")
.arg(ProjectExplorer::ToolChainProfileInformation::msgNoToolChainInTarget()));
}
m_process->start(tc->makeCommand(), QStringList() << QLatin1String("distclean"));
}
break;
......
......@@ -81,9 +81,10 @@ QList<Task> SysRootProfileInformation::validate(Profile *p) const
{
QList<Task> result;
const Utils::FileName dir = SysRootProfileInformation::sysRoot(p);
if (!dir.toFileInfo().isDir() && SysRootProfileInformation::hasSysRoot(p))
result << Task(Task::Error, QObject::tr("Sys Root \"%1\" is not a directory.").arg(dir.toUserOutput()),
if (!dir.toFileInfo().isDir() && SysRootProfileInformation::hasSysRoot(p)) {
result << Task(Task::Error, tr("Sys Root \"%1\" is not a directory.").arg(dir.toUserOutput()),
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
}
return result;
}
......@@ -165,7 +166,7 @@ QList<Task> ToolChainProfileInformation::validate(Profile *p) const
QList<Task> result;
if (!toolChain(p)) {
setToolChain(p, 0); // make sure to clear out no longer known tool chains
result << Task(Task::Error, QObject::tr("No tool chain set up."),
result << Task(Task::Error, ToolChainProfileInformation::msgNoToolChainInTarget(),
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
}
return result;
......@@ -203,6 +204,11 @@ void ToolChainProfileInformation::setToolChain(Profile *p, ToolChain *tc)
p->setValue(Core::Id(TOOLCHAIN_INFORMATION), tc ? tc->id() : QString());
}
QString ToolChainProfileInformation::msgNoToolChainInTarget()
{
return tr("No tool chain set in target.");
}
// --------------------------------------------------------------------------
// DeviceTypeInformation:
// --------------------------------------------------------------------------
......@@ -236,7 +242,7 @@ QList<Task> DeviceTypeProfileInformation::validate(Profile *p) const
IDevice::ConstPtr dev = DeviceProfileInformation::device(p);
QList<Task> result;
if (!dev.isNull() && dev->type() != DeviceTypeProfileInformation::deviceTypeId(p))
result.append(Task(Task::Error, QObject::tr("Device does not match device type."),
result.append(Task(Task::Error, tr("Device does not match device type."),
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)));
return result;
}
......
......@@ -113,6 +113,8 @@ public:
static ToolChain *toolChain(const Profile *p);
static void setToolChain(Profile *p, ToolChain *tc);
static QString msgNoToolChainInTarget();
};
class PROJECTEXPLORER_EXPORT ToolChainMatcher : public ProfileMatcher
......
......@@ -93,7 +93,7 @@ ProfileManagerConfigWidget::ProfileManagerConfigWidget(Profile *p, QWidget *pare
QString ProfileManagerConfigWidget::displayName() const
{
return tr("Profiles");
return tr("Targets");
}
void ProfileManagerConfigWidget::apply()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment