Commit 67bde11f authored by Friedemann Kleint's avatar Friedemann Kleint

QtSupport: Compile with QT_NO_CAST_FROM_ASCII.

Change-Id: I893b225601a073bc5d74199dba3323f3e233560e
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent d50fc34e
This diff is collapsed.
......@@ -75,7 +75,7 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
// of the version pointer while compiling
//
m_qtId = version->uniqueId();
m_qtInstallData = version->versionInfo().value("QT_INSTALL_DATA");
m_qtInstallData = version->versionInfo().value(QLatin1String("QT_INSTALL_DATA"));
if (m_qtInstallData.isEmpty()) {
const QString error
= QCoreApplication::translate(
......@@ -235,8 +235,12 @@ bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &futu
bool success = true;
arguments.directory = QmlObserverTool::copy(m_qtInstallData, &error);
arguments.qmakeArguments << QLatin1String("INCLUDEPATH+=\"\\\"") + qmlDebuggingDirectory + "include\\\"\"";
arguments.qmakeArguments << QLatin1String("LIBS+=-L\"\\\"") + qmlDebuggingDirectory + QLatin1String("\\\"\"");
arguments.qmakeArguments << QLatin1String("INCLUDEPATH+=\"\\\"")
+ qmlDebuggingDirectory
+ QLatin1String("include\\\"\"");
arguments.qmakeArguments << QLatin1String("LIBS+=-L\"\\\"")
+ qmlDebuggingDirectory
+ QLatin1String("\\\"\"");
if (arguments.directory.isEmpty()
|| !QmlObserverTool::build(arguments, &output, &error)) {
......
......@@ -91,6 +91,7 @@ QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader* reader, co
{
QList<ExampleItem> examples;
ExampleItem item;
const QChar slash = QLatin1Char('/');
while (!reader->atEnd()) {
switch (reader->readNext()) {
case QXmlStreamReader::StartElement:
......@@ -101,18 +102,18 @@ QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader* reader, co
item.name = attributes.value(QLatin1String("name")).toString();
item.projectPath = attributes.value(QLatin1String("projectPath")).toString();
item.hasSourceCode = !item.projectPath.isEmpty();
item.projectPath.prepend('/');
item.projectPath.prepend(slash);
item.projectPath.prepend(projectsOffset);
item.imageUrl = attributes.value(QLatin1String("imageUrl")).toString();
item.docUrl = attributes.value(QLatin1String("docUrl")).toString();
} else if (reader->name() == QLatin1String("fileToOpen")) {
item.filesToOpen.append(projectsOffset + '/' + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
item.filesToOpen.append(projectsOffset + slash + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
} else if (reader->name() == QLatin1String("description")) {
item.description = fixStringForTags(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
} else if (reader->name() == QLatin1String("dependency")) {
item.dependencies.append(projectsOffset + '/' + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
item.dependencies.append(projectsOffset + slash + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
} else if (reader->name() == QLatin1String("tags")) {
item.tags = reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement).split(",");
item.tags = reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement).split(QLatin1Char(','));
m_tags.append(item.tags);
}
break;
......@@ -133,6 +134,7 @@ QList<ExampleItem> ExamplesListModel::parseDemos(QXmlStreamReader* reader, const
{
QList<ExampleItem> demos;
ExampleItem item;
const QChar slash = QLatin1Char('/');
while (!reader->atEnd()) {
switch (reader->readNext()) {
case QXmlStreamReader::StartElement:
......@@ -143,18 +145,18 @@ QList<ExampleItem> ExamplesListModel::parseDemos(QXmlStreamReader* reader, const
item.name = attributes.value(QLatin1String("name")).toString();
item.projectPath = attributes.value(QLatin1String("projectPath")).toString();
item.hasSourceCode = !item.projectPath.isEmpty();
item.projectPath.prepend('/');
item.projectPath.prepend(slash);
item.projectPath.prepend(projectsOffset);
item.imageUrl = attributes.value(QLatin1String("imageUrl")).toString();
item.docUrl = attributes.value(QLatin1String("docUrl")).toString();
} else if (reader->name() == QLatin1String("fileToOpen")) {
item.filesToOpen.append(projectsOffset + '/' + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
item.filesToOpen.append(projectsOffset + slash + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
} else if (reader->name() == QLatin1String("description")) {
item.description = fixStringForTags(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
} else if (reader->name() == QLatin1String("dependency")) {
item.dependencies.append(projectsOffset + '/' + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
item.dependencies.append(projectsOffset + slash + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
} else if (reader->name() == QLatin1String("tags")) {
item.tags = reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement).split(",");
item.tags = reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement).split(QLatin1Char(','));
}
break;
case QXmlStreamReader::EndElement:
......@@ -174,6 +176,7 @@ QList<ExampleItem> ExamplesListModel::parseTutorials(QXmlStreamReader* reader, c
{
QList<ExampleItem> tutorials;
ExampleItem item;
const QChar slash = QLatin1Char('/');
while (!reader->atEnd()) {
switch (reader->readNext()) {
case QXmlStreamReader::StartElement:
......@@ -184,7 +187,7 @@ QList<ExampleItem> ExamplesListModel::parseTutorials(QXmlStreamReader* reader, c
item.name = attributes.value(QLatin1String("name")).toString();
item.projectPath = attributes.value(QLatin1String("projectPath")).toString();
item.hasSourceCode = !item.projectPath.isEmpty();
item.projectPath.prepend('/');
item.projectPath.prepend(slash);
item.projectPath.prepend(projectsOffset);
if (attributes.hasAttribute(QLatin1String("imageUrl")))
item.imageUrl = attributes.value(QLatin1String("imageUrl")).toString();
......@@ -197,13 +200,13 @@ QList<ExampleItem> ExamplesListModel::parseTutorials(QXmlStreamReader* reader, c
if (attributes.hasAttribute(QLatin1String("videoLength")))
item.videoLength = attributes.value(QLatin1String("videoLength")).toString();
} else if (reader->name() == QLatin1String("fileToOpen")) {
item.filesToOpen.append(projectsOffset + '/' + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
item.filesToOpen.append(projectsOffset + slash + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
} else if (reader->name() == QLatin1String("description")) {
item.description = fixStringForTags(reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
} else if (reader->name() == QLatin1String("dependency")) {
item.dependencies.append(projectsOffset + '/' + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
item.dependencies.append(projectsOffset + slash + reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement));
} else if (reader->name() == QLatin1String("tags")) {
item.tags = reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement).split(",");
item.tags = reader->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement).split(QLatin1Char(','));
}
break;
case QXmlStreamReader::EndElement:
......@@ -278,10 +281,10 @@ QStringList ExamplesListModel::exampleSources() const
// Read keys from SDK installer
QSettings *settings = Core::ICore::instance()->settings(QSettings::SystemScope);
int size = settings->beginReadArray("ExampleManifests");
int size = settings->beginReadArray(QLatin1String("ExampleManifests"));
for (int i = 0; i < size; ++i) {
settings->setArrayIndex(i);
sources.append(settings->value("Location").toString());
sources.append(settings->value(QLatin1String("Location")).toString());
}
settings->endArray();
......@@ -361,7 +364,7 @@ QVariant ExamplesListModel::data(const QModelIndex &index, int role) const
switch (role)
{
case Qt::DisplayRole: // for search only
return QString(item.name + ' ' + item.tags.join(" "));
return QString(item.name + QLatin1Char(' ') + item.tags.join(QLatin1String(" ")));
case Name:
return item.name;
case ProjectPath:
......@@ -506,7 +509,7 @@ struct SearchStringLexer {
SearchStringLexer(const QString &code)
: code(code)
, codePtr(code.unicode())
, yychar(' ') { }
, yychar(QLatin1Char(' ')) { }
int operator()() { return yylex(); }
......@@ -532,12 +535,12 @@ struct SearchStringLexer {
if (yychar == quote) {
yyinp();
break;
} if (yychar == '\\') {
} if (yychar == QLatin1Char('\\')) {
yyinp();
switch (yychar.unicode()) {
case '"': yytext += '"'; yyinp(); break;
case '\'': yytext += '\''; yyinp(); break;
case '\\': yytext += '\\'; yyinp(); break;
case '"': yytext += QLatin1Char('"'); yyinp(); break;
case '\'': yytext += QLatin1Char('\''); yyinp(); break;
case '\\': yytext += QLatin1Char('\\'); yyinp(); break;
}
} else {
yytext += yychar;
......@@ -548,14 +551,14 @@ struct SearchStringLexer {
}
default:
if (ch.isLetterOrNumber() || ch == '_') {
if (ch.isLetterOrNumber() || ch == QLatin1Char('_')) {
yytext.clear();
yytext += ch;
while (yychar.isLetterOrNumber() || yychar == '_') {
while (yychar.isLetterOrNumber() || yychar == QLatin1Char('_')) {
yytext += yychar;
yyinp();
}
if (yychar == ':' && yytext == QLatin1String("tag")) {
if (yychar == QLatin1Char(':') && yytext == QLatin1String("tag")) {
yyinp();
return TAG;
}
......
......@@ -352,11 +352,11 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
return QString();
} else {
QString error;
QString targetDir = destBaseDir + '/' + exampleDirName;
QString targetDir = destBaseDir + QLatin1Char('/') + exampleDirName;
if (Utils::FileUtils::copyRecursively(projectDir, targetDir, &error)) {
// set vars to new location
QStringList::Iterator it;
for (it = filesToOpen.begin(); it != filesToOpen.end(); ++it)
const QStringList::Iterator end = filesToOpen.end();
for (QStringList::Iterator it = filesToOpen.begin(); it != end; ++it)
it->replace(projectDir, targetDir);
foreach (const QString &dependency, dependencies) {
......@@ -368,7 +368,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
}
return targetDir+ '/' + proFileInfo.fileName();
return targetDir + QLatin1Char('/') + proFileInfo.fileName();
} else {
QMessageBox::warning(Core::ICore::instance()->mainWindow(), tr("Cannot Copy Project"), error);
}
......
......@@ -127,8 +127,8 @@ QStringList QmlDebuggingLibrary::recursiveFileList(const QDir &dir, const QStrin
QStringList files;
QString _prefix = prefix;
if (!_prefix.isEmpty() && !_prefix.endsWith('/')) {
_prefix = _prefix + '/';
if (!_prefix.isEmpty() && !_prefix.endsWith(QLatin1Char('/'))) {
_prefix = _prefix + QLatin1Char('/');
}
foreach (const QString &fileName, dir.entryList(QDir::Files)) {
files << _prefix + fileName;
......
......@@ -196,10 +196,10 @@ static bool hasPrivateHeaders(const QString &qtInstallHeaders) {
bool QmlDumpTool::canBuild(const BaseQtVersion *qtVersion, QString *reason)
{
const QString installHeaders = qtVersion->versionInfo().value("QT_INSTALL_HEADERS");
const QString installHeaders = qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_HEADERS"));
if (qtVersion->type() != Constants::DESKTOPQT
&& qtVersion->type() != Constants::SIMULATORQT) {
if (qtVersion->type() != QLatin1String(Constants::DESKTOPQT)
&& qtVersion->type() != QLatin1String(Constants::SIMULATORQT)) {
if (reason)
*reason = QCoreApplication::translate("Qt4ProjectManager::QmlDumpTool", "Only available for Qt for Desktop and Qt for Qt Simulator.");
return false;
......@@ -227,11 +227,10 @@ bool QmlDumpTool::canBuild(const BaseQtVersion *qtVersion, QString *reason)
QString QmlDumpTool::toolForVersion(BaseQtVersion *version, bool debugDump)
{
if (version) {
QString qtInstallData = version->versionInfo().value("QT_INSTALL_DATA");
QString qtInstallBins = version->versionInfo().value("QT_INSTALL_BINS");
QString qtInstallHeaders = version->versionInfo().value("QT_INSTALL_HEADERS");
QString toolPath = toolForQtPaths(qtInstallData, qtInstallBins, qtInstallHeaders, debugDump);
return toolPath;
const QString qtInstallData = version->versionInfo().value(QLatin1String("QT_INSTALL_DATA"));
const QString qtInstallBins = version->versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
const QString qtInstallHeaders = version->versionInfo().value(QLatin1String("QT_INSTALL_HEADERS"));
return toolForQtPaths(qtInstallData, qtInstallBins, qtInstallHeaders, debugDump);
}
return QString();
......
......@@ -56,8 +56,8 @@ static inline QStringList validBinaryFilenames()
bool QmlObserverTool::canBuild(const BaseQtVersion *qtVersion, QString *reason)
{
if (qtVersion->type() != Constants::DESKTOPQT
&& qtVersion->type() != Constants::SIMULATORQT) {
if (qtVersion->type() != QLatin1String(Constants::DESKTOPQT)
&& qtVersion->type() != QLatin1String(Constants::SIMULATORQT)) {
if (reason)
*reason = QCoreApplication::translate("Qt4ProjectManager::QmlObserverTool", "Only available for Qt for Desktop or Qt for Qt Simulator.");
return false;
......@@ -144,8 +144,8 @@ QStringList QmlObserverTool::recursiveFileList(const QDir &dir, const QString &p
QStringList files;
QString _prefix = prefix;
if (!_prefix.isEmpty() && !_prefix.endsWith('/')) {
_prefix = _prefix + '/';
if (!_prefix.isEmpty() && !_prefix.endsWith(QLatin1Char('/'))) {
_prefix.append(QLatin1Char('/'));
}
foreach (const QString &fileName, dir.entryList(QDir::Files)) {
files << _prefix + fileName;
......
......@@ -96,7 +96,7 @@ QString QtOptionsPage::displayCategory() const
QIcon QtOptionsPage::categoryIcon() const
{
return QIcon(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON);
return QIcon(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON));
}
QWidget *QtOptionsPage::createPage(QWidget *parent)
......@@ -132,8 +132,8 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<BaseQtVersion *>
, m_ui(new Internal::Ui::QtVersionManager())
, m_versionUi(new Internal::Ui::QtVersionInfo())
, m_debuggingHelperUi(new Internal::Ui::DebuggingHelper())
, m_invalidVersionIcon(":/projectexplorer/images/compile_error.png")
, m_warningVersionIcon(":/projectexplorer/images/compile_warning.png")
, m_invalidVersionIcon(QLatin1String(":/projectexplorer/images/compile_error.png"))
, m_warningVersionIcon(QLatin1String(":/projectexplorer/images/compile_warning.png"))
, m_configurationWidget(0)
{
// Initialize m_versions
......@@ -425,7 +425,7 @@ QtOptionsPageWidget::ValidityInfo QtOptionsPageWidget::validInformation(const Ba
QString warning = version->warningReason();
if (!warning.isEmpty()) {
if (!info.message.isEmpty())
info.message.append('\n');
info.message.append(QLatin1Char('\n'));
info.message += warning;
info.icon = m_warningVersionIcon;
}
......@@ -578,7 +578,7 @@ QtOptionsPageWidget::~QtOptionsPageWidget()
static QString filterForQmakeFileDialog()
{
QString filter("qmake (");
QString filter = QLatin1String("qmake (");
foreach (const QString &s, Utils::BuildableHelperLibrary::possibleQMakeCommands()) {
#ifdef Q_WS_MAC
// work around QTBUG-7739 that prohibits filters that don't start with *
......@@ -713,14 +713,15 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
// get names of tools from labels
QStringList helperNames;
const QChar colon = QLatin1Char(':');
if (hasGdbHelper)
helperNames << m_debuggingHelperUi->gdbHelperLabel->text().remove(':');
helperNames << m_debuggingHelperUi->gdbHelperLabel->text().remove(colon);
if (hasQmlDumper)
helperNames << m_debuggingHelperUi->qmlDumpLabel->text().remove(':');
helperNames << m_debuggingHelperUi->qmlDumpLabel->text().remove(colon);
if (hasQmlDebuggingLib)
helperNames << m_debuggingHelperUi->qmlDebuggingLibLabel->text().remove(':');
helperNames << m_debuggingHelperUi->qmlDebuggingLibLabel->text().remove(colon);
if (hasQmlObserver)
helperNames << m_debuggingHelperUi->qmlObserverLabel->text().remove(':');
helperNames << m_debuggingHelperUi->qmlObserverLabel->text().remove(colon);
QString status;
if (helperNames.isEmpty()) {
......@@ -995,7 +996,7 @@ void QtOptionsPageWidget::fixQtVersionName(int index)
if (i != index) {
if (m_versions.at(i)->displayName() == m_versions.at(index)->displayName()) {
// Same name, find new name
QRegExp regexp("^(.*)\\((\\d)\\)$");
QRegExp regexp(QLatin1String("^(.*)\\((\\d)\\)$"));
if (regexp.exactMatch(name)) {
// Already in Name (#) format
name = regexp.cap(1);
......
......@@ -62,7 +62,7 @@ void QtParser::stdError(const QString &line)
m_mocRegExp.cap(5).trimmed(),
m_mocRegExp.cap(1) /* filename */,
lineno,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
QLatin1String(ProjectExplorer::Constants::TASK_CATEGORY_COMPILE));
if (m_mocRegExp.cap(4) == QLatin1String("Warning"))
task.type = Task::Warning;
emit addTask(task);
......@@ -126,7 +126,7 @@ void QtSupportPlugin::testQtOutputParser_data()
<< (QList<ProjectExplorer::Task>() << Task(Task::Warning,
QLatin1String("No relevant classes found. No output generated."),
QLatin1String("..\\untitled\\errorfile.h"), 0,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
QLatin1String(ProjectExplorer::Constants::TASK_CATEGORY_COMPILE)))
<< QString();
QTest::newRow("moc warning 2")
<< QString::fromLatin1("c:\\code\\test.h(96): Warning: Property declaration ) has no READ accessor function. The property will be invalid.")
......@@ -135,7 +135,7 @@ void QtSupportPlugin::testQtOutputParser_data()
<< (QList<ProjectExplorer::Task>() << Task(Task::Warning,
QLatin1String("Property declaration ) has no READ accessor function. The property will be invalid."),
QLatin1String("c:\\code\\test.h"), 96,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
QLatin1String(ProjectExplorer::Constants::TASK_CATEGORY_COMPILE)))
<< QString();
}
......
......@@ -63,7 +63,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromLegacySettings(const Utils::
if (!v)
return 0;
v->setId(id);
v->setDisplayName(s->value("Name").toString());
v->setDisplayName(s->value(QLatin1String("Name")).toString());
v->restoreLegacySettings(s);
return v;
}
......@@ -82,7 +82,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN
ProFileCacheManager::instance()->incRefCount();
ProFileParser parser(ProFileCacheManager::instance()->cache(), &msgHandler);
ProFileEvaluator evaluator(&option, &parser, &msgHandler);
if (ProFile *pro = parser.parsedProFile(mkspec.toString() + "/qmake.conf")) {
if (ProFile *pro = parser.parsedProFile(mkspec.toString() + QLatin1String("/qmake.conf"))) {
evaluator.setCumulative(false);
evaluator.accept(pro, ProFileEvaluator::LoadProOnly);
pro->deref();
......
......@@ -173,7 +173,7 @@ bool QtVersionManager::restoreQtVersions()
break;
const QVariantMap qtversionMap = data.value(key).toMap();
const QString type = qtversionMap.value(QTVERSION_TYPE_KEY).toString();
const QString type = qtversionMap.value(QLatin1String(QTVERSION_TYPE_KEY)).toString();
bool restored = false;
foreach (QtVersionFactory *f, factories) {
......@@ -227,8 +227,8 @@ void QtVersionManager::updateFromInstaller()
if (!data.contains(key))
break;
QVariantMap map = data.value(key).toMap();
Utils::FileName path = Utils::FileName::fromString(map.value(OLDQTVERSION_PATH).toString());
QString autodetectionSource = map.value(OLDQTVERSION_SDKSOURCE).toString();
Utils::FileName path = Utils::FileName::fromString(map.value(QLatin1String(OLDQTVERSION_PATH)).toString());
QString autodetectionSource = map.value(QLatin1String(OLDQTVERSION_SDKSOURCE)).toString();
foreach (BaseQtVersion *v, m_versions) {
if (v->qmakeCommand() == path) {
if (v->autodetectionSource().isEmpty()) {
......@@ -265,7 +265,7 @@ void QtVersionManager::updateFromInstaller()
break;
QVariantMap qtversionMap = data.value(key).toMap();
const QString type = qtversionMap.value(QTVERSION_TYPE_KEY).toString();
const QString type = qtversionMap.value(QLatin1String(QTVERSION_TYPE_KEY)).toString();
const QString autoDetectionSource = qtversionMap.value(QLatin1String("autodetectionSource")).toString();
sdkVersions << autoDetectionSource;
int id = -1; // see BaseQtVersion::fromMap()
......@@ -322,7 +322,7 @@ void QtVersionManager::updateFromInstaller()
}
}
foreach (BaseQtVersion *qtVersion, QtVersionManager::instance()->versions()) {
if (qtVersion->autodetectionSource().startsWith("SDK.")) {
if (qtVersion->autodetectionSource().startsWith(QLatin1String("SDK."))) {
if (!sdkVersions.contains(qtVersion->autodetectionSource())) {
if (debug)
qDebug() << " removing version"<<qtVersion->autodetectionSource();
......@@ -351,13 +351,13 @@ void QtVersionManager::saveQtVersions()
QVariantMap tmp = qtv->toMap();
if (tmp.isEmpty())
continue;
tmp.insert(QTVERSION_TYPE_KEY, qtv->type());
tmp.insert(QLatin1String(QTVERSION_TYPE_KEY), qtv->type());
writer.saveValue(QString::fromLatin1(QTVERSION_DATA_KEY) + QString::number(count), tmp);
++count;
}
writer.saveValue(QLatin1String(QTVERSION_COUNT_KEY), count);
writer.save(settingsFileName(), "QtCreatorQtVersions", Core::ICore::instance()->mainWindow());
writer.save(settingsFileName(), QLatin1String("QtCreatorQtVersions"), Core::ICore::instance()->mainWindow());
}
void QtVersionManager::findSystemQt()
......@@ -374,22 +374,23 @@ void QtVersionManager::findSystemQt()
bool QtVersionManager::legacyRestore()
{
QSettings *s = Core::ICore::instance()->settings();
if (!s->contains(QLatin1String(QtVersionsSectionName) + QLatin1String("/size")))
const QString qtVersionSection = QLatin1String(QtVersionsSectionName);
if (!s->contains(qtVersionSection + QLatin1String("/size")))
return false;
int size = s->beginReadArray(QtVersionsSectionName);
int size = s->beginReadArray(qtVersionSection);
for (int i = 0; i < size; ++i) {
s->setArrayIndex(i);
// Find the right id
// Either something saved or something generated
// Note: This code assumes that either all ids are read from the settings
// or generated on the fly.
int id = s->value("Id", -1).toInt();
int id = s->value(QLatin1String("Id"), -1).toInt();
if (id == -1)
id = getUniqueId();
else if (m_idcount < id)
m_idcount = id + 1;
Utils::FileName qmakePath = Utils::FileName::fromString(s->value("QMakePath").toString());
Utils::FileName qmakePath = Utils::FileName::fromString(s->value(QLatin1String("QMakePath")).toString());
if (qmakePath.isEmpty())
continue; //skip this version
......@@ -408,7 +409,7 @@ bool QtVersionManager::legacyRestore()
if (!mingwDir.isEmpty()) {
QFileInfo fi(mingwDir + QLatin1String("/bin/g++.exe"));
if (fi.exists() && fi.isExecutable()) {
ProjectExplorer::MingwToolChain *tc = createToolChain<ProjectExplorer::MingwToolChain>(ProjectExplorer::Constants::MINGW_TOOLCHAIN_ID);
ProjectExplorer::MingwToolChain *tc = createToolChain<ProjectExplorer::MingwToolChain>(QLatin1String(ProjectExplorer::Constants::MINGW_TOOLCHAIN_ID));
if (tc) {
tc->setCompilerPath(fi.absoluteFilePath());
tc->setDisplayName(tr("MinGW from %1").arg(version->displayName()));
......@@ -427,7 +428,7 @@ bool QtVersionManager::legacyRestore()
}
s->endArray();
s->remove(QtVersionsSectionName);
s->remove(qtVersionSection);
return true;
}
......@@ -540,7 +541,7 @@ void QtVersionManager::updateSettings()
// prefer versions with declarative examples
foreach (version, candidates) {
if (QDir(version->examplesPath()+"/declarative").exists()) {
if (QDir(version->examplesPath() + QLatin1String("/declarative")).exists()) {
emit updateExamples(version->examplesPath(), version->demosPath(), version->sourcePath().toString());
return;
}
......@@ -693,7 +694,7 @@ Utils::FileName QtVersionManager::findQMakeBinaryFromMakefile(const QString &mak
QFile fi(makefile);
if (fi.exists() && fi.open(QFile::ReadOnly)) {
QTextStream ts(&fi);
QRegExp r1("QMAKE\\s*=(.*)");
QRegExp r1(QLatin1String("QMAKE\\s*=(.*)"));
while (!ts.atEnd()) {
QString line = ts.readLine();
if (r1.exactMatch(line)) {
......@@ -747,7 +748,7 @@ QtVersionManager::MakefileCompatible QtVersionManager::makefileIsFor(const QStri
if (line.isEmpty())
return CouldNotParse;
line = line.mid(line.indexOf(QChar(':')) + 1);
line.remove(0, line.indexOf(QLatin1Char(':')) + 1);
line = line.trimmed();
QFileInfo srcFileInfo(QFileInfo(makefile).absoluteDir(), line);
......@@ -798,7 +799,7 @@ QPair<BaseQtVersion::QmakeBuildConfigs, QString> QtVersionManager::scanMakeFile(
if (debug) {
qDebug()<<"\n\nDumping information from scanMakeFile";
qDebug()<<"QMake CONFIG variable parsing";
qDebug()<<" "<< (result & BaseQtVersion::NoBuild ? "No Build" : QString::number(int(result)));
qDebug()<<" "<< (result & BaseQtVersion::NoBuild ? QByteArray("No Build") : QByteArray::number(int(result)));
qDebug()<<" "<< (result & BaseQtVersion::DebugBuild ? "debug" : "release");
qDebug()<<" "<< (result & BaseQtVersion::BuildAll ? "debug_and_release" : "no debug_and_release");
qDebug()<<"\nAddtional Arguments";
......@@ -833,7 +834,7 @@ QString QtVersionManager::trimLine(const QString line)
void QtVersionManager::parseArgs(const QString &args, QList<QMakeAssignment> *assignments, QList<QMakeAssignment> *afterAssignments, QString *additionalArguments)
{
QRegExp regExp("([^\\s\\+-]*)\\s*(\\+=|=|-=|~=)(.*)");
QRegExp regExp(QLatin1String("([^\\s\\+-]*)\\s*(\\+=|=|-=|~=)(.*)"));
bool after = false;
bool ignoreNext = false;
*additionalArguments = args;
......@@ -885,22 +886,22 @@ BaseQtVersion::QmakeBuildConfigs QtVersionManager::qmakeBuildConfigFromCmdArgs(Q
QList<QMakeAssignment> oldAssignments = *assignments;
assignments->clear();
foreach(const QMakeAssignment &qa, oldAssignments) {
if (qa.variable == "CONFIG") {
QStringList values = qa.value.split(' ');
if (qa.variable == QLatin1String("CONFIG")) {
QStringList values = qa.value.split(QLatin1Char(' '));
QStringList newValues;
foreach(const QString &value, values) {
if (value == "debug") {
if (qa.op == "+=")
if (value == QLatin1String("debug")) {
if (qa.op == QLatin1String("+="))
result = result | BaseQtVersion::DebugBuild;
else
result = result & ~BaseQtVersion::DebugBuild;
} else if (value == "release") {
if (qa.op == "+=")
} else if (value == QLatin1String("release")) {
if (qa.op == QLatin1String("+="))
result = result & ~BaseQtVersion::DebugBuild;
else
result = result | BaseQtVersion::DebugBuild;
} else if (value == "debug_and_release") {
if (qa.op == "+=")
} else if (value == QLatin1String("debug_and_release")) {
if (qa.op == QLatin1String("+="))
result = result | BaseQtVersion::BuildAll;
else
result = result & ~BaseQtVersion::BuildAll;
......@@ -908,7 +909,7 @@ BaseQtVersion::QmakeBuildConfigs QtVersionManager::qmakeBuildConfigFromCmdArgs(Q
newValues.append(value);
}
QMakeAssignment newQA = qa;
newQA.value = newValues.join(" ");
newQA.value = newValues.join(QLatin1String(" "));
if (!newValues.isEmpty())
assignments->append(newQA);
}
......
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