forked from qt-creator/qt-creator
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: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user