From 42625ec3d2b00044ac282874e6a6427322eef444 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 3 Apr 2012 11:53:55 +0200 Subject: [PATCH] Compile autotools-plugin with QT_NO_CAST_FROM_ASCII. Change-Id: If8928c5d2d878339aa3a7808655f8125e0a012cf Reviewed-by: Friedemann Kleint --- .../autotoolsprojectmanager/autogenstep.cpp | 4 ++-- .../autotoolsprojectmanager/autoreconfstep.cpp | 6 +++--- .../autotoolsbuildconfiguration.cpp | 6 +++--- .../autotoolsprojectmanager/autotoolsproject.cpp | 13 +++++-------- .../autotoolsprojectmanager.pro | 1 + .../autotoolsprojectmanager/autotoolstarget.cpp | 4 ++-- .../autotoolsprojectmanager/configurestep.cpp | 6 +++--- .../autotoolsprojectmanager/makefileparser.cpp | 14 +++++++------- src/plugins/autotoolsprojectmanager/makestep.cpp | 2 +- 9 files changed, 27 insertions(+), 29 deletions(-) diff --git a/src/plugins/autotoolsprojectmanager/autogenstep.cpp b/src/plugins/autotoolsprojectmanager/autogenstep.cpp index e6d1b93b57d..4c3c4e66072 100644 --- a/src/plugins/autotoolsprojectmanager/autogenstep.cpp +++ b/src/plugins/autotoolsprojectmanager/autogenstep.cpp @@ -84,7 +84,7 @@ bool AutogenStepFactory::canCreate(BuildStepList *parent, const QString &id) con if (parent->target()->project()->id() != QLatin1String(Constants::AUTOTOOLS_PROJECT_ID)) return false; - if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD) + if (parent->id() != QLatin1String(ProjectExplorer::Constants::BUILDSTEPS_BUILD)) return false; return QLatin1String(AUTOGEN_STEP_ID) == id; @@ -282,7 +282,7 @@ void AutogenStepConfigWidget::updateDetails() param.setMacroExpander(bc->macroExpander()); param.setEnvironment(bc->environment()); param.setWorkingDirectory(bc->buildDirectory()); - param.setCommand("autogen.sh"); + param.setCommand(QLatin1String("autogen.sh")); param.setArguments(m_autogenStep->additionalArguments()); m_summaryText = param.summary(displayName()); emit updateSummary(); diff --git a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp index 09d7d3cc2a7..587bd68333c 100644 --- a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp +++ b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp @@ -83,7 +83,7 @@ bool AutoreconfStepFactory::canCreate(BuildStepList *parent, const QString &id) if (parent->target()->project()->id() != QLatin1String(Constants::AUTOTOOLS_PROJECT_ID)) return false; - if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD) + if (parent->id() != QLatin1String(ProjectExplorer::Constants::BUILDSTEPS_BUILD)) return false; return QLatin1String(AUTORECONF_STEP_ID) == id; @@ -166,7 +166,7 @@ bool AutoreconfStep::init() pp->setMacroExpander(bc->macroExpander()); pp->setEnvironment(bc->environment()); pp->setWorkingDirectory(bc->buildDirectory()); - pp->setCommand("autoreconf"); + pp->setCommand(QLatin1String("autoreconf")); pp->setArguments(additionalArguments()); return AbstractProcessStep::init(); @@ -276,7 +276,7 @@ void AutoreconfStepConfigWidget::updateDetails() param.setMacroExpander(bc->macroExpander()); param.setEnvironment(bc->environment()); param.setWorkingDirectory(bc->buildDirectory()); - param.setCommand("autoreconf"); + param.setCommand(QLatin1String("autoreconf")); param.setArguments(m_autoreconfStep->additionalArguments()); m_summaryText = param.summary(displayName()); emit updateSummary(); diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp index b0986cfc73a..92eafe762bb 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp @@ -170,7 +170,7 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::create(Target * bc->setDisplayName(buildConfigurationName); t->addBuildConfiguration(bc); - t->addDeployConfiguration(t->createDeployConfiguration(DEFAULT_DEPLOYCONFIGURATION_ID)); + t->addDeployConfiguration(t->createDeployConfiguration(QLatin1String(DEFAULT_DEPLOYCONFIGURATION_ID))); // User needs to choose where the executable file is. // TODO: Parse the file in *Anjuta style* to be able to add custom RunConfigurations. t->addRunConfiguration(new CustomExecutableRunConfiguration(t)); @@ -181,7 +181,7 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::create(Target * AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::createDefaultConfiguration(AutotoolsTarget *target) const { AutotoolsBuildConfiguration *bc = new AutotoolsBuildConfiguration(target); - BuildStepList *buildSteps = bc->stepList(BUILDSTEPS_BUILD); + BuildStepList *buildSteps = bc->stepList(QLatin1String(BUILDSTEPS_BUILD)); // ### Build Steps Build ### // autogen.sh or autoreconf @@ -205,7 +205,7 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::createDefaultCo makeStep->setBuildTarget(QLatin1String("all"), /*on =*/ true); // ### Build Steps Clean ### - BuildStepList *cleanSteps = bc->stepList(BUILDSTEPS_CLEAN); + BuildStepList *cleanSteps = bc->stepList(QLatin1String(BUILDSTEPS_CLEAN)); MakeStep *cleanMakeStep = new MakeStep(cleanSteps); cleanMakeStep->setAdditionalArguments(QLatin1String("clean")); cleanMakeStep->setClean(true); diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp index e46bea064d0..92603861af3 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp @@ -312,7 +312,7 @@ void AutotoolsProject::makefileParsingFinished() // Add configure.ac file to project and watch for changes. const QLatin1String configureAc(QLatin1String("configure.ac")); - const QFile configureAcFile(fileInfo.absolutePath() + QChar('/') + configureAc); + const QFile configureAcFile(fileInfo.absolutePath() + QLatin1Char('/') + configureAc); if (configureAcFile.exists()) { files.append(configureAc); const QString configureAcFilePath = dir.absoluteFilePath(configureAc); @@ -363,13 +363,10 @@ void AutotoolsProject::buildFileNodeTree(const QDir &directory, if (file.contains(QLatin1String(".moc"))) continue; - QString subDir = baseDir + QChar('/') + file; - for (int i = subDir.length() - 1; i >= 0; --i) { - if (subDir.at(i) == QChar('/')) { - subDir = subDir.left(i); - break; - } - } + QString subDir = baseDir + QLatin1Char('/') + file; + const int lastSlashPos = subDir.lastIndexOf(QLatin1Char('/')); + if (lastSlashPos != -1) + subDir.truncate(lastSlashPos); // Add folder nodes, that are not already available oldParentFolder = parentFolder; diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro index b642847aa7c..b428d54a282 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro +++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro @@ -1,6 +1,7 @@ TEMPLATE = lib TARGET = AutotoolsProjectManager #PROVIDER = Openismus +DEFINES += QT_NO_CAST_FROM_ASCII include(../../qtcreatorplugin.pri) include(autotoolsprojectmanager_dependencies.pri) diff --git a/src/plugins/autotoolsprojectmanager/autotoolstarget.cpp b/src/plugins/autotoolsprojectmanager/autotoolstarget.cpp index 1ed7d5de700..431a9e63676 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolstarget.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolstarget.cpp @@ -146,10 +146,10 @@ AutotoolsTarget *AutotoolsTargetFactory::create(Project *parent, const QString & // Add default build configuration: AutotoolsBuildConfigurationFactory *bcf = t->buildConfigurationFactory(); AutotoolsBuildConfiguration *bc = bcf->createDefaultConfiguration(t); - bc->setDisplayName("Default Build"); + bc->setDisplayName(tr("Default Build")); t->addBuildConfiguration(bc); - t->addDeployConfiguration(t->createDeployConfiguration(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID)); + t->addDeployConfiguration(t->createDeployConfiguration(QLatin1String(ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID))); // User needs to choose where the executable file is. // TODO: Parse the file in *Anjuta style* to be able to add custom RunConfigurations. t->addRunConfiguration(new CustomExecutableRunConfiguration(t)); diff --git a/src/plugins/autotoolsprojectmanager/configurestep.cpp b/src/plugins/autotoolsprojectmanager/configurestep.cpp index 1fce702ca87..095911a3269 100644 --- a/src/plugins/autotoolsprojectmanager/configurestep.cpp +++ b/src/plugins/autotoolsprojectmanager/configurestep.cpp @@ -84,7 +84,7 @@ bool ConfigureStepFactory::canCreate(BuildStepList *parent, const QString &id) c if (parent->target()->project()->id() != QLatin1String(Constants::AUTOTOOLS_PROJECT_ID)) return false; - if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD) + if (parent->id() != QLatin1String(ProjectExplorer::Constants::BUILDSTEPS_BUILD)) return false; return QLatin1String(CONFIGURE_STEP_ID) == id; @@ -167,7 +167,7 @@ bool ConfigureStep::init() pp->setMacroExpander(bc->macroExpander()); pp->setEnvironment(bc->environment()); pp->setWorkingDirectory(bc->buildDirectory()); - pp->setCommand("configure"); + pp->setCommand(QLatin1String("configure")); pp->setArguments(additionalArguments()); return AbstractProcessStep::init(); @@ -280,7 +280,7 @@ void ConfigureStepConfigWidget::updateDetails() param.setMacroExpander(bc->macroExpander()); param.setEnvironment(bc->environment()); param.setWorkingDirectory(bc->buildDirectory()); - param.setCommand("configure"); + param.setCommand(QLatin1String("configure")); param.setArguments(m_configureStep->additionalArguments()); m_summaryText = param.summary(displayName()); emit updateSummary(); diff --git a/src/plugins/autotoolsprojectmanager/makefileparser.cpp b/src/plugins/autotoolsprojectmanager/makefileparser.cpp index 0bee4403436..c87ca62b468 100644 --- a/src/plugins/autotoolsprojectmanager/makefileparser.cpp +++ b/src/plugins/autotoolsprojectmanager/makefileparser.cpp @@ -134,7 +134,7 @@ MakefileParser::TopTarget MakefileParser::topTarget() const TopTarget topTarget = Undefined; const QString line = m_line.simplified(); - if (!line.isEmpty() && !line.startsWith(QChar('#'))) { + if (!line.isEmpty() && !line.startsWith(QLatin1Char('#'))) { // TODO: Check how many fixed strings like AM_DEFAULT_SOURCE_EXT will // be needed vs. variable strings like _SOURCES. Dependent on this a // more clever way than this (expensive) if-cascading might be done. @@ -236,7 +236,7 @@ void MakefileParser::parseSubDirs() QStringList::iterator it = subDirs.begin(); while (it != subDirs.end()) { // Erase all entries that represent a '.' - if ((*it) == QChar('.')) { + if ((*it) == QLatin1String(".")) { hasDotSubDir = true; it = subDirs.erase(it); } else { @@ -256,7 +256,7 @@ void MakefileParser::parseSubDirs() // Delegate the parsing of all sub directories to a local // makefile parser and merge the results foreach (const QString& subDir, subDirs) { - const QChar slash('/'); + const QChar slash = QLatin1Char('/'); const QString subDirMakefile = path + slash + subDir + slash + makefileName; @@ -317,7 +317,7 @@ QStringList MakefileParser::directorySources(const QString &directory, extensions); const QString dirPath = info.fileName(); foreach (const QString& subDirSource, subDirSources) - list.append(dirPath + QChar('/') + subDirSource); + list.append(dirPath + QLatin1Char('/') + subDirSource); } else { // Check whether the file matches to an extension foreach (const QString& extension, extensions) { @@ -339,7 +339,7 @@ QStringList MakefileParser::targetValues(bool *hasVariables) if (hasVariables != 0) *hasVariables = false; - const int index = m_line.indexOf(QChar('=')); + const int index = m_line.indexOf(QLatin1Char('=')); if (index < 0) { m_success = false; return QStringList(); @@ -354,7 +354,7 @@ QStringList MakefileParser::targetValues(bool *hasVariables) // Get all values of a line separated by spaces. // Values representing a variable like $(value) get // removed currently. - QStringList lineValues = m_line.split(QChar(' ')); + QStringList lineValues = m_line.split(QLatin1Char(' ')); QStringList::iterator it = lineValues.begin(); while (it != lineValues.end()) { if ((*it).startsWith(QLatin1String("$("))) { @@ -368,7 +368,7 @@ QStringList MakefileParser::targetValues(bool *hasVariables) endReached = lineValues.isEmpty(); if (!endReached) { - const QChar backSlash('\\'); + const QChar backSlash = QLatin1Char('\\'); QString last = lineValues.last(); if (last.endsWith(backSlash)) { // The last value contains a backslash. Remove the diff --git a/src/plugins/autotoolsprojectmanager/makestep.cpp b/src/plugins/autotoolsprojectmanager/makestep.cpp index 57c3ef834a7..e44eee9fe1c 100644 --- a/src/plugins/autotoolsprojectmanager/makestep.cpp +++ b/src/plugins/autotoolsprojectmanager/makestep.cpp @@ -87,7 +87,7 @@ bool MakeStepFactory::canCreate(BuildStepList *parent, const QString &id) const if (parent->target()->project()->id() != QLatin1String(AUTOTOOLS_PROJECT_ID)) return false; - if (parent->id() != BUILDSTEPS_BUILD) + if (parent->id() != QLatin1String(BUILDSTEPS_BUILD)) return false; return QLatin1String(MAKE_STEP_ID) == id;