forked from qt-creator/qt-creator
CMake: Compile with QT_NO_CAST_FROM_ASCII
Change-Id: I23134b7eef222dcdb3425e2f2f6d62ab863009fe Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
committed by
Daniel Teske
parent
b5bfb81508
commit
862629c57a
@@ -203,15 +203,15 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer:
|
||||
|
||||
MakeStep *cleanMakeStep = new MakeStep(cleanSteps);
|
||||
cleanSteps->insertStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setAdditionalArguments("clean");
|
||||
cleanMakeStep->setAdditionalArguments(QLatin1String("clean"));
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
bc->setBuildDirectory(copw.buildDirectory());
|
||||
bc->setUseNinja(copw.useNinja());
|
||||
|
||||
// Default to all
|
||||
if (project->hasBuildTarget("all"))
|
||||
makeStep->setBuildTarget("all", true);
|
||||
if (project->hasBuildTarget(QLatin1String("all")))
|
||||
makeStep->setBuildTarget(QLatin1String("all"), true);
|
||||
|
||||
return bc;
|
||||
}
|
||||
@@ -255,13 +255,13 @@ bool CMakeBuildConfigurationFactory::canHandle(const ProjectExplorer::Target *t)
|
||||
ProjectExplorer::BuildConfiguration::BuildType CMakeBuildConfiguration::buildType() const
|
||||
{
|
||||
QString cmakeBuildType;
|
||||
QFile cmakeCache(buildDirectory() + "/CMakeCache.txt");
|
||||
QFile cmakeCache(buildDirectory() + QLatin1String("/CMakeCache.txt"));
|
||||
if (cmakeCache.open(QIODevice::ReadOnly)) {
|
||||
while (!cmakeCache.atEnd()) {
|
||||
QString line = cmakeCache.readLine();
|
||||
QByteArray line = cmakeCache.readLine();
|
||||
if (line.startsWith("CMAKE_BUILD_TYPE")) {
|
||||
if (int pos = line.indexOf('=')) {
|
||||
cmakeBuildType = line.mid(pos + 1).trimmed();
|
||||
cmakeBuildType = QString::fromLocal8Bit(line.mid(pos + 1).trimmed());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -270,13 +270,13 @@ ProjectExplorer::BuildConfiguration::BuildType CMakeBuildConfiguration::buildTyp
|
||||
}
|
||||
|
||||
// Cover all common CMake build types
|
||||
if (cmakeBuildType.compare("Release", Qt::CaseInsensitive) == 0
|
||||
|| cmakeBuildType.compare("MinSizeRel", Qt::CaseInsensitive) == 0)
|
||||
if (cmakeBuildType.compare(QLatin1String("Release"), Qt::CaseInsensitive) == 0
|
||||
|| cmakeBuildType.compare(QLatin1String("MinSizeRel"), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return Release;
|
||||
} else if (cmakeBuildType.compare("Debug", Qt::CaseInsensitive) == 0
|
||||
|| cmakeBuildType.compare("debugfull", Qt::CaseInsensitive) == 0
|
||||
|| cmakeBuildType.compare("RelWithDebInfo", Qt::CaseInsensitive) == 0)
|
||||
} else if (cmakeBuildType.compare(QLatin1String("Debug"), Qt::CaseInsensitive) == 0
|
||||
|| cmakeBuildType.compare(QLatin1String("DebugFull"), Qt::CaseInsensitive) == 0
|
||||
|| cmakeBuildType.compare(QLatin1String("RelWithDebInfo"), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return Debug;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
if (fi.exists()) {
|
||||
if (fi.isDir()) {
|
||||
QDir subDir(fi.absoluteFilePath());
|
||||
QString subProject = subDir.filePath("CMakeLists.txt");
|
||||
QString subProject = subDir.filePath(QLatin1String("CMakeLists.txt"));
|
||||
if (QFileInfo(subProject).exists())
|
||||
fileName = subProject;
|
||||
else
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
|
||||
static bool isVariable(const QString &word)
|
||||
static bool isVariable(const QByteArray &word)
|
||||
{
|
||||
if (word.length() < 4) // must be at least "${.}"
|
||||
return false;
|
||||
@@ -53,14 +53,14 @@ CMakeHighlighter::CMakeHighlighter(QTextDocument *document) :
|
||||
|
||||
void CMakeHighlighter::highlightBlock(const QString &text)
|
||||
{
|
||||
QString buf;
|
||||
QByteArray buf;
|
||||
bool inCommentMode = false;
|
||||
bool inStringMode = (previousBlockState() == 1);
|
||||
|
||||
QTextCharFormat emptyFormat;
|
||||
int i=0;
|
||||
for (i=0; i < text.length(); i++) {
|
||||
const QChar c = text.at(i);
|
||||
char c = text.at(i).toLatin1();
|
||||
if (inCommentMode) {
|
||||
setFormat(i, 1, m_formats[CMakeCommentFormat]);
|
||||
} else {
|
||||
@@ -80,7 +80,7 @@ void CMakeHighlighter::highlightBlock(const QString &text)
|
||||
} else {
|
||||
buf += c;
|
||||
}
|
||||
} else if (c.isSpace()) {
|
||||
} else if (text.at(i).isSpace()) {
|
||||
if (!inStringMode)
|
||||
buf.clear();
|
||||
else
|
||||
|
||||
@@ -81,8 +81,8 @@ namespace Internal {
|
||||
bool isNinja() const;
|
||||
|
||||
QString displayName() const;
|
||||
QString generatorArgument() const;
|
||||
QString generator() const;
|
||||
QByteArray generatorArgument() const;
|
||||
QByteArray generator() const;
|
||||
|
||||
private:
|
||||
ProjectExplorer::Kit *m_kit;
|
||||
@@ -111,36 +111,36 @@ bool GeneratorInfo::isNinja() const {
|
||||
return m_isNinja;
|
||||
}
|
||||
|
||||
QString GeneratorInfo::generator() const
|
||||
QByteArray GeneratorInfo::generator() const
|
||||
{
|
||||
if (!m_kit)
|
||||
return QString();
|
||||
return QByteArray();
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(m_kit);
|
||||
ProjectExplorer::Abi targetAbi = tc->targetAbi();
|
||||
if (m_isNinja) {
|
||||
return QLatin1String("Ninja");
|
||||
return "Ninja";
|
||||
} else if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
|
||||
if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
|
||||
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
|
||||
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor
|
||||
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2012Flavor) {
|
||||
return QLatin1String("NMake Makefiles");
|
||||
return "NMake Makefiles";
|
||||
} else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
return QLatin1String("MinGW Makefiles");
|
||||
return "MinGW Makefiles";
|
||||
else
|
||||
return QLatin1String("Unix Makefiles");
|
||||
return "Unix Makefiles";
|
||||
}
|
||||
}
|
||||
return QLatin1String("Unix Makefiles");
|
||||
return "Unix Makefiles";
|
||||
}
|
||||
|
||||
QString GeneratorInfo::generatorArgument() const
|
||||
QByteArray GeneratorInfo::generatorArgument() const
|
||||
{
|
||||
QString tmp = generator();
|
||||
QByteArray tmp = generator();
|
||||
if (tmp.isEmpty())
|
||||
return tmp;
|
||||
return QLatin1String("-GCodeBlocks - ") + tmp;
|
||||
return QByteArray("-GCodeBlocks - ") + tmp;
|
||||
}
|
||||
|
||||
QString GeneratorInfo::displayName() const
|
||||
@@ -267,7 +267,7 @@ CMakeManager *CMakeOpenProjectWizard::cmakeManager() const
|
||||
|
||||
bool CMakeOpenProjectWizard::hasInSourceBuild() const
|
||||
{
|
||||
QFileInfo fi(m_sourceDirectory + "/CMakeCache.txt");
|
||||
QFileInfo fi(m_sourceDirectory + QLatin1String("/CMakeCache.txt"));
|
||||
if (fi.exists())
|
||||
return true;
|
||||
return false;
|
||||
@@ -279,7 +279,7 @@ bool CMakeOpenProjectWizard::existsUpToDateXmlFile() const
|
||||
if (!cbpFile.isEmpty()) {
|
||||
// We already have a cbp file
|
||||
QFileInfo cbpFileInfo(cbpFile);
|
||||
QFileInfo cmakeListsFileInfo(sourceDirectory() + "/CMakeLists.txt");
|
||||
QFileInfo cmakeListsFileInfo(sourceDirectory() + QLatin1String("/CMakeLists.txt"));
|
||||
|
||||
if (cbpFileInfo.lastModified() > cmakeListsFileInfo.lastModified())
|
||||
return true;
|
||||
@@ -394,7 +394,7 @@ ChooseCMakePage::ChooseCMakePage(CMakeOpenProjectWizard *cmakeWizard)
|
||||
// Show a field for the user to enter
|
||||
m_cmakeExecutable = new Utils::PathChooser(this);
|
||||
m_cmakeExecutable->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
fl->addRow("cmake Executable:", m_cmakeExecutable);
|
||||
fl->addRow(tr("cmake Executable:"), m_cmakeExecutable);
|
||||
|
||||
connect(m_cmakeExecutable, SIGNAL(editingFinished()),
|
||||
this, SLOT(cmakeExecutableChanged()));
|
||||
@@ -499,18 +499,18 @@ void CMakeRunPage::initWidgets()
|
||||
setMinimumSize(600, 400);
|
||||
}
|
||||
|
||||
QString CMakeRunPage::cachedGeneratorFromFile(const QString &cache)
|
||||
QByteArray CMakeRunPage::cachedGeneratorFromFile(const QString &cache)
|
||||
{
|
||||
QFile fi(cache);
|
||||
if (fi.exists()) {
|
||||
// Cache exists, then read it...
|
||||
if (fi.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
while (!fi.atEnd()) {
|
||||
QString line = fi.readLine();
|
||||
QByteArray line = fi.readLine();
|
||||
if (line.startsWith("CMAKE_GENERATOR:INTERNAL=")) {
|
||||
int splitpos = line.indexOf('=');
|
||||
if (splitpos != -1) {
|
||||
QString cachedGenerator = line.mid(splitpos + 1).trimmed();
|
||||
QByteArray cachedGenerator = line.mid(splitpos + 1).trimmed();
|
||||
if (!cachedGenerator.isEmpty())
|
||||
return cachedGenerator;
|
||||
}
|
||||
@@ -518,7 +518,7 @@ QString CMakeRunPage::cachedGeneratorFromFile(const QString &cache)
|
||||
}
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
void CMakeRunPage::initializePage()
|
||||
@@ -569,7 +569,7 @@ void CMakeRunPage::initializePage()
|
||||
|
||||
if (m_mode == Initial) {
|
||||
// Try figuring out generator and toolchain from CMakeCache.txt
|
||||
QString cachedGenerator = cachedGeneratorFromFile(m_buildDirectory + "/CMakeCache.txt");
|
||||
QByteArray cachedGenerator = cachedGeneratorFromFile(m_buildDirectory + QLatin1String("/CMakeCache.txt"));
|
||||
|
||||
m_generatorComboBox->show();
|
||||
QList<ProjectExplorer::Kit *> kitList =
|
||||
@@ -652,7 +652,7 @@ void CMakeRunPage::runCMake()
|
||||
connect(m_cmakeProcess, SIGNAL(readyReadStandardError()), this, SLOT(cmakeReadyReadStandardError()));
|
||||
connect(m_cmakeProcess, SIGNAL(finished(int)), this, SLOT(cmakeFinished()));
|
||||
cmakeManager->createXmlFile(m_cmakeProcess, m_argumentsLineEdit->text(), m_cmakeWizard->sourceDirectory(),
|
||||
m_buildDirectory, env, generatorInfo.generatorArgument());
|
||||
m_buildDirectory, env, QString::fromLatin1(generatorInfo.generatorArgument()));
|
||||
} else {
|
||||
m_runCMake->setEnabled(true);
|
||||
m_argumentsLineEdit->setEnabled(true);
|
||||
@@ -677,7 +677,7 @@ void CMakeRunPage::cmakeReadyReadStandardOutput()
|
||||
tf.setFont(font);
|
||||
tf.setForeground(m_output->palette().color(QPalette::Text));
|
||||
|
||||
cursor.insertText(m_cmakeProcess->readAllStandardOutput(), tf);
|
||||
cursor.insertText(QString::fromLocal8Bit(m_cmakeProcess->readAllStandardOutput()), tf);
|
||||
}
|
||||
|
||||
void CMakeRunPage::cmakeReadyReadStandardError()
|
||||
@@ -691,7 +691,7 @@ void CMakeRunPage::cmakeReadyReadStandardError()
|
||||
tf.setFont(boldFont);
|
||||
tf.setForeground(mix_colors(m_output->palette().color(QPalette::Text), QColor(Qt::red)));
|
||||
|
||||
cursor.insertText(m_cmakeProcess->readAllStandardError(), tf);
|
||||
cursor.insertText(QString::fromLocal8Bit(m_cmakeProcess->readAllStandardError()), tf);
|
||||
}
|
||||
|
||||
void CMakeRunPage::cmakeFinished()
|
||||
|
||||
@@ -179,7 +179,7 @@ private slots:
|
||||
void cmakeReadyReadStandardError();
|
||||
private:
|
||||
void initWidgets();
|
||||
QString cachedGeneratorFromFile(const QString &cache);
|
||||
QByteArray cachedGeneratorFromFile(const QString &cache);
|
||||
CMakeOpenProjectWizard *m_cmakeWizard;
|
||||
QPlainTextEdit *m_output;
|
||||
QPushButton *m_runCMake;
|
||||
|
||||
@@ -251,7 +251,7 @@ bool CMakeProject::parseCMakeLists()
|
||||
projectFiles.insert(node->path());
|
||||
} else {
|
||||
// Manually add the CMakeLists.txt file
|
||||
QString cmakeListTxt = projectDirectory() + "/CMakeLists.txt";
|
||||
QString cmakeListTxt = projectDirectory() + QLatin1String("/CMakeLists.txt");
|
||||
bool generated = false;
|
||||
fileList.append(new ProjectExplorer::FileNode(cmakeListTxt, ProjectExplorer::ProjectFileType, generated));
|
||||
projectFiles.insert(cmakeListTxt);
|
||||
@@ -279,13 +279,13 @@ bool CMakeProject::parseCMakeLists()
|
||||
|
||||
// TOOD this code ain't very pretty ...
|
||||
m_uicCommand.clear();
|
||||
QFile cmakeCache(activeBC->buildDirectory() + "/CMakeCache.txt");
|
||||
QFile cmakeCache(activeBC->buildDirectory() + QLatin1String("/CMakeCache.txt"));
|
||||
cmakeCache.open(QIODevice::ReadOnly);
|
||||
while (!cmakeCache.atEnd()) {
|
||||
QString line = cmakeCache.readLine();
|
||||
QByteArray line = cmakeCache.readLine();
|
||||
if (line.startsWith("QT_UIC_EXECUTABLE")) {
|
||||
if (int pos = line.indexOf('=')) {
|
||||
m_uicCommand = line.mid(pos + 1).trimmed();
|
||||
m_uicCommand = QString::fromLocal8Bit(line.mid(pos + 1).trimmed());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -542,7 +542,7 @@ bool CMakeProject::fromMap(const QVariantMap &map)
|
||||
Kit *k = copw.kit();
|
||||
Target *t = new Target(this, k);
|
||||
CMakeBuildConfiguration *bc(new CMakeBuildConfiguration(t));
|
||||
bc->setDefaultDisplayName("all");
|
||||
bc->setDefaultDisplayName(QLatin1String("all"));
|
||||
bc->setUseNinja(copw.useNinja());
|
||||
bc->setBuildDirectory(copw.buildDirectory());
|
||||
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
@@ -553,7 +553,7 @@ bool CMakeProject::fromMap(const QVariantMap &map)
|
||||
|
||||
MakeStep *cleanMakeStep = new MakeStep(cleanSteps);
|
||||
cleanSteps->insertStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setAdditionalArguments("clean");
|
||||
cleanMakeStep->setAdditionalArguments(QLatin1String("clean"));
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
t->addBuildConfiguration(bc);
|
||||
@@ -594,11 +594,11 @@ bool CMakeProject::fromMap(const QVariantMap &map)
|
||||
|
||||
parseCMakeLists();
|
||||
|
||||
if (!hasUserFile && hasBuildTarget("all")) {
|
||||
if (!hasUserFile && hasBuildTarget(QLatin1String("all"))) {
|
||||
MakeStep *makeStep = qobject_cast<MakeStep *>(
|
||||
activeTarget()->activeBuildConfiguration()->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)->at(0));
|
||||
Q_ASSERT(makeStep);
|
||||
makeStep->setBuildTarget("all", true);
|
||||
makeStep->setBuildTarget(QLatin1String("all"), true);
|
||||
}
|
||||
|
||||
connect(Core::EditorManager::instance(), SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
@@ -691,7 +691,7 @@ void CMakeProject::updateRunConfigurations(Target *t)
|
||||
continue;
|
||||
if (ct.executable.isEmpty())
|
||||
continue;
|
||||
if (ct.title.endsWith("/fast"))
|
||||
if (ct.title.endsWith(QLatin1String("/fast")))
|
||||
continue;
|
||||
QList<CMakeRunConfiguration *> list = existingRunConfigurations.values(ct.title);
|
||||
if (!list.isEmpty()) {
|
||||
@@ -743,7 +743,7 @@ void CMakeProject::createUiCodeModelSupport()
|
||||
|
||||
// Find all ui files
|
||||
foreach (const QString &uiFile, m_files) {
|
||||
if (uiFile.endsWith(".ui")) {
|
||||
if (uiFile.endsWith(QLatin1String(".ui"))) {
|
||||
// UI file, not convert to
|
||||
QString uiHeaderFilePath = uiHeaderFile(uiFile);
|
||||
QMap<QString, CMakeUiCodeModelSupport *>::iterator it
|
||||
@@ -872,7 +872,7 @@ QString CMakeFile::suggestedFileName() const
|
||||
|
||||
QString CMakeFile::mimeType() const
|
||||
{
|
||||
return Constants::CMAKEMIMETYPE;
|
||||
return QLatin1String(Constants::CMAKEMIMETYPE);
|
||||
}
|
||||
|
||||
|
||||
@@ -1042,12 +1042,12 @@ void CMakeCbpParser::parseBuildTarget()
|
||||
m_buildTargetType = false;
|
||||
m_buildTarget.clear();
|
||||
|
||||
if (attributes().hasAttribute("title"))
|
||||
m_buildTarget.title = attributes().value("title").toString();
|
||||
if (attributes().hasAttribute(QLatin1String("title")))
|
||||
m_buildTarget.title = attributes().value(QLatin1String("title")).toString();
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
if (m_buildTargetType || m_buildTarget.title == "all" || m_buildTarget.title == "install") {
|
||||
if (m_buildTargetType || m_buildTarget.title == QLatin1String("all") || m_buildTarget.title == QLatin1String("install")) {
|
||||
m_buildTargets.append(m_buildTarget);
|
||||
}
|
||||
return;
|
||||
@@ -1063,15 +1063,19 @@ void CMakeCbpParser::parseBuildTarget()
|
||||
|
||||
void CMakeCbpParser::parseBuildTargetOption()
|
||||
{
|
||||
if (attributes().hasAttribute("output")) {
|
||||
m_buildTarget.executable = attributes().value("output").toString();
|
||||
} else if (attributes().hasAttribute("type") && (attributes().value("type") == "1" || attributes().value("type") == "0")) {
|
||||
if (attributes().hasAttribute(QLatin1String("output"))) {
|
||||
m_buildTarget.executable = attributes().value(QLatin1String("output")).toString();
|
||||
} else if (attributes().hasAttribute(QLatin1String("type"))
|
||||
&& (attributes().value(QLatin1String("type")) == QLatin1String("1")
|
||||
|| attributes().value(QLatin1String("type")) == QLatin1String("0"))) {
|
||||
m_buildTargetType = true;
|
||||
} else if (attributes().hasAttribute("type") && (attributes().value("type") == "3" || attributes().value("type") == "2")) {
|
||||
} else if (attributes().hasAttribute(QLatin1String("type"))
|
||||
&& (attributes().value(QLatin1String("type")) == QLatin1String("3")
|
||||
|| attributes().value(QLatin1String("type")) == QLatin1String("2"))) {
|
||||
m_buildTargetType = true;
|
||||
m_buildTarget.library = true;
|
||||
} else if (attributes().hasAttribute("working_dir")) {
|
||||
m_buildTarget.workingDirectory = attributes().value("working_dir").toString();
|
||||
} else if (attributes().hasAttribute(QLatin1String("working_dir"))) {
|
||||
m_buildTarget.workingDirectory = attributes().value(QLatin1String("working_dir")).toString();
|
||||
}
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
@@ -1092,11 +1096,11 @@ QString CMakeCbpParser::projectName() const
|
||||
|
||||
void CMakeCbpParser::parseOption()
|
||||
{
|
||||
if (attributes().hasAttribute("title"))
|
||||
m_projectName = attributes().value("title").toString();
|
||||
if (attributes().hasAttribute(QLatin1String("title")))
|
||||
m_projectName = attributes().value(QLatin1String("title")).toString();
|
||||
|
||||
if (attributes().hasAttribute("compiler"))
|
||||
m_compiler = attributes().value("compiler").toString();
|
||||
if (attributes().hasAttribute(QLatin1String("compiler")))
|
||||
m_compiler = attributes().value(QLatin1String("compiler")).toString();
|
||||
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
@@ -1126,8 +1130,8 @@ void CMakeCbpParser::parseMakeCommand()
|
||||
|
||||
void CMakeCbpParser::parseBuildTargetBuild()
|
||||
{
|
||||
if (attributes().hasAttribute("command"))
|
||||
m_buildTarget.makeCommand = attributes().value("command").toString();
|
||||
if (attributes().hasAttribute(QLatin1String("command")))
|
||||
m_buildTarget.makeCommand = attributes().value(QLatin1String("command")).toString();
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
@@ -1140,8 +1144,8 @@ void CMakeCbpParser::parseBuildTargetBuild()
|
||||
|
||||
void CMakeCbpParser::parseBuildTargetClean()
|
||||
{
|
||||
if (attributes().hasAttribute("command"))
|
||||
m_buildTarget.makeCleanCommand = attributes().value("command").toString();
|
||||
if (attributes().hasAttribute(QLatin1String("command")))
|
||||
m_buildTarget.makeCleanCommand = attributes().value(QLatin1String("command")).toString();
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
@@ -1171,19 +1175,19 @@ void CMakeCbpParser::parseAdd()
|
||||
// CMake only supports <Add option=\> and <Add directory=\>
|
||||
const QXmlStreamAttributes addAttributes = attributes();
|
||||
|
||||
const QString includeDirectory = addAttributes.value("directory").toString();
|
||||
const QString includeDirectory = addAttributes.value(QLatin1String("directory")).toString();
|
||||
// allow adding multiple times because order happens
|
||||
if (!includeDirectory.isEmpty()) {
|
||||
m_includeFiles.append(includeDirectory);
|
||||
}
|
||||
|
||||
QString compilerOption = addAttributes.value("option").toString();
|
||||
QString compilerOption = addAttributes.value(QLatin1String("option")).toString();
|
||||
// defining multiple times a macro to the same value makes no sense
|
||||
if (!compilerOption.isEmpty() && !m_compilerOptions.contains(compilerOption)) {
|
||||
m_compilerOptions.append(compilerOption);
|
||||
int macroNameIndex = compilerOption.indexOf("-D") + 2;
|
||||
int macroNameIndex = compilerOption.indexOf(QLatin1String("-D")) + 2;
|
||||
if (macroNameIndex != 1) {
|
||||
int assignIndex = compilerOption.indexOf('=', macroNameIndex);
|
||||
int assignIndex = compilerOption.indexOf(QLatin1Char('='), macroNameIndex);
|
||||
if (assignIndex != -1) {
|
||||
compilerOption[assignIndex] = ' ';
|
||||
}
|
||||
@@ -1206,7 +1210,7 @@ void CMakeCbpParser::parseAdd()
|
||||
void CMakeCbpParser::parseUnit()
|
||||
{
|
||||
//qDebug()<<stream.attributes().value("filename");
|
||||
QString fileName = attributes().value("filename").toString();
|
||||
QString fileName = attributes().value(QLatin1String("filename")).toString();
|
||||
m_parsingCmakeUnit = false;
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
@@ -1218,9 +1222,9 @@ void CMakeCbpParser::parseUnit()
|
||||
} else {
|
||||
bool generated = false;
|
||||
QString onlyFileName = QFileInfo(fileName).fileName();
|
||||
if ( (onlyFileName.startsWith("moc_") && onlyFileName.endsWith(".cxx"))
|
||||
|| (onlyFileName.startsWith("ui_") && onlyFileName.endsWith(".h"))
|
||||
|| (onlyFileName.startsWith("qrc_") && onlyFileName.endsWith(".cxx")))
|
||||
if ( (onlyFileName.startsWith(QLatin1String("moc_")) && onlyFileName.endsWith(QLatin1String(".cxx")))
|
||||
|| (onlyFileName.startsWith(QLatin1String("ui_")) && onlyFileName.endsWith(QLatin1String(".h")))
|
||||
|| (onlyFileName.startsWith(QLatin1String("qrc_")) && onlyFileName.endsWith(QLatin1String(".cxx"))))
|
||||
generated = true;
|
||||
|
||||
if (fileName.endsWith(QLatin1String(".qrc")))
|
||||
@@ -1241,7 +1245,7 @@ void CMakeCbpParser::parseUnit()
|
||||
|
||||
void CMakeCbpParser::parseUnitOption()
|
||||
{
|
||||
if (attributes().hasAttribute("virtualFolder"))
|
||||
if (attributes().hasAttribute(QLatin1String("virtualFolder")))
|
||||
m_parsingCmakeUnit = true;
|
||||
|
||||
while (!atEnd()) {
|
||||
|
||||
@@ -133,7 +133,7 @@ ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName, QSt
|
||||
|
||||
QString CMakeManager::mimeType() const
|
||||
{
|
||||
return Constants::CMAKEMIMETYPE;
|
||||
return QLatin1String(Constants::CMAKEMIMETYPE);
|
||||
}
|
||||
|
||||
QString CMakeManager::cmakeExecutable() const
|
||||
@@ -224,7 +224,7 @@ QString CMakeManager::qtVersionForQMake(const QString &qmakePath)
|
||||
qWarning("Timeout running '%s'.", qPrintable(qmakePath));
|
||||
return QString();
|
||||
}
|
||||
QString output = qmake.readAllStandardOutput();
|
||||
QString output = QString::fromLocal8Bit(qmake.readAllStandardOutput());
|
||||
QRegExp regexp(QLatin1String("(QMake version|Qmake version:)[\\s]*([\\d.]*)"));
|
||||
regexp.indexIn(output);
|
||||
if (regexp.cap(2).startsWith(QLatin1String("2."))) {
|
||||
|
||||
@@ -4,6 +4,8 @@ TARGET = CMakeProjectManager
|
||||
include(../../qtcreatorplugin.pri)
|
||||
include(cmakeprojectmanager_dependencies.pri)
|
||||
|
||||
DEFINES += QT_NO_CAST_FROM_ASCII
|
||||
|
||||
HEADERS = cmakeproject.h \
|
||||
cmakeprojectplugin.h \
|
||||
cmakeprojectmanager.h \
|
||||
|
||||
@@ -5,14 +5,16 @@ import "../QtcPlugin.qbs" as QtcPlugin
|
||||
QtcPlugin {
|
||||
name: "CMakeProjectManager"
|
||||
|
||||
Depends { name: "cpp" }
|
||||
Depends { name: "Qt.widgets" }
|
||||
Depends { name: "Core" }
|
||||
Depends { name: "ProjectExplorer" }
|
||||
Depends { name: "CppTools" }
|
||||
Depends { name: "CPlusPlus" }
|
||||
Depends { name: "TextEditor" }
|
||||
Depends { name: "Locator" }
|
||||
Depends { name: "ProjectExplorer" }
|
||||
Depends { name: "TextEditor" }
|
||||
Depends { name: "QtSupport" }
|
||||
cpp.defines: base.concat(["QT_NO_CAST_FROM_ASCII"])
|
||||
|
||||
files: [
|
||||
"CMakeProject.mimetypes.xml",
|
||||
|
||||
@@ -200,7 +200,7 @@ QString CMakeRunConfiguration::defaultDisplayName() const
|
||||
{
|
||||
if (m_title.isEmpty())
|
||||
return tr("Run CMake kit");
|
||||
return m_title + (m_enabled ? "" : tr(" (disabled)"));
|
||||
return m_title + (m_enabled ? QString() : tr(" (disabled)"));
|
||||
}
|
||||
|
||||
QWidget *CMakeRunConfiguration::createConfigurationWidget()
|
||||
|
||||
@@ -85,13 +85,13 @@ void CMakeValidator::finished(int exitCode)
|
||||
return;
|
||||
}
|
||||
if (m_state == CMakeValidator::RunningBasic) {
|
||||
QString response = m_process->readAll();
|
||||
QByteArray response = m_process->readAll();
|
||||
QRegExp versionRegexp(QLatin1String("^cmake version ([\\d\\.]*)"));
|
||||
versionRegexp.indexIn(response);
|
||||
versionRegexp.indexIn(QString::fromLocal8Bit(response));
|
||||
|
||||
//m_supportsQtCreator = response.contains(QLatin1String("QtCreator"));
|
||||
m_hasCodeBlocksMsvcGenerator = response.contains(QLatin1String("CodeBlocks - NMake Makefiles"));
|
||||
m_hasCodeBlocksNinjaGenerator = response.contains(QLatin1String("CodeBlocks - Ninja"));
|
||||
m_hasCodeBlocksMsvcGenerator = response.contains("CodeBlocks - NMake Makefiles");
|
||||
m_hasCodeBlocksNinjaGenerator = response.contains("CodeBlocks - Ninja");
|
||||
m_version = versionRegexp.cap(1);
|
||||
if (!(versionRegexp.capturedTexts().size() > 3))
|
||||
m_version += QLatin1Char('.') + versionRegexp.cap(3);
|
||||
@@ -169,7 +169,7 @@ static void extractKeywords(const QByteArray &input, QStringList *destination)
|
||||
QString keyword;
|
||||
int ignoreZone = 0;
|
||||
for (int i = 0; i < input.count(); ++i) {
|
||||
const QChar chr = input.at(i);
|
||||
const QChar chr = QLatin1Char(input.at(i));
|
||||
if (chr == QLatin1Char('{'))
|
||||
++ignoreZone;
|
||||
if (chr == QLatin1Char('}'))
|
||||
@@ -200,16 +200,14 @@ void CMakeValidator::parseFunctionOutput(const QByteArray &output)
|
||||
if (!cmakeFunctionsList.isEmpty()) {
|
||||
cmakeFunctionsList.removeFirst(); //remove version string
|
||||
foreach (const QByteArray &function, cmakeFunctionsList)
|
||||
m_functions << QString(function).trimmed();
|
||||
m_functions << QString::fromLocal8Bit(function.trimmed());
|
||||
}
|
||||
}
|
||||
|
||||
QString CMakeValidator::formatFunctionDetails(const QString &command, const QByteArray &args)
|
||||
QString CMakeValidator::formatFunctionDetails(const QString &command, const QString &args)
|
||||
{
|
||||
return QLatin1String("<table><tr><td><b>") + Qt::escape(command)
|
||||
+ QLatin1String("</b></td><td>")
|
||||
+ Qt::escape(args)
|
||||
+ QLatin1String("</td></tr>");
|
||||
return QString::fromLatin1("<table><tr><td><b>%1</b></td><td>%2</td></tr>")
|
||||
.arg(Qt::escape(command)).arg(Qt::escape(args));
|
||||
}
|
||||
|
||||
void CMakeValidator::parseFunctionDetailsOutput(const QByteArray &output)
|
||||
@@ -229,25 +227,26 @@ void CMakeValidator::parseFunctionDetailsOutput(const QByteArray &output)
|
||||
if (cmakeFunctionsList.first().toLatin1() == lineTrimmed) {
|
||||
//start of next function in output
|
||||
if (!currentCommandSyntax.isEmpty())
|
||||
commandSyntaxes << currentCommandSyntax.append("</table>");
|
||||
commandSyntaxes << currentCommandSyntax.append(QLatin1String("</table>"));
|
||||
--i;
|
||||
break;
|
||||
}
|
||||
if (lineTrimmed.startsWith(currentCommand.toLatin1() + "(")) {
|
||||
if (!currentCommandSyntax.isEmpty())
|
||||
commandSyntaxes << currentCommandSyntax.append("</table>");
|
||||
commandSyntaxes << currentCommandSyntax.append(QLatin1String("</table>"));
|
||||
|
||||
QByteArray argLine = lineTrimmed.mid(currentCommand.length());
|
||||
extractKeywords(argLine, &m_variables);
|
||||
currentCommandSyntax = formatFunctionDetails(currentCommand, argLine);
|
||||
currentCommandSyntax = formatFunctionDetails(currentCommand, QString::fromUtf8(argLine));
|
||||
} else {
|
||||
if (!currentCommandSyntax.isEmpty()) {
|
||||
if (lineTrimmed.isEmpty()) {
|
||||
commandSyntaxes << currentCommandSyntax.append("</table>");
|
||||
commandSyntaxes << currentCommandSyntax.append(QLatin1String("</table>"));
|
||||
currentCommandSyntax.clear();
|
||||
} else {
|
||||
extractKeywords(lineTrimmed, &m_variables);
|
||||
currentCommandSyntax += "<tr><td> </td><td>" + Qt::escape(lineTrimmed) + "</td></tr>";
|
||||
currentCommandSyntax += QString::fromLatin1("<tr><td> </td><td>%1</td></tr>")
|
||||
.arg(Qt::escape(QString::fromLocal8Bit(lineTrimmed)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,4 +258,3 @@ void CMakeValidator::parseFunctionDetailsOutput(const QByteArray &output)
|
||||
m_variables.sort();
|
||||
m_variables.removeDuplicates();
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
bool startProcess(const QStringList &args);
|
||||
void parseFunctionOutput(const QByteArray &output);
|
||||
void parseFunctionDetailsOutput(const QByteArray &output);
|
||||
QString formatFunctionDetails(const QString &command, const QByteArray &args);
|
||||
QString formatFunctionDetails(const QString &command, const QString &args);
|
||||
|
||||
State m_state;
|
||||
QProcess *m_process;
|
||||
|
||||
@@ -91,8 +91,8 @@ MakeStep::MakeStep(BuildStepList *bsl, MakeStep *bs) :
|
||||
|
||||
void MakeStep::ctor()
|
||||
{
|
||||
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
||||
m_ninjaProgress = QRegExp ("^\\[\\s*(\\d*)/\\s*(\\d*)");
|
||||
m_percentProgress = QRegExp(QLatin1String("^\\[\\s*(\\d*)%\\]"));
|
||||
m_ninjaProgress = QRegExp(QLatin1String("^\\[\\s*(\\d*)/\\s*(\\d*)"));
|
||||
m_ninjaProgressString = QLatin1String("[%s/%t "); // ninja: [33/100
|
||||
//: Default display name for the cmake make step.
|
||||
setDefaultDisplayName(tr("Make"));
|
||||
@@ -455,7 +455,7 @@ BuildStep *MakeStepFactory::create(BuildStepList *parent, const Core::Id id)
|
||||
MakeStep *step = new MakeStep(parent);
|
||||
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
|
||||
step->setClean(true);
|
||||
step->setAdditionalArguments("clean");
|
||||
step->setAdditionalArguments(QLatin1String("clean"));
|
||||
}
|
||||
return step;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user