diff options
54 files changed, 170 insertions, 160 deletions
diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index ee75ff511c..bbf49812bd 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -227,7 +227,7 @@ static QByteArray stripPointerType(const QByteArray &_type) // This is used to abort evaluation of custom data dumpers in a "coordinated" // way. Abortion will happen at the latest when we try to access a non-initialized -// non-trivial object, so there is no way to prevent this from occuring at all +// non-trivial object, so there is no way to prevent this from occurring at all // conceptionally. Ideally, if there is API to check memory access, it should // be used to terminate nicely, especially with CDB. // 1) Gdb will catch SIGSEGV and return to the calling frame. @@ -3436,7 +3436,7 @@ static void handleProtocolVersion2and3(QDumper &d) #endif const char *type = stripNamespace(d.outerType); - // type[0] is usally 'Q', so don't use it + // type[0] is usually 'Q', so don't use it switch (type[1]) { case 'a': if (isEqual(type, "map")) diff --git a/share/qtcreator/gdbmacros/test/main.cpp b/share/qtcreator/gdbmacros/test/main.cpp index 65cd27f8a6..64348b5c51 100644 --- a/share/qtcreator/gdbmacros/test/main.cpp +++ b/share/qtcreator/gdbmacros/test/main.cpp @@ -56,7 +56,7 @@ unsigned optVerbose = 0; const char *appPath = 0; // Provide address of type of be tested. -// When testing unitialized memory, allocate at random. +// When testing uninitialized memory, allocate at random. template <class T> inline T* testAddress(T* in) { diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 1e6658fa51..64176d6350 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -260,7 +260,7 @@ bool CMakeProject::parseCMakeLists() foreach(const CMakeTarget &ct, m_targets) { 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()) { @@ -312,7 +312,7 @@ QStringList CMakeProject::targets() const foreach (const CMakeTarget &ct, m_targets) { if (ct.executable.isEmpty()) continue; - if (ct.title.endsWith("/fast")) + if (ct.title.endsWith(QLatin1String("/fast"))) continue; results << ct.title; } @@ -324,7 +324,7 @@ bool CMakeProject::hasTarget(const QString &title) const foreach (const CMakeTarget &ct, m_targets) { if (ct.executable.isEmpty()) continue; - if (ct.title.endsWith("/fast")) + if (ct.title.endsWith(QLatin1String("/fast"))) continue; if (ct.title == title) return true; @@ -410,11 +410,12 @@ void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer:: ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *rootNode, QString directory) { QString relativePath = QDir(QFileInfo(rootNode->path()).path()).relativeFilePath(directory); - QStringList parts = relativePath.split("/", QString::SkipEmptyParts); + QStringList parts = relativePath.split(QLatin1Char('/'), QString::SkipEmptyParts); ProjectExplorer::FolderNode *parent = rootNode; QString path = QFileInfo(rootNode->path()).path(); foreach (const QString &part, parts) { - path += "/" + part; + path += QLatin1Char('/'); + path += part; // Find folder in subFolders bool found = false; foreach (ProjectExplorer::FolderNode *folder, parent->subFolderNodes()) { @@ -899,12 +900,12 @@ void CMakeCbpParser::parseUnit() while (!atEnd()) { readNext(); if (isEndElement()) { - if (!fileName.endsWith(".rule") && !m_processedUnits.contains(fileName)) { + if (!fileName.endsWith(QLatin1String(".rule")) && !m_processedUnits.contains(fileName)) { // Now check whether we found a virtual element beneath if (m_parsingCmakeUnit) { m_cmakeFileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ProjectFileType, false)); } else { - if (fileName.endsWith(".qrc")) + if (fileName.endsWith(QLatin1String(".qrc"))) m_fileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ResourceType, false)); else m_fileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::SourceType, false)); diff --git a/src/plugins/cmakeprojectmanager/makestep.cpp b/src/plugins/cmakeprojectmanager/makestep.cpp index 0c3b09843d..532fff0452 100644 --- a/src/plugins/cmakeprojectmanager/makestep.cpp +++ b/src/plugins/cmakeprojectmanager/makestep.cpp @@ -292,7 +292,7 @@ void MakeStepConfigWidget::updateDetails() CMakeBuildConfiguration *bc = m_makeStep->cmakeBuildConfiguration(); ProjectExplorer::ToolChain *tc = bc->toolChain(); if (tc) - m_summaryText = tr("<b>Make:</b> %1 %2").arg(tc->makeCommand(), arguments.join(" ")); + m_summaryText = tr("<b>Make:</b> %1 %2").arg(tc->makeCommand(), arguments.join(QString(QLatin1Char(' ')))); else m_summaryText = tr("<b>Unknown Toolchain</b>"); emit updateSummary(); diff --git a/src/plugins/coreplugin/settingsdatabase.cpp b/src/plugins/coreplugin/settingsdatabase.cpp index 0203036345..1a98d8f44f 100644 --- a/src/plugins/coreplugin/settingsdatabase.cpp +++ b/src/plugins/coreplugin/settingsdatabase.cpp @@ -67,7 +67,7 @@ class SettingsDatabasePrivate public: QString effectiveGroup() const { - return m_groups.join(QLatin1String("/")); + return m_groups.join(QString(QLatin1Char('/'))); } QString effectiveKey(const QString &key) const diff --git a/src/plugins/cpaster/codepasterprotocol.cpp b/src/plugins/cpaster/codepasterprotocol.cpp index 00eb1f7c11..80ec046905 100644 --- a/src/plugins/cpaster/codepasterprotocol.cpp +++ b/src/plugins/cpaster/codepasterprotocol.cpp @@ -129,7 +129,7 @@ void CodePasterProtocol::paste(const QString &text, data += CGI::encodeURL(username).toLatin1(); http.setHost(hostName); - http.post("/", data); + http.post(QString(QLatin1Char('/')), data); } bool CodePasterProtocol::hasSettings() const diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp index 933002681a..e0bbab66ac 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp @@ -40,7 +40,7 @@ using namespace CPlusPlus; CppCurrentDocumentFilter::CppCurrentDocumentFilter(CppModelManager *manager, Core::EditorManager *editorManager) : m_modelManager(manager) { - setShortcutString("."); + setShortcutString(QString(QLatin1Char('.'))); setIncludedByDefault(false); search.setSymbolsToSearchFor(SearchSymbols::Declarations | @@ -64,10 +64,11 @@ QList<Locator::FilterEntry> CppCurrentDocumentFilter::matchesFor(const QString & QList<Locator::FilterEntry> goodEntries; QList<Locator::FilterEntry> betterEntries; QStringMatcher matcher(entry, Qt::CaseInsensitive); - const QRegExp regexp("*"+entry+"*", Qt::CaseInsensitive, QRegExp::Wildcard); + const QChar asterisk = QLatin1Char('*'); + const QRegExp regexp(asterisk + entry + asterisk, Qt::CaseInsensitive, QRegExp::Wildcard); if (!regexp.isValid()) return goodEntries; - bool hasWildcard = (entry.contains('*') || entry.contains('?')); + bool hasWildcard = (entry.contains(asterisk) || entry.contains('?')); if (m_currentFileName.isEmpty()) return goodEntries; diff --git a/src/plugins/cpptools/cppfunctionsfilter.cpp b/src/plugins/cpptools/cppfunctionsfilter.cpp index 01b4e823da..1033ffb5d7 100644 --- a/src/plugins/cpptools/cppfunctionsfilter.cpp +++ b/src/plugins/cpptools/cppfunctionsfilter.cpp @@ -34,7 +34,7 @@ using namespace CppTools::Internal; CppFunctionsFilter::CppFunctionsFilter(CppModelManager *manager, Core::EditorManager *editorManager) : CppLocatorFilter(manager, editorManager) { - setShortcutString("m"); + setShortcutString(QString(QLatin1Char('m'))); setIncludedByDefault(false); search.setSymbolsToSearchFor(SearchSymbols::Functions); diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp index df38a42a8d..2c28562d7e 100644 --- a/src/plugins/cpptools/cpplocatorfilter.cpp +++ b/src/plugins/cpptools/cpplocatorfilter.cpp @@ -44,7 +44,7 @@ CppLocatorFilter::CppLocatorFilter(CppModelManager *manager, Core::EditorManager m_editorManager(editorManager), m_forceNewSearchList(true) { - setShortcutString(":"); + setShortcutString(QString(QLatin1Char(':'))); setIncludedByDefault(false); connect(manager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)), @@ -84,11 +84,12 @@ QList<Locator::FilterEntry> CppLocatorFilter::matchesFor(const QString &origEntr QString entry = trimWildcards(origEntry); QList<Locator::FilterEntry> goodEntries; QList<Locator::FilterEntry> betterEntries; + const QChar asterisk = QLatin1Char('*'); QStringMatcher matcher(entry, Qt::CaseInsensitive); - const QRegExp regexp("*"+entry+"*", Qt::CaseInsensitive, QRegExp::Wildcard); + const QRegExp regexp(asterisk + entry+ asterisk, Qt::CaseInsensitive, QRegExp::Wildcard); if (!regexp.isValid()) return goodEntries; - bool hasWildcard = (entry.contains('*') || entry.contains('?')); + bool hasWildcard = (entry.contains(asterisk) || entry.contains('?')); QMutableMapIterator<QString, Info> it(m_searchList); while (it.hasNext()) { diff --git a/src/plugins/cpptools/searchsymbols.cpp b/src/plugins/cpptools/searchsymbols.cpp index 1a4d124144..b4c8837c58 100644 --- a/src/plugins/cpptools/searchsymbols.cpp +++ b/src/plugins/cpptools/searchsymbols.cpp @@ -197,7 +197,7 @@ QString SearchSymbols::symbolName(const Symbol *symbol) const } symbolName = QLatin1String("<anonymous "); symbolName += type; - symbolName += QLatin1String(">"); + symbolName += QLatin1Char('>'); } return symbolName; } diff --git a/src/plugins/debugger/debuggeroutputwindow.cpp b/src/plugins/debugger/debuggeroutputwindow.cpp index 981045be16..ca90c72ada 100644 --- a/src/plugins/debugger/debuggeroutputwindow.cpp +++ b/src/plugins/debugger/debuggeroutputwindow.cpp @@ -268,7 +268,7 @@ public slots: void gotoResult(int i) { QString needle = QString::number(i) + '^'; - QString needle2 = QLatin1String(">") + needle; + QString needle2 = QLatin1Char('>') + needle; QTextCursor cursor(document()); do { const QString line = cursor.block().text(); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 3213b0830f..57bbef92b7 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -2207,7 +2207,7 @@ void GdbEngine::attemptBreakpointSynchronization() // (reloadSourceFiles and reloadBreakList) to be executed // within the same stop-executecommand-continue cycle. // Just calling reloadSourceFiles and reloadBreakList doesn't work - // in this case, because a) stopping the executable is asyncronous, + // in this case, because a) stopping the executable is asynchronous, // b) we wouldn't want to stop-exec-continue twice m_sourcesListUpdating = true; GdbCommand cmd; diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp index 08985110d6..83c5c8f104 100644 --- a/src/plugins/debugger/stackhandler.cpp +++ b/src/plugins/debugger/stackhandler.cpp @@ -255,7 +255,7 @@ QList<StackFrame> StackHandler::frames() const bool StackHandler::isDebuggingDebuggingHelpers() const { for (int i = m_stackFrames.size(); --i >= 0; ) - if (m_stackFrames.at(i).function.startsWith("qDumpObjectData")) + if (m_stackFrames.at(i).function.startsWith(QLatin1String("qDumpObjectData"))) return true; return false; } diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index a1d61cabb7..f908e7fbd0 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -152,7 +152,7 @@ void WatchData::setValue(const QString &value0) } // avoid duplicated information - if (value.startsWith("(") && value.contains(") 0x")) + if (value.startsWith(QLatin1Char('(')) && value.contains(") 0x")) value = value.mid(value.lastIndexOf(") 0x") + 2); // doubles are sometimes displayed as "@0x6141378: 1.2". @@ -171,8 +171,8 @@ void WatchData::setValue(const QString &value0) // pointer type information is available in the 'type' // column. No need to duplicate it here. - if (value.startsWith("(" + type + ") 0x")) - value = value.section(" ", -1, -1); + if (value.startsWith(QLatin1Char('(') + type + ") 0x")) + value = value.section(QLatin1Char(' '), -1, -1); setValueUnneeded(); } @@ -796,7 +796,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const switch (idx.column()) { case 0: if (data.name == QLatin1String("*") && item->parent) - return QLatin1String("*") + item->parent->name; + return QLatin1Char('*') + item->parent->name; return data.name; case 1: { int format = m_handler->m_individualFormats.value(data.iname, -1); diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp index d0dfcd888e..8137b4744d 100644 --- a/src/plugins/debugger/watchutils.cpp +++ b/src/plugins/debugger/watchutils.cpp @@ -164,11 +164,11 @@ bool isSkippableFunction(const QString &funcName, const QString &fileName) if (fileName.endsWith(QLatin1String(".moc"))) return true; - if (funcName.endsWith("::qt_metacall")) + if (funcName.endsWith(QLatin1String("::qt_metacall"))) return true; - if (funcName.endsWith("::d_func")) + if (funcName.endsWith(QLatin1String("::d_func"))) return true; - if (funcName.endsWith("::q_func")) + if (funcName.endsWith(QLatin1String("::q_func"))) return true; return false; diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 88f32a9f15..6c6a0ecfb7 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -2207,7 +2207,7 @@ void FakeVimHandler::Private::handleCommand(const QString &cmd) static bool isSubstitution(const QString &cmd0, QStringList *result) { QString cmd; - if (cmd0.startsWith("substitute")) + if (cmd0.startsWith(QLatin1String("substitute"))) cmd = cmd0.mid(10); else if (cmd0.startsWith('s') && cmd0.size() > 1 && !isalpha(cmd0.at(1).unicode())) @@ -2450,7 +2450,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0) } else if (act) { // non-boolean to show showBlackMessage(arg + '=' + act->value().toString()); - } else if (arg.startsWith("no") + } else if (arg.startsWith(QLatin1String("no")) && (act = theFakeVimSettings()->item(arg.mid(2)))) { // boolean config to be switched off bool oldValue = act->value().toBool(); @@ -2505,10 +2505,10 @@ void FakeVimHandler::Private::passUnknownSetCommand(const QString &arg) static void vimPatternToQtPattern(QString *needle, QTextDocument::FindFlags *flags) { // FIXME: Rough mapping of a common case - if (needle->startsWith("\\<") && needle->endsWith("\\>")) + if (needle->startsWith(QLatin1String("\\<")) && needle->endsWith(QLatin1String("\\>"))) (*flags) |= QTextDocument::FindWholeWords; - needle->replace("\\<", ""); // start of word - needle->replace("\\>", ""); // end of word + needle->remove(QLatin1String("\\<")); // start of word + needle->remove(QLatin1String("\\>")); // end of word //qDebug() << "NEEDLE " << needle0 << needle; } diff --git a/src/plugins/find/searchresulttreemodel.cpp b/src/plugins/find/searchresulttreemodel.cpp index 3d55f70130..b1117693b9 100644 --- a/src/plugins/find/searchresulttreemodel.cpp +++ b/src/plugins/find/searchresulttreemodel.cpp @@ -231,41 +231,36 @@ QVariant SearchResultTreeModel::data(const SearchResultTextRow *row, int role) c QVariant SearchResultTreeModel::data(const SearchResultFile *file, int role) const { - QVariant result; - switch (role) { #if 0 case Qt::CheckStateRole: if (file->isUserCheckable()) - result = file->checkState(); - break; + return QVariant(file->checkState()); #endif case Qt::BackgroundRole: { const QColor baseColor = QApplication::palette().base().color(); - result = baseColor.darker(105); + return QVariant(baseColor.darker(105)); break; } - case Qt::DisplayRole: - result = QString(QDir::toNativeSeparators(file->fileName()) - + " (" + QString::number(file->childrenCount()) + ")"); - break; + case Qt::DisplayRole: { + QString result = QDir::toNativeSeparators(file->fileName()); + result += QLatin1String(" ("); + result += QString::number(file->childrenCount()); + result += QLatin1Char(')'); + return QVariant(result); + } case ItemDataRoles::FileNameRole: case Qt::ToolTipRole: - result = QDir::toNativeSeparators(file->fileName()); - break; + return QVariant(QDir::toNativeSeparators(file->fileName())); case ItemDataRoles::ResultLinesCountRole: - result = file->childrenCount(); - break; + return QVariant(file->childrenCount()); case ItemDataRoles::TypeRole: - result = "file"; - break; + return QVariant(QLatin1String("file")); default: - result = QVariant(); break; } - - return result; + return QVariant(); } QVariant SearchResultTreeModel::headerData(int section, Qt::Orientation orientation, diff --git a/src/plugins/genericprojectmanager/genericprojectnodes.cpp b/src/plugins/genericprojectmanager/genericprojectnodes.cpp index 8a7c69a841..0bb0184448 100644 --- a/src/plugins/genericprojectmanager/genericprojectnodes.cpp +++ b/src/plugins/genericprojectmanager/genericprojectnodes.cpp @@ -144,7 +144,7 @@ ProjectExplorer::FolderNode *GenericProjectNode::findOrCreateFolderByName(const else if (FolderNode *folder = m_folderByName.value(folderName)) return folder; - FolderNode *folder = new FolderNode(baseDir + "/" + folderName); + FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName); folder->setFolderName(component); m_folderByName.insert(folderName, folder); diff --git a/src/plugins/help/helpindexfilter.cpp b/src/plugins/help/helpindexfilter.cpp index 9ea9ab3636..85087f77f5 100644 --- a/src/plugins/help/helpindexfilter.cpp +++ b/src/plugins/help/helpindexfilter.cpp @@ -49,7 +49,7 @@ HelpIndexFilter::HelpIndexFilter(HelpPlugin *plugin, QHelpEngine *helpEngine): m_icon(QIcon()) // TODO: Put an icon next to the results { setIncludedByDefault(false); - setShortcutString("?"); + setShortcutString(QString(QLatin1Char('?'))); connect(m_helpEngine->indexModel(), SIGNAL(indexCreated()), this, SLOT(updateIndices())); diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 8960f20228..f01589f8d0 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -590,16 +590,16 @@ void HelpPlugin::extensionsInitialized() QStringList documentationToRemove; QStringList filtersToRemove; - const QString &docInternal = QString("com.nokia.qtcreator.%1%2%3") + const QString &docInternal = QString::fromLatin1("com.nokia.qtcreator.%1%2%3") .arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR).arg(IDE_VERSION_RELEASE); - const QString filterInternal = QString("Qt Creator %1.%2.%3") + const QString filterInternal = QString::fromLatin1("Qt Creator %1.%2.%3") .arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR).arg(IDE_VERSION_RELEASE); const QRegExp filterRegExp("Qt Creator \\d*\\.\\d*\\.\\d*"); const QStringList &docs = m_helpEngine->registeredDocumentations(); foreach (const QString &ns, docs) { if (ns == docInternal) { assistantInternalDocRegistered = true; - } else if (ns.startsWith("com.nokia.qtcreator.")) { + } else if (ns.startsWith(QLatin1String("com.nokia.qtcreator."))) { documentationToRemove << ns; } } @@ -663,8 +663,8 @@ void HelpPlugin::extensionsInitialized() QString addedDocs = m_helpEngine->customValue(QLatin1String("AddedDocs")).toString(); if (!addedDocs.isEmpty()) { - QStringList documentationToAdd = addedDocs.split(";"); - foreach (QString item, documentationToAdd) + const QStringList documentationToAdd = addedDocs.split(QLatin1Char(';')); + foreach (const QString &item, documentationToAdd) m_helpEngine->registerDocumentation(item); m_helpEngine->removeCustomValue(QLatin1String("AddedDocs")); } @@ -984,7 +984,7 @@ void HelpPlugin::openHelpPage(const QString& url) } else { // local help not installed, resort to external web help QString urlPrefix; - if (url.startsWith("qthelp://com.nokia.qtcreator")) { + if (url.startsWith(QLatin1String("qthelp://com.nokia.qtcreator"))) { urlPrefix = QString::fromLatin1("http://doc.trolltech.com/qtcreator-%1.%2/") .arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR); } else { diff --git a/src/plugins/locator/directoryfilter.cpp b/src/plugins/locator/directoryfilter.cpp index 983b51c92e..213203874e 100644 --- a/src/plugins/locator/directoryfilter.cpp +++ b/src/plugins/locator/directoryfilter.cpp @@ -225,7 +225,7 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future) QDir::Files|QDir::Hidden, QDir::Name|QDir::IgnoreCase|QDir::LocaleAware); foreach (const QString &file, fileEntries) - files.append(dir.path()+"/"+file); + files.append(dir.path()+ QLatin1Char('/') +file); progress += dirProgressMax; } else { int subProgress = dirProgressMax/(subDirs.size()+1); @@ -234,7 +234,7 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future) progressValues.push(selfProgress); processedValues.push(true); foreach (const QString &directory, subDirs) { - dirs.push(QDir(dir.path()+"/"+directory)); + dirs.push(QDir(dir.path()+ QLatin1Char('/') + directory)); progressValues.push(subProgress); processedValues.push(false); } diff --git a/src/plugins/locator/filesystemfilter.cpp b/src/plugins/locator/filesystemfilter.cpp index 99506b0760..7989d515c5 100644 --- a/src/plugins/locator/filesystemfilter.cpp +++ b/src/plugins/locator/filesystemfilter.cpp @@ -40,7 +40,7 @@ using namespace Locator::Internal; FileSystemFilter::FileSystemFilter(EditorManager *editorManager, LocatorWidget *locatorWidget) : m_editorManager(editorManager), m_locatorWidget(locatorWidget), m_includeHidden(true) { - setShortcutString("f"); + setShortcutString(QString(QLatin1Char('f'))); setIncludedByDefault(false); } @@ -52,13 +52,13 @@ QList<FilterEntry> FileSystemFilter::matchesFor(const QString &entry) QString directory = entryInfo.path(); QString filePath = entryInfo.filePath(); if (entryInfo.isRelative()) { - if (filePath.startsWith("~/")) { + if (filePath.startsWith(QLatin1String("~/"))) { directory.replace(0, 1, QDir::homePath()); } else { IEditor *editor = m_editorManager->currentEditor(); if (editor && !editor->file()->fileName().isEmpty()) { QFileInfo info(editor->file()->fileName()); - directory.prepend(info.absolutePath()+"/"); + directory.prepend(info.absolutePath() + QLatin1Char('/')); } } } @@ -74,7 +74,7 @@ QList<FilterEntry> FileSystemFilter::matchesFor(const QString &entry) QStringList files = dirInfo.entryList(fileFilter, QDir::Name|QDir::IgnoreCase|QDir::LocaleAware); foreach (const QString &dir, dirs) { - if (dir != "." && (name.isEmpty() || dir.startsWith(name, Qt::CaseInsensitive))) { + if (dir != QLatin1String(".") && (name.isEmpty() || dir.startsWith(name, Qt::CaseInsensitive))) { FilterEntry entry(this, dir, dirInfo.filePath(dir)); entry.resolveFileIcon = true; value.append(entry); @@ -95,7 +95,9 @@ void FileSystemFilter::accept(FilterEntry selection) const { QFileInfo info(selection.internalData.toString()); if (info.isDir()) { - QString value = shortcutString() + " " + QDir::toNativeSeparators(info.absoluteFilePath()+"/"); + QString value = shortcutString(); + value += QLatin1Char(' '); + value += QDir::toNativeSeparators(info.absoluteFilePath() + QLatin1Char('/')); m_locatorWidget->show(value, value.length()); return; } diff --git a/src/plugins/locator/locatorwidget.cpp b/src/plugins/locator/locatorwidget.cpp index 567658e112..d80a36fb5c 100644 --- a/src/plugins/locator/locatorwidget.cpp +++ b/src/plugins/locator/locatorwidget.cpp @@ -375,7 +375,7 @@ void LocatorWidget::showPopup() QList<ILocatorFilter*> LocatorWidget::filtersFor(const QString &text, QString &searchText) { QList<ILocatorFilter*> filters = m_locatorPlugin->filters(); - int whiteSpace = text.indexOf(" "); + const int whiteSpace = text.indexOf(QLatin1Char(' ')); QString prefix; if (whiteSpace >= 0) prefix = text.left(whiteSpace); @@ -464,13 +464,13 @@ void LocatorWidget::filterSelected() if (!currentText.isEmpty()) { searchText = currentText; foreach (ILocatorFilter *otherfilter, m_locatorPlugin->filters()) { - if (currentText.startsWith(otherfilter->shortcutString() + " ")) { + if (currentText.startsWith(otherfilter->shortcutString() + QLatin1Char(' '))) { searchText = currentText.mid(otherfilter->shortcutString().length()+1); break; } } } - show(filter->shortcutString() + " " + searchText, + show(filter->shortcutString() + QLatin1Char(' ') + searchText, filter->shortcutString().length() + 1, searchText.length()); updateCompletionList(m_fileLineEdit->text()); diff --git a/src/plugins/locator/opendocumentsfilter.cpp b/src/plugins/locator/opendocumentsfilter.cpp index a85da7fee9..096db8b7ea 100644 --- a/src/plugins/locator/opendocumentsfilter.cpp +++ b/src/plugins/locator/opendocumentsfilter.cpp @@ -42,7 +42,7 @@ OpenDocumentsFilter::OpenDocumentsFilter(EditorManager *editorManager) : this, SLOT(refreshInternally())); connect(m_editorManager, SIGNAL(editorsClosed(QList<Core::IEditor*>)), this, SLOT(refreshInternally())); - setShortcutString("o"); + setShortcutString(QString(QLatin1Char('o'))); setIncludedByDefault(true); } diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index e4e16bd6d6..2e24cad6b0 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -636,7 +636,7 @@ void PerforcePlugin::startSubmitProject() QStringList fstatLines = fstatResult.stdOut.split(QLatin1Char('\n')); QStringList depotFileNames; foreach (const QString &line, fstatLines) { - if (line.startsWith("... depotFile")) + if (line.startsWith(QLatin1String("... depotFile"))) depotFileNames.append(line.mid(14)); } if (depotFileNames.isEmpty()) { diff --git a/src/plugins/projectexplorer/abstractprocessstep.cpp b/src/plugins/projectexplorer/abstractprocessstep.cpp index 95ecaf35ff..701c06bdbb 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.cpp +++ b/src/plugins/projectexplorer/abstractprocessstep.cpp @@ -281,8 +281,8 @@ void AbstractProcessStep::taskAdded(const ProjectExplorer::TaskWindow::Task &tas } else { // More then one filename, so do a better compare // Chop of any "../" - while (filePath.startsWith("../")) - filePath = filePath.mid(3); + while (filePath.startsWith(QLatin1String("../"))) + filePath.remove(0, 3); int count = 0; QString possibleFilePath; foreach(const QFileInfo &fi, possibleFiles) { diff --git a/src/plugins/projectexplorer/allprojectsfilter.cpp b/src/plugins/projectexplorer/allprojectsfilter.cpp index bd7d120d42..67e4bf88ee 100644 --- a/src/plugins/projectexplorer/allprojectsfilter.cpp +++ b/src/plugins/projectexplorer/allprojectsfilter.cpp @@ -44,7 +44,7 @@ AllProjectsFilter::AllProjectsFilter(ProjectExplorerPlugin *pe) { connect(m_projectExplorer, SIGNAL(fileListChanged()), this, SLOT(markFilesAsOutOfDate())); - setShortcutString("a"); + setShortcutString(QString(QLatin1Char('a'))); setIncludedByDefault(true); } diff --git a/src/plugins/projectexplorer/allprojectsfind.cpp b/src/plugins/projectexplorer/allprojectsfind.cpp index 032077db9a..a486e5cbb0 100644 --- a/src/plugins/projectexplorer/allprojectsfind.cpp +++ b/src/plugins/projectexplorer/allprojectsfind.cpp @@ -56,7 +56,7 @@ AllProjectsFind::AllProjectsFind(ProjectExplorerPlugin *plugin, SearchResultWind QString AllProjectsFind::id() const { - return "All Projects"; + return QLatin1String("All Projects"); } QString AllProjectsFind::name() const @@ -128,14 +128,14 @@ QWidget *AllProjectsFind::createConfigWidget() void AllProjectsFind::writeSettings(QSettings *settings) { - settings->beginGroup("AllProjectsFind"); + settings->beginGroup(QLatin1String("AllProjectsFind")); writeCommonSettings(settings); settings->endGroup(); } void AllProjectsFind::readSettings(QSettings *settings) { - settings->beginGroup("AllProjectsFind"); - readCommonSettings(settings, "*"); + settings->beginGroup(QLatin1String("AllProjectsFind")); + readCommonSettings(settings, QString(QLatin1Char('*'))); settings->endGroup(); } diff --git a/src/plugins/projectexplorer/currentprojectfilter.cpp b/src/plugins/projectexplorer/currentprojectfilter.cpp index c43eba56e0..b99b392bed 100644 --- a/src/plugins/projectexplorer/currentprojectfilter.cpp +++ b/src/plugins/projectexplorer/currentprojectfilter.cpp @@ -49,7 +49,7 @@ CurrentProjectFilter::CurrentProjectFilter(ProjectExplorerPlugin *pe) connect(m_projectExplorer, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)), this, SLOT(currentProjectChanged(ProjectExplorer::Project*))); - setShortcutString("p"); + setShortcutString(QString(QLatin1Char('p'))); setIncludedByDefault(false); } diff --git a/src/plugins/projectexplorer/currentprojectfind.cpp b/src/plugins/projectexplorer/currentprojectfind.cpp index 41bb2f5490..9cef5497a9 100644 --- a/src/plugins/projectexplorer/currentprojectfind.cpp +++ b/src/plugins/projectexplorer/currentprojectfind.cpp @@ -56,7 +56,7 @@ CurrentProjectFind::CurrentProjectFind(ProjectExplorerPlugin *plugin, SearchResu QString CurrentProjectFind::id() const { - return "Current Project"; + return QLatin1String("Current Project"); } QString CurrentProjectFind::name() const @@ -123,14 +123,14 @@ QWidget *CurrentProjectFind::createConfigWidget() void CurrentProjectFind::writeSettings(QSettings *settings) { - settings->beginGroup("CurrentProjectFind"); + settings->beginGroup(QLatin1String("CurrentProjectFind")); writeCommonSettings(settings); settings->endGroup(); } void CurrentProjectFind::readSettings(QSettings *settings) { - settings->beginGroup("CurrentProjectFind"); - readCommonSettings(settings, "*"); + settings->beginGroup(QLatin1String("CurrentProjectFind")); + readCommonSettings(settings, QString(QLatin1Char('*'))); settings->endGroup(); } diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 51689dfd57..96c50dedb5 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -332,7 +332,7 @@ QString CustomExecutableRunConfiguration::executable() const Environment env = activeBuildConfiguration()->environment(); exec = env.searchInPath(m_executable); if (exec.isEmpty()) - exec = QDir::cleanPath(workingDirectory() + "/" + m_executable); + exec = QDir::cleanPath(workingDirectory() + QLatin1Char('/') + m_executable); } else { exec = m_executable; } diff --git a/src/plugins/projectexplorer/environment.cpp b/src/plugins/projectexplorer/environment.cpp index 154cb7f311..d307b8d55a 100644 --- a/src/plugins/projectexplorer/environment.cpp +++ b/src/plugins/projectexplorer/environment.cpp @@ -42,7 +42,7 @@ QList<EnvironmentItem> EnvironmentItem::fromStringList(QStringList list) foreach (const QString &string, list) { int pos = string.indexOf(QLatin1Char('=')); if (pos == -1) { - EnvironmentItem item(string, ""); + EnvironmentItem item(string, QString()); item.unset = true; result.append(item); } else { @@ -152,21 +152,21 @@ void Environment::prependOrSet(const QString&key, const QString &value, const QS void Environment::appendOrSetPath(const QString &value) { #ifdef Q_OS_WIN - QString sep = ";"; + const QChar sep = QLatin1Char(';'); #else - QString sep = ":"; + const QChar sep = QLatin1Char(':'); #endif - appendOrSet("PATH", QDir::toNativeSeparators(value), sep); + appendOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value), QString(sep)); } void Environment::prependOrSetPath(const QString &value) { #ifdef Q_OS_WIN - QString sep = ";"; + const QChar sep = QLatin1Char(';'); #else - QString sep = ":"; + const QChar sep = QLatin1Char(':'); #endif - prependOrSet("PATH", QDir::toNativeSeparators(value), sep); + prependOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value), QString(sep)); } Environment Environment::systemEnvironment() @@ -209,11 +209,11 @@ QString Environment::searchInPath(QString executable) const QStringList Environment::path() const { #ifdef Q_OS_WIN - QString sep = ";"; + const QChar sep = QLatin1Char(';'); #else - QString sep = ":"; + const QChar sep = QLatin1Char(':'); #endif - return m_values.value("PATH").split(sep); + return m_values.value(QLatin1String("PATH")).split(sep); } QString Environment::value(const QString &key) const @@ -340,12 +340,15 @@ QStringList Environment::parseCombinedArgString(const QString &program) QString Environment::joinArgumentList(const QStringList &arguments) { QString result; + const QChar doubleQuote = QLatin1Char('"'); foreach (QString arg, arguments) { if (!result.isEmpty()) result += QLatin1Char(' '); - arg.replace(QLatin1String("\""), QLatin1String("\"\"\"")); - if (arg.contains(QLatin1Char(' '))) - arg = "\"" + arg + "\""; + arg.replace(QString(doubleQuote), QLatin1String("\"\"\"")); + if (arg.contains(QLatin1Char(' '))) { + arg.insert(0, doubleQuote); + arg += doubleQuote; + } result += arg; } return result; diff --git a/src/plugins/projectexplorer/processstep.cpp b/src/plugins/projectexplorer/processstep.cpp index b222893ca7..87302655cb 100644 --- a/src/plugins/projectexplorer/processstep.cpp +++ b/src/plugins/projectexplorer/processstep.cpp @@ -270,8 +270,8 @@ void ProcessStepConfigWidget::updateDetails() m_summaryText = tr("<b>%1</b> %2 %3 %4") .arg(displayName, m_step->command(), - m_step->arguments().join(" "), - m_step->enabled() ? "" : tr("(disabled)")); + m_step->arguments().join(QString(QLatin1Char(' '))), + m_step->enabled() ? QString() : tr("(disabled)")); emit updateSummary(); } @@ -289,7 +289,7 @@ void ProcessStepConfigWidget::init() workingDirectory = "$BUILDDIR"; m_ui.workingDirectory->setPath(workingDirectory); - m_ui.commandArgumentsLineEdit->setText(m_step->arguments().join(" ")); + m_ui.commandArgumentsLineEdit->setText(m_step->arguments().join(QString(QLatin1Char(' ')))); m_ui.enabledCheckBox->setChecked(m_step->enabled()); m_ui.nameLineEdit->setText(m_step->displayName()); @@ -320,7 +320,7 @@ void ProcessStepConfigWidget::workingDirectoryLineEditTextEdited() void ProcessStepConfigWidget::commandArgumentsLineEditTextEdited() { - m_step->setArguments(m_ui.commandArgumentsLineEdit->text().split(" ", + m_step->setArguments(m_ui.commandArgumentsLineEdit->text().split(QLatin1Char(' '), QString::SkipEmptyParts)); updateDetails(); } diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index ce65dabd90..c61cd2512f 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1167,7 +1167,7 @@ void ProjectExplorerPlugin::restoreSession() arguments.removeOne(d->m_sessionToRestoreAtStartup); // Restore latest session or what was passed on the command line - if (d->m_sessionToRestoreAtStartup == QString::null) { + if (d->m_sessionToRestoreAtStartup.isEmpty()) { d->m_session->createAndLoadNewDefaultSession(); } else { d->m_session->loadSession(d->m_sessionToRestoreAtStartup); @@ -1728,6 +1728,7 @@ void ProjectExplorerPlugin::addToRecentProjects(const QString &fileName, const Q void ProjectExplorerPlugin::updateRecentProjectMenu() { + typedef QList<QPair<QString, QString> >::const_iterator StringPairListConstIterator; if (debug) qDebug() << "ProjectExplorerPlugin::updateRecentProjectMenu"; @@ -1739,12 +1740,10 @@ void ProjectExplorerPlugin::updateRecentProjectMenu() menu->setEnabled(!d->m_recentProjects.isEmpty()); //projects (ignore sessions, they used to be in this list) - - QList<QPair<QString, QString> >::const_iterator it, end; - end = d->m_recentProjects.constEnd(); - for (it = d->m_recentProjects.constBegin(); it != end; ++it) { + const StringPairListConstIterator end = d->m_recentProjects.constEnd(); + for (StringPairListConstIterator it = d->m_recentProjects.constBegin(); it != end; ++it) { const QPair<QString, QString> &s = *it; - if (s.first.endsWith(".qws")) + if (s.first.endsWith(QLatin1String(".qws"))) continue; QAction *action = menu->addAction(s.first); action->setData(s.first); diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 8e815b0b11..f7051cae8a 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -173,7 +173,7 @@ bool SessionFile::load(const QString &fileName) // We used to write relative paths into the session file // relative to the session files, and those were stored in the // config dir - it.setValue(configDir + "/" + file); + it.setValue(configDir + QLatin1Char('/') + file); } } @@ -380,9 +380,9 @@ SessionManager::SessionManager(QObject *parent) // Move sessions to that directory foreach (const QString &session, sessions()) { - QFile file(configDir + "/" + session + ".qws"); + QFile file(configDir + QLatin1Char('/') + session + QLatin1String(".qws")); if (file.exists()) - if (file.copy(configDir + "/qtcreator/" + session + ".qws")) + if (file.copy(configDir + QLatin1String("/qtcreator/") + session + QLatin1String(".qws"))) file.remove(); } } diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index c9b5d9dedf..5dce13258f 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -240,7 +240,7 @@ void TaskModel::addTask(const TaskWindow::Task &task) QFont font; QFontMetrics fm(font); QString filename = task.file; - int pos = filename.lastIndexOf("/"); + const int pos = filename.lastIndexOf(QLatin1Char('/')); if (pos != -1) filename = task.file.mid(pos +1); @@ -876,7 +876,7 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, // Assemble string for the right side // just filename + linenumer QString file = index.data(TaskModel::File).toString(); - int pos = file.lastIndexOf("/"); + const int pos = file.lastIndexOf(QLatin1Char('/')); if (pos != -1) file = file.mid(pos +1); painter->drawText(width + 22 + 4, 2 + opt.rect.top() + fm.ascent(), file); diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp index 5a44108958..28686817b5 100644 --- a/src/plugins/projectexplorer/toolchain.cpp +++ b/src/plugins/projectexplorer/toolchain.cpp @@ -179,9 +179,9 @@ QByteArray GccToolChain::predefinedMacros() // Turn off flag indicating Apple's blocks support int idx = m_predefinedMacros.indexOf("#define __BLOCKS__ 1"); if (idx != -1) { - idx = m_predefinedMacros.indexOf("1", idx); + idx = m_predefinedMacros.indexOf(QLatin1Char('1'), idx); m_predefinedMacros[idx] = '0'; - } + }- // Define __strong and __weak (used for Apple's GC extension of C) to be empty m_predefinedMacros.append("#define __strong\n"); @@ -397,7 +397,7 @@ QByteArray MSVCToolChain::predefinedMacros() if (!value.isEmpty()) { value.chop(1); //remove '\n' } - QByteArray newDefine = "#define " + key + " " + value + '\n'; + QByteArray newDefine = "#define " + key + ' ' + value + '\n'; m_predefinedMacros.append(newDefine); } } @@ -543,7 +543,7 @@ void WinCEToolChain::addToEnvironment(ProjectExplorer::Environment &env) // Find MSVC path - path += "/"; + path += QLatin1Char('/'); // Find Platform name CeSdkHandler cesdkhandler; diff --git a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp index 2207a4a778..f00bf51afc 100644 --- a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp +++ b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp @@ -137,15 +137,18 @@ void GettingStartedWelcomePageWidget::updateExamples(const QString& examplePath, inExamples = true; } if (inExamples && reader.name() == "example") { - QString name = reader.attributes().value(QLatin1String("name")).toString(); - QString fn = reader.attributes().value(QLatin1String("filename")).toString(); - QString relativeProPath = '/' + dirName + '/' + fn + '/' + fn + ".pro"; + const QChar slash = QLatin1Char('/'); + const QString name = reader.attributes().value(QLatin1String("name")).toString(); + const QString fn = reader.attributes().value(QLatin1String("filename")).toString(); + const QString relativeProPath = slash + dirName + slash + fn + slash + fn + QLatin1String(".pro"); QString fileName = examplePath + relativeProPath; if (!QFile::exists(fileName)) - fileName = sourcePath + "/examples" + relativeProPath; - QString helpPath = "qthelp://com.trolltech.qt/qdoc/" + dirName.replace("/", "-") + "-" + fn + ".html"; + fileName = sourcePath + QLatin1String("/examples") + relativeProPath; + QString helpPath = QLatin1String("qthelp://com.trolltech.qt/qdoc/") + + dirName.replace(slash, QLatin1Char('-')) + + QLatin1Char('-') + fn + QLatin1String(".html"); - ui->examplesComboBox->addItem(" " + name, fileName); + ui->examplesComboBox->addItem(QLatin1String(" ") + name, fileName); ui->examplesComboBox->setItemData(ui->examplesComboBox->count()-1, helpPath, Qt::UserRole+1); } break; diff --git a/src/plugins/qt4projectmanager/makestep.cpp b/src/plugins/qt4projectmanager/makestep.cpp index 3b791d1f21..8b8007b5d8 100644 --- a/src/plugins/qt4projectmanager/makestep.cpp +++ b/src/plugins/qt4projectmanager/makestep.cpp @@ -129,8 +129,8 @@ bool MakeStep::init() makeCmd = m_makeCmd; if (!QFileInfo(makeCmd).isAbsolute()) { // Try to detect command in environment - QString tmp = environment.searchInPath(makeCmd); - if (tmp == QString::null) { + const QString tmp = environment.searchInPath(makeCmd); + if (tmp.isEmpty()) { emit addOutput(tr("<font color=\"#ff0000\">Could not find make command: %1 "\ "in the build environment</font>").arg(makeCmd)); return false; @@ -241,8 +241,8 @@ void MakeStepConfigWidget::updateDetails() if (!QFileInfo(makeCmd).isAbsolute()) { Environment environment = bc->environment(); // Try to detect command in environment - QString tmp = environment.searchInPath(makeCmd); - if (tmp == QString::null) { + const QString tmp = environment.searchInPath(makeCmd); + if (tmp.isEmpty()) { m_summaryText = tr("<b>Make Step:</b> %1 not found in the environment.").arg(makeCmd); emit updateSummary(); return; diff --git a/src/plugins/qt4projectmanager/projectloadwizard.cpp b/src/plugins/qt4projectmanager/projectloadwizard.cpp index 4051ae0b22..7b72e5ce96 100644 --- a/src/plugins/qt4projectmanager/projectloadwizard.cpp +++ b/src/plugins/qt4projectmanager/projectloadwizard.cpp @@ -172,8 +172,10 @@ void ProjectLoadWizard::setupImportPage(QtVersion *version, QtVersion::QmakeBuil QVBoxLayout *importLayout = new QVBoxLayout(importPage); importLabel = new QLabel(importPage); - QString versionString = version->displayName() + " (" + QDir::toNativeSeparators(version->qmakeCommand()) + ")"; - QString buildConfigString = (buildConfig & QtVersion::BuildAll) ? QLatin1String("debug_and_release ") : QLatin1String(""); + QString versionString = version->displayName() + QLatin1String(" (") + + QDir::toNativeSeparators(version->qmakeCommand()) + + QLatin1Char(')'); + QString buildConfigString = (buildConfig & QtVersion::BuildAll) ? QLatin1String("debug_and_release ") : QString(); buildConfigString.append((buildConfig & QtVersion::DebugBuild) ? QLatin1String("debug") : QLatin1String("release")); importLabel->setTextFormat(Qt::RichText); importLabel->setText(tr("Qt Creator has found an already existing build in the source directory.<br><br>" diff --git a/src/plugins/qt4projectmanager/qmakeparser.cpp b/src/plugins/qt4projectmanager/qmakeparser.cpp index 804a567291..8b9074a98f 100644 --- a/src/plugins/qt4projectmanager/qmakeparser.cpp +++ b/src/plugins/qt4projectmanager/qmakeparser.cpp @@ -45,7 +45,7 @@ QMakeParser::QMakeParser() void QMakeParser::stdError(const QString &line) { QString lne(line.trimmed()); - if (lne.startsWith("Project ERROR:")) { + if (lne.startsWith(QLatin1String("Project ERROR:"))) { const QString description = lne.mid(15); emit addTask(TaskWindow::Task(TaskWindow::Error, description, diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp index 001cdd2b6d..b570d4b1ce 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp @@ -496,8 +496,8 @@ void MaemoRunConfiguration::updateSimulatorInformation() if (m_cachedSimulatorInformationValid) return; - m_simulator = QString::null; - m_simulatorArgs == QString::null; + m_simulator.clear(); + m_simulatorArgs.clear(); m_cachedSimulatorInformationValid = true; m_simulatorPath = QDir::toNativeSeparators(m_userSimulatorPath); m_visibleSimulatorParameter = tr("Could not autodetect target simulator, " diff --git a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp index 46350c219d..ab11558c7a 100644 --- a/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/winscwtoolchain.cpp @@ -74,7 +74,7 @@ QStringList WINSCWToolChain::systemIncludes() const ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); QString symIncludesValue = env.value("MWCSYM2INCLUDES"); if (!symIncludesValue.isEmpty()) - return symIncludesValue.split(";"); + return symIncludesValue.split(QLatin1Char(';')); } else { QStringList symIncludes = QStringList() << "\\MSL\\MSL_C\\MSL_Common\\Include" @@ -94,7 +94,7 @@ QStringList WINSCWToolChain::systemIncludes() const void WINSCWToolChain::addToEnvironment(ProjectExplorer::Environment &env) { if (!m_carbidePath.isEmpty()) { - env.set("MWCSYM2INCLUDES", systemIncludes().join(";")); + env.set("MWCSYM2INCLUDES", systemIncludes().join(QString(QLatin1Char(';')))); QStringList symLibraries = QStringList() << "\\Win32-x86 Support\\Libraries\\Win32 SDK" << "\\Runtime\\Runtime_x86\\Runtime_Win32\\Libs"; diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp index f175e05e0d..ca6e6e3b54 100644 --- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp @@ -523,13 +523,13 @@ QString Qt4BuildConfiguration::extractSpecFromArgumentList(const QStringList &li // if it is the former we need to get the canonical form // for the other one we don't need to do anything if (QFileInfo(parsedSpec).isRelative()) { - if(QFileInfo(directory + "/" + parsedSpec).exists()) { - parsedSpec = QDir::cleanPath(directory + "/" + parsedSpec); + if(QFileInfo(directory + QLatin1Char('/') + parsedSpec).exists()) { + parsedSpec = QDir::cleanPath(directory + QLatin1Char('/') + parsedSpec); #ifdef Q_OS_WIN parsedSpec = parsedSpec.toLower(); #endif } else { - parsedSpec = baseMkspecDir + "/" + parsedSpec; + parsedSpec = baseMkspecDir + QLatin1Char('/') + parsedSpec; } } diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 7b6eadfb42..e777e10184 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -1147,13 +1147,13 @@ QStringList Qt4ProFileNode::subDirsPaths(ProFileReader *reader) const realDir = subDirVar; QFileInfo info(realDir); if (!info.isAbsolute()) { - info.setFile(m_projectDir + "/" + realDir); - realDir = m_projectDir + "/" + realDir; + info.setFile(m_projectDir + QLatin1Char('/') + realDir); + realDir = m_projectDir + QLatin1Char('/') + realDir; } QString realFile; if (info.isDir()) { - realFile = QString("%1/%2.pro").arg(realDir, info.fileName()); + realFile = QString::fromLatin1("%1/%2.pro").arg(realDir, info.fileName()); } else { realFile = realDir; } diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index f071a37583..e1e664999d 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -591,7 +591,7 @@ void Qt4Project::updateCodeModel() //support to access this information // TODO this is wastefull - // only save it per .pro file, and on beeing asked + // only save it per .pro file, and on being asked // search for the .pro file that has that file foreach (FileNode *fileNode, pro->fileNodes()) { const QString path = fileNode->path(); diff --git a/src/plugins/qt4projectmanager/qtoptionspage.cpp b/src/plugins/qt4projectmanager/qtoptionspage.cpp index aae26a0cce..c7f1417292 100644 --- a/src/plugins/qt4projectmanager/qtoptionspage.cpp +++ b/src/plugins/qt4projectmanager/qtoptionspage.cpp @@ -651,9 +651,12 @@ void QtOptionsPageWidget::fixQtVersionName(int index) QRegExp regexp("^(.*)\\((\\d)\\)$"); if (regexp.exactMatch(name)) { // Already in Name (#) format - name = regexp.cap(1) + "(" + QString().setNum(regexp.cap(2).toInt() + 1) + ")"; + name = regexp.cap(1); + name += QLatin1Char('('); + name += QString::number(regexp.cap(2).toInt() + 1); + name += QLatin1Char(')'); } else { - name = name + " (2)"; + name += QLatin1String(" (2)"); } // set new name m_versions[index]->setDisplayName(name); diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index 1d7f11eb23..8ac704e5db 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -814,12 +814,12 @@ QPair<QtVersion::QmakeBuildConfigs, QStringList> QtVersionManager::scanMakeFile( QString QtVersionManager::findQMakeLine(const QString &directory) { - QFile makefile(directory + "/Makefile" ); + QFile makefile(directory + QLatin1String("/Makefile" )); if (makefile.exists() && makefile.open(QFile::ReadOnly)) { QTextStream ts(&makefile); while (!ts.atEnd()) { - QString line = ts.readLine(); - if (line.startsWith("# Command:")) + const QString line = ts.readLine(); + if (line.startsWith(QLatin1String("# Command:"))) return line; } } @@ -831,7 +831,7 @@ QString QtVersionManager::trimLine(const QString line) { // Actually the first space after #Command: /path/to/qmake - int firstSpace = line.indexOf(" ", 11); + const int firstSpace = line.indexOf(QLatin1Char(' '), 11); return line.mid(firstSpace).trimmed(); } @@ -989,8 +989,8 @@ void QtVersion::updateVersionInfo() const QByteArray output = process.readAllStandardOutput(); QTextStream stream(&output); while (!stream.atEnd()) { - QString line = stream.readLine(); - int index = line.indexOf(":"); + const QString line = stream.readLine(); + const int index = line.indexOf(QLatin1Char(':')); if (index != -1) m_versionInfo.insert(line.left(index), QDir::fromNativeSeparators(line.mid(index+1))); } @@ -1379,9 +1379,9 @@ QString QtVersion::invalidReason() const { if (isValid()) return QString(); - if (qmakeCommand() == QString::null) + if (qmakeCommand().isEmpty()) return QApplication::translate("QtVersion", "No QMake path set"); - if (displayName() == QString::null) + if (displayName().isEmpty()) return QApplication::translate("QtVersion", "Qt Version has no name"); if (m_notInstalled) return QApplication::translate("QtVersion", "Qt Version is not installed, please run make install"); diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index 701ea748d8..e318af83eb 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -74,9 +74,9 @@ QStringList BaseFileFind::fileNameFilters() const { QStringList filters; if (m_filterCombo && !m_filterCombo->currentText().isEmpty()) { - QStringList parts = m_filterCombo->currentText().split(","); + const QStringList parts = m_filterCombo->currentText().split(QLatin1Char(',')); foreach (const QString &part, parts) { - QString filter = part.trimmed(); + const QString filter = part.trimmed(); if (!filter.isEmpty()) { filters << filter; } diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index b356a5e4f4..d0436d4eea 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -3195,7 +3195,7 @@ void BaseTextEditor::slotCursorPositionChanged() #if 0 qDebug() << "block" << textCursor().blockNumber()+1 << "depth:" << TextEditDocumentLayout::braceDepth(textCursor().block()) - << "/" << TextEditDocumentLayout::braceDepth(document()->lastBlock()); + << '/' << TextEditDocumentLayout::braceDepth(document()->lastBlock()); #endif if (!d->m_contentsChanged && d->m_lastCursorChangeWasInteresting) { Core::EditorManager::instance()->addCurrentPositionToNavigationHistory(editableInterface(), d->m_tempNavigationState); diff --git a/src/plugins/texteditor/linenumberfilter.cpp b/src/plugins/texteditor/linenumberfilter.cpp index e4eccecdf4..26cfbd46c3 100644 --- a/src/plugins/texteditor/linenumberfilter.cpp +++ b/src/plugins/texteditor/linenumberfilter.cpp @@ -42,7 +42,7 @@ using namespace TextEditor::Internal; LineNumberFilter::LineNumberFilter(QObject *parent) : ILocatorFilter(parent) { - setShortcutString("l"); + setShortcutString(QString(QLatin1Char('l'))); setIncludedByDefault(true); } diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h index d4d7ebabd8..503e7da240 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.h +++ b/src/plugins/vcsbase/vcsbaseplugin.h @@ -157,7 +157,7 @@ public slots: // Convenience slot for "Delete current file" action. Prompts to // delete the file via VCSManager. void promptToDeleteCurrentFile(); - // Prompt to initalize version control in a directory, initially + // Prompt to initialize version control in a directory, initially // pointing to the current project. void createRepository(); diff --git a/src/shared/indenter/test/main.cpp b/src/shared/indenter/test/main.cpp index d1a30923b4..1c7c78da72 100644 --- a/src/shared/indenter/test/main.cpp +++ b/src/shared/indenter/test/main.cpp @@ -117,7 +117,7 @@ static QStringList parseCommandLine(char **begin, char **end) int format(const QString &fileName) { const QString code = fileContents(fileName); - if (code == QString::null) + if (code.isEmpty()) return 1; QStringList program = code.split(QLatin1Char('\n'), QString::KeepEmptyParts); diff --git a/src/shared/trk/trkdevice.h b/src/shared/trk/trkdevice.h index fd6a961b08..948ba8cd1b 100644 --- a/src/shared/trk/trkdevice.h +++ b/src/shared/trk/trkdevice.h @@ -55,7 +55,7 @@ struct TrkDevicePrivate; * Contains a write message queue allowing * for queueing messages with a notification callback. If the message receives * an ACK, the callback is invoked. - * The special message TRK_WRITE_QUEUE_NOOP_CODE code can be used for synchronisation. + * The special message TRK_WRITE_QUEUE_NOOP_CODE code can be used for synchronization. * The respective message will not be sent, the callback is just invoked. */ enum { TRK_WRITE_QUEUE_NOOP_CODE = 0x7f }; |