aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-10-14 15:48:12 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-10-14 15:48:12 +0200
commit7063fefe4b5e866b27001bb9b911fc2f68034e40 (patch)
tree1ce35139475d83399572a3265414c2da3443a321 /tools
parentf3446071da8357620d0c8593a04e3b4fbba88f21 (diff)
parent4f3379352a265bab00a7265f85ffc38a9ca4ffe4 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Diffstat (limited to 'tools')
-rw-r--r--tools/qmleasing/segmentproperties.cpp2
-rw-r--r--tools/qmleasing/splineeditor.cpp7
-rw-r--r--tools/qmlimportscanner/main.cpp6
-rw-r--r--tools/qmljs/qmljs.cpp4
-rw-r--r--tools/qmlmin/main.cpp20
-rw-r--r--tools/qmlplugindump/main.cpp27
-rw-r--r--tools/qmlprofiler/qmlprofilerapplication.cpp2
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.cpp4
-rw-r--r--tools/qmlscene/main.cpp6
9 files changed, 42 insertions, 36 deletions
diff --git a/tools/qmleasing/segmentproperties.cpp b/tools/qmleasing/segmentproperties.cpp
index cfc10b7f54..cf49b2488c 100644
--- a/tools/qmleasing/segmentproperties.cpp
+++ b/tools/qmleasing/segmentproperties.cpp
@@ -103,7 +103,7 @@ void SegmentProperties::invalidate()
{
m_blockSignals = true;
- m_ui_pane_p.label->setText(QLatin1String("p") + QString::number(m_segment));
+ m_ui_pane_p.label->setText(QLatin1Char('p') + QString::number(m_segment));
m_ui_pane_p.smooth->setChecked(m_smooth);
m_ui_pane_p.smooth->parentWidget()->setEnabled(!m_last);
diff --git a/tools/qmleasing/splineeditor.cpp b/tools/qmleasing/splineeditor.cpp
index 56444f6b3b..2ae4d11309 100644
--- a/tools/qmleasing/splineeditor.cpp
+++ b/tools/qmleasing/splineeditor.cpp
@@ -293,10 +293,11 @@ QString SplineEditor::generateCode()
{
QString s = QLatin1String("[");
foreach (const QPointF &point, m_controlPoints) {
- s += QString::number(point.x(), 'g', 2) + "," + QString::number(point.y(), 'g', 3) + ",";
+ s += QString::number(point.x(), 'g', 2) + QLatin1Char(',')
+ + QString::number(point.y(), 'g', 3) + QLatin1Char(',');
}
s.chop(1); //removing last ","
- s += "]";
+ s += QLatin1Char(']');
return s;
}
@@ -675,7 +676,7 @@ void SplineEditor::setEasingCurve(const QString &code)
{
if (m_block)
return;
- if (code.left(1) == QLatin1String("[") && code.right(1) == QLatin1String("]")) {
+ if (code.startsWith(QLatin1Char('[')) && code.endsWith(QLatin1Char(']'))) {
QString cleanCode = code;
cleanCode.remove(0, 1);
cleanCode.chop(1);
diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp
index 7f8c3080c4..395c31a710 100644
--- a/tools/qmlimportscanner/main.cpp
+++ b/tools/qmlimportscanner/main.cpp
@@ -129,10 +129,10 @@ QVariantMap pluginsForModulePath(const QString &modulePath) {
line = qmldirFile.readLine();
if (line.startsWith("plugin")) {
plugins += QString::fromUtf8(line.split(' ').at(1));
- plugins += QStringLiteral(" ");
+ plugins += QLatin1Char(' ');
} else if (line.startsWith("classname")) {
classnames += QString::fromUtf8(line.split(' ').at(1));
- classnames += QStringLiteral(" ");
+ classnames += QLatin1Char(' ');
} else if (line.startsWith("depends")) {
QList<QByteArray> dep = line.split(' ');
if (dep.length() != 3)
@@ -199,7 +199,7 @@ QVariantList findPathsForModuleImports(const QVariantList &imports)
if (plugininfo.contains(QStringLiteral("dependencies"))) {
QStringList dependencies = plugininfo.value(QStringLiteral("dependencies")).toStringList();
foreach (const QString &line, dependencies) {
- QList<QString> dep = line.split(QStringLiteral(" "));
+ QList<QString> dep = line.split(QLatin1Char(' '));
QVariantMap depImport;
depImport[QStringLiteral("type")] = QStringLiteral("module");
depImport[QStringLiteral("name")] = dep[0];
diff --git a/tools/qmljs/qmljs.cpp b/tools/qmljs/qmljs.cpp
index 132817ff8c..27aeed4c0c 100644
--- a/tools/qmljs/qmljs.cpp
+++ b/tools/qmljs/qmljs.cpp
@@ -126,8 +126,8 @@ static void showException(QV4::ExecutionContext *ctx, const QV4::Value &exceptio
foreach (const QV4::StackFrame &frame, trace) {
std::cerr << " at " << qPrintable(frame.function) << " (" << qPrintable(frame.source);
if (frame.line >= 0)
- std::cerr << ":" << frame.line;
- std::cerr << ")" << std::endl;
+ std::cerr << ':' << frame.line;
+ std::cerr << ')' << std::endl;
}
}
diff --git a/tools/qmlmin/main.cpp b/tools/qmlmin/main.cpp
index 35b62ef6fd..a3f2b92bde 100644
--- a/tools/qmlmin/main.cpp
+++ b/tools/qmlmin/main.cpp
@@ -245,7 +245,7 @@ void Minify::escape(const QChar &ch, QString *out)
switch (hx.length()) {
case 1: out->append(QLatin1String("000")); break;
case 2: out->append(QLatin1String("00")); break;
- case 3: out->append(QLatin1String("0")); break;
+ case 3: out->append(QLatin1Char('0')); break;
case 4: break;
default: Q_ASSERT(!"unreachable");
}
@@ -274,7 +274,8 @@ bool Minify::parse(int startToken)
_tokens.append(tokenKind());
_tokenStrings.append(tokenText());
} else {
- std::cerr << qPrintable(fileName()) << ":" << tokenStartLine() << ":" << tokenStartColumn() << ": syntax error" << std::endl;
+ std::cerr << qPrintable(fileName()) << ':' << tokenStartLine() << ':'
+ << tokenStartColumn() << ": syntax error" << std::endl;
return false;
}
}
@@ -394,7 +395,8 @@ bool Minify::parse(int startToken)
goto again;
}
- std::cerr << qPrintable(fileName()) << ":" << tokenStartLine() << ":" << tokenStartColumn() << ": syntax error" << std::endl;
+ std::cerr << qPrintable(fileName()) << ':' << tokenStartLine() << ':' << tokenStartColumn()
+ << ": syntax error" << std::endl;
return false;
}
@@ -447,7 +449,8 @@ bool Tokenize::parse(int startToken)
_tokens.append(tokenKind());
_tokenStrings.append(tokenText());
} else {
- std::cerr << qPrintable(fileName()) << ":" << tokenStartLine() << ":" << tokenStartColumn() << ": syntax error" << std::endl;
+ std::cerr << qPrintable(fileName()) << ':' << tokenStartLine() << ':'
+ << tokenStartColumn() << ": syntax error" << std::endl;
return false;
}
}
@@ -511,7 +514,8 @@ bool Tokenize::parse(int startToken)
goto again;
}
- std::cerr << qPrintable(fileName()) << ":" << tokenStartLine() << ":" << tokenStartColumn() << ": syntax error" << std::endl;
+ std::cerr << qPrintable(fileName()) << ':' << tokenStartLine() << ':'
+ << tokenStartColumn() << ": syntax error" << std::endl;
return false;
}
@@ -599,7 +603,7 @@ int runQmlmin(int argc, char *argv[])
else {
usage(/*show help*/ isInvalidOpt);
if (isInvalidOpt)
- std::cerr << "qmlmin: invalid option '" << qPrintable(arg) << "'" << std::endl;
+ std::cerr << "qmlmin: invalid option '" << qPrintable(arg) << '\'' << std::endl;
else
std::cerr << "qmlmin: too many input files specified" << std::endl;
return EXIT_FAILURE;
@@ -632,7 +636,7 @@ int runQmlmin(int argc, char *argv[])
//
QQmlJS::Minify secondMinify(width);
if (! secondMinify(fileName, minify.minifiedCode()) || secondMinify.minifiedCode() != minify.minifiedCode()) {
- std::cerr << "qmlmin: cannot minify '" << qPrintable(fileName) << "'" << std::endl;
+ std::cerr << "qmlmin: cannot minify '" << qPrintable(fileName) << '\'' << std::endl;
return EXIT_FAILURE;
}
@@ -641,7 +645,7 @@ int runQmlmin(int argc, char *argv[])
minimizedTokens(fileName, minify.minifiedCode());
if (originalTokens.tokenStream().size() != minimizedTokens.tokenStream().size()) {
- std::cerr << "qmlmin: cannot minify '" << qPrintable(fileName) << "'" << std::endl;
+ std::cerr << "qmlmin: cannot minify '" << qPrintable(fileName) << '\'' << std::endl;
return EXIT_FAILURE;
}
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index 0238a4aaae..98c9b54bcd 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -32,6 +32,7 @@
****************************************************************************/
#include <QtQml/qqmlengine.h>
+#include <QtQml/private/qqmlengine_p.h>
#include <QtQml/private/qqmlmetatype_p.h>
#include <QtQml/private/qqmlopenmetaobject_p.h>
#include <QtQuick/private/qquickevents_p_p.h>
@@ -129,11 +130,11 @@ void collectReachableMetaObjects(QObject *object, QSet<const QMetaObject *> *met
}
}
-void collectReachableMetaObjects(const QQmlType *ty, QSet<const QMetaObject *> *metas)
+void collectReachableMetaObjects(QQmlEnginePrivate *engine, const QQmlType *ty, QSet<const QMetaObject *> *metas)
{
collectReachableMetaObjects(ty->metaObject(), metas, ty->isExtendedType());
- if (ty->attachedPropertiesType())
- collectReachableMetaObjects(ty->attachedPropertiesType(), metas);
+ if (ty->attachedPropertiesType(engine))
+ collectReachableMetaObjects(ty->attachedPropertiesType(engine), metas);
}
/* We want to add the MetaObject for 'Qt' to the list, this is a
@@ -195,11 +196,11 @@ QByteArray convertToId(const QMetaObject *mo)
// Collect all metaobjects for types registered with qmlRegisterType() without parameters
-void collectReachableMetaObjectsWithoutQmlName( QSet<const QMetaObject *>& metas ) {
+void collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate *engine, QSet<const QMetaObject *>& metas ) {
foreach (const QQmlType *ty, QQmlMetaType::qmlAllTypes()) {
if ( ! metas.contains(ty->metaObject()) ) {
if (!ty->isComposite()) {
- collectReachableMetaObjects(ty, &metas);
+ collectReachableMetaObjects(engine, ty, &metas);
} else {
qmlTypesByCompositeName[ty->elementName()] = ty;
}
@@ -225,7 +226,7 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
qmlTypesByCppName[ty->metaObject()->className()].insert(ty);
if (ty->isExtendedType())
extensions[ty->typeName()].insert(ty->metaObject()->className());
- collectReachableMetaObjects(ty, &metas);
+ collectReachableMetaObjects(QQmlEnginePrivate::get(engine), ty, &metas);
} else {
qmlTypesByCompositeName[ty->elementName()] = ty;
}
@@ -324,7 +325,7 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
}
}
- collectReachableMetaObjectsWithoutQmlName(metas);
+ collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate::get(engine), metas);
return metas;
}
@@ -374,7 +375,7 @@ public:
if (qmlTyName.startsWith("./")) {
qmlTyName.remove(0, 2);
}
- if (qmlTyName.startsWith("/")) {
+ if (qmlTyName.startsWith(QLatin1Char('/'))) {
qmlTyName.remove(0, 1);
}
const QString exportString = enquote(
@@ -510,7 +511,7 @@ public:
qml->writeEndObject();
}
- void dump(const QMetaObject *meta, bool isUncreatable, bool isSingleton)
+ void dump(QQmlEnginePrivate *engine, const QMetaObject *meta, bool isUncreatable, bool isSingleton)
{
qml->writeStartObject("Component");
@@ -556,7 +557,7 @@ public:
}
qml->writeArrayBinding(QLatin1String("exportMetaObjectRevisions"), metaObjectRevisions);
- if (const QMetaObject *attachedType = (*qmlTypes.begin())->attachedPropertiesType()) {
+ if (const QMetaObject *attachedType = (*qmlTypes.begin())->attachedPropertiesType(engine)) {
// Can happen when a type is registered that returns itself as attachedPropertiesType()
// because there is no creatable type to attach to.
if (attachedType != meta) {
@@ -735,7 +736,7 @@ static bool readDependenciesData(QString dependenciesFile, const QByteArray &fil
std::cerr << "parsing "
<< qPrintable( dependenciesFile ) << " skipping";
foreach (const QString &uriToSkip, urisToSkip)
- std::cerr << " " << qPrintable(uriToSkip);
+ std::cerr << ' ' << qPrintable(uriToSkip);
std::cerr << std::endl;
}
QJsonParseError parseError;
@@ -828,7 +829,7 @@ static bool getDependencies(const QQmlEngine &engine, const QString &pluginImpor
if (!importScanner.waitForFinished()) {
std::cerr << "failure to start " << qPrintable(command);
foreach (const QString &arg, commandArgs)
- std::cerr << " " << qPrintable(arg);
+ std::cerr << ' ' << qPrintable(arg);
std::cerr << std::endl;
return false;
}
@@ -1173,7 +1174,7 @@ int main(int argc, char *argv[])
if (relocatable)
dumper.setRelocatableModuleUri(pluginImportUri);
foreach (const QMetaObject *meta, nameToMeta) {
- dumper.dump(meta, uncreatableMetas.contains(meta), singletonMetas.contains(meta));
+ dumper.dump(QQmlEnginePrivate::get(&engine), meta, uncreatableMetas.contains(meta), singletonMetas.contains(meta));
}
foreach (const QQmlType *compositeType, qmlTypesByCompositeName)
dumper.dumpComposite(&engine, compositeType, defaultReachableNames);
diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp
index 93cc49659f..74356c21a3 100644
--- a/tools/qmlprofiler/qmlprofilerapplication.cpp
+++ b/tools/qmlprofiler/qmlprofilerapplication.cpp
@@ -475,7 +475,7 @@ void QmlProfilerApplication::run()
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), this,
SLOT(processFinished()));
logStatus(QString("Starting '%1 %2' ...").arg(m_programPath,
- arguments.join(" ")));
+ arguments.join(QLatin1Char(' '))));
m_process->start(m_programPath, arguments);
if (!m_process->waitForStarted()) {
logError(QString("Could not run '%1': %2").arg(m_programPath,
diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp
index a8a5b1f7b3..91ffbac4a9 100644
--- a/tools/qmlprofiler/qmlprofilerdata.cpp
+++ b/tools/qmlprofiler/qmlprofilerdata.cpp
@@ -233,8 +233,8 @@ void QmlProfilerData::addQmlEvent(QQmlProfilerDefinitions::RangeType type,
if (data.isEmpty())
details = tr("Source code not available");
else {
- details = data.join(QStringLiteral(" ")).replace(
- QLatin1Char('\n'),QStringLiteral(" ")).simplified();
+ details = data.join(QLatin1Char(' ')).replace(
+ QLatin1Char('\n'), QLatin1Char(' ')).simplified();
QRegExp rewrite(QStringLiteral("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)"));
bool match = rewrite.exactMatch(details);
if (match) {
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index 14845ed433..ab37b6457d 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -204,7 +204,7 @@ static int displayOptionsDialog(Options *options)
QFileInfoList fileInfos = findQmlFiles(":/bundle") + findQmlFiles("./qmlscene-resources");
foreach (QFileInfo fileInfo, fileInfos)
- qmlFileComboBox->addItem(fileInfo.dir().dirName() + "/" + fileInfo.fileName(), QVariant::fromValue(fileInfo));
+ qmlFileComboBox->addItem(fileInfo.dir().dirName() + QLatin1Char('/') + fileInfo.fileName(), QVariant::fromValue(fileInfo));
QCheckBox *originalCheckBox = new QCheckBox(&dialog);
originalCheckBox->setText("Use original QML viewer");
@@ -235,7 +235,7 @@ static int displayOptionsDialog(Options *options)
QVariant variant = qmlFileComboBox->itemData(qmlFileComboBox->currentIndex());
QFileInfo fileInfo = variant.value<QFileInfo>();
- if (fileInfo.canonicalFilePath().startsWith(":"))
+ if (fileInfo.canonicalFilePath().startsWith(QLatin1Char(':')))
options->file = QUrl("qrc" + fileInfo.canonicalFilePath());
else
options->file = QUrl::fromLocalFile(fileInfo.canonicalFilePath());
@@ -270,7 +270,7 @@ static bool checkVersion(const QUrl &url)
bool codeFound= false;
while (!codeFound) {
QString line = stream.readLine();
- if (line.contains("{")) {
+ if (line.contains(QLatin1Char('{'))) {
codeFound = true;
} else {
QString import;