Fix Krazy code scanning tool warnings (QString, loops, spelling).

This commit is contained in:
Friedemann Kleint
2011-02-25 15:27:13 +01:00
parent 49311aa362
commit 88f333267f
56 changed files with 119 additions and 110 deletions
@@ -127,7 +127,7 @@ static const CommandDescription commandDescriptions[] = {
"Prints local variables of symbol group in GDBMI or debug format",
"[-t token] [-v] [T formats] [-I formats] [-f debugfilter] [-c] [-h] [-d]\n[-e expand-list] [-u uninitialized-list]\n"
"[-W] [-w watch-iname watch-expression] <frame-number> [iname]\n"
"-h human-readable ouput\n"
"-h human-readable output\n"
"-v increase verboseness of dumping\n"
"-d debug output\n"
"-f debug_filter\n"
@@ -142,7 +142,7 @@ static const CommandDescription commandDescriptions[] = {
{"watches",
"Prints watches variables of symbol group in GDBMI or debug format",
"[-t token] [-v] [T formats] [-I formats] [-f debugfilter] [-c] [-h] [-d] <iname>\n"
"-h human-readable ouput\n"
"-h human-readable output\n"
"-v increase verboseness of dumping\n"
"-d debug output\n"
"-f debug_filter\n"
@@ -610,7 +610,7 @@ std::string SymbolGroupValue::resolveType(const std::string &typeIn,
// Use the module of the current symbol group for templates.
// This is because resolving some template types (std::list<> has been
// observed to result in 'QtGui4d!std::list', which subseqently fails.
// observed to result in 'QtGui4d!std::list', which subsequently fails.
if (!currentModule.empty() && stripped.find('<') != std::string::npos) {
std::string trc = currentModule;
trc.push_back('!');
+1 -1
View File
@@ -59,7 +59,7 @@ static QString quoteWinCommand(const QString &program)
{
const QChar doubleQuote = QLatin1Char('"');
// add the programm as the first arg ... it works better
// add the program as the first arg ... it works better
QString programName = program;
programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
if (!programName.startsWith(doubleQuote) && !programName.endsWith(doubleQuote)
+1 -1
View File
@@ -325,7 +325,7 @@ void EnvironmentModel::unsetVariable(const QString &name)
int pos = m_d->findInChanges(name);
if (pos != -1) {
m_d->m_items[pos].unset = true;
m_d->m_items[pos].value = QString();
m_d->m_items[pos].value.clear();
m_d->updateResultEnvironment();
emit dataChanged(index(row, 0, QModelIndex()), index(row, 1, QModelIndex()));
emit userChangesChanged();
+5 -5
View File
@@ -500,7 +500,7 @@ bool ExternalTool::save(QString *errorMessage) const
return true;
}
bool ExternalTool::operator==(const ExternalTool &other)
bool ExternalTool::operator==(const ExternalTool &other) const
{
return m_id == other.m_id
&& m_description == other.m_description
@@ -537,9 +537,9 @@ bool ExternalToolRunner::resolve()
{
if (!m_tool)
return false;
m_resolvedExecutable = QString::null;
m_resolvedArguments = QString::null;
m_resolvedWorkingDirectory = QString::null;
m_resolvedExecutable.clear();
m_resolvedArguments.clear();
m_resolvedWorkingDirectory.clear();
{ // executable
foreach (const QString &executable, m_tool->executables()) {
QString resolved = Utils::expandMacros(executable,
@@ -813,7 +813,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
it.next();
ActionContainer *container = 0;
const QString &containerName = it.key();
if (containerName == QString()) { // no displayCategory, so put into external tools menu directly
if (containerName.isEmpty()) { // no displayCategory, so put into external tools menu directly
container = mexternaltools;
} else {
if (m_containers.contains(containerName)) {
+2 -2
View File
@@ -93,8 +93,8 @@ public:
bool save(QString *errorMessage = 0) const;
bool operator==(const ExternalTool &other);
bool operator!=(const ExternalTool &other) { return !((*this) == other); }
bool operator==(const ExternalTool &other) const;
bool operator!=(const ExternalTool &other) const { return !((*this) == other); }
ExternalTool &operator=(const ExternalTool &other);
void setId(const QString &id);
+1 -1
View File
@@ -339,7 +339,7 @@ void FileManager::renamedFile(const QString &from, const QString &to)
}
}
/* Removes all occurrances of the IFile from m_filesWithWatch and m_states.
/* Removes all occurrences of the IFile from m_filesWithWatch and m_states.
If that results in a file no longer being referenced by any IFile, this
also removes the file watcher.
*/
+2 -2
View File
@@ -112,7 +112,7 @@ public:
QList<IFile *> saveModifiedFiles(const QList<IFile *> &files,
bool *cancelled = 0,
const QString &message = QString(),
const QString &alwaysSaveMessage = QString::null,
const QString &alwaysSaveMessage = QString(),
bool *alwaysSave = 0);
@@ -167,7 +167,7 @@ private:
QList<IFile *> saveModifiedFiles(const QList<IFile *> &files,
bool *cancelled, bool silently,
const QString &message,
const QString &alwaysSaveMessage = QString::null,
const QString &alwaysSaveMessage = QString(),
bool *alwaysSave = 0);
Internal::FileManagerPrivate *d;
+1 -1
View File
@@ -61,7 +61,7 @@ namespace Internal {
// breakpoint type. The controls not applicable to the current type
// (say function name for file-and-line) are disabled and cleared out.
// However,the values are saved and restored once the respective mode
// is again choosen, which is done using m_savedParameters and
// is again chosen, which is done using m_savedParameters and
// setters/getters taking the parts mask enumeration parameter.
//
///////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -2472,7 +2472,7 @@ static inline void formatCdbBreakPointResponse(BreakpointId id, const Breakpoint
void CdbEngine::handleBreakPoints(const CdbExtensionCommandPtr &reply)
{
if (debugBreakpoints)
qDebug("CdbEngine::handleBreakPoints: sucess=%d: %s", reply->success, reply->reply.constData());
qDebug("CdbEngine::handleBreakPoints: success=%d: %s", reply->success, reply->reply.constData());
if (!reply->success) {
showMessage(QString::fromAscii(reply->errorMessage), LogError);
return;
+1 -1
View File
@@ -310,7 +310,7 @@ void ConsoleWindow::showOutput(int channel, const QString &output)
line.truncate(n);
line += QLatin1String(" [...] <cut off>");
}
m_console->appendPlainText(charForChannel(channel) + line + "\n");
m_console->appendPlainText(charForChannel(channel) + line + '\n');
}
QTextCursor cursor = m_console->textCursor();
cursor.movePosition(QTextCursor::End);
+3 -3
View File
@@ -271,12 +271,12 @@ void DisassemblerAgent::setContents(const DisassemblerLines &contents)
for (int i = 0, n = contents.size(); i != n; ++i) {
const DisassemblerLine &dl = contents.at(i);
if (dl.address) {
str += QString("0x");
str += QLatin1String("0x");
str += QString::number(dl.address, 16);
str += " ";
str += QLatin1String(" ");
}
str += dl.data;
str += "\n";
str += QLatin1Char('\n');
}
plainTextEdit->setPlainText(str);
plainTextEdit->setReadOnly(true);
@@ -280,7 +280,7 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
if (debuggerCore()->boolSetting(AutoDerefPointers)) {
// Try automatic dereferentiation
data.exp = "(*(" + data.exp + "))";
data.type = data.type + "."; // FIXME: fragile HACK to avoid recursion
data.type = data.type + '.'; // FIXME: fragile HACK to avoid recursion
insertData(data);
} else {
data.setChildrenUnneeded();
+1 -1
View File
@@ -597,7 +597,7 @@ void CodaGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
sendGdbServerAck();
logMessage(_("Not implemented 'Continue with signal' %1: ").arg(signalNumber),
LogWarning);
sendGdbServerMessage("O" + QByteArray("Console output").toHex());
sendGdbServerMessage('O' + QByteArray("Console output").toHex());
sendGdbServerMessage("W81"); // "Process exited with result 1
sendTrkContinue();
}
+1 -1
View File
@@ -2782,7 +2782,7 @@ void GdbEngine::requestModuleSymbols(const QString &moduleName)
QString fileName = tf.fileName();
tf.close();
postCommand("maint print msymbols " + fileName.toLocal8Bit()
+ " " + moduleName.toLocal8Bit(),
+ ' ' + moduleName.toLocal8Bit(),
NeedsStop, CB(handleShowModuleSymbols),
QVariant(moduleName + QLatin1Char('@') + fileName));
}
+1 -1
View File
@@ -837,7 +837,7 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
}
} // qPart/qXfer
else if (cmd.startsWith("X")) {
else if (cmd.startsWith('X')) {
logMessage(msgGdbPacket(QLatin1String("Write memory")));
// X addr,length
sendGdbServerAck();
@@ -350,7 +350,7 @@ void LldbEngineGuest::requestUpdateWatchData(const Internal::WatchData &data,
void LldbEngineGuest::getWatchDataR(lldb::SBValue v, int level,
const QByteArray &p_iname, QList<WatchData> &wd)
{
QByteArray iname = p_iname + "." + QByteArray(v.GetName());
QByteArray iname = p_iname + '.' + QByteArray(v.GetName());
m_localesCache.insert(QString::fromLocal8Bit(iname), v);
#if defined(HAVE_LLDB_PRIVATE)
@@ -584,7 +584,7 @@ void LldbEngineGuest::updateThreads()
ThreadData thread;
thread.id = t.GetThreadID();
thread.targetId = QString::number(t.GetThreadID());
thread.core = QString();
thread.core.clear();
thread.state = QString::number(t.GetStopReason());
switch (t.GetStopReason()) {
+1 -1
View File
@@ -368,7 +368,7 @@ void QmlCppEngine::interruptInferior()
void QmlCppEngine::requestInterruptInferior()
{
EDEBUG("\nMASTER REQUEST INTERUPT INFERIOR");
EDEBUG("\nMASTER REQUEST INTERRUPT INFERIOR");
DebuggerEngine::requestInterruptInferior();
d->m_cppEngine->requestInterruptInferior();
}
+2 -2
View File
@@ -826,9 +826,9 @@ void QmlEngine::messageReceived(const QByteArray &message)
logMessage(LogReceive, logString);
QString msg = stackFrames.isEmpty()
? tr("<p>An Uncaught Exception occured:</p><p>%2</p>")
? tr("<p>An Uncaught Exception occurred:</p><p>%2</p>")
.arg(Qt::escape(error))
: tr("<p>An Uncaught Exception occured in <i>%1</i>:</p><p>%2</p>")
: tr("<p>An Uncaught Exception occurred in <i>%1</i>:</p><p>%2</p>")
.arg(stackFrames.value(0).file, Qt::escape(error));
showMessageBox(QMessageBox::Information, tr("Uncaught Exception"), msg);
} else {
+1 -1
View File
@@ -61,7 +61,7 @@ void dumpBacktrace(int maxdepth)
proc.start("addr2line", args);
proc.waitForStarted();
for (int i = 0; i < qMin(size, maxdepth); i++)
proc.write("0x" + QByteArray::number(quintptr(bt[i]), 16) + "\n");
proc.write("0x" + QByteArray::number(quintptr(bt[i]), 16) + '\n');
proc.closeWriteChannel();
QByteArray out = proc.readAllStandardOutput();
qDebug() << QCoreApplication::arguments().at(0);
+1 -1
View File
@@ -1963,7 +1963,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(const Input &input)
m_movetype = MoveExclusive;
m_subsubmode = SearchSubSubMode;
m_commandPrefix = QLatin1Char(m_lastSearchForward ? '/' : '?');
m_commandBuffer = QString();
m_commandBuffer.clear();
updateMiniBuffer();
}
} else if (input.is('`')) {
+1 -1
View File
@@ -1432,7 +1432,7 @@ QString PerforcePlugin::fileNameFromPerforceName(const QString& perforceName,
const PerforceResponse response = runP4Cmd(m_settings.topLevelSymLinkTarget(), args, flags);
if (response.error) {
*errorMessage = msgWhereFailed(perforceName, response.message);
return QString::null;
return QString();
}
QString output = response.stdOut;
+1 -1
View File
@@ -270,7 +270,7 @@ QString Abi::toString(const OSFlavor &of)
return QLatin1String("msys");
case ProjectExplorer::Abi::WindowsCEFlavor:
return QLatin1String("ce");
case ProjectExplorer::Abi::UnknownFlavor: // fall throught!
case ProjectExplorer::Abi::UnknownFlavor: // fall through!
default:
return QLatin1String("unknown");
}
@@ -171,10 +171,10 @@ void OutputParserTester::taskAdded(const ProjectExplorer::Task &task)
void OutputParserTester::reset()
{
m_receivedStdErrChildLine = QString();
m_receivedStdOutChildLine = QString();
m_receivedStdErrChildLine.clear();
m_receivedStdOutChildLine.clear();
m_receivedTasks.clear();
m_receivedOutput = QString();
m_receivedOutput.clear();
}
#endif
@@ -1353,7 +1353,8 @@ void ProjectExplorerPlugin::restoreSession()
// Converts "filename" "+45" or "filename" ":23"
// into "filename+45" and "filename:23"
foreach (const QString &str, arguments) {
if (!combinedList.isEmpty() && (str.startsWith("+") || str.startsWith(":"))) {
if (!combinedList.isEmpty() && (str.startsWith(QLatin1Char('+'))
|| str.startsWith(QLatin1Char(':')))) {
combinedList.last().append(str);
} else {
combinedList << str;
@@ -2209,7 +2210,7 @@ QString ProjectExplorerPlugin::directoryFor(Node *node)
// We figure out a commonPath from the subfolders
QStringList list;
foreach (FolderNode *f, folder->subFolderNodes())
list << f->path() + "/";
list << f->path() + QLatin1Char('/');
if (list.isEmpty())
location = path.left(path.indexOf('#'));
else
@@ -2432,7 +2433,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to)
return;
QString orgFilePath = QFileInfo(node->path()).absoluteFilePath();
QString dir = QFileInfo(orgFilePath).absolutePath();
QString newFilePath = dir + "/" + to;
QString newFilePath = dir + QLatin1Char('/') + to;
Core::ICore *core = Core::ICore::instance();
Core::IVersionControl *vc = core->vcsManager()->findVersionControlForDirectory(dir);
bool result = false;
+1 -1
View File
@@ -81,7 +81,7 @@ public slots:
signals:
void removeButtonClicked();
// This signal is emited whenever the target pointed to by the indices
// This signal is emitted whenever the target pointed to by the indices
// has changed.
void currentChanged(int targetIndex, int subIndex);
@@ -386,7 +386,8 @@ bool ItemLibraryModel::isItemVisible(int itemLibId)
QString entryToImport(const ItemLibraryEntry &entry)
{
return entry.requiredImport() + " " + QString::number(entry.majorVersion()) + "." + QString::number(entry.minorVersion());
return entry.requiredImport() + QLatin1Char(' ') + QString::number(entry.majorVersion())
+ QLatin1Char('.') + QString::number(entry.minorVersion());
}
void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
@@ -401,7 +402,7 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
QStringList imports;
foreach (const Import &import, model->imports())
if (import.isLibraryImport())
imports << import.url() + " " + import.version();
imports << import.url() + QLatin1Char(' ') + import.version();
foreach (ItemLibraryEntry entry, itemLibraryInfo->entries()) {
@@ -573,7 +573,7 @@ QString NavigatorTreeModel::qmlTypeInQtContainer(const QString &qtContainerType)
{
QString typeName(qtContainerType);
if (typeName.startsWith("QDeclarativeListProperty<") &&
typeName.endsWith(">")) {
typeName.endsWith('>')) {
typeName.remove(0, 25);
typeName.chop(1);
}
@@ -581,7 +581,7 @@ QString templateGeneration(NodeMetaInfo type, NodeMetaInfo superType, const QmlO
foreach (const QString &name, orderedList) {
QString properName = name;
properName.replace(".", "_");
properName.replace('.', '_');
QString typeName = type.propertyTypeName(name);
//alias resolution only possible with instance
@@ -55,7 +55,7 @@ QImage StatesEditorImageProvider::requestImage(const QString &id, QSize *size, c
if (newSize.isEmpty())
newSize = QSize (100, 100);
QString imageId = id.split("-").first();
QString imageId = id.split(QLatin1Char('-')).first();
QImage image;
if (imageId == "baseState") {
@@ -283,7 +283,7 @@ void QMLRewriter::includeLeadingEmptyLine(int &start) const
// FIXME: duplicate code in the QmlJS::Rewriter class, remove this
UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *members, const QStringList &propertyOrder)
{
const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString::null);
const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString());
UiObjectMemberList *lastObjectDef = 0;
UiObjectMemberList *lastNonObjectDef = 0;
@@ -81,7 +81,7 @@ class CORESHARED_EXPORT NodeInstanceView : public AbstractView, public NodeInsta
public:
typedef QWeakPointer<NodeInstanceView> Pointer;
NodeInstanceView(QObject *parent = 0, NodeInstanceServerInterface::RunModus runModus = NodeInstanceServerInterface::NormalModus);
explicit NodeInstanceView(QObject *parent = 0, NodeInstanceServerInterface::RunModus runModus = NodeInstanceServerInterface::NormalModus);
~NodeInstanceView();
void modelAttached(Model *model);
@@ -353,12 +353,12 @@ void NodeInstanceServer::addImports(const QVector<AddImportContainer> &container
importStatement += container.url().toString();
if (!container.version().isEmpty())
importStatement += " " + container.version();
importStatement += ' ' + container.version();
if (!container.alias().isEmpty())
importStatement += " as " + container.alias();
importStatement.append("\n");
importStatement.append('\n');
if (!m_importList.contains(importStatement))
m_importList.append(importStatement);
@@ -74,7 +74,7 @@ void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString &
&& QDeclarativeMetaType::isQObject(metaProperty.userType())) {
QObject *propertyObject = QDeclarativeMetaType::toQObject(metaProperty.read(spiedObject));
if (propertyObject)
registerObject(propertyObject, prefix + metaProperty.name() + ".");
registerObject(propertyObject, prefix + metaProperty.name() + QLatin1Char('.'));
} else if (metaProperty.hasNotifySignal()) {
QMetaMethod metaMethod = metaProperty.notifySignal();
bool isConnecting = QMetaObject::connect(spiedObject, metaMethod.methodIndex(), this, methodeOffset, Qt::DirectConnection);
@@ -90,7 +90,7 @@ void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString &
&& QDeclarativeMetaType::isQObject(metaProperty.userType())) {
QObject *propertyObject = QDeclarativeMetaType::toQObject(metaProperty.read(spiedObject));
if (propertyObject)
registerObject(propertyObject, prefix + metaProperty.name() + "/");
registerObject(propertyObject, prefix + metaProperty.name() + QLatin1Char('/'));
}
// search recursive in objects list
@@ -101,7 +101,7 @@ void NodeInstanceSignalSpy::registerObject(QObject *spiedObject, const QString &
for (int i = 0; i < list.count(); i++) {
QObject *propertyObject = list.at(i);
if (propertyObject)
registerObject(propertyObject, prefix + metaProperty.name() + "/");
registerObject(propertyObject, prefix + metaProperty.name() + QLatin1Char('/'));
}
}
}
@@ -99,13 +99,13 @@ public:
{
const Interpreter::ASTPropertyReference *ref = dynamic_cast<const Interpreter::ASTPropertyReference*>(value);
if (ref) {
QString type = "unkown";
QString type = "unknown";
if (ref->ast()->memberType)
type = ref->ast()->memberType->asString();
m_properties.append(qMakePair(name, type));
} else {
if (const Interpreter::QmlObjectValue * ov = dynamic_cast<const Interpreter::QmlObjectValue *>(value)) {
QString qualifiedTypeName = ov->packageName().isEmpty() ? ov->className() : ov->packageName() + "/" + ov->className();
QString qualifiedTypeName = ov->packageName().isEmpty() ? ov->className() : ov->packageName() + '/' + ov->className();
m_properties.append(qMakePair(name, qualifiedTypeName));
} else {
Interpreter::TypeId typeId;
@@ -158,11 +158,11 @@ QStringList prototypes(const Interpreter::ObjectValue *ov, LookupContext::Ptr co
const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(ov);
if (qmlValue) {
if (versions) {
list << qmlValue->packageName() + "/" + qmlValue->className() +
" " + QString::number(qmlValue->version().majorVersion()) +
"." + QString::number(qmlValue->version().minorVersion());
list << qmlValue->packageName() + '/' + qmlValue->className() +
' ' + QString::number(qmlValue->version().majorVersion()) +
'.' + QString::number(qmlValue->version().minorVersion());
} else {
list << qmlValue->packageName() + "/" + qmlValue->className();
list << qmlValue->packageName() + '/' + qmlValue->className();
}
} else {
if (versions) {
@@ -385,7 +385,7 @@ QHash<QString, NodeMetaInfoPrivate::Pointer> NodeMetaInfoPrivate::m_nodeMetaInfo
static inline QString stringIdentifier( const QString &type, int maj, int min)
{
return type + QString::number(maj) + "_" + QString::number(min);
return type + QString::number(maj) + '_' + QString::number(min);
}
NodeMetaInfoPrivate::Pointer NodeMetaInfoPrivate::create(Model *model, const QString &type, int maj, int min)
@@ -492,8 +492,9 @@ bool NodeMetaInfoPrivate::isPropertyWritable(const QString &propertyName) const
return false;
if (propertyName.contains('.')) {
const QString objectName = propertyName.split(".").first();
const QString rawPropertyName = propertyName.split(".").last();
const QStringList parts = propertyName.split('.');
const QString objectName = parts.first();
const QString rawPropertyName = parts.last();
const QString objectType = propertyType(objectName);
if (isValueType(objectType)) {
@@ -523,8 +524,9 @@ bool NodeMetaInfoPrivate::isPropertyList(const QString &propertyName) const
return false;
if (propertyName.contains('.')) {
const QString objectName = propertyName.split(".").first();
const QString rawPropertyName = propertyName.split(".").last();
const QStringList parts = propertyName.split('.');
const QString objectName = parts.first();
const QString rawPropertyName = parts.last();
const QString objectType = propertyType(objectName);
if (isValueType(objectType)) {
@@ -550,8 +552,9 @@ bool NodeMetaInfoPrivate::isPropertyPointer(const QString &propertyName) const
return false;
if (propertyName.contains('.')) {
const QString objectName = propertyName.split(".").first();
const QString rawPropertyName = propertyName.split(".").last();
const QStringList parts = propertyName.split('.');
const QString objectName = parts.first();
const QString rawPropertyName = parts.last();
const QString objectType = propertyType(objectName);
if (isValueType(objectType)) {
@@ -577,8 +580,9 @@ bool NodeMetaInfoPrivate::isPropertyEnum(const QString &propertyName) const
return false;
if (propertyName.contains('.')) {
const QString objectName = propertyName.split(".").first();
const QString rawPropertyName = propertyName.split(".").last();
const QStringList parts = propertyName.split('.');
const QString objectName = parts.first();
const QString rawPropertyName = parts.last();
const QString objectType = propertyType(objectName);
if (isValueType(objectType)) {
@@ -612,8 +616,9 @@ QString NodeMetaInfoPrivate::propertyEnumScope(const QString &propertyName) cons
return QString();
if (propertyName.contains('.')) {
const QString objectName = propertyName.split(".").first();
const QString rawPropertyName = propertyName.split(".").last();
const QStringList parts = propertyName.split('.');
const QString objectName = parts.first();
const QString rawPropertyName = parts.last();
const QString objectType = propertyType(objectName);
if (isValueType(objectType)) {
@@ -797,7 +802,7 @@ void NodeMetaInfoPrivate::setupPrototypes()
description.minorVersion = qmlValue->version().minorVersion();
description.majorVersion = qmlValue->version().majorVersion();
if (!qmlValue->packageName().isEmpty())
description.className = qmlValue->packageName() + "/" + description.className;
description.className = qmlValue->packageName() + '/' + description.className;
m_prototypes.append(description);
} else {
if (lookupContext()->context()->lookupType(document(), QStringList() << ov->className()))
@@ -69,7 +69,7 @@ public:
bool operator()(QmlJS::AST::UiProgram *sourceAST) {
m_inStates = false;
m_stateName = QString();
m_stateName.clear();
Node::accept(sourceAST->imports, this);
@@ -138,7 +138,7 @@ QString QmlTextGenerator::toQml(const ModelNode &node, int indentDepth) const
QString type = node.type();
QString url;
if (type.contains('/')) {
QStringList nameComponents = type.split("/");
const QStringList nameComponents = type.split('/');
url = nameComponents.first();
type = nameComponents.last();
}
@@ -158,7 +158,7 @@ QString QmlTextGenerator::toQml(const ModelNode &node, int indentDepth) const
QString result;
if (!alias.isEmpty())
result = alias + ".";
result = alias + '.';
result += type;
result += QLatin1String(" {\n");
@@ -73,9 +73,10 @@ ViewLogger::ViewLogger(QObject *parent)
#else
const QString tempPath = QDir::tempPath();
#endif
QTemporaryFile *temporaryFile = new QTemporaryFile(tempPath + QString("/qmldesigner-logger-%1-XXXXXX.txt").arg(QDateTime::currentDateTime().toString(Qt::ISODate).replace(":", "-")), this);
const QString path = tempPath + QString("/qmldesigner-logger-%1-XXXXXX.txt").
arg(QDateTime::currentDateTime().toString(Qt::ISODate).
replace(':', '-'));
QTemporaryFile *temporaryFile = new QTemporaryFile(path, this);
temporaryFile->setAutoRemove(false);
if (temporaryFile->open()) {
qDebug() << "QmlDesigner: Log file is:" << temporaryFile->fileName();
@@ -55,13 +55,13 @@ static QString toString(Statement *statement)
{
ExpressionStatement *expStmt = cast<ExpressionStatement *>(statement);
if (!expStmt)
return QString::null;
return QString();
if (IdentifierExpression *idExp = cast<IdentifierExpression *>(expStmt->expression)) {
return idExp->name->asString();
} else if (StringLiteral *strExp = cast<StringLiteral *>(expStmt->expression)) {
return strExp->value->asString();
}
return QString::null;
return QString();
}
static QString getIdProperty(UiObjectDefinition *def)
@@ -100,5 +100,5 @@ QString ComponentNameDialog::isValid() const
if (path.isEmpty() || !QFileInfo(path).isDir())
return tr("Invalid path");
return QString::null;
return QString();
}
@@ -151,7 +151,7 @@ ProjectExplorer::FolderNode *QmlProjectNode::findOrCreateFolderByName(const QStr
else if (FolderNode *folder = m_folderByName.value(folderName))
return folder;
FolderNode *folder = new FolderNode(baseDir + "/" + folderName);
FolderNode *folder = new FolderNode(baseDir + '/' + folderName);
folder->setDisplayName(component);
m_folderByName.insert(folderName, folder);
@@ -131,7 +131,7 @@ QString Qt4DesktopTargetFactory::defaultShadowBuildDirectory(const QString &proj
QList<BuildConfigurationInfo> Qt4DesktopTargetFactory::availableBuildConfigurations(const QString &id, const QString &proFilePath, const QtVersionNumber &minimumQtVersion)
{
Q_ASSERT(id == Constants::DESKTOP_TARGET_ID);
QList<BuildConfigurationInfo> infos;
QList<BuildConfigurationInfo> infoList;
QList<QtVersion *> knownVersions = QtVersionManager::instance()->versionsForTargetId(id, minimumQtVersion);
foreach (QtVersion *version, knownVersions) {
@@ -140,10 +140,10 @@ QList<BuildConfigurationInfo> Qt4DesktopTargetFactory::availableBuildConfigurati
QtVersion::QmakeBuildConfigs config = version->defaultBuildConfig();
QString dir = defaultShadowBuildDirectory(Qt4Project::defaultTopLevelBuildDirectory(proFilePath), id);
infos.append(BuildConfigurationInfo(version, config, QString(), dir));
infos.append(BuildConfigurationInfo(version, config ^ QtVersion::DebugBuild, QString(), dir));
infoList.append(BuildConfigurationInfo(version, config, QString(), dir));
infoList.append(BuildConfigurationInfo(version, config ^ QtVersion::DebugBuild, QString(), dir));
}
return infos;
return infoList;
}
Qt4TargetSetupWidget *Qt4DesktopTargetFactory::createTargetSetupWidget(const QString &id, const QString &proFilePath, const QtVersionNumber &number, bool importEnabled, QList<BuildConfigurationInfo> importInfos)
@@ -135,8 +135,8 @@ QStringList createHtmlCapabilityList(uint capabilities)
while (i.hasNext()) {
i.next();
if (i.key() == capabilitySet[j].value) {
foreach (QString capability, i.value()) {
result << QString("<font color=\"%1\">%2</font>")
foreach (const QString &capability, i.value()) {
result << QString::fromAscii("<font color=\"%1\">%2</font>")
.arg(capabilitySet[j].color).arg(capability);
}
break;
@@ -708,10 +708,10 @@ void S60CreatePackageStep::resetPassphrases()
{
m_passphrases->beginGroup("keys");
QStringList keys = m_passphrases->allKeys();
foreach (QString key, keys) {
m_passphrases->setValue(key, "");
foreach (const QString &key, keys) {
m_passphrases->setValue(key, QString());
}
m_passphrases->remove("");
m_passphrases->remove(QString());
m_passphrases->endGroup();
}
@@ -101,7 +101,7 @@ private slots:
private:
void ctor();
void handleParserState(bool sucess);
void handleParserState(bool success);
QString m_proFilePath;
QString m_commandLineArguments;
@@ -336,7 +336,7 @@ public:
/**
* Get a value for a specific subject_info parameter name.
* @param name the name of the paramter to look up. Possible names are
* @param name the name of the parameter to look up. Possible names are
* "X509.Certificate.version", "X509.Certificate.serial",
* "X509.Certificate.start", "X509.Certificate.end",
* "X509.Certificate.v2.key_id", "X509.Certificate.public_key",
+7 -7
View File
@@ -363,7 +363,7 @@ struct InternalNode
// replace i.value() by i.value()->subnodes.begin()
QString key = i.value()->subnodes.begin().key();
InternalNode *keep = i.value()->subnodes.value(key);
keep->displayName = i.value()->displayName + "/" + keep->displayName;
keep->displayName = i.value()->displayName + '/' + keep->displayName;
newSubnodes.insert(key, keep);
i.value()->subnodes.clear();
delete i.value();
@@ -556,9 +556,9 @@ void Qt4PriFileNode::update(ProFile *includeFileExact, ProFileReader *readerExac
for (int i=0; i < folders.size(); ++i) {
QFileInfo fi(folders.at(i));
const QFileInfo fi(folders.at(i));
if (fi.isRelative())
folders[i] = projectDir + "/" + folders.at(i);
folders[i] = projectDir + '/' + folders.at(i);
}
@@ -1287,7 +1287,7 @@ QStringList Qt4ProFileNode::symbianCapabilities() const
foreach (const QString &cap, m_varValues[SymbianCapabilities]) {
QString capability = cap.toLower();
if (capability.startsWith("-")) {
if (capability.startsWith('-')) {
lowerCasedResult.removeAll(capability.mid(1));
} else if (capability == "all") {
foreach (const QString &a, all)
@@ -1299,7 +1299,7 @@ QStringList Qt4ProFileNode::symbianCapabilities() const
}
QStringList result; //let's make the result pretty
int index = -1;
foreach (QString lowerCase, lowerCasedResult) {
foreach (const QString &lowerCase, lowerCasedResult) {
for (int i = 0; i < all.count(); ++i) {
index = -1;
if (QString::compare(lowerCase, all.at(i),
@@ -1916,7 +1916,7 @@ QString Qt4ProFileNode::uiDirPath(ProFileReader *reader) const
{
QString path = reader->value("UI_DIR");
if (QFileInfo(path).isRelative())
path = QDir::cleanPath(buildDir() + "/" + path);
path = QDir::cleanPath(buildDir() + '/' + path);
return path;
}
@@ -1924,7 +1924,7 @@ QString Qt4ProFileNode::mocDirPath(ProFileReader *reader) const
{
QString path = reader->value("MOC_DIR");
if (QFileInfo(path).isRelative())
path = QDir::cleanPath(buildDir() + "/" + path);
path = QDir::cleanPath(buildDir() + '/' + path);
return path;
}
+3 -2
View File
@@ -1087,8 +1087,9 @@ QSet<QString> CentralizedFolderWatcher::recursiveDirs(const QString &folder)
QDir dir(folder);
QStringList list = dir.entryList(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
foreach (const QString &f, list) {
result.insert(folder + f + "/");
result += recursiveDirs(folder + f + "/");
const QString a = folder + f + '/';
result.insert(a);
result += recursiveDirs(a);
}
return result;
}
+1 -1
View File
@@ -421,7 +421,7 @@ QString Qt4DefaultTargetSetupWidget::displayNameFrom(const BuildConfigurationInf
//: release build
buildType = tr("release");
}
return info.version->displayName() + " " + buildType;
return info.version->displayName() + ' ' + buildType;
}
void Qt4DefaultTargetSetupWidget::setProFilePath(const QString &proFilePath)
@@ -864,7 +864,7 @@ void QtVersion::setQMakeCommand(const QString& qmakeCommand)
m_abiUpToDate = false;
// TODO do i need to optimize this?
m_versionInfoUpToDate = false;
m_qtVersionString = QString();
m_qtVersionString.clear();
updateSourcePath();
}
+1 -1
View File
@@ -151,7 +151,7 @@ void QTestLibPlugin::projectRunHook(ProjectExplorer::Project *proj)
if (!proj)
return;
m_projectDirectory = QString();
m_projectDirectory.clear();
//NBS proj->setExtraApplicationRunArguments(QStringList());
//NBS proj->setCustomApplicationOutputHandler(0);
@@ -120,10 +120,10 @@ public:
* indention level (or higher).
*/
inline void setFoldingIndent(int indent) { m_foldingIndent = indent; }
// Set whether the first charater of the folded region will show when the code is folded.
// Set whether the first character of the folded region will show when the code is folded.
inline void setFoldingStartIncluded(bool included) { m_foldingStartIncluded = included; }
inline bool foldingStartIncluded() const { return m_foldingStartIncluded; }
// Set whether the last charater of the folded region will show when the code is folded.
// Set whether the last character of the folded region will show when the code is folded.
inline void setFoldingEndIncluded(bool included) { m_foldingEndIncluded = included; }
inline bool foldingEndIncluded() const { return m_foldingEndIncluded; }
inline int lexerState() const { return m_lexerState; }
@@ -208,7 +208,7 @@ void ICompletionCollector::filter(const QList<TextEditor::CompletionItem> &items
}
const QRegExp regExp(keyRegExp);
foreach (TextEditor::CompletionItem item, items)
foreach (const TextEditor::CompletionItem &item, items)
if (regExp.indexIn(item.text) == 0)
filteredItems->append(item);
}
+1 -1
View File
@@ -44,7 +44,7 @@ namespace TextEditor {
class TEXTEDITOR_EXPORT Snippet
{
public:
Snippet(const QString &groupId = QString(), const QString &id = QString());
explicit Snippet(const QString &groupId = QString(), const QString &id = QString());
~Snippet();
const QString &id() const;
+1 -1
View File
@@ -53,7 +53,7 @@ static QString errorCodeToString(DWORD errorCode)
if (data != 0)
LocalFree(data);
if (result.endsWith("\n"))
if (result.endsWith('\n'))
result.truncate(result.length() - 1);
return result;
+1 -1
View File
@@ -17,7 +17,7 @@
// Put everything into a single project.
static int targetDepth = 0;
static bool forceOverWrite = false;
static QString subProjectSeparator = "_";
static QString subProjectSeparator = QString(QLatin1Char('_'));
// FIXME: Make file classes configurable on the command line.
static const char *defaultExtensions[] =