summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/parser/javascriptlexer.cpp2
-rw-r--r--src/declarative/qml/qml.h4
-rw-r--r--src/declarative/qml/qmlbindablevalue.cpp30
-rw-r--r--src/declarative/qml/qmlboundsignal.cpp12
-rw-r--r--src/declarative/qml/qmlcompiledcomponent.cpp24
-rw-r--r--src/declarative/qml/qmlcompiler.cpp364
-rw-r--r--src/declarative/qml/qmlcomponent.cpp42
-rw-r--r--src/declarative/qml/qmlcompositetypemanager.cpp54
-rw-r--r--src/declarative/qml/qmlcontext.cpp32
-rw-r--r--src/declarative/qml/qmldom.cpp98
-rw-r--r--src/declarative/qml/qmlengine.cpp138
-rw-r--r--src/declarative/qml/qmlinfo.cpp2
-rw-r--r--src/declarative/qml/qmlinstruction.cpp2
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp220
-rw-r--r--src/declarative/qml/qmlmetatype.cpp108
-rw-r--r--src/declarative/qml/qmlmetatype.h4
-rw-r--r--src/declarative/qml/qmlparser.cpp20
-rw-r--r--src/declarative/qml/qmlparserstatus.cpp2
-rw-r--r--src/declarative/qml/qmlprivate.h6
-rw-r--r--src/declarative/qml/qmlproxymetaobject.cpp18
-rw-r--r--src/declarative/qml/qmlrefcount.cpp2
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp6
-rw-r--r--src/declarative/qml/qmlstringconverters.cpp34
-rw-r--r--src/declarative/qml/qmlvme.cpp128
-rw-r--r--src/declarative/qml/qmlvmemetaobject.cpp22
-rw-r--r--src/declarative/qml/qmlxmlparser.cpp34
-rw-r--r--src/declarative/qml/script/generator/main.cpp12
-rw-r--r--src/declarative/qml/script/qmlbasicscript.cpp108
28 files changed, 764 insertions, 764 deletions
diff --git a/src/declarative/qml/parser/javascriptlexer.cpp b/src/declarative/qml/parser/javascriptlexer.cpp
index 1cfb3b5..80a558d 100644
--- a/src/declarative/qml/parser/javascriptlexer.cpp
+++ b/src/declarative/qml/parser/javascriptlexer.cpp
@@ -789,7 +789,7 @@ int JavaScript::Lexer::lex()
case Eof:
return 0;
case Other:
- if(token == JavaScriptGrammar::T_RBRACE || token == JavaScriptGrammar::T_SEMICOLON)
+ if (token == JavaScriptGrammar::T_RBRACE || token == JavaScriptGrammar::T_SEMICOLON)
delimited = true;
return token;
case Identifier:
diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h
index 2d8d83e..1c662a7 100644
--- a/src/declarative/qml/qml.h
+++ b/src/declarative/qml/qml.h
@@ -100,10 +100,10 @@ QObject *qmlAttachedPropertiesObject(const QObject *obj)
// ### is this threadsafe?
static int idx = -1;
- if(idx == -1)
+ if (idx == -1)
idx = QmlMetaType::attachedPropertiesFuncId(&T::staticMetaObject);
- if(idx == -1 || !obj)
+ if (idx == -1 || !obj)
return 0;
return qmlAttachedPropertiesObjectById(obj, idx);
diff --git a/src/declarative/qml/qmlbindablevalue.cpp b/src/declarative/qml/qmlbindablevalue.cpp
index c2632da..b312b40 100644
--- a/src/declarative/qml/qmlbindablevalue.cpp
+++ b/src/declarative/qml/qmlbindablevalue.cpp
@@ -80,7 +80,7 @@ void QmlBindableValue::setTarget(const QmlMetaProperty &prop)
void QmlBindableValue::init()
{
- if(_inited)
+ if (_inited)
return;
_inited = true;
update();
@@ -98,30 +98,30 @@ void QmlBindableValue::update()
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindableValueUpdate> bu;
#endif
- if(!_inited)
+ if (!_inited)
return;
- if(_property.propertyCategory() == QmlMetaProperty::List) {
+ if (_property.propertyCategory() == QmlMetaProperty::List) {
QVariant value = this->value();
int listType = QmlMetaType::listType(_property.propertyType());
- if(value.userType() == qMetaTypeId<QList<QObject *> >()) {
+ if (value.userType() == qMetaTypeId<QList<QObject *> >()) {
const QList<QObject *> &list =
qvariant_cast<QList<QObject *> >(value);
QVariant listVar = _property.read();
QmlMetaType::clear(listVar);
- for(int ii = 0; ii < list.count(); ++ii) {
+ for (int ii = 0; ii < list.count(); ++ii) {
QVariant v = QmlMetaType::fromObject(list.at(ii), listType);
QmlMetaType::append(listVar, v);
}
- } else if(value.type() == uint(listType) ||
+ } else if (value.type() == uint(listType) ||
value.userType() == listType) {
QVariant listVar = _property.read();
QmlMetaType::clear(listVar);
QmlMetaType::append(listVar, value);
}
- } else if(_property.propertyCategory() == QmlMetaProperty::QmlList) {
+ } else if (_property.propertyCategory() == QmlMetaProperty::QmlList) {
// XXX - optimize!
QVariant value = this->value();
QVariant list = _property.read();
@@ -137,13 +137,13 @@ void QmlBindableValue::update()
const QMetaObject *objMo = obj->metaObject();
bool found = false;
while(!found && objMo) {
- if(objMo == mo)
+ if (objMo == mo)
found = true;
else
objMo = objMo->superClass();
}
- if(!found) {
+ if (!found) {
qWarning() << "Unable to assign object to list";
return;
}
@@ -153,7 +153,7 @@ void QmlBindableValue::update()
void *d = (void *)&obj;
li->append(d);
}
- } else if(_property.propertyCategory() == QmlMetaProperty::Bindable) {
+ } else if (_property.propertyCategory() == QmlMetaProperty::Bindable) {
// NOTE: We assume that only core properties can have
// propertyType == Bindable
@@ -166,12 +166,12 @@ void QmlBindableValue::update()
_property.object()->qt_metacall(QMetaObject::WriteProperty,
idx, a);
- } else if(_property.propertyCategory() == QmlMetaProperty::Object) {
+ } else if (_property.propertyCategory() == QmlMetaProperty::Object) {
QVariant value = this->value();
- if((int)value.type() != qMetaTypeId<QObject *>()) {
- if(scriptWarnings()) {
- if(!value.isValid()) {
+ if ((int)value.type() != qMetaTypeId<QObject *>()) {
+ if (scriptWarnings()) {
+ if (!value.isValid()) {
qWarning() << "QmlBindableValue: Unable to assign invalid value to object property";
} else {
qWarning() << "QmlBindableValue: Unable to assign non-object to object property";
@@ -194,7 +194,7 @@ void QmlBindableValue::update()
_property.object()->qt_metacall(QMetaObject::WriteProperty,
idx, a);
- } else if(_property.propertyCategory() == QmlMetaProperty::Normal) {
+ } else if (_property.propertyCategory() == QmlMetaProperty::Normal) {
QVariant value = this->value();
_property.write(value);
}
diff --git a/src/declarative/qml/qmlboundsignal.cpp b/src/declarative/qml/qmlboundsignal.cpp
index 5359753..67e3dcf 100644
--- a/src/declarative/qml/qmlboundsignal.cpp
+++ b/src/declarative/qml/qmlboundsignal.cpp
@@ -59,7 +59,7 @@ QmlBoundSignal::QmlBoundSignal(QmlContext *ctxt, const QString &val, QObject *me
// This is thread safe. Although it may be updated by two threads, they
// will both set it to the same value - so the worst thing that can happen
// is that they both do the work to figure it out. Boo hoo.
- if(evaluateIdx == -1) evaluateIdx = QmlExpressionObject::staticMetaObject.indexOfMethod("value()");
+ if (evaluateIdx == -1) evaluateIdx = QmlExpressionObject::staticMetaObject.indexOfMethod("value()");
setTrackChange(false);
QFx_setParent_noEvent(this, parent);
@@ -78,7 +78,7 @@ QmlBoundSignalProxy::QmlBoundSignalProxy(QmlContext *ctxt, const QString &val, Q
int QmlBoundSignalProxy::qt_metacall(QMetaObject::Call c, int id, void **a)
{
- if(c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) {
+ if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) {
params->setValues(a);
value();
params->clearValues();
@@ -103,17 +103,17 @@ QmlBoundSignalParameters::QmlBoundSignalParameters(const QMetaMethod &method,
QList<QByteArray> paramTypes = method.parameterTypes();
QList<QByteArray> paramNames = method.parameterNames();
types = new int[paramTypes.count()];
- for(int ii = 0; ii < paramTypes.count(); ++ii) {
+ for (int ii = 0; ii < paramTypes.count(); ++ii) {
const QByteArray &type = paramTypes.at(ii);
const QByteArray &name = paramNames.at(ii);
- if(name.isEmpty() || type.isEmpty()) {
+ if (name.isEmpty() || type.isEmpty()) {
types[ii] = 0;
continue;
}
QVariant::Type t = (QVariant::Type)QMetaType::type(type.constData());
- if(QmlMetaType::isObject(t)) {
+ if (QmlMetaType::isObject(t)) {
types[ii] = QMetaType::QObjectStar;
QMetaPropertyBuilder prop = mob.addProperty(name, "QObject*");
prop.setWritable(false);
@@ -147,7 +147,7 @@ void QmlBoundSignalParameters::clearValues()
int QmlBoundSignalParameters::metaCall(QMetaObject::Call c, int id, void **a)
{
- if(c == QMetaObject::ReadProperty && id >= 1) {
+ if (c == QMetaObject::ReadProperty && id >= 1) {
QmlMetaType::copy(types[id - 1], a[0], values[id]);
return -1;
} else {
diff --git a/src/declarative/qml/qmlcompiledcomponent.cpp b/src/declarative/qml/qmlcompiledcomponent.cpp
index a8b2be0..2c76f0c 100644
--- a/src/declarative/qml/qmlcompiledcomponent.cpp
+++ b/src/declarative/qml/qmlcompiledcomponent.cpp
@@ -56,21 +56,21 @@ QmlCompiledComponent::QmlCompiledComponent()
QmlCompiledComponent::~QmlCompiledComponent()
{
- for(int ii = 0; ii < mos.count(); ++ii)
+ for (int ii = 0; ii < mos.count(); ++ii)
qFree(mos.at(ii));
}
void QmlCompiledComponent::dumpInstructions()
{
- if(!compilerDump())
+ if (!compilerDump())
return;
- if(!name.isEmpty())
+ if (!name.isEmpty())
qWarning() << name;
qWarning() << "Index\tLine\tOperation\t\tData1\tData2\t\tComments";
qWarning() << "-------------------------------------------------------------------------------";
- for(int ii = 0; ii < bytecode.count(); ++ii) {
+ for (int ii = 0; ii < bytecode.count(); ++ii) {
dump(&bytecode[ii], ii);
}
qWarning() << "-------------------------------------------------------------------------------";
@@ -79,29 +79,29 @@ void QmlCompiledComponent::dumpInstructions()
void QmlCompiledComponent::dump(int indent, Property *p)
{
QByteArray ba(indent * 4, ' ');
- for(int ii = 0; ii < p->values.count(); ++ii)
+ for (int ii = 0; ii < p->values.count(); ++ii)
dump(indent, p->values.at(ii));
- if(p->value)
+ if (p->value)
dump(indent, p->value);
}
void QmlCompiledComponent::dump(int indent, Object *o)
{
QByteArray ba(indent * 4, ' ');
- if(o->type != -1) {
+ if (o->type != -1) {
qWarning() << ba.constData() << "Object:" << types.at(o->type).className;
} else {
qWarning() << ba.constData() << "Object: fetched";
}
- for(QHash<QByteArray, Property *>::ConstIterator iter = o->properties.begin();
+ for (QHash<QByteArray, Property *>::ConstIterator iter = o->properties.begin();
iter != o->properties.end();
++iter) {
qWarning() << ba.constData() << " Property" << iter.key();
dump(indent + 1, *iter);
}
- if(o->defaultProperty) {
+ if (o->defaultProperty) {
qWarning() << ba.constData() << " Default property";
dump(indent + 1, o->defaultProperty);
}
@@ -142,7 +142,7 @@ void QmlCompiledComponent::dump(int indent, Value *v)
};
QByteArray ba(indent * 4, ' ');
- if(v->object) {
+ if (v->object) {
qWarning() << ba.constData() << "Value (" << type << "):";
dump(indent + 1, v->object);
} else {
@@ -152,7 +152,7 @@ void QmlCompiledComponent::dump(int indent, Value *v)
void QmlCompiledComponent::dumpPre()
{
- if(!(dumpStatus & DumpPre)) {
+ if (!(dumpStatus & DumpPre)) {
dumpInstructions();
dumpStatus = (DumpStatus)(dumpStatus | DumpPre);
}
@@ -160,7 +160,7 @@ void QmlCompiledComponent::dumpPre()
void QmlCompiledComponent::dumpPost()
{
- if(!(dumpStatus & DumpPost)) {
+ if (!(dumpStatus & DumpPost)) {
dumpInstructions();
dumpStatus = (DumpStatus)(dumpStatus | DumpPost);
}
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index d55647c..fae0f43 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -80,7 +80,7 @@ using namespace QmlParser;
int QmlCompiledData::indexForString(const QString &data)
{
int idx = primitives.indexOf(data);
- if(idx == -1) {
+ if (idx == -1) {
idx = primitives.count();
primitives << data;
}
@@ -90,7 +90,7 @@ int QmlCompiledData::indexForString(const QString &data)
int QmlCompiledData::indexForByteArray(const QByteArray &data)
{
int idx = datas.indexOf(data);
- if(idx == -1) {
+ if (idx == -1) {
idx = datas.count();
datas << data;
}
@@ -101,21 +101,21 @@ int QmlCompiledData::indexForFloat(float *data, int count)
{
Q_ASSERT(count > 0);
- for(int ii = 0; ii < floatData.count() - count; ++ii) {
+ for (int ii = 0; ii < floatData.count() - count; ++ii) {
bool found = true;
- for(int jj = 0; jj < count; ++jj) {
- if(floatData.at(ii + jj) != data[jj]) {
+ for (int jj = 0; jj < count; ++jj) {
+ if (floatData.at(ii + jj) != data[jj]) {
found = false;
break;
}
}
- if(found)
+ if (found)
return ii;
}
int idx = floatData.count();
- for(int ii = 0; ii < count; ++ii)
+ for (int ii = 0; ii < count; ++ii)
floatData << data[ii];
return idx;
@@ -125,21 +125,21 @@ int QmlCompiledData::indexForInt(int *data, int count)
{
Q_ASSERT(count > 0);
- for(int ii = 0; ii < floatData.count() - count; ++ii) {
+ for (int ii = 0; ii < floatData.count() - count; ++ii) {
bool found = true;
- for(int jj = 0; jj < count; ++jj) {
- if(intData.at(ii + jj) != data[jj]) {
+ for (int jj = 0; jj < count; ++jj) {
+ if (intData.at(ii + jj) != data[jj]) {
found = false;
break;
}
}
- if(found)
+ if (found)
return ii;
}
int idx = intData.count();
- for(int ii = 0; ii < count; ++ii)
+ for (int ii = 0; ii < count; ++ii)
intData << data[ii];
return idx;
@@ -167,12 +167,12 @@ QString QmlCompiler::errorDescription() const
bool QmlCompiler::isValidId(const QString &val)
{
- if(val.isEmpty())
+ if (val.isEmpty())
return false;
QChar u(QLatin1Char('_'));
- for(int ii = 0; ii < val.count(); ++ii)
- if(val.at(ii) != u &&
+ for (int ii = 0; ii < val.count(); ++ii)
+ if (val.at(ii) != u &&
((ii == 0 && !val.at(ii).isLetter()) ||
(ii != 0 && !val.at(ii).isLetterOrNumber())) )
return false;
@@ -208,15 +208,15 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
int coreIdx, int primitive,
const QString *string)
{
- if(!prop.isWritable())
+ if (!prop.isWritable())
return ReadOnly;
- if(prop.isEnumType()) {
+ if (prop.isEnumType()) {
int value;
if (prop.isFlagType()) {
value = prop.enumerator().keysToValue(string->toLatin1().constData());
} else
value = prop.enumerator().keyToValue(string->toLatin1().constData());
- if(value == -1)
+ if (value == -1)
return InvalidData;
instr.type = QmlInstruction::StoreInteger;
instr.storeInteger.propertyIndex = coreIdx;
@@ -228,7 +228,7 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
case -1:
instr.type = QmlInstruction::StoreVariant;
instr.storeString.propertyIndex = coreIdx;
- if(primitive == -1)
+ if (primitive == -1)
primitive = cdata.indexForString(*string);
instr.storeString.value = primitive;
break;
@@ -237,11 +237,11 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
{
instr.type = QmlInstruction::StoreString;
instr.storeString.propertyIndex = coreIdx;
- if(string->startsWith(QLatin1Char('\'')) && string->endsWith(QLatin1Char('\''))) {
+ if (string->startsWith(QLatin1Char('\'')) && string->endsWith(QLatin1Char('\''))) {
QString unquotedString = string->mid(1, string->length() - 2);
primitive = cdata.indexForString(unquotedString);
} else {
- if(primitive == -1)
+ if (primitive == -1)
primitive = cdata.indexForString(*string);
}
instr.storeString.value = primitive;
@@ -395,7 +395,7 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
default:
{
int t = prop.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = prop.userType();
QmlMetaType::StringConverter converter =
QmlMetaType::customStringConverter(t);
@@ -406,7 +406,7 @@ QmlCompiler::generateStoreInstruction(QmlCompiledData &cdata,
instr.assignCustomType.valueIndex = index;
QmlCompiledData::CustomTypeData data;
- if(primitive == -1)
+ if (primitive == -1)
primitive = cdata.indexForString(*string);
data.index = primitive;
data.type = t;
@@ -428,8 +428,8 @@ void QmlCompiler::reset(QmlCompiledComponent *cc, bool deleteMemory)
cc->intData.clear();
cc->customTypeData.clear();
cc->datas.clear();
- if(deleteMemory) {
- for(int ii = 0; ii < cc->mos.count(); ++ii)
+ if (deleteMemory) {
+ for (int ii = 0; ii < cc->mos.count(); ++ii)
qFree(cc->mos.at(ii));
}
cc->mos.clear();
@@ -464,23 +464,23 @@ bool QmlCompiler::compile(QmlEngine *engine,
output = out;
// Compile types
- for(int ii = 0; ii < unit->types.count(); ++ii) {
+ for (int ii = 0; ii < unit->types.count(); ++ii) {
QmlCompositeTypeData::TypeReference &tref = unit->types[ii];
QmlCompiledComponent::TypeReference ref;
- if(tref.type)
+ if (tref.type)
ref.type = tref.type;
- else if(tref.unit) {
+ else if (tref.unit) {
ref.component = tref.unit->toComponent(engine);
ref.ref = tref.unit;
ref.ref->addref();
- } else if(tref.parser)
+ } else if (tref.parser)
ref.parser = tref.parser;
ref.className = unit->data.types().at(ii).toLatin1();
out->types << ref;
}
Object *root = unit->data.tree();
- if(!root) {
+ if (!root) {
exceptionDescription = QLatin1String("Can't compile because of earlier errors");
output = 0;
return false;
@@ -488,7 +488,7 @@ bool QmlCompiler::compile(QmlEngine *engine,
compileTree(root);
- if(!isError()) {
+ if (!isError()) {
out->dumpPre();
} else {
reset(out, true);
@@ -506,7 +506,7 @@ void QmlCompiler::compileTree(Object *tree)
init.init.dataSize = 0;
output->bytecode << init;
- if(!compileObject(tree, 0)) // Compile failed
+ if (!compileObject(tree, 0)) // Compile failed
return;
QmlInstruction def;
@@ -519,12 +519,12 @@ void QmlCompiler::compileTree(Object *tree)
bool QmlCompiler::compileObject(Object *obj, int ctxt)
{
- if(obj->type != -1) {
+ if (obj->type != -1) {
obj->metatype =
QmlMetaType::metaObjectForType(output->types.at(obj->type).className);
}
- if(output->types.at(obj->type).className == "Component") {
+ if (output->types.at(obj->type).className == "Component") {
COMPILE_CHECK(compileComponent(obj, ctxt));
return true;
}
@@ -535,24 +535,24 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
// doesn't have already have them
bool ignoreProperties = false;
bool ignoreSignals = false;
- if(obj->metatype && obj->metatype->indexOfProperty(PROPERTIES_NAME) != -1)
+ if (obj->metatype && obj->metatype->indexOfProperty(PROPERTIES_NAME) != -1)
ignoreProperties = true;
- if(obj->metatype && obj->metatype->indexOfProperty(SIGNALS_NAME) != -1)
+ if (obj->metatype && obj->metatype->indexOfProperty(SIGNALS_NAME) != -1)
ignoreSignals = true;
Property *propertiesProperty = ignoreProperties?0:obj->getProperty(PROPERTIES_NAME, false);
Property *signalsProperty = ignoreSignals?0:obj->getProperty(SIGNALS_NAME, false);
- if(propertiesProperty) {
+ if (propertiesProperty) {
obj->dynamicPropertiesProperty = propertiesProperty;
obj->properties.remove(PROPERTIES_NAME);
}
- if(signalsProperty) {
+ if (signalsProperty) {
obj->dynamicSignalsProperty = signalsProperty;
obj->properties.remove(SIGNALS_NAME);
}
- if(obj->type != -1 && output->types.at(obj->type).parser) {
+ if (obj->type != -1 && output->types.at(obj->type).parser) {
QByteArray data = obj->custom;
int ref = output->indexForByteArray(data);
@@ -573,15 +573,15 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
COMPILE_CHECK(compileDynamicPropertiesAndSignals(obj));
- if(obj->type != -1) {
- if(output->types.at(obj->type).component) {
+ if (obj->type != -1) {
+ if (output->types.at(obj->type).component) {
QmlInstruction begin;
begin.type = QmlInstruction::TryBeginObject;
begin.line = obj->line;
output->bytecode << begin;
} else {
int cast = QmlMetaType::qmlParserStatusCast(QmlMetaType::type(output->types.at(obj->type).className));
- if(cast != -1) {
+ if (cast != -1) {
QmlInstruction begin;
begin.type = QmlInstruction::BeginObject;
begin.begin.castValue = cast;
@@ -592,9 +592,9 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
}
foreach(Property *prop, obj->properties) {
- if(!ignoreProperties && prop->name == PROPERTIES_NAME) {
- } else if(!ignoreSignals && prop->name == SIGNALS_NAME) {
- } else if(prop->name.length() >= 3 && prop->name.startsWith("on") &&
+ if (!ignoreProperties && prop->name == PROPERTIES_NAME) {
+ } else if (!ignoreSignals && prop->name == SIGNALS_NAME) {
+ } else if (prop->name.length() >= 3 && prop->name.startsWith("on") &&
('A' <= prop->name.at(2) && 'Z' >= prop->name.at(2))) {
COMPILE_CHECK(compileSignal(prop, obj));
} else {
@@ -602,18 +602,18 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
}
}
- if(obj->defaultProperty)
+ if (obj->defaultProperty)
COMPILE_CHECK(compileProperty(obj->defaultProperty, obj, ctxt));
- if(obj->type != -1) {
- if(output->types.at(obj->type).component) {
+ if (obj->type != -1) {
+ if (output->types.at(obj->type).component) {
QmlInstruction complete;
complete.type = QmlInstruction::TryCompleteObject;
complete.line = obj->line;
output->bytecode << complete;
} else {
int cast = QmlMetaType::qmlParserStatusCast(QmlMetaType::type(output->types.at(obj->type).className));
- if(cast != -1) {
+ if (cast != -1) {
QmlInstruction complete;
complete.type = QmlInstruction::CompleteObject;
complete.complete.castValue = cast;
@@ -629,30 +629,30 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
bool QmlCompiler::compileComponent(Object *obj, int ctxt)
{
Property *idProp = 0;
- if(obj->properties.count() > 1 ||
+ if (obj->properties.count() > 1 ||
(obj->properties.count() == 1 && obj->properties.begin().key() != "id"))
COMPILE_EXCEPTION("Invalid component specification");
- if(obj->defaultProperty &&
+ if (obj->defaultProperty &&
(obj->defaultProperty->value || obj->defaultProperty->values.count() > 1 ||
(obj->defaultProperty->values.count() == 1 && !obj->defaultProperty->values.first()->object)))
COMPILE_EXCEPTION("Invalid component body specification");
- if(obj->properties.count())
+ if (obj->properties.count())
idProp = *obj->properties.begin();
- if(idProp && (idProp->value || idProp->values.count() > 1))
+ if (idProp && (idProp->value || idProp->values.count() > 1))
COMPILE_EXCEPTION("Invalid component id specification");
Object *root = 0;
- if(obj->defaultProperty && obj->defaultProperty->values.count())
+ if (obj->defaultProperty && obj->defaultProperty->values.count())
root = obj->defaultProperty->values.first()->object;
COMPILE_CHECK(compileComponentFromRoot(root, ctxt));
- if(idProp && idProp->values.count()) {
+ if (idProp && idProp->values.count()) {
QString val = idProp->values.at(0)->primitive;
- if(!isValidId(val))
+ if (!isValidId(val))
COMPILE_EXCEPTION("Invalid id property value");
- if(ids.contains(val))
+ if (ids.contains(val))
COMPILE_EXCEPTION("id is not unique");
ids.insert(val);
@@ -684,7 +684,7 @@ bool QmlCompiler::compileComponentFromRoot(Object *obj, int ctxt)
QSet<QString> oldIds = ids;
ids.clear();
- if(obj)
+ if (obj)
COMPILE_CHECK(compileObject(obj, ctxt));
ids = oldIds;
@@ -698,11 +698,11 @@ bool QmlCompiler::compileComponentFromRoot(Object *obj, int ctxt)
bool QmlCompiler::compileFetchedObject(Object *obj, int ctxt)
{
- if(obj->defaultProperty)
+ if (obj->defaultProperty)
COMPILE_CHECK(compileProperty(obj->defaultProperty, obj, ctxt));
foreach(Property *prop, obj->properties) {
- if(prop->name.length() >= 3 && prop->name.startsWith("on") &&
+ if (prop->name.length() >= 3 && prop->name.startsWith("on") &&
('A' <= prop->name.at(2) && 'Z' >= prop->name.at(2))) {
COMPILE_CHECK(compileSignal(prop, obj));
} else {
@@ -715,18 +715,18 @@ bool QmlCompiler::compileFetchedObject(Object *obj, int ctxt)
bool QmlCompiler::compileSignal(Property *prop, Object *obj)
{
- if(prop->values.isEmpty() && !prop->value)
+ if (prop->values.isEmpty() && !prop->value)
return true;
- if(prop->value || prop->values.count() > 1)
+ if (prop->value || prop->values.count() > 1)
COMPILE_EXCEPTION("Incorrectly specified signal");
- if(prop->values.at(0)->object) {
+ if (prop->values.at(0)->object) {
int pr = output->indexForByteArray(prop->name);
bool rv = compileObject(prop->values.at(0)->object, 0);
- if(rv) {
+ if (rv) {
QmlInstruction assign;
assign.type = QmlInstruction::AssignSignalObject;
assign.line = prop->values.at(0)->line;
@@ -741,10 +741,10 @@ bool QmlCompiler::compileSignal(Property *prop, Object *obj)
} else {
QString script = prop->values.at(0)->primitive.trimmed();
- if(script.isEmpty())
+ if (script.isEmpty())
return true;
- if(isBinding(script))
+ if (isBinding(script))
COMPILE_EXCEPTION("Cannot assign binding to signal property");
int idx = output->indexForString(script);
@@ -766,25 +766,25 @@ bool QmlCompiler::compileSignal(Property *prop, Object *obj)
bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
{
- if(prop->values.isEmpty() && !prop->value)
+ if (prop->values.isEmpty() && !prop->value)
return true;
// First we're going to need a reference to this property
- if(obj->type != -1) {
+ if (obj->type != -1) {
const QMetaObject *mo = obj->metaObject();
- if(mo) {
- if(prop->isDefault) {
+ if (mo) {
+ if (prop->isDefault) {
QMetaProperty p = QmlMetaType::defaultProperty(mo);
// XXX
// Currently we don't handle enums in the static analysis
// so we let them drop through to generateStoreInstruction()
- if(p.name() && !p.isEnumType()) {
+ if (p.name() && !p.isEnumType()) {
prop->index = mo->indexOfProperty(p.name());
prop->name = p.name();
int t = p.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = p.userType();
prop->type = t;
@@ -795,9 +795,9 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
// XXX
// Currently we don't handle enums in the static analysis
// so we let them drop through to generateStoreInstruction()
- if(p.name() && !p.isEnumType()) {
+ if (p.name() && !p.isEnumType()) {
int t = p.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = p.userType();
prop->type = t;
@@ -806,41 +806,41 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
}
} else {
const QMetaObject *mo = obj->metaObject();
- if(mo) {
- if(prop->isDefault) {
+ if (mo) {
+ if (prop->isDefault) {
QMetaProperty p = QmlMetaType::defaultProperty(mo);
- if(p.name()) {
+ if (p.name()) {
prop->index = mo->indexOfProperty(p.name());
prop->name = p.name();
}
int t = p.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = p.userType();
prop->type = t;
} else {
prop->index = mo->indexOfProperty(prop->name.constData());
QMetaProperty p = mo->property(prop->index);
int t = p.type();
- if(t == QVariant::UserType)
+ if (t == QVariant::UserType)
t = p.userType();
prop->type = t;
}
}
}
- if(prop->name == "id") {
+ if (prop->name == "id") {
COMPILE_CHECK(compileIdProperty(prop, obj));
- } else if(isAttachedProperty(prop->name)) {
+ } else if (isAttachedProperty(prop->name)) {
COMPILE_CHECK(compileAttachedProperty(prop, obj, ctxt));
- } else if(prop->value) {
+ } else if (prop->value) {
COMPILE_CHECK(compileNestedProperty(prop, ctxt));
- } else if(QmlMetaType::isQmlList(prop->type) ||
+ } else if (QmlMetaType::isQmlList(prop->type) ||
QmlMetaType::isList(prop->type)) {
COMPILE_CHECK(compileListProperty(prop, obj, ctxt));
@@ -857,24 +857,24 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
bool QmlCompiler::compileIdProperty(QmlParser::Property *prop,
QmlParser::Object *obj)
{
- if(prop->value)
+ if (prop->value)
COMPILE_EXCEPTION("The 'id' property cannot be fetched");
- if(prop->values.count() > 1)
+ if (prop->values.count() > 1)
COMPILE_EXCEPTION("The 'id' property cannot be multiset");
- if(prop->values.count() == 1) {
- if(prop->values.at(0)->object)
+ if (prop->values.count() == 1) {
+ if (prop->values.at(0)->object)
COMPILE_EXCEPTION("Cannot assign an object as an id");
QString val = prop->values.at(0)->primitive;
- if(!isValidId(val))
+ if (!isValidId(val))
COMPILE_EXCEPTION(val << "is not a valid id");
- if(ids.contains(val))
+ if (ids.contains(val))
COMPILE_EXCEPTION("id is not unique");
ids.insert(val);
int pref = output->indexForString(val);
- if(prop->type == QVariant::String) {
+ if (prop->type == QVariant::String) {
QmlInstruction assign;
assign.type = QmlInstruction::StoreString;
assign.storeString.propertyIndex = prop->index;
@@ -905,14 +905,14 @@ bool QmlCompiler::compileAttachedProperty(QmlParser::Property *prop,
QmlParser::Object *obj,
int ctxt)
{
- if(!prop->value)
+ if (!prop->value)
COMPILE_EXCEPTION("Incorrect usage of an attached property");
QmlInstruction fetch;
fetch.type = QmlInstruction::FetchAttached;
fetch.line = prop->line;
int id = QmlMetaType::attachedPropertiesFuncId(prop->name);
- if(id == -1)
+ if (id == -1)
COMPILE_EXCEPTION("Non-existant attached property object" << prop->name);
fetch.fetchAttached.id = id;
output->bytecode << fetch;
@@ -930,11 +930,11 @@ bool QmlCompiler::compileAttachedProperty(QmlParser::Property *prop,
bool QmlCompiler::compileNestedProperty(QmlParser::Property *prop,
int ctxt)
{
- if(prop->type != 0)
+ if (prop->type != 0)
prop->value->metatype = QmlMetaType::metaObjectForType(prop->type);
QmlInstruction fetch;
- if(prop->index != -1 &&
+ if (prop->index != -1 &&
QmlMetaType::isObject(prop->value->metatype)) {
fetch.type = QmlInstruction::FetchObject;
fetch.fetch.property = prop->index;
@@ -961,7 +961,7 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
int ctxt)
{
int t = prop->type;
- if(QmlMetaType::isQmlList(t)) {
+ if (QmlMetaType::isQmlList(t)) {
QmlInstruction fetch;
fetch.line = prop->line;
fetch.type = QmlInstruction::FetchQmlList;
@@ -969,9 +969,9 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
fetch.fetchQmlList.type = QmlMetaType::qmlListType(t);
output->bytecode << fetch;
- for(int ii = 0; ii < prop->values.count(); ++ii) {
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
Value *v = prop->values.at(ii);
- if(v->object) {
+ if (v->object) {
v->type = Value::CreatedObject;
COMPILE_CHECK(compileObject(v->object, ctxt));
QmlInstruction assign;
@@ -999,9 +999,9 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
output->bytecode << fetch;
bool assignedBinding = false;
- for(int ii = 0; ii < prop->values.count(); ++ii) {
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
Value *v = prop->values.at(ii);
- if(v->object) {
+ if (v->object) {
v->type = Value::CreatedObject;
COMPILE_CHECK(compileObject(v->object, ctxt));
QmlInstruction assign;
@@ -1010,8 +1010,8 @@ bool QmlCompiler::compileListProperty(QmlParser::Property *prop,
assign.assignObject.property = output->indexForByteArray(prop->name);
assign.assignObject.castValue = 0;
output->bytecode << assign;
- } else if(isBinding(v->primitive)) {
- if(assignedBinding)
+ } else if (isBinding(v->primitive)) {
+ if (assignedBinding)
COMPILE_EXCEPTION("Can only assign one binding to lists");
compileBinding(v->primitive, prop, ctxt, obj->metaObject(), v->line);
@@ -1033,9 +1033,9 @@ bool QmlCompiler::compilePropertyAssignment(QmlParser::Property *prop,
QmlParser::Object *obj,
int ctxt)
{
- for(int ii = 0; ii < prop->values.count(); ++ii) {
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
Value *v = prop->values.at(ii);
- if(v->object) {
+ if (v->object) {
COMPILE_CHECK(compilePropertyObjectAssignment(prop, obj, v, ctxt));
@@ -1054,10 +1054,10 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
QmlParser::Value *v,
int ctxt)
{
- if(v->object->type != -1)
+ if (v->object->type != -1)
v->object->metatype = QmlMetaType::metaObjectForType(output->types.at(v->object->type).className);
- if(v->object->metaObject()) {
+ if (v->object->metaObject()) {
const QMetaObject *propmo =
QmlMetaType::rawMetaObjectForType(prop->type);
@@ -1065,7 +1065,7 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
bool isPropertyValue = false;
bool isAssignable = false;
- if(propmo) {
+ if (propmo) {
// We want to raw metaObject here as the raw metaobject is the
// actual property type before we applied any extensions
const QMetaObject *c = v->object->metatype;
@@ -1082,14 +1082,14 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
}
}
- if(!propmo && !isPropertyValue) {
+ if (!propmo && !isPropertyValue) {
COMPILE_CHECK(compileObject(v->object, ctxt));
QmlInstruction assign;
assign.type = QmlInstruction::AssignObject;
assign.line = v->object->line;
assign.assignObject.castValue = 0;
- if(prop->isDefault)
+ if (prop->isDefault)
assign.assignObject.property = -1;
else
assign.assignObject.property =
@@ -1097,7 +1097,7 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
output->bytecode << assign;
v->type = Value::CreatedObject;
- } else if(isAssignable) {
+ } else if (isAssignable) {
COMPILE_CHECK(compileObject(v->object, ctxt));
QmlInstruction assign;
@@ -1109,7 +1109,7 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
output->bytecode << assign;
v->type = Value::CreatedObject;
- } else if(propmo == &QmlComponent::staticMetaObject) {
+ } else if (propmo == &QmlComponent::staticMetaObject) {
COMPILE_CHECK(compileComponentFromRoot(v->object, ctxt));
@@ -1122,7 +1122,7 @@ bool QmlCompiler::compilePropertyObjectAssignment(QmlParser::Property *prop,
output->bytecode << assign;
v->type = Value::Component;
- } else if(isPropertyValue) {
+ } else if (isPropertyValue) {
COMPILE_CHECK(compileObject(v->object, ctxt));
if (prop->index != -1) {
@@ -1165,7 +1165,7 @@ bool QmlCompiler::compilePropertyLiteralAssignment(QmlParser::Property *prop,
QmlParser::Value *v,
int ctxt)
{
- if(isBinding(v->primitive)) {
+ if (isBinding(v->primitive)) {
compileBinding(v->primitive, prop, ctxt, obj->metaObject(), v->line);
@@ -1177,28 +1177,28 @@ bool QmlCompiler::compilePropertyLiteralAssignment(QmlParser::Property *prop,
assign.line = v->line;
bool doassign = true;
- if(prop->index != -1) {
+ if (prop->index != -1) {
StoreInstructionResult r =
generateStoreInstruction(*output, assign, obj->metaObject()->property(prop->index), prop->index, -1, &v->primitive);
- if(r == Ok) {
+ if (r == Ok) {
doassign = false;
- } else if(r == InvalidData) {
+ } else if (r == InvalidData) {
//### we are restricted to a rather generic message here. If we can find a way to move
// the exception into generateStoreInstruction we could potentially have better messages.
// (the problem is that both compile and run exceptions can be generated, though)
COMPILE_EXCEPTION("Cannot assign value" << v->primitive << "to property" << obj->metaObject()->property(prop->index).name());
doassign = false;
- } else if(r == ReadOnly) {
+ } else if (r == ReadOnly) {
COMPILE_EXCEPTION("Cannot assign value" << v->primitive << "to the read-only property" << obj->metaObject()->property(prop->index).name());
} else {
doassign = true;
}
}
- if(doassign) {
+ if (doassign) {
assign.type = QmlInstruction::AssignConstant;
- if(prop->isDefault) {
+ if (prop->isDefault) {
assign.assignConstant.property = -1;
} else {
assign.assignConstant.property =
@@ -1238,17 +1238,17 @@ bool QmlCompiler::findDynamicProperties(QmlParser::Property *prop,
sizeof(propTypeNameToTypes[0]);
- if(prop->value)
+ if (prop->value)
COMPILE_EXCEPTION("Invalid property specification");
bool seenDefault = false;
- for(int ii = 0; ii < prop->values.count(); ++ii) {
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
QmlParser::Value *val = prop->values.at(ii);
- if(!val->object)
+ if (!val->object)
COMPILE_EXCEPTION("Invalid property specification");
QmlParser::Object *obj = val->object;
- if(obj->type == -1 || output->types.at(obj->type).className != "Property")
+ if (obj->type == -1 || output->types.at(obj->type).className != "Property")
COMPILE_EXCEPTION("Use Property tag to specify properties");
@@ -1259,75 +1259,75 @@ bool QmlCompiler::findDynamicProperties(QmlParser::Property *prop,
Object::DynamicProperty propDef;
- for(QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
obj->properties.begin();
iter != obj->properties.end();
++iter) {
QmlParser::Property *property = *iter;
- if(property->name == "name") {
+ if (property->name == "name") {
if (seen & Name)
COMPILE_EXCEPTION("May only specify Property name once");
seen = (Seen)(seen | Name);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Property name");
propDef.name = property->values.at(0)->primitive.toLatin1();
- } else if(property->name == "type") {
+ } else if (property->name == "type") {
if (seen & Type)
COMPILE_EXCEPTION("May only specify Property type once");
seen = (Seen)(seen | Type);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Property type");
QString type = property->values.at(0)->primitive.toLower();
bool found = false;
- for(int ii = 0; !found && ii < propTypeNameToTypesCount; ++ii) {
- if(type == QLatin1String(propTypeNameToTypes[ii].name)){
+ for (int ii = 0; !found && ii < propTypeNameToTypesCount; ++ii) {
+ if (type == QLatin1String(propTypeNameToTypes[ii].name)){
found = true;
propDef.type = propTypeNameToTypes[ii].type;
}
}
- if(!found)
+ if (!found)
COMPILE_EXCEPTION("Invalid Property type");
- } else if(property->name == "value") {
+ } else if (property->name == "value") {
if (seen & Value)
COMPILE_EXCEPTION("May only specify Property value once");
seen = (Seen)(seen | Value);
propDef.defaultValue = property;
- } else if(property->name == "onValueChanged") {
+ } else if (property->name == "onValueChanged") {
if (seen & ValueChanged)
COMPILE_EXCEPTION("May only specify Property onValueChanged once");
seen = (Seen)(seen | ValueChanged);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Property onValueChanged");
propDef.onValueChanged = property->values.at(0)->primitive;
- } else if(property->name == "default") {
- if(seen & Default)
+ } else if (property->name == "default") {
+ if (seen & Default)
COMPILE_EXCEPTION("May only specify Property default once");
seen = (Seen)(seen | Default);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Property default");
bool defaultValue =
QmlStringConverters::boolFromString(property->values.at(0)->primitive);
propDef.isDefaultProperty = defaultValue;
- if(defaultValue) {
- if(seenDefault)
+ if (defaultValue) {
+ if (seenDefault)
COMPILE_EXCEPTION("Only one property may be the default");
seenDefault = true;
}
@@ -1337,15 +1337,15 @@ bool QmlCompiler::findDynamicProperties(QmlParser::Property *prop,
}
}
- if(obj->defaultProperty) {
- if(seen & Value)
+ if (obj->defaultProperty) {
+ if (seen & Value)
COMPILE_EXCEPTION("May only specify Property value once");
seen = (Seen)(seen | Value);
propDef.defaultValue = obj->defaultProperty;
}
- if(!(seen & Name))
+ if (!(seen & Name))
COMPILE_EXCEPTION("Must specify Property name");
definedProperties << propDef;
@@ -1360,33 +1360,33 @@ bool QmlCompiler::findDynamicSignals(QmlParser::Property *sigs,
{
QList<Object::DynamicSignal> definedSignals;
- if(sigs->value)
+ if (sigs->value)
COMPILE_EXCEPTION("Invalid signal specification");
- for(int ii = 0; ii < sigs->values.count(); ++ii) {
+ for (int ii = 0; ii < sigs->values.count(); ++ii) {
QmlParser::Value *val = sigs->values.at(ii);
- if(!val->object)
+ if (!val->object)
COMPILE_EXCEPTION("Invalid signal specification");
QmlParser::Object *obj = val->object;
- if(obj->type == -1 || output->types.at(obj->type).className != "Signal")
+ if (obj->type == -1 || output->types.at(obj->type).className != "Signal")
COMPILE_EXCEPTION("Use Signal tag to specify signals");
enum Seen { None = 0, Name = 0x01 } seen = None;
Object::DynamicSignal sigDef;
- for(QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
obj->properties.begin();
iter != obj->properties.end();
++iter) {
QmlParser::Property *property = *iter;
- if(property->name == "name") {
+ if (property->name == "name") {
if (seen & Name)
COMPILE_EXCEPTION("May only specify Signal name once");
seen = (Seen)(seen | Name);
- if(property->value || property->values.count() != 1 ||
+ if (property->value || property->values.count() != 1 ||
property->values.at(0)->object)
COMPILE_EXCEPTION("Invalid Signal name");
@@ -1398,10 +1398,10 @@ bool QmlCompiler::findDynamicSignals(QmlParser::Property *sigs,
}
- if(obj->defaultProperty)
+ if (obj->defaultProperty)
COMPILE_EXCEPTION("Invalid Signal property");
- if(!(seen & Name))
+ if (!(seen & Name))
COMPILE_EXCEPTION("Must specify Signal name");
definedSignals << sigDef;
@@ -1413,23 +1413,23 @@ bool QmlCompiler::findDynamicSignals(QmlParser::Property *sigs,
bool QmlCompiler::compileDynamicPropertiesAndSignals(QmlParser::Object *obj)
{
- if(obj->dynamicPropertiesProperty)
+ if (obj->dynamicPropertiesProperty)
findDynamicProperties(obj->dynamicPropertiesProperty, obj);
- if(obj->dynamicSignalsProperty)
+ if (obj->dynamicSignalsProperty)
findDynamicSignals(obj->dynamicSignalsProperty, obj);
- if(obj->dynamicProperties.isEmpty() && obj->dynamicSignals.isEmpty())
+ if (obj->dynamicProperties.isEmpty() && obj->dynamicSignals.isEmpty())
return true;
QMetaObjectBuilder builder;
- if(obj->metatype)
+ if (obj->metatype)
builder.setClassName(QByteArray(obj->metatype->className()) + "QML");
builder.setFlags(QMetaObjectBuilder::DynamicMetaObject);
- for(int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
+ for (int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
const Object::DynamicProperty &p = obj->dynamicProperties.at(ii);
- if(p.isDefaultProperty)
+ if (p.isDefaultProperty)
builder.addClassInfo("DefaultProperty", p.name);
QByteArray type;
@@ -1461,12 +1461,12 @@ bool QmlCompiler::compileDynamicPropertiesAndSignals(QmlParser::Object *obj)
builder.addProperty(p.name, type, ii);
}
- for(int ii = 0; ii < obj->dynamicSignals.count(); ++ii) {
+ for (int ii = 0; ii < obj->dynamicSignals.count(); ++ii) {
const Object::DynamicSignal &s = obj->dynamicSignals.at(ii);
builder.addSignal(s.name + "()");
}
- if(obj->metatype)
+ if (obj->metatype)
builder.setSuperClass(obj->metatype);
obj->extObject = builder.toMetaObject();
@@ -1478,16 +1478,16 @@ bool QmlCompiler::compileDynamicPropertiesAndSignals(QmlParser::Object *obj)
store.line = obj->line;
output->bytecode << store;
- for(int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
+ for (int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
const Object::DynamicProperty &p = obj->dynamicProperties.at(ii);
- if(p.defaultValue) {
+ if (p.defaultValue) {
p.defaultValue->name = p.name;
p.defaultValue->isDefault = false;
COMPILE_CHECK(compileProperty(p.defaultValue, obj, 0));
}
- if(!p.onValueChanged.isEmpty()) {
+ if (!p.onValueChanged.isEmpty()) {
QmlInstruction assign;
assign.type = QmlInstruction::AssignSignal;
assign.line = obj->line;
@@ -1512,7 +1512,7 @@ void QmlCompiler::compileBinding(const QString &str, QmlParser::Property *prop,
bs.compile(bind.toLatin1());
int bref;
- if(bs.isValid()) {
+ if (bs.isValid()) {
bref = output->indexForByteArray(QByteArray(bs.compileData(), bs.compileDataSize()));
} else {
bref = output->indexForString(bind);
@@ -1521,8 +1521,8 @@ void QmlCompiler::compileBinding(const QString &str, QmlParser::Property *prop,
QmlInstruction assign;
assign.assignBinding.context = ctxt;
assign.line = line;
- if(prop->index != -1) {
- if(bs.isValid())
+ if (prop->index != -1) {
+ if (bs.isValid())
assign.type = QmlInstruction::StoreCompiledBinding;
else
assign.type = QmlInstruction::StoreBinding;
@@ -1530,13 +1530,13 @@ void QmlCompiler::compileBinding(const QString &str, QmlParser::Property *prop,
assign.assignBinding.property = prop->index;
assign.assignBinding.value = bref;
assign.assignBinding.category = QmlMetaProperty::Unknown;
- if(mo) {
+ if (mo) {
//XXX we should generate an exception if the property is read-only
QMetaProperty mp = mo->property(assign.assignBinding.property);
assign.assignBinding.category = QmlMetaProperty::propertyCategory(mp);
}
} else {
- if(bs.isValid())
+ if (bs.isValid())
assign.type = QmlInstruction::AssignCompiledBinding;
else
assign.type = QmlInstruction::AssignBinding;
@@ -1553,42 +1553,42 @@ int QmlCompiler::optimizeExpressions(int start, int end, int patch)
int saveCount = 0;
int newInstrs = 0;
- for(int ii = start; ii <= end; ++ii) {
+ for (int ii = start; ii <= end; ++ii) {
const QmlInstruction &instr = output->bytecode.at(ii);
- if(instr.type == QmlInstruction::CreateComponent) {
+ if (instr.type == QmlInstruction::CreateComponent) {
ii += instr.createComponent.count - 1;
continue;
}
- if(instr.type == QmlInstruction::SetId) {
+ if (instr.type == QmlInstruction::SetId) {
QString id = output->primitives.at(instr.setId.value);
ids.insert(id, ii);
}
}
- for(int ii = start; ii <= end; ++ii) {
+ for (int ii = start; ii <= end; ++ii) {
const QmlInstruction &instr = output->bytecode.at(ii);
- if(instr.type == QmlInstruction::CreateComponent) {
+ if (instr.type == QmlInstruction::CreateComponent) {
ii += instr.createComponent.count - 1;
continue;
}
- if(instr.type == QmlInstruction::StoreCompiledBinding) {
+ if (instr.type == QmlInstruction::StoreCompiledBinding) {
QmlBasicScript s(output->datas.at(instr.assignBinding.value).constData());
- if(s.isSingleLoad()) {
+ if (s.isSingleLoad()) {
QString slt = QLatin1String(s.singleLoadTarget());
- if(!slt.at(0).isUpper())
+ if (!slt.at(0).isUpper())
continue;
- if(ids.contains(slt) &&
+ if (ids.contains(slt) &&
instr.assignBinding.category == QmlMetaProperty::Object) {
int id = ids[slt];
int saveId = -1;
- if(output->bytecode.at(id).setId.save != -1) {
+ if (output->bytecode.at(id).setId.save != -1) {
saveId = output->bytecode.at(id).setId.save;
} else {
output->bytecode[id].setId.save = saveCount;
@@ -1615,7 +1615,7 @@ int QmlCompiler::optimizeExpressions(int start, int end, int patch)
}
- if(saveCount)
+ if (saveCount)
output->bytecode[patch].init.dataSize = saveCount;
return newInstrs;
@@ -1632,8 +1632,8 @@ QmlCompiledData::QmlCompiledData(const QmlCompiledData &other)
QmlCompiledData::~QmlCompiledData()
{
- for(int ii = 0; ii < types.count(); ++ii) {
- if(types.at(ii).ref)
+ for (int ii = 0; ii < types.count(); ++ii) {
+ if (types.at(ii).ref)
types.at(ii).ref->release();
}
}
@@ -1653,12 +1653,12 @@ QmlCompiledData &QmlCompiledData::operator=(const QmlCompiledData &other)
QObject *QmlCompiledData::TypeReference::createInstance(QmlContext *ctxt) const
{
- if(type) {
+ if (type) {
QObject *rv = type->create();
- if(rv)
+ if (rv)
QmlEngine::setContextForObject(rv, ctxt);
return rv;
- } else if(component) {
+ } else if (component) {
return component->create(ctxt);
} else {
return 0;
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index 92f6b28..2c3ebd6 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -130,7 +130,7 @@ void QmlComponentPrivate::fromTypeData(QmlCompositeTypeData *data)
url = QUrl(data->url);
QmlCompiledComponent *c = data->toCompiledComponent(engine);
- if(!c) {
+ if (!c) {
Q_ASSERT(data->status == QmlCompositeTypeData::Error);
errorDescription = data->errorDescription;
@@ -148,13 +148,13 @@ void QmlComponentPrivate::fromTypeData(QmlCompositeTypeData *data)
void QmlComponentPrivate::clear()
{
- if(typeData) {
+ if (typeData) {
typeData->remWaiter(this);
typeData->release();
typeData = 0;
}
- if(cc) {
+ if (cc) {
cc->release();
cc = 0;
}
@@ -186,11 +186,11 @@ QmlComponent::Status QmlComponent::status() const
{
Q_D(const QmlComponent);
- if(d->typeData)
+ if (d->typeData)
return Loading;
- else if(d->engine && d->cc)
+ else if (d->engine && d->cc)
return Ready;
- else if(!d->errorDescription.isEmpty())
+ else if (!d->errorDescription.isEmpty())
return Error;
else
return Null;
@@ -307,7 +307,7 @@ void QmlComponent::setData(const QByteArray &data, const QUrl &url)
QmlCompositeTypeData *typeData =
d->engine->d_func()->typeManager.getImmediate(data, url);
- if(typeData->status == QmlCompositeTypeData::Waiting) {
+ if (typeData->status == QmlCompositeTypeData::Waiting) {
d->typeData = typeData;
d->typeData->addWaiter(d);
@@ -335,7 +335,7 @@ void QmlComponent::loadUrl(const QUrl &url)
QmlCompositeTypeData *data =
d->engine->d_func()->typeManager.get(url);
- if(data->status == QmlCompositeTypeData::Waiting) {
+ if (data->status == QmlCompositeTypeData::Waiting) {
d->typeData = data;
d->typeData->addWaiter(d);
@@ -352,7 +352,7 @@ void QmlComponent::loadUrl(const QUrl &url)
QString QmlComponent::errorDescription() const
{
Q_D(const QmlComponent);
- if(isError())
+ if (isError())
return d->errorDescription;
else
return QString();
@@ -388,10 +388,10 @@ QObject *QmlComponent::create(QmlContext *context)
{
Q_D(QmlComponent);
- if(!context)
+ if (!context)
context = d->engine->rootContext();
- if(context->engine() != d->engine) {
+ if (context->engine() != d->engine) {
qWarning("QmlComponent::create(): Must create component in context from the same QmlEngine");
return 0;
}
@@ -428,12 +428,12 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
{
Q_D(QmlComponent);
- if(!context) {
+ if (!context) {
qWarning("QmlComponent::beginCreate(): Cannot create a component in a null context");
return 0;
}
- if(context->engine() != d->engine) {
+ if (context->engine() != d->engine) {
qWarning("QmlComponent::beginCreate(): Must create component in context from the same QmlEngine");
return 0;
}
@@ -443,7 +443,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
return 0;
}
- if(!isReady()) {
+ if (!isReady()) {
qWarning("QmlComponent: Cannot create un-ready component");
return 0;
}
@@ -451,7 +451,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::CreateComponent> perf;
#endif
- if(!d->engine->d_func()->rootComponent)
+ if (!d->engine->d_func()->rootComponent)
d->engine->d_func()->rootComponent = this;
QmlContext *ctxt =
@@ -462,7 +462,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
QmlVME vme;
QObject *rv = vme.run(ctxt, d->cc, d->start, d->count);
- if(vme.isError()) {
+ if (vme.isError()) {
qWarning().nospace()
#ifdef QML_VERBOSEERRORS_ENABLED
<< "QmlComponent: "
@@ -474,10 +474,10 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
ctxt->deactivate();
- if(rv) {
+ if (rv) {
QFx_setParent_noEvent(ctxt, rv);
QmlEnginePrivate *ep = d->engine->d_func();
- if(ep->rootComponent == this) {
+ if (ep->rootComponent == this) {
ep->rootComponent = 0;
d->bindValues = ep->currentBindValues;
@@ -508,13 +508,13 @@ void QmlComponent::completeCreate()
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindInit> bi;
#endif
- for(int ii = 0; ii < d->bindValues.count(); ++ii)
+ for (int ii = 0; ii < d->bindValues.count(); ++ii)
d->bindValues.at(ii)->init();
}
QSet<QmlParserStatus *> done;
- for(int ii = 0; ii < d->parserStatus.count(); ++ii) {
+ for (int ii = 0; ii < d->parserStatus.count(); ++ii) {
QmlParserStatus *ps = d->parserStatus.at(ii);
- if(!done.contains(ps)) {
+ if (!done.contains(ps)) {
done.insert(ps);
ps->componentComplete();
}
diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp
index b05a6fa..7f2cc58 100644
--- a/src/declarative/qml/qmlcompositetypemanager.cpp
+++ b/src/declarative/qml/qmlcompositetypemanager.cpp
@@ -57,13 +57,13 @@ QmlCompositeTypeData::QmlCompositeTypeData()
QmlCompositeTypeData::~QmlCompositeTypeData()
{
- for(int ii = 0; ii < dependants.count(); ++ii)
+ for (int ii = 0; ii < dependants.count(); ++ii)
dependants.at(ii)->release();
- if(compiledComponent)
+ if (compiledComponent)
compiledComponent->release();
- if(component)
+ if (component)
delete component;
}
@@ -79,10 +79,10 @@ void QmlCompositeTypeData::remWaiter(QmlComponentPrivate *p)
QmlComponent *QmlCompositeTypeData::toComponent(QmlEngine *engine)
{
- if(!component) {
+ if (!component) {
QmlCompiledComponent *cc = toCompiledComponent(engine);
- if(cc) {
+ if (cc) {
component = new QmlComponent(engine, cc, -1, -1, 0);
} else {
component = new QmlComponent(engine, 0);
@@ -96,14 +96,14 @@ QmlComponent *QmlCompositeTypeData::toComponent(QmlEngine *engine)
QmlCompiledComponent *
QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine)
{
- if(status == Complete && !compiledComponent) {
+ if (status == Complete && !compiledComponent) {
compiledComponent = new QmlCompiledComponent;
compiledComponent->url = QUrl(url);
compiledComponent->name = url.toLatin1(); // ###
QmlCompiler compiler;
- if(!compiler.compile(engine, this, compiledComponent)) {
+ if (!compiler.compile(engine, this, compiledComponent)) {
status = Error;
errorDescription = compiler.errorDescription() +
QLatin1String("@") +
@@ -117,7 +117,7 @@ QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine)
data.clear();
}
- if(compiledComponent)
+ if (compiledComponent)
compiledComponent->addref();
return compiledComponent;
@@ -137,7 +137,7 @@ QmlCompositeTypeData *QmlCompositeTypeManager::get(const QUrl &url)
{
QmlCompositeTypeData *unit = components.value(url.toString());
- if(!unit) {
+ if (!unit) {
unit = new QmlCompositeTypeData;
unit->status = QmlCompositeTypeData::Waiting;
unit->url = url.toString();
@@ -162,8 +162,8 @@ QmlCompositeTypeManager::getImmediate(const QByteArray &data, const QUrl &url)
void QmlCompositeTypeManager::clearCache()
{
- for(Components::Iterator iter = components.begin(); iter != components.end();) {
- if((*iter)->status != QmlCompositeTypeData::Waiting) {
+ for (Components::Iterator iter = components.begin(); iter != components.end();) {
+ if ((*iter)->status != QmlCompositeTypeData::Waiting) {
(*iter)->release();
iter = components.erase(iter);
} else {
@@ -180,7 +180,7 @@ void QmlCompositeTypeManager::replyFinished()
QmlCompositeTypeData *unit = components.value(reply->url().toString());
Q_ASSERT(unit);
- if(reply->error() != QNetworkReply::NoError) {
+ if (reply->error() != QNetworkReply::NoError) {
QString errorDescription;
// ### - Fill in error
@@ -204,10 +204,10 @@ void QmlCompositeTypeManager::loadSource(QmlCompositeTypeData *unit)
{
QUrl url(unit->url);
- if(url.scheme() == QLatin1String("file")) {
+ if (url.scheme() == QLatin1String("file")) {
QFile file(url.toLocalFile());
- if(file.open(QFile::ReadOnly)) {
+ if (file.open(QFile::ReadOnly)) {
QByteArray data = file.readAll();
setData(unit, data, url);
} else {
@@ -231,7 +231,7 @@ void QmlCompositeTypeManager::setData(QmlCompositeTypeData *unit,
const QByteArray &data,
const QUrl &url)
{
- if(!unit->data.parse(data, url)) {
+ if (!unit->data.parse(data, url)) {
unit->status = QmlCompositeTypeData::Error;
unit->errorDescription = unit->data.errorDescription();
@@ -247,7 +247,7 @@ void QmlCompositeTypeManager::setData(QmlCompositeTypeData *unit,
void QmlCompositeTypeManager::doComplete(QmlCompositeTypeData *unit)
{
- for(int ii = 0; ii < unit->dependants.count(); ++ii) {
+ for (int ii = 0; ii < unit->dependants.count(); ++ii) {
checkComplete(unit->dependants.at(ii));
unit->dependants.at(ii)->release();
}
@@ -261,26 +261,26 @@ void QmlCompositeTypeManager::doComplete(QmlCompositeTypeData *unit)
void QmlCompositeTypeManager::checkComplete(QmlCompositeTypeData *unit)
{
- if(unit->status != QmlCompositeTypeData::Waiting)
+ if (unit->status != QmlCompositeTypeData::Waiting)
return;
int waiting = 0;
- for(int ii = 0; ii < unit->types.count(); ++ii) {
+ for (int ii = 0; ii < unit->types.count(); ++ii) {
QmlCompositeTypeData *u = unit->types.at(ii).unit;
- if(!u)
+ if (!u)
continue;
- if(u->status == QmlCompositeTypeData::Error) {
+ if (u->status == QmlCompositeTypeData::Error) {
unit->status = QmlCompositeTypeData::Error;
unit->errorDescription = u->errorDescription;
doComplete(unit);
return;
- } else if(u->status == QmlCompositeTypeData::Waiting) {
+ } else if (u->status == QmlCompositeTypeData::Waiting) {
waiting++;
}
}
- if(!waiting) {
+ if (!waiting) {
unit->status = QmlCompositeTypeData::Complete;
doComplete(unit);
}
@@ -291,7 +291,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
QStringList typeNames = unit->data.types();
int waiting = 0;
- for(int ii = 0; ii < typeNames.count(); ++ii) {
+ for (int ii = 0; ii < typeNames.count(); ++ii) {
QByteArray type = typeNames.at(ii).toLatin1();
QmlCompositeTypeData::TypeReference ref;
@@ -304,14 +304,14 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
QmlCustomParser *parser =
QmlMetaType::customParser(type);
- if(parser) {
+ if (parser) {
ref.parser = parser;
unit->types << ref;
continue;
}
ref.type = QmlMetaType::qmlType(type);
- if(ref.type) {
+ if (ref.type) {
ref.parser = parser;
unit->types << ref;
continue;
@@ -320,7 +320,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
QUrl url = engine->componentUrl(QUrl(type + ".qml"), QUrl(unit->url));
QmlCompositeTypeData *urlUnit = components.value(url.toString());
- if(!urlUnit) {
+ if (!urlUnit) {
urlUnit = new QmlCompositeTypeData;
urlUnit->status = QmlCompositeTypeData::Waiting;
urlUnit->url = url.toString();
@@ -351,7 +351,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
unit->types << ref;
}
- if(waiting) {
+ if (waiting) {
unit->status = QmlCompositeTypeData::Waiting;
} else {
unit->status = QmlCompositeTypeData::Complete;
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp
index 40e33c2..c1acdc7 100644
--- a/src/declarative/qml/qmlcontext.cpp
+++ b/src/declarative/qml/qmlcontext.cpp
@@ -68,16 +68,16 @@ void QmlContextPrivate::dump(int depth)
QByteArray ba(depth * 4, ' ');
qWarning() << ba << properties.keys();
qWarning() << ba << variantProperties.keys();
- if(parent)
+ if (parent)
parent->d_func()->dump(depth + 1);
}
void QmlContextPrivate::destroyed(QObject *obj)
{
defaultObjects.removeAll(obj);
- for(QHash<QString, QObject *>::Iterator iter = properties.begin();
+ for (QHash<QString, QObject *>::Iterator iter = properties.begin();
iter != properties.end(); ) {
- if(*iter == obj)
+ if (*iter == obj)
iter = properties.erase(iter);
else
++iter;
@@ -102,13 +102,13 @@ void QmlContextPrivate::init()
void QmlContextPrivate::addDefaultObject(QObject *object, Priority priority)
{
- if(defaultObjects.count() >= (MAXIMUM_DEFAULT_OBJECTS - 1)) {
+ if (defaultObjects.count() >= (MAXIMUM_DEFAULT_OBJECTS - 1)) {
qWarning("QmlContext: Cannot have more than %d default objects on "
"one bind context.", MAXIMUM_DEFAULT_OBJECTS - 1);
return;
}
- if(priority == HighPriority) {
+ if (priority == HighPriority) {
defaultObjects.insert(highPriorityCount++, object);
} else {
defaultObjects.append(object);
@@ -233,7 +233,7 @@ QmlContext::QmlContext(QmlContext *parentContext, QObject *parent)
QmlContext::~QmlContext()
{
Q_D(QmlContext);
- if(d->component) d->component->release();
+ if (d->component) d->component->release();
}
@@ -313,7 +313,7 @@ void QmlContext::deactivate()
QmlEnginePrivate *ep = engine()->d_func();
Q_ASSERT(ep->activeContexts.top() == this);
ep->activeContexts.pop();
- if(ep->activeContexts.isEmpty())
+ if (ep->activeContexts.isEmpty())
ep->setCurrentBindContext(0);
else
ep->setCurrentBindContext(ep->activeContexts.top());
@@ -332,7 +332,7 @@ void QmlContext::deactivate()
QmlContext *QmlContext::activeContext()
{
QmlEngine *engine = QmlEngine::activeEngine();
- if(engine)
+ if (engine)
return engine->activeContext();
else
return 0;
@@ -351,16 +351,16 @@ QmlContext *QmlContext::activeContext()
QUrl QmlContext::resolvedUrl(const QUrl &src)
{
QmlContext *ctxt = this;
- if(src.isRelative()) {
- if(ctxt) {
+ if (src.isRelative()) {
+ if (ctxt) {
while(ctxt) {
- if(ctxt->d_func()->component)
+ if (ctxt->d_func()->component)
break;
else
ctxt = ctxt->parentContext();
}
- if(ctxt)
+ if (ctxt)
return ctxt->d_func()->component->url.resolved(src);
}
return QUrl();
@@ -380,16 +380,16 @@ QUrl QmlContext::resolvedUrl(const QUrl &src)
QUrl QmlContext::resolvedUri(const QUrl &src)
{
QmlContext *ctxt = this;
- if(src.isRelative()) {
- if(ctxt) {
+ if (src.isRelative()) {
+ if (ctxt) {
while(ctxt) {
- if(ctxt->d_func()->component)
+ if (ctxt->d_func()->component)
break;
else
ctxt = ctxt->parentContext();
}
- if(ctxt)
+ if (ctxt)
return ctxt->d_func()->engine->componentUrl(src, ctxt->d_func()->component->url);
}
return QUrl();
diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp
index cbe5d5d..72c1c76 100644
--- a/src/declarative/qml/qmldom.cpp
+++ b/src/declarative/qml/qmldom.cpp
@@ -59,12 +59,12 @@ QmlDomDocumentPrivate::QmlDomDocumentPrivate(const QmlDomDocumentPrivate &other)
: QSharedData(other), root(0)
{
root = other.root;
- if(root) root->addref();
+ if (root) root->addref();
}
QmlDomDocumentPrivate::~QmlDomDocumentPrivate()
{
- if(root) root->release();
+ if (root) root->release();
}
/*!
@@ -152,7 +152,7 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data)
d->error = QString();
QmlScriptParser parser;
- if(!parser.parse(data)) {
+ if (!parser.parse(data)) {
d->error = parser.errorDescription();
return false;
}
@@ -162,12 +162,12 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data)
// ###
// compiler.compile(engine, parser, &component);
- if(compiler.isError()) {
+ if (compiler.isError()) {
d->error = compiler.errorDescription();
return false;
}
- if(parser.tree()) {
+ if (parser.tree()) {
component.dump(0, parser.tree());
d->root = parser.tree();
d->root->addref();
@@ -214,7 +214,7 @@ QmlDomObject QmlDomDocument::rootObject() const
{
QmlDomObject rv;
rv.d->object = d->root;
- if(rv.d->object) rv.d->object->addref();
+ if (rv.d->object) rv.d->object->addref();
return rv;
}
@@ -227,12 +227,12 @@ QmlDomPropertyPrivate::QmlDomPropertyPrivate(const QmlDomPropertyPrivate &other)
: QSharedData(other), property(0)
{
property = other.property;
- if(property) property->addref();
+ if (property) property->addref();
}
QmlDomPropertyPrivate::~QmlDomPropertyPrivate()
{
- if(property) property->release();
+ if (property) property->release();
}
/*!
@@ -313,7 +313,7 @@ QByteArray QmlDomProperty::propertyName() const
*/
QList<QByteArray> QmlDomProperty::propertyNameParts() const
{
- if(d->propertyName.isEmpty()) return QList<QByteArray>();
+ if (d->propertyName.isEmpty()) return QList<QByteArray>();
else return d->propertyName.split('.');
}
@@ -344,7 +344,7 @@ bool QmlDomProperty::isDefaultProperty() const
QmlDomValue QmlDomProperty::value() const
{
QmlDomValue rv;
- if(d->property) {
+ if (d->property) {
rv.d->property = d->property;
rv.d->value = d->property->values.at(0);
rv.d->property->addref();
@@ -371,13 +371,13 @@ QmlDomObjectPrivate::QmlDomObjectPrivate(const QmlDomObjectPrivate &other)
: QSharedData(other), object(0), isVirtualComponent(false)
{
object = other.object;
- if(object) object->addref();
+ if (object) object->addref();
isVirtualComponent = other.isVirtualComponent;
}
QmlDomObjectPrivate::~QmlDomObjectPrivate()
{
- if(object) object->release();
+ if (object) object->release();
}
QmlDomObjectPrivate::Properties
@@ -385,7 +385,7 @@ QmlDomObjectPrivate::properties() const
{
Properties rv;
- for(QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
object->properties.begin();
iter != object->properties.end();
++iter) {
@@ -401,9 +401,9 @@ QmlDomObjectPrivate::properties(QmlParser::Property *property) const
{
Properties rv;
- if(property->value) {
+ if (property->value) {
- for(QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
property->value->properties.begin();
iter != property->value->properties.end();
++iter) {
@@ -413,13 +413,13 @@ QmlDomObjectPrivate::properties(QmlParser::Property *property) const
}
QByteArray name(property->name + ".");
- for(Properties::Iterator iter = rv.begin(); iter != rv.end(); ++iter)
+ for (Properties::Iterator iter = rv.begin(); iter != rv.end(); ++iter)
iter->second.prepend(name);
} else {
// We don't display "id" sets as a property in the dom
- if(property->values.count() != 1 ||
+ if (property->values.count() != 1 ||
property->values.at(0)->type != QmlParser::Value::Id)
rv << qMakePair(property, property->name);
@@ -515,7 +515,7 @@ bool QmlDomObject::isValid() const
*/
QByteArray QmlDomObject::objectType() const
{
- if(d->object) return d->object->typeName;
+ if (d->object) return d->object->typeName;
else return QByteArray();
}
@@ -530,7 +530,7 @@ QByteArray QmlDomObject::objectType() const
*/
QByteArray QmlDomObject::objectId() const
{
- if(d->object) return d->object->id;
+ if (d->object) return d->object->id;
else return QByteArray();
}
@@ -557,11 +557,11 @@ QList<QmlDomProperty> QmlDomObject::properties() const
{
QList<QmlDomProperty> rv;
- if(!d->object)
+ if (!d->object)
return rv;
QmlDomObjectPrivate::Properties properties = d->properties();
- for(int ii = 0; ii < properties.count(); ++ii) {
+ for (int ii = 0; ii < properties.count(); ++ii) {
QmlDomProperty domProperty;
domProperty.d->property = properties.at(ii).first;
@@ -571,7 +571,7 @@ QList<QmlDomProperty> QmlDomObject::properties() const
}
- if(d->object->defaultProperty) {
+ if (d->object->defaultProperty) {
QmlDomProperty domProperty;
domProperty.d->property = d->object->defaultProperty;
domProperty.d->property->addref();
@@ -596,8 +596,8 @@ QList<QmlDomProperty> QmlDomObject::properties() const
QmlDomProperty QmlDomObject::property(const QByteArray &name) const
{
QList<QmlDomProperty> props = properties();
- for(int ii = 0; ii < props.count(); ++ii)
- if(props.at(ii).propertyName() == name)
+ for (int ii = 0; ii < props.count(); ++ii)
+ if (props.at(ii).propertyName() == name)
return props.at(ii);
return QmlDomProperty();
}
@@ -684,7 +684,7 @@ bool QmlDomObject::isComponent() const
QmlDomComponent QmlDomObject::toComponent() const
{
QmlDomComponent rv;
- if(isComponent())
+ if (isComponent())
rv.d = d;
return rv;
}
@@ -698,12 +698,12 @@ QmlDomBasicValuePrivate::QmlDomBasicValuePrivate(const QmlDomBasicValuePrivate &
: QSharedData(other), value(0)
{
value = other.value;
- if(value) value->addref();
+ if (value) value->addref();
}
QmlDomBasicValuePrivate::~QmlDomBasicValuePrivate()
{
- if(value) value->release();
+ if (value) value->release();
}
/*!
@@ -761,7 +761,7 @@ QmlDomValueLiteral &QmlDomValueLiteral::operator=(const QmlDomValueLiteral &othe
*/
QString QmlDomValueLiteral::literal() const
{
- if(d->value) return d->value->primitive;
+ if (d->value) return d->value->primitive;
else return QString();
}
@@ -827,7 +827,7 @@ QmlDomValueBinding &QmlDomValueBinding::operator=(const QmlDomValueBinding &othe
*/
QString QmlDomValueBinding::binding() const
{
- if(d->value)
+ if (d->value)
return d->value->primitive.mid(1, d->value->primitive.length() - 2);
else
return QString();
@@ -907,7 +907,7 @@ QmlDomValueValueSource &QmlDomValueValueSource::operator=(const QmlDomValueValue
QmlDomObject QmlDomValueValueSource::object() const
{
QmlDomObject rv;
- if(d->value) {
+ if (d->value) {
rv.d->object = d->value->object;
rv.d->object->addref();
}
@@ -933,14 +933,14 @@ QmlDomValuePrivate::QmlDomValuePrivate(const QmlDomValuePrivate &other)
{
property = other.property;
value = other.value;
- if(property) property->addref();
- if(value) value->addref();
+ if (property) property->addref();
+ if (value) value->addref();
}
QmlDomValuePrivate::~QmlDomValuePrivate()
{
- if(property) property->release();
- if(value) value->release();
+ if (property) property->release();
+ if (value) value->release();
}
/*!
@@ -969,13 +969,13 @@ QmlDomValuePrivate::~QmlDomValuePrivate()
QmlDomObject root = document.rootObject();
QmlDomProperty text = root.property("text");
- if(text.value().isLiteral()) {
+ if (text.value().isLiteral()) {
QmlDomValueLiteral literal = text.value().toLiteral();
qDebug() << literal.literal();
}
QmlDomProperty y = root.property("y");
- if(y.value().isBinding()) {
+ if (y.value().isBinding()) {
QmlDomValueBinding binding = y.value().toBinding();
qDebug() << binding.binding();
}
@@ -1032,8 +1032,8 @@ QmlDomValue &QmlDomValue::operator=(const QmlDomValue &other)
*/
QmlDomValue::Type QmlDomValue::type() const
{
- if(d->property)
- if(QmlMetaType::isList(d->property->type) ||
+ if (d->property)
+ if (QmlMetaType::isList(d->property->type) ||
QmlMetaType::isQmlList(d->property->type) ||
(d->property && d->property->values.count() > 1))
return List;
@@ -1121,7 +1121,7 @@ bool QmlDomValue::isList() const
QmlDomValueLiteral QmlDomValue::toLiteral() const
{
QmlDomValueLiteral rv;
- if(type() == Literal) {
+ if (type() == Literal) {
rv.d->value = d->value;
rv.d->value->addref();
}
@@ -1137,7 +1137,7 @@ QmlDomValueLiteral QmlDomValue::toLiteral() const
QmlDomValueBinding QmlDomValue::toBinding() const
{
QmlDomValueBinding rv;
- if(type() == PropertyBinding) {
+ if (type() == PropertyBinding) {
rv.d->value = d->value;
rv.d->value->addref();
}
@@ -1153,7 +1153,7 @@ QmlDomValueBinding QmlDomValue::toBinding() const
QmlDomValueValueSource QmlDomValue::toValueSource() const
{
QmlDomValueValueSource rv;
- if(type() == ValueSource) {
+ if (type() == ValueSource) {
rv.d->value = d->value;
rv.d->value->addref();
}
@@ -1169,7 +1169,7 @@ QmlDomValueValueSource QmlDomValue::toValueSource() const
QmlDomObject QmlDomValue::toObject() const
{
QmlDomObject rv;
- if(type() == Object) {
+ if (type() == Object) {
rv.d->object = d->value->object;
rv.d->object->addref();
}
@@ -1185,7 +1185,7 @@ QmlDomObject QmlDomValue::toObject() const
QmlDomList QmlDomValue::toList() const
{
QmlDomList rv;
- if(type() == List) {
+ if (type() == List) {
rv.d = d;
}
return rv;
@@ -1254,10 +1254,10 @@ QmlDomList &QmlDomList::operator=(const QmlDomList &other)
QList<QmlDomValue> QmlDomList::values() const
{
QList<QmlDomValue> rv;
- if(!d->property)
+ if (!d->property)
return rv;
- for(int ii = 0; ii < d->property->values.count(); ++ii) {
+ for (int ii = 0; ii < d->property->values.count(); ++ii) {
QmlDomValue v;
v.d->value = d->property->values.at(ii);
v.d->value->addref();
@@ -1342,17 +1342,17 @@ QmlDomComponent &QmlDomComponent::operator=(const QmlDomComponent &other)
QmlDomObject QmlDomComponent::componentRoot() const
{
QmlDomObject rv;
- if(d->isVirtualComponent) {
+ if (d->isVirtualComponent) {
rv.d->object = d->object;
rv.d->object->addref();
- } else if(d->object) {
+ } else if (d->object) {
QmlParser::Object *obj = 0;
- if(d->object->defaultProperty &&
+ if (d->object->defaultProperty &&
d->object->defaultProperty->values.count() == 1 &&
d->object->defaultProperty->values.at(0)->object)
obj = d->object->defaultProperty->values.at(0)->object;
- if(obj) {
+ if (obj) {
rv.d->object = obj;
rv.d->object->addref();
}
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 5e698c2..30848c1 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -86,7 +86,7 @@ QML_DEFINE_TYPE(QObject,Object);
static QScriptValue qmlMetaProperty_emit(QScriptContext *ctx, QScriptEngine *engine)
{
QmlMetaProperty mp = qscriptvalue_cast<QmlMetaProperty>(ctx->thisObject());
- if(mp.type() & QmlMetaProperty::Signal)
+ if (mp.type() & QmlMetaProperty::Signal)
mp.emitSignal();
return engine->nullValue();
}
@@ -118,8 +118,8 @@ QmlEngineStack::QmlEngineStack()
QStack<QmlEngine *> *QmlEngineStack::engines()
{
- if(mainThread== 0) {
- if(!QCoreApplication::instance())
+ if (mainThread== 0) {
+ if (!QCoreApplication::instance())
return 0;
mainThread = QCoreApplication::instance()->thread();
}
@@ -127,11 +127,11 @@ QStack<QmlEngine *> *QmlEngineStack::engines()
// Note: This is very slightly faster than just using the thread storage
// for everything.
QStack<QmlEngine *> *engines = 0;
- if(QThread::currentThread() == mainThread) {
+ if (QThread::currentThread() == mainThread) {
engines = &mainThreadEngines;
} else {
engines = storage.localData();
- if(!engines) {
+ if (!engines) {
engines = new QStack<QmlEngine *>;
storage.setLocalData(engines);
}
@@ -171,7 +171,7 @@ void QmlEnginePrivate::init()
objectClass = new QmlObjectScriptClass(q);
rootContext = new QmlContext(q);
#ifdef QT_SCRIPTTOOLS_LIB
- if(debuggerEnabled()){
+ if (debuggerEnabled()){
debugger = new QScriptEngineDebugger(q);
debugger->attachTo(&scriptEngine);
}
@@ -196,7 +196,7 @@ QmlEnginePrivate::queryObject(const QString &propName,
QScriptClass::QueryFlags rv = 0;
QmlMetaProperty prop(obj, propName);
- if(prop.type() == QmlMetaProperty::Invalid) {
+ if (prop.type() == QmlMetaProperty::Invalid) {
QPair<const QMetaObject *, QString> key =
qMakePair(obj->metaObject(), propName);
bool isFunction = false;
@@ -209,7 +209,7 @@ QmlEnginePrivate::queryObject(const QString &propName,
functionCache()->insert(key, isFunction);
}
- if(isFunction) {
+ if (isFunction) {
*id = QmlScriptClass::FunctionId;
rv |= QScriptClass::HandlesReadAccess;
}
@@ -218,7 +218,7 @@ QmlEnginePrivate::queryObject(const QString &propName,
*id |= prop.save();
rv |= QScriptClass::HandlesReadAccess;
- if(prop.isWritable())
+ if (prop.isWritable())
rv |= QScriptClass::HandlesWriteAccess;
}
@@ -228,25 +228,25 @@ QmlEnginePrivate::queryObject(const QString &propName,
QScriptValue QmlEnginePrivate::propertyObject(const QScriptString &propName,
QObject *obj, uint id)
{
- if(id == QmlScriptClass::FunctionId) {
+ if (id == QmlScriptClass::FunctionId) {
QScriptValue sobj = scriptEngine.newQObject(obj);
QScriptValue func = sobj.property(propName);
return func;
} else {
QmlMetaProperty prop;
prop.restore(id, obj);
- if(!prop.isValid())
+ if (!prop.isValid())
return QScriptValue();
- if(prop.type() & QmlMetaProperty::Signal) {
+ if (prop.type() & QmlMetaProperty::Signal) {
return scriptEngine.newVariant(qVariantFromValue(prop));
} else {
QVariant var = prop.read();
capturedProperties << prop;
QObject *varobj = QmlMetaType::toQObject(var);
- if(!varobj)
+ if (!varobj)
varobj = qvariant_cast<QObject *>(var);
- if(varobj) {
+ if (varobj) {
return scriptEngine.newObject(objectClass, scriptEngine.newVariant(QVariant::fromValue(varobj)));
} else {
if (var.type() == QVariant::Bool)
@@ -263,20 +263,20 @@ void QmlEnginePrivate::contextActivated(QmlContext *)
{
Q_Q(QmlEngine);
QmlEngineStack *stack = engineStack();
- if(!stack)
+ if (!stack)
return;
QStack<QmlEngine *> *engines = stack->engines();
- if(engines)
+ if (engines)
engines->push(q);
}
void QmlEnginePrivate::contextDeactivated(QmlContext *)
{
QmlEngineStack *stack = engineStack();
- if(!stack)
+ if (!stack)
return;
QStack<QmlEngine *> *engines = stack->engines();
- if(engines) {
+ if (engines) {
Q_ASSERT(engines->top() == q_func());
engines->pop();
}
@@ -289,19 +289,19 @@ bool QmlEnginePrivate::fetchCache(QmlBasicScriptNodeCache &cache, const QString
{
QmlMetaProperty prop(obj, propName);
- if(!prop.isValid())
+ if (!prop.isValid())
return false;
capturedProperties << prop;
- if(prop.type() & QmlMetaProperty::Attached) {
+ if (prop.type() & QmlMetaProperty::Attached) {
cache.object = obj;
cache.type = QmlBasicScriptNodeCache::Attached;
cache.attached = prop.d->attachedObject();
return true;
- } else if(prop.type() & QmlMetaProperty::Property) {
+ } else if (prop.type() & QmlMetaProperty::Property) {
cache.object = obj;
cache.type = QmlBasicScriptNodeCache::Core;
@@ -309,14 +309,14 @@ bool QmlEnginePrivate::fetchCache(QmlBasicScriptNodeCache &cache, const QString
cache.coreType = prop.propertyType();
return true;
- } else if(prop.type() & QmlMetaProperty::SignalProperty) {
+ } else if (prop.type() & QmlMetaProperty::SignalProperty) {
cache.object = obj;
cache.type = QmlBasicScriptNodeCache::SignalProperty;
cache.core = prop.coreIndex();
return true;
- } else if(prop.type() & QmlMetaProperty::Signal) {
+ } else if (prop.type() & QmlMetaProperty::Signal) {
cache.object = obj;
cache.type = QmlBasicScriptNodeCache::Signal;
@@ -331,25 +331,25 @@ bool QmlEnginePrivate::fetchCache(QmlBasicScriptNodeCache &cache, const QString
bool QmlEnginePrivate::loadCache(QmlBasicScriptNodeCache &cache, const QString &propName, QmlContextPrivate *context)
{
while(context) {
- if(context->variantProperties.contains(propName)) {
+ if (context->variantProperties.contains(propName)) {
cache.object = 0;
cache.type = QmlBasicScriptNodeCache::Variant;
cache.context = context;
return true;
}
- if(context->properties.contains(propName)) {
+ if (context->properties.contains(propName)) {
cache.object = context->properties[propName];
cache.type = QmlBasicScriptNodeCache::Explicit;
return true;
}
foreach(QObject *obj, context->defaultObjects) {
- if(fetchCache(cache, propName, obj))
+ if (fetchCache(cache, propName, obj))
return true;
}
- if(context->parent)
+ if (context->parent)
context = context->parent->d_func();
else
context = 0;
@@ -453,7 +453,7 @@ QmlContext *QmlEngine::rootContext()
QmlContext *QmlEngine::activeContext()
{
Q_D(QmlEngine);
- if(d->currentBindContext)
+ if (d->currentBindContext)
return d->currentBindContext;
else
return 0;
@@ -591,7 +591,7 @@ void QmlEngine::setNetworkAccessManager(QNetworkAccessManager *network)
QNetworkAccessManager *QmlEngine::networkAccessManager() const
{
Q_D(const QmlEngine);
- if(!d->networkAccessManager)
+ if (!d->networkAccessManager)
d->networkAccessManager = new QNetworkAccessManager;
return d->networkAccessManager;
}
@@ -613,12 +613,12 @@ void QmlEngine::setContextForObject(QObject *object, QmlContext *context)
QmlSimpleDeclarativeData *data =
static_cast<QmlSimpleDeclarativeData *>(priv->declarativeData);
- if(data && data->context) {
+ if (data && data->context) {
qWarning("QmlEngine::setContextForObject(): Object already has a QmlContext");
return;
}
- if(!data) {
+ if (!data) {
priv->declarativeData = &context->d_func()->contextData;
} else {
// ### - Don't have to use extended data here
@@ -648,23 +648,23 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object)
QmlExtendedDeclarativeData *edata = (data && data->flags & QmlSimpleDeclarativeData::Extended)?static_cast<QmlExtendedDeclarativeData *>(data):0;
- if(edata) {
+ if (edata) {
QObject *rv = edata->attachedProperties.value(id);
- if(rv)
+ if (rv)
return rv;
}
QmlAttachedPropertiesFunc pf = QmlMetaType::attachedPropertiesFuncById(id);
- if(!pf)
+ if (!pf)
return 0;
QObject *rv = pf(const_cast<QObject *>(object));
- if(rv) {
- if(!edata) {
+ if (rv) {
+ if (!edata) {
edata = new QmlExtendedDeclarativeData;
- if(data) edata->context = data->context;
+ if (data) edata->context = data->context;
priv->declarativeData = edata;
}
@@ -697,15 +697,15 @@ QScriptEngine *QmlEngine::scriptEngine()
QmlEngine *QmlEngine::activeEngine()
{
QmlEngineStack *stack = engineStack();
- if(!stack) return 0;
+ if (!stack) return 0;
QStack<QmlEngine *> *engines = stack->engines();
- if(!engines) {
+ if (!engines) {
qWarning("QmlEngine::activeEngine() cannot be called before the construction of QCoreApplication");
return 0;
}
- if(engines->isEmpty())
+ if (engines->isEmpty())
return 0;
else
return engines->top();
@@ -726,7 +726,7 @@ QmlExpressionPrivate::QmlExpressionPrivate(QmlExpression *b, void *expr, QmlRefC
QmlExpressionPrivate::QmlExpressionPrivate(QmlExpression *b, const QString &expr, bool ssecompile)
: q(b), ctxt(0), expression(expr), sseData(0), proxy(0), me(0), trackChange(true)
{
- if(ssecompile) {
+ if (ssecompile) {
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindCompile> pt;
#endif
@@ -816,7 +816,7 @@ QmlContext *QmlExpression::context() const
*/
QString QmlExpression::expression() const
{
- if(d->sse.isValid())
+ if (d->sse.isValid())
return QLatin1String(d->sse.expression());
else
return d->expression;
@@ -835,7 +835,7 @@ void QmlExpression::clearExpression()
*/
void QmlExpression::setExpression(const QString &expression)
{
- if(d->sseData) {
+ if (d->sseData) {
d->sse.deleteScriptState(d->sseData);
d->sseData = 0;
}
@@ -844,7 +844,7 @@ void QmlExpression::setExpression(const QString &expression)
d->expression = expression;
- if(d->expression.isEmpty())
+ if (d->expression.isEmpty())
d->sse.clear();
else
d->sse.compile(expression.toLatin1());
@@ -875,10 +875,10 @@ void BindExpressionProxy::changed()
*/
QVariant QmlExpression::value()
{
- if(bindValueDebug())
+ if (bindValueDebug())
qWarning() << "QmlEngine: Evaluating:" << expression();
QVariant rv;
- if(!d->ctxt || (!d->sse.isValid() && d->expression.isEmpty()))
+ if (!d->ctxt || (!d->sse.isValid() && d->expression.isEmpty()))
return rv;
#ifdef Q_ENABLE_PERFORMANCE_LOG
@@ -890,14 +890,14 @@ QVariant QmlExpression::value()
QmlEnginePrivate *ep = engine()->d_func();
QmlExpression *lastCurrentExpression = ep->currentExpression;
ep->currentExpression = this;
- if(d->sse.isValid()) {
+ if (d->sse.isValid()) {
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindValueSSE> perfsse;
#endif
context()->d_func()->defaultObjects.insert(context()->d_func()->highPriorityCount, d->me);
- if(!d->sseData)
+ if (!d->sseData)
d->sseData = d->sse.newScriptState();
rv = d->sse.run(context(), d->sseData, &cacheState);
@@ -920,7 +920,7 @@ QVariant QmlExpression::value()
if (scriptEngine->hasUncaughtException()) {
if (scriptEngine->uncaughtException().isError()){
QScriptValue exception = scriptEngine->uncaughtException();
- if(!exception.property(QLatin1String("fileName")).toString().isEmpty()){
+ if (!exception.property(QLatin1String("fileName")).toString().isEmpty()){
qWarning() << exception.property(QLatin1String("fileName")).toString()
<< scriptEngine->uncaughtExceptionLineNumber()
<< exception.toString();
@@ -932,14 +932,14 @@ QVariant QmlExpression::value()
}
context()->d_func()->defaultObjects.removeAt(context()->d_func()->highPriorityCount);
- if(svalue.isArray()) {
+ if (svalue.isArray()) {
int length = svalue.property(QLatin1String("length")).toInt32();
- if(length && svalue.property(0).isObject()) {
+ if (length && svalue.property(0).isObject()) {
QList<QObject *> list;
- for(int ii = 0; ii < length; ++ii) {
+ for (int ii = 0; ii < length; ++ii) {
QScriptValue arrayItem = svalue.property(ii);
QObject *d = qvariant_cast<QObject *>(arrayItem.data().toVariant());
- if(d) {
+ if (d) {
list << d;
} else {
list << 0;
@@ -954,7 +954,7 @@ QVariant QmlExpression::value()
if (objValue.isValid())
rv = objValue.toVariant();
}
- if(rv.isNull()) {
+ if (rv.isNull()) {
rv = svalue.toVariant();
}
@@ -967,35 +967,35 @@ QVariant QmlExpression::value()
}
ep->currentExpression = lastCurrentExpression;
- if(cacheState != QmlBasicScript::NoChange) {
- if(cacheState != QmlBasicScript::Incremental && d->proxy) {
+ if (cacheState != QmlBasicScript::NoChange) {
+ if (cacheState != QmlBasicScript::Incremental && d->proxy) {
delete d->proxy;
d->proxy = 0;
}
- if(trackChange() && ep->capturedProperties.count()) {
- if(!d->proxy)
+ if (trackChange() && ep->capturedProperties.count()) {
+ if (!d->proxy)
d->proxy = new BindExpressionProxy(this);
static int changedIndex = -1;
- if(changedIndex == -1)
+ if (changedIndex == -1)
changedIndex = BindExpressionProxy::staticMetaObject.indexOfSlot("changed()");
- if(bindValueDebug())
+ if (bindValueDebug())
qWarning() << " Depends on:";
- for(int ii = 0; ii < ep->capturedProperties.count(); ++ii) {
+ for (int ii = 0; ii < ep->capturedProperties.count(); ++ii) {
const QmlMetaProperty &prop =
ep->capturedProperties.at(ii);
- if(prop.hasChangedNotifier()) {
+ if (prop.hasChangedNotifier()) {
prop.connectNotifier(d->proxy, changedIndex);
- if(bindValueDebug())
+ if (bindValueDebug())
qWarning() << " property"
<< prop.name()
<< prop.object()
<< prop.object()->metaObject()->superClass()->className();
- } else if(bindValueDebug()) {
+ } else if (bindValueDebug()) {
qWarning() << " non-subscribable property"
<< prop.name()
<< prop.object()
@@ -1006,7 +1006,7 @@ QVariant QmlExpression::value()
}
ep->capturedProperties.clear();
- if(bindValueDebug())
+ if (bindValueDebug())
qWarning() << " Result:" << rv
<< "(SSE: " << d->sse.isValid() << ")";
return rv;
@@ -1177,10 +1177,10 @@ QmlContextScriptClass::queryProperty(const QScriptValue &object,
*id = ObjectListPropertyId;
}
- for(int ii = 0; !rv && ii < bindContext->d_func()->defaultObjects.count(); ++ii) {
+ for (int ii = 0; !rv && ii < bindContext->d_func()->defaultObjects.count(); ++ii) {
rv = engine->d_func()->queryObject(propName, id,
bindContext->d_func()->defaultObjects.at(ii));
- if(rv)
+ if (rv)
*id |= (ii << 24);
}
@@ -1234,7 +1234,7 @@ QScriptValue QmlContextScriptClass::property(const QScriptValue &object,
QObject *obj = bindContext->d_func()->defaultObjects.at(objId);
QScriptValue rv = engine->d_func()->propertyObject(name, obj,
id & ~QmlScriptClass::ClassIdSelectorMask);
- if(rv.isValid()) {
+ if (rv.isValid()) {
#ifdef PROPERTY_DEBUG
qWarning() << "~Property: Resolved property" << propName
<< "to context default object" << bindContext << obj <<". Value:" << rv.toVariant();
@@ -1340,7 +1340,7 @@ QScriptValue QmlObjectScriptClass::property(const QScriptValue &object,
#endif
QScriptValue rv = engine->d_func()->propertyObject(name, obj, id);
- if(rv.isValid()) {
+ if (rv.isValid()) {
#ifdef PROPERTY_DEBUG
qWarning() << "~Property: Resolved property" << propName
<< "to object" << obj <<". Value:" << rv.toVariant();
diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp
index dc7f44c..a2b304f 100644
--- a/src/declarative/qml/qmlinfo.cpp
+++ b/src/declarative/qml/qmlinfo.cpp
@@ -75,7 +75,7 @@ QmlInfo::QmlInfo(QObject *object)
: QDebug(QtWarningMsg)
{
*this << "QML";
- if(object)
+ if (object)
*this << object->metaObject()->className();
*this << "(unknown location):";
}
diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp
index 848c8db..82924c8 100644
--- a/src/declarative/qml/qmlinstruction.cpp
+++ b/src/declarative/qml/qmlinstruction.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
void QmlCompiledComponent::dump(QmlInstruction *instr, int idx)
{
QByteArray lineNumber = QByteArray::number(instr->line);
- if(instr->line == (unsigned short)-1)
+ if (instr->line == (unsigned short)-1)
lineNumber = "NA";
const char *line = lineNumber.constData();
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index 780f8a8..1a511eb 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -127,13 +127,13 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, QmlContext *ctxt)
void QmlMetaProperty::initDefault(QObject *obj)
{
- if(!obj)
+ if (!obj)
return;
d->object = obj;
QHash<const QMetaObject *, QMetaPropertyEx>::ConstIterator iter =
qmlCacheDefProp.find(obj->metaObject());
- if(iter != qmlCacheDefProp.end()) {
+ if (iter != qmlCacheDefProp.end()) {
d->prop = *iter;
d->propType = iter->propertyType;
d->coreIdx = iter->propertyType;
@@ -142,10 +142,10 @@ void QmlMetaProperty::initDefault(QObject *obj)
d->prop = p;
d->propType = p.propertyType;
d->coreIdx = d->prop.propertyIndex();
- if(!QObjectPrivate::get(obj)->metaObject)
+ if (!QObjectPrivate::get(obj)->metaObject)
qmlCacheDefProp.insert(obj->metaObject(), d->prop);
}
- if(d->prop.name() != 0) {
+ if (d->prop.name() != 0) {
d->type = Property | Default;
d->name = QLatin1String(d->prop.name());
}
@@ -169,7 +169,7 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, int idx, PropertyCategory cat, Qm
d->prop = p;
d->propType = p.propertyType;
d->coreIdx = idx;
- if(d->prop.name() != 0)
+ if (d->prop.name() != 0)
d->name = QLatin1String(d->prop.name());
}
@@ -203,22 +203,22 @@ void QmlMetaProperty::initProperty(QObject *obj, const QString &name)
{
d->name = name;
d->object = obj;
- if(name.isEmpty() || !obj)
+ if (name.isEmpty() || !obj)
return;
- if(name.at(0).isUpper()) {
+ if (name.at(0).isUpper()) {
// Attached property
d->attachedFunc = QmlMetaType::attachedPropertiesFuncId(name.toLatin1());
- if(d->attachedFunc != -1)
+ if (d->attachedFunc != -1)
d->type = Property | Attached;
return;
- } else if(name.count() >= 3 && name.startsWith(QLatin1String("on")) && name.at(2).isUpper()) {
+ } else if (name.count() >= 3 && name.startsWith(QLatin1String("on")) && name.at(2).isUpper()) {
// Signal
QString signalName = name.mid(2);
signalName[0] = signalName.at(0).toLower();
d->findSignalInt(obj, signalName);
- if(d->signal.signature() != 0) {
+ if (d->signal.signature() != 0) {
d->type = SignalProperty;
return;
}
@@ -227,7 +227,7 @@ void QmlMetaProperty::initProperty(QObject *obj, const QString &name)
// Property
QHash<QString, QMetaPropertyEx> &props = qmlCacheProps[obj->metaObject()];
QHash<QString, QMetaPropertyEx>::ConstIterator iter = props.find(name);
- if(iter != props.end()) {
+ if (iter != props.end()) {
d->prop = *iter;
d->propType = iter->propertyType;
d->coreIdx = iter->propertyIndex();
@@ -239,12 +239,12 @@ void QmlMetaProperty::initProperty(QObject *obj, const QString &name)
if (!QObjectPrivate::get(obj)->metaObject)
props.insert(name, p);
}
- if(d->prop.name() != 0)
+ if (d->prop.name() != 0)
d->type = Property;
- if(d->type == Invalid) {
+ if (d->type == Invalid) {
int sig = findSignal(obj, name.toLatin1());
- if(sig != -1) {
+ if (sig != -1) {
d->signal = obj->metaObject()->method(sig);
d->type = Signal;
d->coreIdx = sig;
@@ -271,17 +271,17 @@ QmlMetaProperty::PropertyCategory QmlMetaProperty::propertyCategory() const
QmlMetaProperty::PropertyCategory
QmlMetaPropertyPrivate::propertyCategory() const
{
- if(category == QmlMetaProperty::Unknown) {
+ if (category == QmlMetaProperty::Unknown) {
int type = propertyType();
- if(type == QmlMetaProperty::Invalid)
+ if (type == QmlMetaProperty::Invalid)
category = QmlMetaProperty::InvalidProperty;
- else if(type == qMetaTypeId<QmlBindableValue *>())
+ else if (type == qMetaTypeId<QmlBindableValue *>())
category = QmlMetaProperty::Bindable;
- else if(QmlMetaType::isList(type))
+ else if (QmlMetaType::isList(type))
category = QmlMetaProperty::List;
- else if(QmlMetaType::isQmlList(type))
+ else if (QmlMetaType::isQmlList(type))
category = QmlMetaProperty::QmlList;
- else if(QmlMetaType::isObject(type))
+ else if (QmlMetaType::isObject(type))
category = QmlMetaProperty::Object;
else
category = QmlMetaProperty::Normal;
@@ -295,22 +295,22 @@ QmlMetaPropertyPrivate::propertyCategory() const
QmlMetaProperty::PropertyCategory
QmlMetaProperty::propertyCategory(const QMetaProperty &prop)
{
- if(prop.name()) {
+ if (prop.name()) {
int type = 0;
- if(prop.type() == QVariant::LastType)
+ if (prop.type() == QVariant::LastType)
type = qMetaTypeId<QVariant>();
- else if(prop.type() == QVariant::UserType)
+ else if (prop.type() == QVariant::UserType)
type = prop.userType();
else
type = prop.type();
- if(type == qMetaTypeId<QmlBindableValue *>())
+ if (type == qMetaTypeId<QmlBindableValue *>())
return Bindable;
- else if(QmlMetaType::isList(type))
+ else if (QmlMetaType::isList(type))
return List;
- else if(QmlMetaType::isQmlList(type))
+ else if (QmlMetaType::isQmlList(type))
return QmlList;
- else if(QmlMetaType::isObject(type))
+ else if (QmlMetaType::isObject(type))
return Object;
else
return Normal;
@@ -325,7 +325,7 @@ QmlMetaProperty::propertyCategory(const QMetaProperty &prop)
*/
const char *QmlMetaProperty::propertyTypeName() const
{
- if(d->prop.name()) {
+ if (d->prop.name()) {
return d->prop.typeName();
} else {
return 0;
@@ -357,12 +357,12 @@ int QmlMetaPropertyPrivate::propertyType() const
{
int rv = QVariant::Invalid;
- if(prop.name()) {
- if(propType == (int)QVariant::LastType)
+ if (prop.name()) {
+ if (propType == (int)QVariant::LastType)
rv = qMetaTypeId<QVariant>();
else
rv = propType;
- } else if(attachedFunc) {
+ } else if (attachedFunc) {
rv = qMetaTypeId<QObject *>();
}
@@ -423,11 +423,11 @@ QmlMetaProperty &QmlMetaProperty::operator=(const QmlMetaProperty &other)
*/
bool QmlMetaProperty::isWritable() const
{
- if(propertyCategory() == List || propertyCategory() == QmlList)
+ if (propertyCategory() == List || propertyCategory() == QmlList)
return true;
- else if(d->prop.name() != 0)
+ else if (d->prop.name() != 0)
return d->prop.isWritable();
- else if(type() & SignalProperty)
+ else if (type() & SignalProperty)
return true;
else
return false;
@@ -438,7 +438,7 @@ bool QmlMetaProperty::isWritable() const
*/
bool QmlMetaProperty::isDesignable() const
{
- if(d->prop.name() != 0)
+ if (d->prop.name() != 0)
return d->prop.isDesignable();
else
return false;
@@ -458,12 +458,12 @@ bool QmlMetaProperty::isValid() const
*/
QStringList QmlMetaProperty::properties(QObject *obj)
{
- if(!obj)
+ if (!obj)
return QStringList();
QStringList rv;
const QMetaObject *mo = obj->metaObject();
- for(int ii = 0; ii < mo->propertyCount(); ++ii) {
+ for (int ii = 0; ii < mo->propertyCount(); ++ii) {
QMetaProperty prop = mo->property(ii);
rv << QLatin1String(prop.name());
}
@@ -490,16 +490,16 @@ const QMetaProperty &QmlMetaProperty::property() const
*/
QmlBindableValue *QmlMetaProperty::binding()
{
- if(!isProperty() || type() & Attached)
+ if (!isProperty() || type() & Attached)
return 0;
const QObjectList &children = object()->children();
- for(QObjectList::ConstIterator iter = children.begin();
+ for (QObjectList::ConstIterator iter = children.begin();
iter != children.end(); ++iter) {
QObject *child = *iter;
- if(child->metaObject() == &QmlBindableValue::staticMetaObject) {
+ if (child->metaObject() == &QmlBindableValue::staticMetaObject) {
QmlBindableValue *v = static_cast<QmlBindableValue *>(child);
- if(v->property() == *this)
+ if (v->property() == *this)
return v;
}
}
@@ -511,16 +511,16 @@ int QmlMetaProperty::findSignal(const QObject *obj, const char *name)
{
const QMetaObject *mo = obj->metaObject();
int methods = mo->methodCount();
- for(int ii = 0; ii < methods; ++ii) {
+ for (int ii = 0; ii < methods; ++ii) {
QMetaMethod method = mo->method(ii);
- if(method.methodType() != QMetaMethod::Signal)
+ if (method.methodType() != QMetaMethod::Signal)
continue;
QByteArray methodName = method.signature();
int idx = methodName.indexOf('(');
methodName = methodName.left(idx);
- if(methodName == name)
+ if (methodName == name)
return ii;
}
return -1;
@@ -531,13 +531,13 @@ void QmlMetaPropertyPrivate::findSignalInt(QObject *obj, const QString &name)
const QMetaObject *mo = obj->metaObject();
int methods = mo->methodCount();
- for(int ii = 0; ii < methods; ++ii) {
+ for (int ii = 0; ii < methods; ++ii) {
QMetaMethod method = mo->method(ii);
QString methodName = QLatin1String(method.signature());
int idx = methodName.indexOf(QLatin1Char('('));
methodName = methodName.left(idx);
- if(methodName == name) {
+ if (methodName == name) {
signal = method;
coreIdx = ii;
return;
@@ -547,7 +547,7 @@ void QmlMetaPropertyPrivate::findSignalInt(QObject *obj, const QString &name)
QObject *QmlMetaPropertyPrivate::attachedObject() const
{
- if(attachedFunc == -1)
+ if (attachedFunc == -1)
return 0;
else
return qmlAttachedPropertiesObjectById(attachedFunc, object);
@@ -558,17 +558,17 @@ QObject *QmlMetaPropertyPrivate::attachedObject() const
*/
QVariant QmlMetaProperty::read() const
{
- if(type() & SignalProperty) {
+ if (type() & SignalProperty) {
const QObjectList &children = object()->children();
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
QmlBoundSignal *sig = qobject_cast<QmlBoundSignal *>(children.at(ii));
- if(sig && sig->index() == d->coreIdx)
+ if (sig && sig->index() == d->coreIdx)
return sig->expression();
}
- } else if(type() & Property) {
- if(type() & Attached)
+ } else if (type() & Property) {
+ if (type() & Attached)
return QVariant::fromValue(d->attachedObject());
else
return d->prop.read(object());
@@ -583,10 +583,10 @@ void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value)
QString expr = value.toString();
const QObjectList &children = object->children();
- for(int ii = 0; ii < children.count(); ++ii) {
+ for (int ii = 0; ii < children.count(); ++ii) {
QmlBoundSignal *sig = qobject_cast<QmlBoundSignal *>(children.at(ii));
- if(sig && sig->index() == coreIdx) {
- if(expr.isEmpty()) {
+ if (sig && sig->index() == coreIdx) {
+ if (expr.isEmpty()) {
sig->disconnect();
sig->deleteLater();
} else {
@@ -596,7 +596,7 @@ void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value)
}
}
- if(!expr.isEmpty()) {
+ if (!expr.isEmpty()) {
// XXX scope
(void *)new QmlBoundSignal(QmlContext::activeContext(), expr, object,
coreIdx, object);
@@ -605,7 +605,7 @@ void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value)
void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
{
- if(prop.isEnumType()) {
+ if (prop.isEnumType()) {
QVariant v = value;
if (value.type() == QVariant::Double) { //enum values come through the script engine as doubles
double integral;
@@ -615,43 +615,43 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
}
prop.write(object, v);
} else {
- if(!value.isValid())
+ if (!value.isValid())
return;
int t = propertyType();
int vt = value.type();
- if(vt == t ||
+ if (vt == t ||
value.userType() == t) {
void *a[1];
a[0] = (void *)value.constData();
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
- } else if(qMetaTypeId<QVariant>() == t) {
+ } else if (qMetaTypeId<QVariant>() == t) {
prop.write(object, value);
- } else if(propertyCategory() == QmlMetaProperty::Object) {
+ } else if (propertyCategory() == QmlMetaProperty::Object) {
QObject *o = QmlMetaType::toQObject(value);
- if(o)
+ if (o)
prop.write(object, QmlMetaType::fromObject(o, propertyType()));
} else if (propertyCategory() == QmlMetaProperty::List) {
int listType = QmlMetaType::listType(t);
- if(value.userType() == qMetaTypeId<QList<QObject *> >()) {
+ if (value.userType() == qMetaTypeId<QList<QObject *> >()) {
const QList<QObject *> &list =
qvariant_cast<QList<QObject *> >(value);
QVariant listVar = prop.read(object);
QmlMetaType::clear(listVar);
- for(int ii = 0; ii < list.count(); ++ii) {
+ for (int ii = 0; ii < list.count(); ++ii) {
QVariant v = QmlMetaType::fromObject(list.at(ii), listType);
QmlMetaType::append(listVar, v);
}
- } else if(vt == listType ||
+ } else if (vt == listType ||
value.userType() == listType) {
QVariant listVar = prop.read(object);
if (!QmlMetaType::append(listVar, value)) {
@@ -673,13 +673,13 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
const QMetaObject *objMo = obj->metaObject();
bool found = false;
while(!found && objMo) {
- if(objMo == mo)
+ if (objMo == mo)
found = true;
else
objMo = objMo->superClass();
}
- if(!found) {
+ if (!found) {
qWarning() << "Unable to assign object to list";
return;
}
@@ -689,22 +689,22 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
void *d = (void *)&obj;
li->append(d);
}
- } else if(propertyCategory() == QmlMetaProperty::Normal) {
+ } else if (propertyCategory() == QmlMetaProperty::Normal) {
switch(t) {
case QVariant::Double:
{
qreal r;
bool found = true;
- if(vt == QVariant::Int) {
+ if (vt == QVariant::Int) {
r = value.toInt();
- } else if(vt == QVariant::UInt) {
+ } else if (vt == QVariant::UInt) {
r = value.toUInt();
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &r;
QMetaObject::metacall(object,
@@ -719,15 +719,15 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
{
int i;
bool found = true;
- if(vt == QVariant::Double) {
+ if (vt == QVariant::Double) {
i = (int)value.toDouble();
- } else if(vt == QVariant::UInt) {
+ } else if (vt == QVariant::UInt) {
i = (int)value.toUInt();
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &i;
QMetaObject::metacall(object,
@@ -742,13 +742,13 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
{
QString s;
bool found = true;
- if(vt == QVariant::ByteArray) {
+ if (vt == QVariant::ByteArray) {
s = QLatin1String(value.toByteArray());
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &s;
QMetaObject::metacall(object,
@@ -774,13 +774,13 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
*/
void QmlMetaProperty::write(const QVariant &value) const
{
- if(type() & SignalProperty) {
+ if (type() & SignalProperty) {
d->writeSignalProperty(value);
- } else if(d->prop.name()) {
+ } else if (d->prop.name()) {
- if(d->prop.isEnumType()) {
+ if (d->prop.isEnumType()) {
QVariant v = value;
if (value.type() == QVariant::Double) { //enum values come through the script engine as doubles
double integral;
@@ -790,43 +790,43 @@ void QmlMetaProperty::write(const QVariant &value) const
}
d->prop.write(object(), v);
} else {
- if(!value.isValid())
+ if (!value.isValid())
return;
int t = propertyType();
int vt = value.type();
- if(vt == t ||
+ if (vt == t ||
value.userType() == t) {
void *a[1];
a[0] = (void *)value.constData();
QMetaObject::metacall(object(), QMetaObject::WriteProperty, d->coreIdx, a);
- } else if(qMetaTypeId<QVariant>() == t) {
+ } else if (qMetaTypeId<QVariant>() == t) {
d->prop.write(object(), value);
- } else if(propertyCategory() == Object) {
+ } else if (propertyCategory() == Object) {
QObject *o = QmlMetaType::toQObject(value);
- if(o)
+ if (o)
d->prop.write(object(), QmlMetaType::fromObject(o, propertyType()));
} else if (propertyCategory() == List) {
int listType = QmlMetaType::listType(t);
- if(value.userType() == qMetaTypeId<QList<QObject *> >()) {
+ if (value.userType() == qMetaTypeId<QList<QObject *> >()) {
const QList<QObject *> &list =
qvariant_cast<QList<QObject *> >(value);
QVariant listVar = d->prop.read(object());
QmlMetaType::clear(listVar);
- for(int ii = 0; ii < list.count(); ++ii) {
+ for (int ii = 0; ii < list.count(); ++ii) {
QVariant v = QmlMetaType::fromObject(list.at(ii), listType);
QmlMetaType::append(listVar, v);
}
- } else if(vt == listType ||
+ } else if (vt == listType ||
value.userType() == listType) {
QVariant listVar = d->prop.read(object());
if (!QmlMetaType::append(listVar, value)) {
@@ -848,13 +848,13 @@ void QmlMetaProperty::write(const QVariant &value) const
const QMetaObject *objMo = obj->metaObject();
bool found = false;
while(!found && objMo) {
- if(objMo == mo)
+ if (objMo == mo)
found = true;
else
objMo = objMo->superClass();
}
- if(!found) {
+ if (!found) {
qWarning() << "Unable to assign object to list";
return;
}
@@ -864,22 +864,22 @@ void QmlMetaProperty::write(const QVariant &value) const
void *d = (void *)&obj;
li->append(d);
}
- } else if(propertyCategory() == Normal) {
+ } else if (propertyCategory() == Normal) {
switch(t) {
case QVariant::Double:
{
qreal r;
bool found = true;
- if(vt == QVariant::Int) {
+ if (vt == QVariant::Int) {
r = value.toInt();
- } else if(vt == QVariant::UInt) {
+ } else if (vt == QVariant::UInt) {
r = value.toUInt();
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &r;
QMetaObject::metacall(object(),
@@ -894,15 +894,15 @@ void QmlMetaProperty::write(const QVariant &value) const
{
int i;
bool found = true;
- if(vt == QVariant::Double) {
+ if (vt == QVariant::Double) {
i = (int)value.toDouble();
- } else if(vt == QVariant::UInt) {
+ } else if (vt == QVariant::UInt) {
i = (int)value.toUInt();
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &i;
QMetaObject::metacall(object(),
@@ -917,13 +917,13 @@ void QmlMetaProperty::write(const QVariant &value) const
{
QString s;
bool found = true;
- if(vt == QVariant::ByteArray) {
+ if (vt == QVariant::ByteArray) {
s = QLatin1String(value.toByteArray());
} else {
found = false;
}
- if(found) {
+ if (found) {
void *a[1];
a[0] = &s;
QMetaObject::metacall(object(),
@@ -950,7 +950,7 @@ void QmlMetaProperty::write(const QVariant &value) const
*/
bool QmlMetaProperty::hasChangedNotifier() const
{
- if(type() & Property && !(type() & Attached)) {
+ if (type() & Property && !(type() & Attached)) {
return d->prop.hasNotifySignal();
}
return false;
@@ -966,10 +966,10 @@ bool QmlMetaProperty::hasChangedNotifier() const
*/
bool QmlMetaProperty::connectNotifier(QObject *dest, int method) const
{
- if(!(type() & Property) || type() & Attached)
+ if (!(type() & Property) || type() & Attached)
return false;
- if(d->prop.hasNotifySignal()) {
+ if (d->prop.hasNotifySignal()) {
return QMetaObject::connect(d->object, d->prop.notifySignalIndex(), dest, method, Qt::DirectConnection);
} else {
return false;
@@ -986,10 +986,10 @@ bool QmlMetaProperty::connectNotifier(QObject *dest, int method) const
*/
bool QmlMetaProperty::connectNotifier(QObject *dest, const char *slot) const
{
- if(!(type() & Property) || type() & Attached)
+ if (!(type() & Property) || type() & Attached)
return false;
- if(d->prop.hasNotifySignal()) {
+ if (d->prop.hasNotifySignal()) {
QByteArray signal(QByteArray("2") + d->prop.notifySignal().signature());
return QObject::connect(d->object, signal.constData(), dest, slot);
} else {
@@ -1000,8 +1000,8 @@ bool QmlMetaProperty::connectNotifier(QObject *dest, const char *slot) const
/*! \internal */
void QmlMetaProperty::emitSignal()
{
- if(type() & Signal) {
- if(d->signal.parameterTypes().isEmpty())
+ if (type() & Signal) {
+ if (d->signal.parameterTypes().isEmpty())
d->object->metaObject()->activate(d->object, d->coreIdx, 0);
else
qWarning() << "QmlMetaProperty: Cannot emit signal with parameters";
@@ -1023,9 +1023,9 @@ int QmlMetaProperty::coreIndex() const
quint32 QmlMetaProperty::save() const
{
quint32 rv = 0;
- if(type() & Attached) {
+ if (type() & Attached) {
rv = d->attachedFunc;
- } else if(type() != Invalid) {
+ } else if (type() != Invalid) {
rv = d->coreIdx;
}
@@ -1050,14 +1050,14 @@ void QmlMetaProperty::restore(quint32 id, QObject *obj)
d->type = id >> 16;
id &= 0xFFFF;
- if(d->type & Attached) {
+ if (d->type & Attached) {
d->attachedFunc = id;
- } else if(d->type & Property) {
+ } else if (d->type & Property) {
QMetaPropertyEx p(obj->metaObject()->property(id));
d->prop = p;
d->propType = p.propertyType;
d->coreIdx = id;
- } else if(d->type & SignalProperty || d->type & Signal) {
+ } else if (d->type & SignalProperty || d->type & Signal) {
d->signal = obj->metaObject()->method(id);
d->coreIdx = id;
}
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index c12f01a..9b99917 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -164,7 +164,7 @@ QmlType::QmlType(int type, int listType, int qmlListType,
d->m_extFunc = extFunc;
d->m_index = index;
- if(extMetaObject)
+ if (extMetaObject)
d->m_extMetaObject = extMetaObject;
}
@@ -175,16 +175,16 @@ QmlType::~QmlType()
void QmlTypePrivate::init() const
{
- if(m_isSetup) return;
+ if (m_isSetup) return;
QWriteLocker lock(metaTypeDataLock());
- if(m_isSetup)
+ if (m_isSetup)
return;
// Setup extended meta object
// XXX - very inefficient
const QMetaObject *mo = m_baseMetaObject;
- if(m_extFunc) {
+ if (m_extFunc) {
QMetaObject *mmo = new QMetaObject;
*mmo = *m_extMetaObject;
mmo->d.superdata = mo;
@@ -195,12 +195,12 @@ void QmlTypePrivate::init() const
mo = mo->d.superdata;
while(mo) {
QmlType *t = metaTypeData()->metaObjectToType.value(mo);
- if(t) {
- if(t->d->m_extFunc) {
+ if (t) {
+ if (t->d->m_extFunc) {
QMetaObject *mmo = new QMetaObject;
*mmo = *t->d->m_extMetaObject;
mmo->d.superdata = m_baseMetaObject;
- if(!m_metaObjects.isEmpty())
+ if (!m_metaObjects.isEmpty())
m_metaObjects.last().metaObject->d.superdata = mmo;
QmlProxyMetaObject::ProxyData data = { mmo, t->d->m_extFunc, 0 };
m_metaObjects << data;
@@ -209,7 +209,7 @@ void QmlTypePrivate::init() const
mo = mo->d.superdata;
}
- for(int ii = 0; ii < m_metaObjects.count(); ++ii)
+ for (int ii = 0; ii < m_metaObjects.count(); ++ii)
m_metaObjects[ii].propertyOffset =
m_metaObjects.at(ii).metaObject->propertyOffset();
@@ -218,7 +218,7 @@ void QmlTypePrivate::init() const
const QMetaObject *myMetaObject = m_metaObjects.isEmpty()?m_baseMetaObject:m_metaObjects.first().metaObject;
- for(int ii = 0; ii < myMetaObject->propertyCount(); ++ii) {
+ for (int ii = 0; ii < myMetaObject->propertyCount(); ++ii) {
QMetaProperty prop = myMetaObject->property(ii);
hashData.append(prop.type());
hashData.append("|");
@@ -226,7 +226,7 @@ void QmlTypePrivate::init() const
hashData.append("|");
}
- for(int ii = 0; ii < myMetaObject->methodCount(); ++ii) {
+ for (int ii = 0; ii < myMetaObject->methodCount(); ++ii) {
QMetaMethod method = myMetaObject->method(ii);
hashData.append(method.signature());
hashData.append("|");
@@ -240,7 +240,7 @@ void QmlTypePrivate::init() const
QByteArray QmlType::typeName() const
{
- if(d->m_baseMetaObject)
+ if (d->m_baseMetaObject)
return d->m_baseMetaObject->className();
else
return QByteArray();
@@ -324,7 +324,7 @@ const QMetaObject *QmlType::metaObject() const
{
d->init();
- if(d->m_metaObjects.isEmpty())
+ if (d->m_metaObjects.isEmpty())
return d->m_baseMetaObject;
else
return d->m_metaObjects.first().metaObject;
@@ -383,11 +383,11 @@ int QmlMetaType::registerInterface(const QmlPrivate::MetaTypeIds &id,
data->idToType.insert(type->qmlListTypeId(), type);
data->nameToType.insert(type->qmlTypeName(), type);
- if(data->interfaces.size() < id.typeId)
+ if (data->interfaces.size() < id.typeId)
data->interfaces.resize(id.typeId + 16);
- if(data->qmllists.size() < id.qmlListId)
+ if (data->qmllists.size() < id.qmlListId)
data->qmllists.resize(id.qmlListId + 16);
- if(data->lists.size() < id.listId)
+ if (data->lists.size() < id.listId)
data->lists.resize(id.listId + 16);
data->interfaces.setBit(id.typeId, true);
data->qmllists.setBit(id.qmlListId, true);
@@ -403,8 +403,8 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun
QmlMetaTypeData *data = metaTypeData();
QString name = QLatin1String(cname);
- for(int ii = 0; ii < name.count(); ++ii) {
- if(!name.at(ii).isLetterOrNumber()) {
+ for (int ii = 0; ii < name.count(); ++ii) {
+ if (!name.at(ii).isLetterOrNumber()) {
qWarning("QmlMetaType: Invalid QML name %s", cname);
return -1;
}
@@ -421,16 +421,16 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun
data->idToType.insert(type->qListTypeId(), type);
data->idToType.insert(type->qmlListTypeId(), type);
- if(!type->qmlTypeName().isEmpty())
+ if (!type->qmlTypeName().isEmpty())
data->nameToType.insert(type->qmlTypeName(), type);
data->metaObjectToType.insert(type->baseMetaObject(), type);
- if(data->objects.size() <= id.typeId)
+ if (data->objects.size() <= id.typeId)
data->objects.resize(id.typeId + 16);
- if(data->qmllists.size() <= id.qmlListId)
+ if (data->qmllists.size() <= id.qmlListId)
data->qmllists.resize(id.qmlListId + 16);
- if(data->lists.size() <= id.listId)
+ if (data->lists.size() <= id.listId)
data->lists.resize(id.listId + 16);
data->objects.setBit(id.typeId, true);
data->qmllists.setBit(id.qmlListId, true);
@@ -446,7 +446,7 @@ void QmlMetaType::registerCustomParser(const char *qmlName,
QmlMetaTypeData *data = metaTypeData();
Q_ASSERT(parser);
- if(data->customParsers.contains(qmlName)) {
+ if (data->customParsers.contains(qmlName)) {
delete parser;
return;
}
@@ -468,7 +468,7 @@ int QmlMetaType::qmlParserStatusCast(int userType)
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(userType);
- if(type && type->typeId() == userType)
+ if (type && type->typeId() == userType)
return type->parserStatusCast();
else
return -1;
@@ -476,7 +476,7 @@ int QmlMetaType::qmlParserStatusCast(int userType)
QObject *QmlMetaType::toQObject(const QVariant &v)
{
- if(!isObject(v.userType()))
+ if (!isObject(v.userType()))
return 0;
// NOTE: This assumes a cast to QObject does not alter the
@@ -493,7 +493,7 @@ int QmlMetaType::listType(int id)
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(id);
- if(type && type->qListTypeId() == id)
+ if (type && type->qListTypeId() == id)
return type->typeId();
else
return 0;
@@ -507,7 +507,7 @@ int QmlMetaType::qmlListType(int id)
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(id);
- if(type && type->qmlListTypeId() == id)
+ if (type && type->qmlListTypeId() == id)
return type->typeId();
else
return 0;
@@ -520,7 +520,7 @@ bool QmlMetaType::clear(const QVariant &list)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->qListTypeId() == userType) {
+ if (type && type->qListTypeId() == userType) {
type->listClear(list);
return true;
} else {
@@ -535,7 +535,7 @@ bool QmlMetaType::append(const QVariant &list, const QVariant &item)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->qListTypeId() == userType &&
+ if (type && type->qListTypeId() == userType &&
item.userType() == type->typeId()) {
type->listAppend(list, item);
return true;
@@ -551,7 +551,7 @@ QObject *QmlMetaType::create(const QByteArray &name)
lock.unlock();
QmlType *type = data->nameToType.value(name);
- if(type)
+ if (type)
return type->create();
else
return 0;
@@ -563,7 +563,7 @@ QVariant QmlMetaType::fromObject(QObject *obj, int typeId)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(typeId);
- if(type && type->typeId() == typeId)
+ if (type && type->typeId() == typeId)
return type->fromObject(obj);
else
return QVariant();
@@ -575,7 +575,7 @@ const QMetaObject *QmlMetaType::rawMetaObjectForType(int id)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(id);
- if(type && type->typeId() == id)
+ if (type && type->typeId() == id)
return type->baseMetaObject();
else
return 0;
@@ -587,7 +587,7 @@ const QMetaObject *QmlMetaType::rawMetaObjectForType(const QByteArray &name)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->nameToType.value(name);
- if(type)
+ if (type)
return type->baseMetaObject();
else
return 0;
@@ -600,7 +600,7 @@ const QMetaObject *QmlMetaType::metaObjectForType(int id)
QmlType *type = data->idToType.value(id);
lock.unlock();
- if(type && type->typeId() == id)
+ if (type && type->typeId() == id)
return type->metaObject();
else
return 0;
@@ -613,7 +613,7 @@ const QMetaObject *QmlMetaType::metaObjectForType(const QByteArray &name)
QmlType *type = data->nameToType.value(name);
lock.unlock();
- if(type)
+ if (type)
return type->metaObject();
else
return 0;
@@ -625,7 +625,7 @@ int QmlMetaType::type(const QByteArray &name)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->nameToType.value(name);
- if(type)
+ if (type)
return type->typeId();
else
return 0;
@@ -637,7 +637,7 @@ int QmlMetaType::attachedPropertiesFuncId(const QByteArray &name)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->nameToType.value(name);
- if(type && type->attachedPropertiesFunction())
+ if (type && type->attachedPropertiesFunction())
return type->index();
else
return -1;
@@ -649,7 +649,7 @@ int QmlMetaType::attachedPropertiesFuncId(const QMetaObject *mo)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->metaObjectToType.value(mo);
- if(type && type->attachedPropertiesFunction())
+ if (type && type->attachedPropertiesFunction())
return type->index();
else
return -1;
@@ -657,7 +657,7 @@ int QmlMetaType::attachedPropertiesFuncId(const QMetaObject *mo)
QmlAttachedPropertiesFunc QmlMetaType::attachedPropertiesFuncById(int id)
{
- if(id < 0)
+ if (id < 0)
return 0;
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
@@ -670,7 +670,7 @@ QmlMetaType::attachedPropertiesFunc(const QByteArray &name)
QReadLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->nameToType.value(name);
- if(type)
+ if (type)
return type->attachedPropertiesFunction();
else
return 0;
@@ -679,15 +679,15 @@ QmlMetaType::attachedPropertiesFunc(const QByteArray &name)
QMetaProperty QmlMetaType::defaultProperty(const QMetaObject *metaObject)
{
int idx = metaObject->indexOfClassInfo("DefaultProperty");
- if(-1 == idx)
+ if (-1 == idx)
return QMetaProperty();
QMetaClassInfo info = metaObject->classInfo(idx);
- if(!info.value())
+ if (!info.value())
return QMetaProperty();
idx = metaObject->indexOfProperty(info.value());
- if(-1 == idx)
+ if (-1 == idx)
return QMetaProperty();
return metaObject->property(idx);
@@ -695,7 +695,7 @@ QMetaProperty QmlMetaType::defaultProperty(const QMetaObject *metaObject)
QMetaProperty QmlMetaType::defaultProperty(QObject *obj)
{
- if(!obj)
+ if (!obj)
return QMetaProperty();
const QMetaObject *metaObject = obj->metaObject();
@@ -705,15 +705,15 @@ QMetaProperty QmlMetaType::defaultProperty(QObject *obj)
QMetaMethod QmlMetaType::defaultMethod(const QMetaObject *metaObject)
{
int idx = metaObject->indexOfClassInfo("DefaultMethod");
- if(-1 == idx)
+ if (-1 == idx)
return QMetaMethod();
QMetaClassInfo info = metaObject->classInfo(idx);
- if(!info.value())
+ if (!info.value())
return QMetaMethod();
idx = metaObject->indexOfMethod(info.value());
- if(-1 == idx)
+ if (-1 == idx)
return QMetaMethod();
return metaObject->method(idx);
@@ -721,7 +721,7 @@ QMetaMethod QmlMetaType::defaultMethod(const QMetaObject *metaObject)
QMetaMethod QmlMetaType::defaultMethod(QObject *obj)
{
- if(!obj)
+ if (!obj)
return QMetaMethod();
const QMetaObject *metaObject = obj->metaObject();
@@ -739,13 +739,13 @@ QMetaProperty QmlMetaType::property(QObject *obj, const QByteArray &bname)
*/
QMetaProperty QmlMetaType::property(QObject *obj, const char *name)
{
- if(!obj)
+ if (!obj)
return QMetaProperty();
const QMetaObject *metaObject = obj->metaObject();
int idx = metaObject->indexOfProperty(name);
- if(-1 == idx)
+ if (-1 == idx)
return QMetaProperty();
return metaObject->property(idx);
@@ -771,7 +771,7 @@ const char *QmlMetaType::interfaceIId(int userType)
QmlMetaTypeData *data = metaTypeData();
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->isInterface() && type->typeId() == userType)
+ if (type && type->isInterface() && type->typeId() == userType)
return type->interfaceIId();
else
return 0;
@@ -780,7 +780,7 @@ const char *QmlMetaType::interfaceIId(int userType)
bool QmlMetaType::isObject(const QMetaObject *mo)
{
while(mo) {
- if(mo == &QObject::staticMetaObject)
+ if (mo == &QObject::staticMetaObject)
return true;
mo = mo->superClass();
}
@@ -815,7 +815,7 @@ int QmlMetaType::listCount(const QVariant &v)
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->qListTypeId() == userType)
+ if (type && type->qListTypeId() == userType)
return type->listCount(v);
else
return 0;
@@ -830,7 +830,7 @@ QVariant QmlMetaType::listAt(const QVariant &v, int idx)
QmlType *type = data->idToType.value(userType);
lock.unlock();
- if(type && type->qListTypeId() == userType)
+ if (type && type->qListTypeId() == userType)
return type->listAt(v, idx);
else
return 0;
@@ -856,7 +856,7 @@ void QmlMetaType::registerCustomStringConverter(int type, StringConverter conver
QWriteLocker lock(metaTypeDataLock());
QmlMetaTypeData *data = metaTypeData();
- if(data->stringConverters.contains(type))
+ if (data->stringConverters.contains(type))
return;
data->stringConverters.insert(type, converter);
}
diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h
index c17d47f..83fb60b 100644
--- a/src/declarative/qml/qmlmetatype.h
+++ b/src/declarative/qml/qmlmetatype.h
@@ -199,7 +199,7 @@ int qmlRegisterExtendedType(const char *typeName)
QmlAttachedPropertiesFunc attached =
QmlPrivate::attachedPropertiesFunc<E>();
- if(!attached)
+ if (!attached)
attached = QmlPrivate::attachedPropertiesFunc<T>();
return QmlMetaType::registerType(ids, QmlPrivate::list_nocreate_op<T>, 0,
@@ -221,7 +221,7 @@ int qmlRegisterExtendedType(const char *qmlName, const char *typeName)
QmlAttachedPropertiesFunc attached =
QmlPrivate::attachedPropertiesFunc<E>();
- if(!attached)
+ if (!attached)
attached = QmlPrivate::attachedPropertiesFunc<T>();
return QmlMetaType::registerType(ids, QmlPrivate::list_op<T>,
diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp
index 1dd0d4e..ecb6f0b 100644
--- a/src/declarative/qml/qmlparser.cpp
+++ b/src/declarative/qml/qmlparser.cpp
@@ -70,16 +70,16 @@ QmlParser::Object::Object()
QmlParser::Object::~Object()
{
- if(defaultProperty) defaultProperty->release();
+ if (defaultProperty) defaultProperty->release();
foreach(Property *prop, properties)
prop->release();
- if(dynamicPropertiesProperty) dynamicPropertiesProperty->release();
- if(dynamicSignalsProperty) dynamicSignalsProperty->release();
+ if (dynamicPropertiesProperty) dynamicPropertiesProperty->release();
+ if (dynamicSignalsProperty) dynamicSignalsProperty->release();
}
const QMetaObject *Object::metaObject() const
{
- if(extObject && metatype)
+ if (extObject && metatype)
return extObject;
else
return metatype;
@@ -87,15 +87,15 @@ const QMetaObject *Object::metaObject() const
QmlParser::Property *Object::getDefaultProperty()
{
- if(!defaultProperty)
+ if (!defaultProperty)
defaultProperty = new Property;
return defaultProperty;
}
Property *QmlParser::Object::getProperty(const QByteArray &name, bool create)
{
- if(!properties.contains(name)) {
- if(create)
+ if (!properties.contains(name)) {
+ if (create)
properties.insert(name, new Property(name));
else
return 0;
@@ -140,12 +140,12 @@ QmlParser::Property::~Property()
{
foreach(Value *value, values)
value->release();
- if(value) value->release();
+ if (value) value->release();
}
Object *QmlParser::Property::getValue()
{
- if(!value) value = new Object;
+ if (!value) value = new Object;
return value;
}
@@ -167,7 +167,7 @@ QmlParser::Value::Value()
QmlParser::Value::~Value()
{
- if(object) object->release();
+ if (object) object->release();
}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlparserstatus.cpp b/src/declarative/qml/qmlparserstatus.cpp
index 3bb421d..1f49553 100644
--- a/src/declarative/qml/qmlparserstatus.cpp
+++ b/src/declarative/qml/qmlparserstatus.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QmlParserStatus
- \brief provides updates on the parser state.
+ \brief The QmlParserStatus class provides updates on the parser state.
*/
/*!
diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h
index 183f42b..590e0c0 100644
--- a/src/declarative/qml/qmlprivate.h
+++ b/src/declarative/qml/qmlprivate.h
@@ -221,7 +221,7 @@ int QmlPrivate::list_op(QmlPrivate::ListOp op, int val,
const QVariant &value,
void **out)
{
- if(op == QmlPrivate::Create) {
+ if (op == QmlPrivate::Create) {
QObject *obj = static_cast<QObject *>(new T);
*((QObject **)out) = obj;
return 0;
@@ -256,7 +256,7 @@ int QmlPrivate::list_op(QmlPrivate::ListOp op, int val,
{
QObject *fromObj = value.value<QObject *>();
T *me = qobject_cast<T *>(fromObj);
- if(me) {
+ if (me) {
*((QVariant *)*out) = QVariant::fromValue(me);
}
}
@@ -304,7 +304,7 @@ int QmlPrivate::list_nocreate_op(QmlPrivate::ListOp op, int val,
{
QObject *fromObj = value.value<QObject *>();
T *me = qobject_cast<T *>(fromObj);
- if(me) {
+ if (me) {
*((QVariant *)*out) = QVariant::fromValue(me);
}
}
diff --git a/src/declarative/qml/qmlproxymetaobject.cpp b/src/declarative/qml/qmlproxymetaobject.cpp
index 3b9f6ca..d24c5c4 100644
--- a/src/declarative/qml/qmlproxymetaobject.cpp
+++ b/src/declarative/qml/qmlproxymetaobject.cpp
@@ -53,7 +53,7 @@ QmlProxyMetaObject::QmlProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
*static_cast<QMetaObject *>(this) = *metaObjects->last().metaObject;
QObjectPrivate *op = QObjectPrivate::get(obj);
- if(op->metaObject)
+ if (op->metaObject)
parent = static_cast<QAbstractDynamicMetaObject*>(op->metaObject);
op->metaObject = this;
@@ -69,31 +69,31 @@ QmlProxyMetaObject::QmlProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
QmlProxyMetaObject::~QmlProxyMetaObject()
{
- if(parent)
+ if (parent)
delete parent;
parent = 0;
- if(proxies)
+ if (proxies)
delete [] proxies;
proxies = 0;
}
int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
- if((c == QMetaObject::ReadProperty ||
+ if ((c == QMetaObject::ReadProperty ||
c == QMetaObject::WriteProperty) &&
id >= metaObjects->last().propertyOffset) {
- for(int ii = 0; ii < metaObjects->count(); ++ii) {
+ for (int ii = 0; ii < metaObjects->count(); ++ii) {
const ProxyData &data = metaObjects->at(ii);
- if(id >= data.propertyOffset) {
- if(!proxies) {
+ if (id >= data.propertyOffset) {
+ if (!proxies) {
proxies = new QObject*[metaObjects->count()];
::memset(proxies, 0,
sizeof(QObject *) * metaObjects->count());
}
- if(!proxies[ii])
+ if (!proxies[ii])
proxies[ii] = data.createFunc(object);
int proxyOffset = proxies[ii]->metaObject()->propertyOffset();
@@ -104,7 +104,7 @@ int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
}
}
- if(parent)
+ if (parent)
return parent->metaCall(c, id, a);
else
return object->qt_metacall(c, id, a);
diff --git a/src/declarative/qml/qmlrefcount.cpp b/src/declarative/qml/qmlrefcount.cpp
index 4e47ee1..8f71f1b 100644
--- a/src/declarative/qml/qmlrefcount.cpp
+++ b/src/declarative/qml/qmlrefcount.cpp
@@ -60,7 +60,7 @@ void QmlRefCount::release()
{
Q_ASSERT(refCount > 0);
--refCount;
- if(refCount == 0)
+ if (refCount == 0)
delete this;
}
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index 4e0c283..317a3bf 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -247,7 +247,7 @@ Object *ProcessAST::defineObjectBinding_helper(int line,
Value *v = new Value;
v->object = obj;
v->line = line;
- if(state.property)
+ if (state.property)
state.property->addValue(v);
else
state.object->getDefaultProperty()->addValue(v);
@@ -403,7 +403,7 @@ QString ProcessAST::getPrimitive(const QByteArray &propertyName, AST::Expression
{
QString primitive;
- if(isSignalProperty(propertyName)) {
+ if (isSignalProperty(propertyName)) {
primitive = asString(expr);
} else if (propertyName == "id" && expr && expr->kind == AST::Node::Kind_IdentifierExpression) {
primitive = asString(expr);
@@ -593,7 +593,7 @@ Object *QmlScriptParser::tree() const
void QmlScriptParser::clear()
{
- if(root) {
+ if (root) {
root->release();
root = 0;
}
diff --git a/src/declarative/qml/qmlstringconverters.cpp b/src/declarative/qml/qmlstringconverters.cpp
index 82d6eee..c1f4b8c 100644
--- a/src/declarative/qml/qmlstringconverters.cpp
+++ b/src/declarative/qml/qmlstringconverters.cpp
@@ -51,18 +51,18 @@ QT_BEGIN_NAMESPACE
static uchar fromHex(const uchar c, const uchar c2)
{
uchar rv = 0;
- if(c >= '0' && c <= '9')
+ if (c >= '0' && c <= '9')
rv += (c - '0') * 16;
- else if(c >= 'A' && c <= 'F')
+ else if (c >= 'A' && c <= 'F')
rv += (c - 'A' + 10) * 16;
- else if(c >= 'a' && c <= 'f')
+ else if (c >= 'a' && c <= 'f')
rv += (c - 'a' + 10) * 16;
- if(c2 >= '0' && c2 <= '9')
+ if (c2 >= '0' && c2 <= '9')
rv += (c2 - '0');
- else if(c2 >= 'A' && c2 <= 'F')
+ else if (c2 >= 'A' && c2 <= 'F')
rv += (c2 - 'A' + 10);
- else if(c2 >= 'a' && c2 <= 'f')
+ else if (c2 >= 'a' && c2 <= 'f')
rv += (c2 - 'a' + 10);
return rv;
@@ -77,41 +77,41 @@ static uchar fromHex(const QString &s, int idx)
QVariant QmlStringConverters::variantFromString(const QString &s)
{
- if(s.isEmpty())
+ if (s.isEmpty())
return QVariant(s);
- if(s.startsWith(QLatin1Char('\'')) && s.endsWith(QLatin1Char('\''))) {
+ if (s.startsWith(QLatin1Char('\'')) && s.endsWith(QLatin1Char('\''))) {
QString data = s.mid(1, s.length() - 2);
return QVariant(data);
}
bool ok = false;
QRectF r = rectFFromString(s, &ok);
- if(ok) return QVariant(r);
+ if (ok) return QVariant(r);
QColor c = colorFromString(s, &ok);
- if(ok) return QVariant(c);
+ if (ok) return QVariant(c);
QPointF p = pointFFromString(s, &ok);
- if(ok) return QVariant(p);
+ if (ok) return QVariant(p);
QSizeF sz = sizeFFromString(s, &ok);
- if(ok) return QVariant(sz);
+ if (ok) return QVariant(sz);
bool b = boolFromString(s, &ok);
- if(ok) return QVariant(b);
+ if (ok) return QVariant(b);
return QVariant(s);
}
QColor QmlStringConverters::colorFromString(const QString &s, bool *ok)
{
- if(s.startsWith(QLatin1Char('#')) && s.length() == 9) {
+ if (s.startsWith(QLatin1Char('#')) && s.length() == 9) {
uchar a = fromHex(s, 1);
uchar r = fromHex(s, 3);
uchar g = fromHex(s, 5);
uchar b = fromHex(s, 7);
- if(ok) *ok = true;
+ if (ok) *ok = true;
return QColor(r, g, b, a);
} else {
QColor rv;
- if(s.startsWith(QLatin1Char('#')) || QColor::colorNames().contains(s.toLower()))
+ if (s.startsWith(QLatin1Char('#')) || QColor::colorNames().contains(s.toLower()))
rv = QColor(s);
- if(ok) *ok = rv.isValid();
+ if (ok) *ok = rv.isValid();
return rv;
}
}
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index 62a0864..253e9a7 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -224,13 +224,13 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QStack<QmlMetaProperty> pushedProperties;
QObject **savedObjects = 0;
- if(start == -1) start = 0;
- if(count == -1) count = comp->bytecode.count();
+ if (start == -1) start = 0;
+ if (count == -1) count = comp->bytecode.count();
- for(int ii = start; !isError() && ii < (start + count); ++ii) {
+ for (int ii = start; !isError() && ii < (start + count); ++ii) {
QmlInstruction &instr = comp->bytecode[ii];
- if(instr.type >= QmlInstruction::StoreInstructionsStart &&
+ if (instr.type >= QmlInstruction::StoreInstructionsStart &&
instr.type <= QmlInstruction::StoreInstructionsEnd) {
runStoreInstruction(stack, instr, comp);
@@ -240,7 +240,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
switch(instr.type) {
case QmlInstruction::Init:
{
- if(instr.init.dataSize) {
+ if (instr.init.dataSize) {
savedObjects = new QObject*[instr.init.dataSize];
::memset(savedObjects, 0,
sizeof(QObject *)*instr.init.dataSize);
@@ -254,10 +254,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QFxCompilerTimer<QFxCompiler::InstrCreateObject> cc;
#endif
QObject *o = types.at(instr.create.type).createInstance(QmlContext::activeContext());
- if(!o)
+ if (!o)
VME_EXCEPTION("Unable to create object of type" << types.at(instr.create.type).className);
- if(!stack.isEmpty()) {
+ if (!stack.isEmpty()) {
QObject *parent = stack.top();
o->setParent(parent);
}
@@ -274,11 +274,11 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
types.at(instr.createCustom.type).parser->create(datas.at(instr.createCustom.data));
// XXX
QObject *o = QmlMetaType::toQObject(v);
- if(!o)
+ if (!o)
VME_EXCEPTION("Unable to create" << types.at(instr.create.type).className);
QmlEngine::setContextForObject(o, QmlContext::activeContext());
- if(!stack.isEmpty()) {
+ if (!stack.isEmpty()) {
QObject *parent = stack.top();
o->setParent(parent);
}
@@ -296,7 +296,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlContext::activeContext();
ctxt->setContextProperty(primitives.at(instr.setId.value), target);
- if(instr.setId.save != -1)
+ if (instr.setId.save != -1)
savedObjects[instr.setId.save] = target;
}
break;
@@ -365,14 +365,14 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
const QByteArray &pr = datas.at(sigIdx);
QmlMetaProperty prop(target, QLatin1String(pr));
- if(prop.type() & QmlMetaProperty::SignalProperty) {
+ if (prop.type() & QmlMetaProperty::SignalProperty) {
int coreIdx = prop.coreIndex();
int primRef = instr.assignSignal.value;
instr.type = QmlInstruction::StoreSignal;
instr.storeSignal.signalIndex = coreIdx;
instr.storeSignal.value = primRef;
--ii;
- } else if(prop.type() & QmlMetaProperty::Property) {
+ } else if (prop.type() & QmlMetaProperty::Property) {
int prop = sigIdx;
int primRef = instr.assignSignal.value;
instr.type = QmlInstruction::AssignConstant;
@@ -398,18 +398,18 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
const QByteArray &pr = datas.at(sigIdx);
QmlMetaProperty prop(target, QLatin1String(pr));
- if(prop.type() & QmlMetaProperty::SignalProperty) {
+ if (prop.type() & QmlMetaProperty::SignalProperty) {
QMetaMethod method = QmlMetaType::defaultMethod(assign);
- if(method.signature() == 0)
+ if (method.signature() == 0)
VME_EXCEPTION("Cannot assign object type" << assign->metaObject()->className() << "with no default method");
- if(!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature()))
+ if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature()))
VME_EXCEPTION("Cannot connect mismatched signal/slot" << method.signature() << prop.method().signature());
QMetaObject::connect(target, prop.coreIndex(), assign, method.methodIndex());
- } else if(prop.type() & QmlMetaProperty::Property) {
+ } else if (prop.type() & QmlMetaProperty::Property) {
instr.type = QmlInstruction::AssignObject;
instr.assignObject.castValue = 0;
instr.assignObject.property = sigIdx;
@@ -432,7 +432,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QMetaMethod signal =
target->metaObject()->method(instr.storeSignal.signalIndex);
- if(signal.parameterTypes().isEmpty()) {
+ if (signal.parameterTypes().isEmpty()) {
(void *)new QmlBoundSignal(QmlContext::activeContext(), primitives.at(instr.storeSignal.value), target, instr.storeSignal.signalIndex, target);
} else {
(void *)new QmlBoundSignalProxy(new QmlContext(QmlContext::activeContext(), target), primitives.at(instr.storeSignal.value), target, instr.storeSignal.signalIndex, target);
@@ -450,9 +450,9 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
int propIdx = instr.assignConstant.property;
int idx = instr.assignConstant.constant;
QByteArray pr;
- if(propIdx == -1) {
+ if (propIdx == -1) {
pr = QmlMetaType::defaultProperty(target).name();
- if(pr.isEmpty())
+ if (pr.isEmpty())
VME_EXCEPTION("Cannot resolve defalt property on type" << target->metaObject()->className());
} else {
pr = datas.at(propIdx);
@@ -460,14 +460,14 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
int coreIdx = qIndexOfProperty(target, pr);
- if(coreIdx != -1) {
+ if (coreIdx != -1) {
QMetaProperty prop =
target->metaObject()->property(coreIdx);
bool replace = !prop.isDynamic();
QmlInstruction *writeInstr = 0;
QmlInstruction dummy;
- if(replace) {
+ if (replace) {
writeInstr = &instr;
} else {
writeInstr = &dummy;
@@ -476,8 +476,8 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlCompiler::StoreInstructionResult r = QmlCompiler::generateStoreInstruction(*comp, *writeInstr, prop,
coreIdx, idx, &primitives.at(idx));
- if(r != QmlCompiler::Ok) {
- if(prop.isEnumType()){
+ if (r != QmlCompiler::Ok) {
+ if (prop.isEnumType()){
VME_EXCEPTION(primitives.at(idx) << "is not a valid enumeration value");
} else if (r == QmlCompiler::UnknownType) {
VME_EXCEPTION("Property" << prop.name() << "is of an unknown type");
@@ -507,7 +507,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlParserStatus *status =
qobject_cast<QmlParserStatus *>(target);
- if(status) {
+ if (status) {
instr.type = QmlInstruction::BeginObject;
instr.begin.castValue = int(reinterpret_cast<char *>(status) - reinterpret_cast<char *>(target));
--ii;
@@ -538,7 +538,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlParserStatus *status =
qobject_cast<QmlParserStatus *>(target);
- if(status) {
+ if (status) {
instr.type = QmlInstruction::CompleteObject;
instr.complete.castValue = int(reinterpret_cast<char *>(status) - reinterpret_cast<char *>(target));
--ii;
@@ -570,10 +570,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
int idx = qIndexOfProperty(target, pr);
// XXX - need to check if the type is QmlBindableValue*
- if(idx == -1) {
+ if (idx == -1) {
VME_EXCEPTION("Unknown property" << pr);
} else {
- if(QmlInstruction::AssignCompiledBinding == instr.type)
+ if (QmlInstruction::AssignCompiledBinding == instr.type)
instr.type = QmlInstruction::StoreCompiledBinding;
else
instr.type = QmlInstruction::StoreBinding;
@@ -589,16 +589,16 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *target = stack.at(stack.count() - 2);
int propIdx = instr.assignValueSource.property;
QByteArray pr;
- if(propIdx == -1) {
+ if (propIdx == -1) {
pr = QmlMetaType::defaultProperty(target).name();
- if(pr.isEmpty())
+ if (pr.isEmpty())
VME_EXCEPTION("Unable to resolve default property");
} else {
pr = datas.at(propIdx);
}
int coreIdx = qIndexOfProperty(target, pr);
- if(coreIdx != -1) {
+ if (coreIdx != -1) {
instr.type = QmlInstruction::StoreValueSource;
instr.assignValueSource.property = coreIdx;
ii--;
@@ -685,18 +685,18 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
#endif
QObject *assign = stack.pop();
const ListInstance &list = qliststack.top();
- if(list.qmlListInterface) {
+ if (list.qmlListInterface) {
int type = list.type;
void *d = 0;
void *ptr = 0;
bool found = false;
- if(QmlMetaType::isInterface(type)) {
+ if (QmlMetaType::isInterface(type)) {
const char *iid = QmlMetaType::interfaceIId(type);
- if(iid)
+ if (iid)
ptr = assign->qt_metacast(iid);
- if(ptr) {
+ if (ptr) {
d = &ptr;
found = true;
}
@@ -706,7 +706,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
const QMetaObject *assignMo = assign->metaObject();
while(!found && assignMo) {
- if(assignMo == mo)
+ if (assignMo == mo)
found = true;
else
assignMo = assignMo->superClass();
@@ -718,7 +718,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
- if(!found)
+ if (!found)
VME_EXCEPTION("Cannot assign object to list");
list.qmlListInterface->append(d);
@@ -726,10 +726,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
} else {
int type = list.type;
- if(QmlMetaType::isInterface(type)) {
+ if (QmlMetaType::isInterface(type)) {
void *ptr = 0;
const char *iid = QmlMetaType::interfaceIId(type);
- if(iid)
+ if (iid)
ptr = assign->qt_metacast(iid);
QVariant v(list.type, &ptr);
QmlMetaType::append(list.list, v);
@@ -750,7 +750,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *target = stack.top();
QByteArray property;
- if(instr.assignObject.property == -1) {
+ if (instr.assignObject.property == -1) {
// XXX - optimize!
property =
QmlMetaType::defaultProperty(target).name();
@@ -760,17 +760,17 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
int coreIdx = qIndexOfProperty(target, property);
- if(coreIdx != -1) {
+ if (coreIdx != -1) {
QMetaProperty prop =
target->metaObject()->property(coreIdx);
int t = prop.userType();
// XXX - optimize!
- if(QmlMetaType::isList(t)) {
+ if (QmlMetaType::isList(t)) {
QVariant list = prop.read(target);
int listtype = QmlMetaType::listType(t);
QVariant v = QmlMetaType::fromObject(assign, listtype);
QmlMetaType::append(list, v);
- } else if(QmlMetaType::isQmlList(t)) {
+ } else if (QmlMetaType::isQmlList(t)) {
// XXX - optimize!
QVariant list = prop.read(target);
@@ -785,13 +785,13 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
const QMetaObject *assignMo = assign->metaObject();
bool found = false;
while(!found && assignMo) {
- if(assignMo == mo)
+ if (assignMo == mo)
found = true;
else
assignMo = assignMo->superClass();
}
- if(!found)
+ if (!found)
VME_EXCEPTION("Cannot assign object to list");
// NOTE: This assumes a cast to QObject does not alter
@@ -799,12 +799,12 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
void *d = (void *)&assign;
li->append(d);
- } else if(QmlMetaType::isInterface(t)) {
+ } else if (QmlMetaType::isInterface(t)) {
const char *iid = QmlMetaType::interfaceIId(t);
bool ok = false;
- if(iid) {
+ if (iid) {
void *ptr = assign->qt_metacast(iid);
- if(ptr) {
+ if (ptr) {
void *a[1];
a[0] = &ptr;
QMetaObject::metacall(target, QMetaObject::WriteProperty,
@@ -813,10 +813,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
}
- if(!ok)
+ if (!ok)
VME_EXCEPTION("Cannot assign object to interface property" << property);
- } else if(prop.userType() == -1 /* means qvariant */) {
+ } else if (prop.userType() == -1 /* means qvariant */) {
prop.write(target, qVariantFromValue(assign));
} else {
const QMetaObject *propmo =
@@ -831,11 +831,11 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
c = c->superClass();
}
- if(isAssignable) {
+ if (isAssignable) {
// XXX - optimize!
QVariant v = QmlMetaType::fromObject(assign, t);
prop.write(target, v);
- } else if(isPropertyValue) {
+ } else if (isPropertyValue) {
QmlPropertyValueSource *vs =
static_cast<QmlPropertyValueSource *>(assign);
vs->setParent(target);
@@ -862,7 +862,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *qmlObject = qmlAttachedPropertiesObjectById(instr.fetchAttached.id, target);
- if(!qmlObject)
+ if (!qmlObject)
VME_EXCEPTION("Unable to create attached object");
stack.push(qmlObject);
@@ -883,7 +883,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
a[0] = &list;
QMetaObject::metacall(target, QMetaObject::ReadProperty,
instr.fetchQmlList.property, a);
- if(!list)
+ if (!list)
VME_EXCEPTION("Cannot assign to null list");
qliststack.push(ListInstance(list, instr.fetchQmlList.type));
@@ -911,14 +911,14 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *target = stack.top();
const QByteArray &pr = datas.at(instr.fetch.property);
int idx = qIndexOfProperty(target, pr);
- if(idx == -1)
+ if (idx == -1)
VME_EXCEPTION("Cannot resolve property" << pr);
QMetaProperty prop = target->metaObject()->property(idx);
instr.type = QmlInstruction::FetchObject;
instr.fetch.property = idx;
- if(QmlMetaType::isObject(prop.userType())) {
+ if (QmlMetaType::isObject(prop.userType())) {
instr.fetch.isObject = true;
- } else if(prop.userType() == -1) {
+ } else if (prop.userType() == -1) {
instr.fetch.isObject = false;
} else {
VME_EXCEPTION("Cannot set properties on" << prop.name() << "as it is of unknown type");
@@ -935,7 +935,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QObject *target = stack.top();
QObject *obj = 0;
- if(instr.fetch.isObject) {
+ if (instr.fetch.isObject) {
// NOTE: This assumes a cast to QObject does not alter the
// object pointer
void *a[1];
@@ -952,7 +952,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
- if(!obj)
+ if (!obj)
VME_EXCEPTION("Cannot set properties on" << target->metaObject()->property(instr.fetch.property).name() << "as it is null");
stack.push(obj);
@@ -994,13 +994,13 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
bool found = false;
while(!found && assignMo) {
- if(assignMo == mo)
+ if (assignMo == mo)
found = true;
else
assignMo = assignMo->superClass();
}
- if(!found)
+ if (!found)
VME_EXCEPTION("Unable to assign object");
instr.type = QmlInstruction::StoreStackObject;
@@ -1042,8 +1042,8 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
}
}
- if(isError()) {
- if(!stack.isEmpty()) {
+ if (isError()) {
+ if (!stack.isEmpty()) {
delete stack.at(0);
}
return 0;
@@ -1055,10 +1055,10 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
comp->dumpPost();
- if(savedObjects)
+ if (savedObjects)
delete [] savedObjects;
- if(stack.isEmpty())
+ if (stack.isEmpty())
return 0;
else
return stack.top();
diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp
index 2b1060b..f7d2635 100644
--- a/src/declarative/qml/qmlvmemetaobject.cpp
+++ b/src/declarative/qml/qmlvmemetaobject.cpp
@@ -52,7 +52,7 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
QmlRefCount *rc)
: object(obj), ref(rc)
{
- if(ref)
+ if (ref)
ref->addref();
*static_cast<QMetaObject *>(this) = *other;
@@ -64,9 +64,9 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
data = new QVariant[propertyCount() - baseProp];
vTypes.resize(propertyCount() - baseProp);
- for(int ii = baseProp; ii < propertyCount(); ++ii) {
+ for (int ii = baseProp; ii < propertyCount(); ++ii) {
QMetaProperty prop = property(ii);
- if((int)prop.type() != -1) {
+ if ((int)prop.type() != -1) {
data[ii - baseProp] = QVariant((QVariant::Type)prop.userType());
} else {
vTypes.setBit(ii - baseProp, true);
@@ -76,27 +76,27 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
QmlVMEMetaObject::~QmlVMEMetaObject()
{
- if(ref)
+ if (ref)
ref->release();
delete [] data;
}
int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
- if(id >= baseProp) {
+ if (id >= baseProp) {
int propId = id - baseProp;
bool needActivate = false;
- if(vTypes.testBit(propId)) {
- if(c == QMetaObject::ReadProperty) {
+ if (vTypes.testBit(propId)) {
+ if (c == QMetaObject::ReadProperty) {
*reinterpret_cast<QVariant *>(a[0]) = data[propId];
- } else if(c == QMetaObject::WriteProperty) {
+ } else if (c == QMetaObject::WriteProperty) {
needActivate =
(data[propId] != *reinterpret_cast<QVariant *>(a[0]));
data[propId] = *reinterpret_cast<QVariant *>(a[0]);
}
} else {
- if(c == QMetaObject::ReadProperty) {
+ if (c == QMetaObject::ReadProperty) {
switch(data[propId].type()) {
case QVariant::Int:
*reinterpret_cast<int *>(a[0]) = data[propId].toInt();
@@ -120,7 +120,7 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
qFatal("Unknown type");
break;
}
- } else if(c == QMetaObject::WriteProperty) {
+ } else if (c == QMetaObject::WriteProperty) {
QVariant value = QVariant((QVariant::Type)data[propId].type(), a[0]);
needActivate = (data[propId] != value);
@@ -128,7 +128,7 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
}
}
- if(c == QMetaObject::WriteProperty && needActivate) {
+ if (c == QMetaObject::WriteProperty && needActivate) {
activate(object, baseSig + propId, 0);
}
diff --git a/src/declarative/qml/qmlxmlparser.cpp b/src/declarative/qml/qmlxmlparser.cpp
index 0af9115..b3565a0 100644
--- a/src/declarative/qml/qmlxmlparser.cpp
+++ b/src/declarative/qml/qmlxmlparser.cpp
@@ -70,7 +70,7 @@ struct QmlXmlParserStateStack : public QStack<QmlXmlParserState>
void pushProperty(const QString &name, int lineNumber)
{
const QmlXmlParserState &state = top();
- if(state.property) {
+ if (state.property) {
QmlXmlParserState s(state.property->getValue(),
state.property->getValue()->getProperty(name.toLatin1()));
s.property->line = lineNumber;
@@ -86,7 +86,7 @@ struct QmlXmlParserStateStack : public QStack<QmlXmlParserState>
QmlXmlParser::~QmlXmlParser()
{
- if(root)
+ if (root)
root->release();
}
@@ -189,7 +189,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
if (isType) {
// Class
int typeId = _typeNames.indexOf(qualifiedname);
- if(typeId == -1) {
+ if (typeId == -1) {
typeId = _typeNames.count();
_typeNames.append(qualifiedname);
}
@@ -214,7 +214,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
}
- if(!root) {
+ if (!root) {
root = obj;
states.pushObject(obj);
} else {
@@ -222,7 +222,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
Value *v = new Value;
v->object = obj;
v->line = line;
- if(state.property)
+ if (state.property)
state.property->addValue(v);
else
state.object->getDefaultProperty()->addValue(v);
@@ -235,7 +235,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
break;
}
QStringList str = name.split(QLatin1Char('.'));
- for(int ii = 0; ii < str.count(); ++ii) {
+ for (int ii = 0; ii < str.count(); ++ii) {
QString s = str.at(ii);
states.pushProperty(s, line);
}
@@ -253,7 +253,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
foreach(QXmlStreamAttribute attr, attrs) {
QStringList str = attr.name().toString().split(QLatin1Char('.'));
- for(int ii = 0; ii < str.count(); ++ii) {
+ for (int ii = 0; ii < str.count(); ++ii) {
QString s = str.at(ii);
states.pushProperty(s, line);
}
@@ -264,7 +264,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
v->line = reader.lineNumber();
state.property->addValue(v);
- for(int ii = str.count() - 1; ii >= 0; --ii)
+ for (int ii = str.count() - 1; ii >= 0; --ii)
states.pop();
}
}
@@ -280,24 +280,24 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
{
QString name = reader.name().toString();
Q_ASSERT(!name.isEmpty());
- if(name.at(0).isUpper() && !name.contains(QLatin1Char('.'))) {
+ if (name.at(0).isUpper() && !name.contains(QLatin1Char('.'))) {
// Class
states.pop();
} else {
// Property
QStringList str = name.split(QLatin1Char('.'));
- for(int ii = 0; ii < str.count(); ++ii)
+ for (int ii = 0; ii < str.count(); ++ii)
states.pop();
}
}
break;
case QXmlStreamReader::Characters:
- if(!reader.isWhitespace()) {
+ if (!reader.isWhitespace()) {
const QmlXmlParserState &state = states.top();
Value *v = new Value;
v->primitive = reader.text().toString();
v->line = reader.lineNumber();
- if(state.property)
+ if (state.property)
state.property->addValue(v);
else
state.object->getDefaultProperty()->addValue(v);
@@ -309,11 +309,11 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
case QXmlStreamReader::EntityReference:
break;
case QXmlStreamReader::ProcessingInstruction:
- if(reader.processingInstructionTarget() == QLatin1String("qtfx")) {
+ if (reader.processingInstructionTarget() == QLatin1String("qtfx")) {
QString str = reader.processingInstructionData().toString();
QString token, data;
int idx = str.indexOf(QLatin1Char(':'));
- if(-1 != idx) {
+ if (-1 != idx) {
token = str.left(idx);
data = str.mid(idx + 1);
} else {
@@ -324,7 +324,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
// <?qtfx namespacepath: namespace=path>
- if(token == QLatin1String("namespacepath")) {
+ if (token == QLatin1String("namespacepath")) {
int eq=data.indexOf(QLatin1Char('='));
if (eq>=0) {
_nameSpacePaths.insertMulti(data.left(eq),data.mid(eq+1));
@@ -338,7 +338,7 @@ bool QmlXmlParser::parse(const QByteArray &data, const QUrl &url)
}
}
- if(reader.hasError()) {
+ if (reader.hasError()) {
if (root) {
root->release();
root = 0;
@@ -379,7 +379,7 @@ QString QmlXmlParser::errorDescription() const
void QmlXmlParser::clear()
{
- if(root) {
+ if (root) {
root->release();
root = 0;
}
diff --git a/src/declarative/qml/script/generator/main.cpp b/src/declarative/qml/script/generator/main.cpp
index 676671f..a841cbc 100644
--- a/src/declarative/qml/script/generator/main.cpp
+++ b/src/declarative/qml/script/generator/main.cpp
@@ -72,7 +72,7 @@ void newState(QList<State> &states, const char *token, const char *lexem)
while(*lexem) {
int next = states[state].next[(int)*lexem];
- if(!next) {
+ if (!next) {
next = states.size();
states += State(character?"CHARACTER":"INCOMPLETE");
states[state].next[(int)*lexem] = next;
@@ -89,7 +89,7 @@ void newState(QList<State> &states, const char *token, const char *lexem)
void newState(QList<State> &states, const char *token, char lexem)
{
int next = states[0].next[(int)lexem];
- if(!next) {
+ if (!next) {
next = states.size();
states += State(token);
states[0].next[(int)lexem] = next;
@@ -111,11 +111,11 @@ int main()
newState(states, "CHARACTER", '_');
// add digits
- for(int cc = '0'; cc <= '9'; ++cc)
+ for (int cc = '0'; cc <= '9'; ++cc)
newState(states, "DIGIT", cc);
// keywords
- for(int ii = 0; keywords[ii].lexem; ++ii)
+ for (int ii = 0; keywords[ii].lexem; ++ii)
newState(states, keywords[ii].token, keywords[ii].lexem);
::printf("static const struct\n{\n"
@@ -123,9 +123,9 @@ int main()
" char next[128];\n"
"} keywords[] = {\n");
- for(int ii = 0; ii < states.size(); ++ii) {
+ for (int ii = 0; ii < states.size(); ++ii) {
printf("%s { %s, { ", ii?",\n":"", states[ii].token.data());
- for(int jj = 0; jj < 128; jj++)
+ for (int jj = 0; jj < 128; jj++)
printf("%s%d", jj?",":"", states[ii].next[jj]);
printf(" } }");
}
diff --git a/src/declarative/qml/script/qmlbasicscript.cpp b/src/declarative/qml/script/qmlbasicscript.cpp
index 4f40016..8b38e08 100644
--- a/src/declarative/qml/script/qmlbasicscript.cpp
+++ b/src/declarative/qml/script/qmlbasicscript.cpp
@@ -48,7 +48,7 @@ public:
static unsigned int alignRound(int s)
{
- if(s % 4)
+ if (s % 4)
s += 4 - (s % 4);
return s;
}
@@ -171,7 +171,7 @@ static QVariant fetch_value(QObject *o, int idx, int type)
break;
default:
{
- if(QmlMetaType::isObject(type)) {
+ if (QmlMetaType::isObject(type)) {
// NOTE: This assumes a cast to QObject does not alter the
// object pointer
QObject *val = 0;
@@ -180,7 +180,7 @@ static QVariant fetch_value(QObject *o, int idx, int type)
return QVariant::fromValue(val);
} else {
QVariant var = o->metaObject()->property(idx).read(o);
- if(QmlMetaType::isObject(var.userType())) {
+ if (QmlMetaType::isObject(var.userType())) {
QObject *obj = 0;
obj = *(QObject **)var.data();
var = QVariant::fromValue(obj);
@@ -299,7 +299,7 @@ QmlBasicScript::QmlBasicScript()
QmlBasicScript::QmlBasicScript(const char *data, QmlRefCount *owner)
: flags(0), d((QmlBasicScriptPrivate *)data), rc(owner)
{
- if(rc) rc->addref();
+ if (rc) rc->addref();
}
/*!
@@ -307,7 +307,7 @@ QmlBasicScript::QmlBasicScript(const char *data, QmlRefCount *owner)
*/
QByteArray QmlBasicScript::expression() const
{
- if(!d)
+ if (!d)
return QByteArray();
else
return QByteArray(d->expr());
@@ -318,9 +318,9 @@ QByteArray QmlBasicScript::expression() const
*/
QmlBasicScript::~QmlBasicScript()
{
- if(flags & QmlBasicScriptPrivate::OwnData)
+ if (flags & QmlBasicScriptPrivate::OwnData)
free(d);
- if(rc) rc->release();
+ if (rc) rc->release();
d = 0;
rc = 0;
}
@@ -331,9 +331,9 @@ QmlBasicScript::~QmlBasicScript()
*/
void QmlBasicScript::clear()
{
- if(flags & QmlBasicScriptPrivate::OwnData)
+ if (flags & QmlBasicScriptPrivate::OwnData)
free(d);
- if(rc) rc->release();
+ if (rc) rc->release();
d = 0;
rc = 0;
flags = 0;
@@ -345,7 +345,7 @@ void QmlBasicScript::clear()
*/
void *QmlBasicScript::newScriptState()
{
- if(!d) {
+ if (!d) {
return 0;
} else {
void *rv = ::malloc(d->stateSize * sizeof(QmlBasicScriptNodeCache));
@@ -359,7 +359,7 @@ void *QmlBasicScript::newScriptState()
*/
void QmlBasicScript::deleteScriptState(void *data)
{
- if(!data) return;
+ if (!data) return;
Q_ASSERT(d);
clearCache(data);
free(data);
@@ -370,12 +370,12 @@ void QmlBasicScript::deleteScriptState(void *data)
*/
void QmlBasicScript::dump()
{
- if(!d)
+ if (!d)
return;
qWarning() << d->instructionCount << "instructions:";
const char *data = d->data();
- for(int ii = 0; ii < d->instructionCount; ++ii) {
+ for (int ii = 0; ii < d->instructionCount; ++ii) {
const ScriptInstruction &instr = d->instructions()[ii];
switch(instr.type) {
@@ -438,7 +438,7 @@ bool QmlBasicScript::compile(const QByteArray &src)
*/
bool QmlBasicScript::compile(const char *src)
{
- if(!src) return false;
+ if (!src) return false;
QmlBasicScriptCompiler bsc;
bsc.script = this;
@@ -446,14 +446,14 @@ bool QmlBasicScript::compile(const char *src)
bsc.src = src;
// dumpTokens(src, bsc.tokens);
- if(d) {
- if(flags & QmlBasicScriptPrivate::OwnData)
+ if (d) {
+ if (flags & QmlBasicScriptPrivate::OwnData)
free(d);
d = 0;
flags = 0;
}
- if(bsc.compile()) {
+ if (bsc.compile()) {
int len = ::strlen(src);
flags = QmlBasicScriptPrivate::OwnData;
int size = sizeof(QmlBasicScriptPrivate) +
@@ -465,7 +465,7 @@ bool QmlBasicScript::compile(const char *src)
d->instructionCount = bsc.bytecode.count();
d->exprLen = len;
::memcpy((char *)d->expr(), src, len + 1);
- for(int ii = 0; ii < d->instructionCount; ++ii)
+ for (int ii = 0; ii < d->instructionCount; ++ii)
d->instructions()[ii] = bsc.bytecode.at(ii);
::memcpy((char *)d->data(), bsc.data.constData(), bsc.data.count());
}
@@ -481,21 +481,21 @@ void QmlBasicScriptCompiler::skipWhitespace()
bool QmlBasicScriptCompiler::compile()
{
- if(!compileExpr())
+ if (!compileExpr())
return false;
skipWhitespace();
- if(atEnd())
+ if (atEnd())
return true;
int t = token();
- if(t != AND)
+ if (t != AND)
return false;
adv();
skipWhitespace();
- if(!compileExpr())
+ if (!compileExpr())
return false;
ScriptInstruction instr;
@@ -513,12 +513,12 @@ bool QmlBasicScriptCompiler::compileExpr()
EXPRESSION := <NAME><OPERATOR>[<CONSTANT>|<NAME>]
*/
- if(!parseName())
+ if (!parseName())
return false;
skipWhitespace();
- if(atEnd())
+ if (atEnd())
return true;
int t = token();
@@ -539,7 +539,7 @@ bool QmlBasicScriptCompiler::compileExpr()
skipWhitespace();
- if(!parseConstant() &&
+ if (!parseConstant() &&
!parseName())
return false;
@@ -578,18 +578,18 @@ bool QmlBasicScriptCompiler::parseName()
bool pushed = false;
while(!atEnd()) {
int t = token();
- if(t == CHARACTER) {
+ if (t == CHARACTER) {
named = true;
seendot = false;
seenchar = true;
namestart = index();
adv();
- } else if(t == DIGIT) {
- if(!seenchar) break;
+ } else if (t == DIGIT) {
+ if (!seenchar) break;
adv();
- } else if(t == DOT) {
+ } else if (t == DOT) {
seendot = true;
- if(namestart == -1)
+ if (namestart == -1)
break;
seenchar = false;
@@ -598,7 +598,7 @@ bool QmlBasicScriptCompiler::parseName()
data.append(name);
data.append('\0');
ScriptInstruction instr;
- if(pushed)
+ if (pushed)
instr.type = ScriptInstruction::Fetch;
else
instr.type = ScriptInstruction::Load;
@@ -613,13 +613,13 @@ bool QmlBasicScriptCompiler::parseName()
}
}
- if(namestart != -1) {
+ if (namestart != -1) {
QByteArray name = string(namestart, index() - 1);
int nref = data.count();
data.append(name);
data.append('\0');
ScriptInstruction instr;
- if(pushed)
+ if (pushed)
instr.type = ScriptInstruction::Fetch;
else
instr.type = ScriptInstruction::Load;
@@ -629,7 +629,7 @@ bool QmlBasicScriptCompiler::parseName()
++stateSize;
}
- if(seendot)
+ if (seendot)
return false;
else
return named;
@@ -688,7 +688,7 @@ int QmlBasicScriptCompiler::index() const
QByteArray QmlBasicScriptCompiler::string(int from, int to)
{
QByteArray rv;
- for(int ii = from; ii <= to; ++ii) {
+ for (int ii = from; ii <= to; ++ii) {
const LexerToken &token = tokens.at(ii);
rv.append(QByteArray(src + token.start, token.end - token.start + 1));
}
@@ -703,8 +703,8 @@ void QmlBasicScript::clearCache(void *voidCache)
QmlBasicScriptNodeCache *dataCache =
reinterpret_cast<QmlBasicScriptNodeCache *>(voidCache);
- for(int ii = 0; ii < d->stateSize; ++ii) {
- if(!dataCache[ii].isCore() && !dataCache[ii].isExplicit() &&
+ for (int ii = 0; ii < d->stateSize; ++ii) {
+ if (!dataCache[ii].isCore() && !dataCache[ii].isExplicit() &&
dataCache[ii].object) {
QMetaObject::removeGuard(&dataCache[ii].object);
dataCache[ii].object = 0;
@@ -715,9 +715,9 @@ void QmlBasicScript::clearCache(void *voidCache)
void QmlBasicScript::guard(QmlBasicScriptNodeCache &n)
{
- if(n.object) {
- if(n.isExplicit()) {
- } else if(n.isCore()) {
+ if (n.object) {
+ if (n.isExplicit()) {
+ } else if (n.isCore()) {
n.metaObject =
n.object->metaObject();
} else {
@@ -750,7 +750,7 @@ bool QmlBasicScript::valid(QmlBasicScriptNodeCache &n, QObject *obj)
*/
QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *cached)
{
- if(!isValid())
+ if (!isValid())
return QVariant();
QmlBasicScriptNodeCache *dataCache =
@@ -763,7 +763,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
const char *data = d->data();
- if(dataCache[0].type == QmlBasicScriptNodeCache::Invalid) {
+ if (dataCache[0].type == QmlBasicScriptNodeCache::Invalid) {
resetting = true;
hasReset = true;
}
@@ -771,7 +771,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
CacheState state = NoChange;
dataCacheItem = 0;
- for(int idx = 0; idx < d->instructionCount; ++idx) {
+ for (int idx = 0; idx < d->instructionCount; ++idx) {
const ScriptInstruction &instr = d->instructions()[idx];
switch(instr.type) {
@@ -781,9 +781,9 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
const char *id = data + instr.fetch.idx;
QmlBasicScriptNodeCache &n = dataCache[dataCacheItem];
- if(instr.type == ScriptInstruction::Load) {
+ if (instr.type == ScriptInstruction::Load) {
- if(n.type == QmlBasicScriptNodeCache::Invalid) {
+ if (n.type == QmlBasicScriptNodeCache::Invalid) {
context->engine()->d_func()->loadCache(n, QLatin1String(id), static_cast<QmlContextPrivate*>(context->d_ptr));
state = Incremental;
}
@@ -792,9 +792,9 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
QVariant o = stack.pop();
QObject *obj = qvariant_cast<QObject *>(o);
- if(!obj) {
- if(n.type == QmlBasicScriptNodeCache::Invalid) {
- if(scriptWarnings())
+ if (!obj) {
+ if (n.type == QmlBasicScriptNodeCache::Invalid) {
+ if (scriptWarnings())
qWarning() << "QmlBasicScript: Unable to convert" << o;
*cached = state;
return QVariant();
@@ -804,11 +804,11 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
CacheState dummy;
return run(context, voidCache, &dummy);
}
- } else if(n.type == QmlBasicScriptNodeCache::Invalid) {
+ } else if (n.type == QmlBasicScriptNodeCache::Invalid) {
context->engine()->d_func()->fetchCache(n, QLatin1String(id), obj);
guard(n);
state = Incremental;
- } else if(!valid(n, obj)) {
+ } else if (!valid(n, obj)) {
clearCache(dataCache);
*cached = Reset;
CacheState dummy;
@@ -875,7 +875,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
*cached = state;
- if(stack.isEmpty())
+ if (stack.isEmpty())
return QVariant();
else
return stack.top();
@@ -895,7 +895,7 @@ const char *QmlBasicScript::compileData() const
*/
unsigned int QmlBasicScript::compileDataSize() const
{
- if(d)
+ if (d)
return d->size;
else
return 0;
@@ -903,7 +903,7 @@ unsigned int QmlBasicScript::compileDataSize() const
bool QmlBasicScript::isSingleLoad() const
{
- if(!d)
+ if (!d)
return false;
return d->instructionCount == 1 &&
@@ -912,7 +912,7 @@ bool QmlBasicScript::isSingleLoad() const
QByteArray QmlBasicScript::singleLoadTarget() const
{
- if(!isSingleLoad())
+ if (!isSingleLoad())
return QByteArray();
// We know there is one instruction and it is a load