Commit fb9ab99c authored by Takumi ASAKI's avatar Takumi ASAKI Committed by Nikolai Kosjar

ClangStaticAnalyzer: tr()-Fixes

Do not use QObject::tr().

Change-Id: Id3631a8e90bc821377a8b3b7e0aae22b355274d3
Reviewed-by: Ulf Hermann's avatarUlf Hermann <ulf.hermann@qt.io>
Reviewed-by: Nikolai Kosjar's avatarNikolai Kosjar <nikolai.kosjar@qt.io>
parent af56457a
......@@ -38,6 +38,7 @@ namespace Internal {
class ClangStaticAnalyzerLogFileReader
{
Q_DECLARE_TR_FUNCTIONS(ClangStaticAnalyzer::Internal::ClangStaticAnalyzerLogFileReader)
public:
ClangStaticAnalyzerLogFileReader(const QString &filePath);
......@@ -79,7 +80,7 @@ QList<Diagnostic> LogFileReader::read(const QString &filePath, QString *errorMes
QFileInfo fi(filePath);
if (!fi.exists() || !fi.isReadable()) {
if (errorMessage) {
*errorMessage = QObject::tr("File \"%1\" does not exist or is not readable.")
*errorMessage = tr("File \"%1\" does not exist or is not readable.")
.arg(filePath);
}
return emptyList;
......@@ -97,22 +98,22 @@ QList<Diagnostic> LogFileReader::read(const QString &filePath, QString *errorMes
// Handle errors
case QXmlStreamReader::UnexpectedElementError:
if (errorMessage) {
*errorMessage = QObject::tr("Could not read file \"%1\": UnexpectedElementError.")
*errorMessage = tr("Could not read file \"%1\": UnexpectedElementError.")
.arg(filePath);
} // fall-through
case QXmlStreamReader::CustomError:
if (errorMessage) {
*errorMessage = QObject::tr("Could not read file \"%1\": CustomError.")
*errorMessage = tr("Could not read file \"%1\": CustomError.")
.arg(filePath);
} // fall-through
case QXmlStreamReader::NotWellFormedError:
if (errorMessage) {
*errorMessage = QObject::tr("Could not read file \"%1\": NotWellFormedError.")
*errorMessage = tr("Could not read file \"%1\": NotWellFormedError.")
.arg(filePath);
} // fall-through
case QXmlStreamReader::PrematureEndOfDocumentError:
if (errorMessage) {
*errorMessage = QObject::tr("Could not read file \"%1\": PrematureEndOfDocumentError.")
*errorMessage = tr("Could not read file \"%1\": PrematureEndOfDocumentError.")
.arg(filePath);
} // fall-through
default:
......@@ -161,7 +162,7 @@ void ClangStaticAnalyzerLogFileReader::readPlist()
if (m_xml.attributes().value(QLatin1String("version")) == QLatin1String("1.0"))
readTopLevelDict();
} else {
m_xml.raiseError(QObject::tr("File is not a plist version 1.0 file."));
m_xml.raiseError(tr("File is not a plist version 1.0 file."));
}
}
}
......@@ -344,7 +345,7 @@ QString ClangStaticAnalyzerLogFileReader::readString()
if (m_xml.readNextStartElement() && m_xml.name() == QLatin1String("string"))
return m_xml.readElementText();
m_xml.raiseError(QObject::tr("Expected a string element."));
m_xml.raiseError(tr("Expected a string element."));
return QString();
}
......@@ -360,7 +361,7 @@ QStringList ClangStaticAnalyzerLogFileReader::readStringArray()
return result;
}
m_xml.raiseError(QObject::tr("Expected an array element."));
m_xml.raiseError(tr("Expected an array element."));
return QStringList();
}
......@@ -371,7 +372,7 @@ int ClangStaticAnalyzerLogFileReader::readInteger(bool *convertedSuccessfully)
return contents.toInt(convertedSuccessfully);
}
m_xml.raiseError(QObject::tr("Expected an integer element."));
m_xml.raiseError(tr("Expected an integer element."));
if (convertedSuccessfully)
*convertedSuccessfully = false;
return -1;
......
......@@ -28,12 +28,14 @@
#include "clangstaticanalyzerdiagnostic.h"
#include <QList>
#include <QCoreApplication>
namespace ClangStaticAnalyzer {
namespace Internal {
class LogFileReader
{
Q_DECLARE_TR_FUNCTIONS(ClangStaticAnalyzer::Internal::LogFileReader)
public:
static QList<Diagnostic> read(const QString &filePath, QString *errorMessage);
};
......
......@@ -37,14 +37,17 @@
static Q_LOGGING_CATEGORY(LOG, "qtc.clangstaticanalyzer.runner")
namespace ClangStaticAnalyzer {
namespace Internal {
static QString generalProcessError()
{
return QObject::tr("An error occurred with the Clang Static Analyzer process.");
return ClangStaticAnalyzerRunner::tr("An error occurred with the Clang Static Analyzer process.");
}
static QString finishedDueToCrash()
{
return QObject::tr("Clang Static Analyzer crashed.");
return ClangStaticAnalyzerRunner::tr("Clang Static Analyzer crashed.");
}
static QStringList constructCommandLineArguments(const QString &filePath,
......@@ -61,12 +64,9 @@ static QStringList constructCommandLineArguments(const QString &filePath,
return arguments;
}
namespace ClangStaticAnalyzer {
namespace Internal {
QString finishedWithBadExitCode(int exitCode)
{
return QObject::tr("Clang Static Analyzer finished with exit code: %1.").arg(exitCode);
return ClangStaticAnalyzerRunner::tr("Clang Static Analyzer finished with exit code: %1.").arg(exitCode);
}
ClangStaticAnalyzerRunner::ClangStaticAnalyzerRunner(const QString &clangExecutable,
......@@ -171,7 +171,7 @@ QString ClangStaticAnalyzerRunner::createLogFile(const QString &filePath) const
QString ClangStaticAnalyzerRunner::processCommandlineAndOutput() const
{
return QObject::tr("Command line: \"%1\"\n"
return tr("Command line: \"%1\"\n"
"Process Error: %2\n"
"Output:\n%3")
.arg(m_commandLine,
......
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