diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-09-30 13:50:59 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-30 14:08:51 +0200 |
commit | d25745647aa4a1125c03eeba0efb8283cc0a5f91 (patch) | |
tree | d40a6e7e71339ff27200e40509947e3ebd054d8a /src | |
parent | 8f69461c480e10424401e95b16b507eec3e28e54 (diff) |
Declarative: Fix ASCII conversion warnings.
Change-Id: Ide43c1e37eeda8e5dc2c2d24b99c3b4f96e1b53e
Reviewed-on: http://codereview.qt-project.org/5867
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/items/context2d/qsgcontext2d.cpp | 28 | ||||
-rw-r--r-- | src/declarative/items/qsganimation.cpp | 6 | ||||
-rw-r--r-- | src/declarative/items/qsgspriteimage.cpp | 4 | ||||
-rw-r--r-- | src/declarative/particles/qsgparticlesmodule.cpp | 12 | ||||
-rw-r--r-- | src/declarative/particles/qsgparticlesystem.cpp | 4 | ||||
-rw-r--r-- | src/declarative/particles/qsgturbulence.cpp | 2 |
6 files changed, 30 insertions, 26 deletions
diff --git a/src/declarative/items/context2d/qsgcontext2d.cpp b/src/declarative/items/context2d/qsgcontext2d.cpp index 71cc9dc0c9..e9cf65de84 100644 --- a/src/declarative/items/context2d/qsgcontext2d.cpp +++ b/src/declarative/items/context2d/qsgcontext2d.cpp @@ -829,10 +829,10 @@ static v8::Handle<v8::Value> ctx2d_fillStyle(v8::Local<v8::String>, const v8::Ac if (color.alpha() == 255) return engine->toString(color.name()); QString alphaString = QString::number(color.alphaF(), 'f'); - while (alphaString.endsWith('0')) + while (alphaString.endsWith(QLatin1Char('0'))) alphaString.chop(1); - if (alphaString.endsWith('.')) - alphaString += '0'; + if (alphaString.endsWith(QLatin1Char('.'))) + alphaString += QLatin1Char('0'); return engine->toString(QString::fromLatin1("rgba(%1, %2, %3, %4)").arg(color.red()).arg(color.green()).arg(color.blue()).arg(alphaString)); } return r->context->m_fillStyle; @@ -898,10 +898,10 @@ static void ctx2d_fillRule_set(v8::Local<v8::String>, v8::Local<v8::Value> value QV8Engine *engine = V8ENGINE_ACCESSOR(); - if ((value->IsString() && engine->toString(value) == "WindingFill") + if ((value->IsString() && engine->toString(value) == QStringLiteral("WindingFill")) ||(value->IsNumber() && value->NumberValue() == Qt::WindingFill)) { r->context->state.fillRule = Qt::WindingFill; - } else if ((value->IsString() && engine->toString(value) == "OddEvenFill") + } else if ((value->IsString() && engine->toString(value) == QStringLiteral("OddEvenFill")) ||(value->IsNumber() && value->NumberValue() == Qt::OddEvenFill)) { r->context->state.fillRule = Qt::OddEvenFill; } else { @@ -934,10 +934,10 @@ v8::Handle<v8::Value> ctx2d_strokeStyle(v8::Local<v8::String>, const v8::Accesso if (color.alpha() == 255) return engine->toString(color.name()); QString alphaString = QString::number(color.alphaF(), 'f'); - while (alphaString.endsWith('0')) + while (alphaString.endsWith(QLatin1Char('0'))) alphaString.chop(1); - if (alphaString.endsWith('.')) - alphaString += '0'; + if (alphaString.endsWith(QLatin1Char('.'))) + alphaString += QLatin1Char('0'); return engine->toString(QString::fromLatin1("rgba(%1, %2, %3, %4)").arg(color.red()).arg(color.green()).arg(color.blue()).arg(alphaString)); } return r->context->m_strokeStyle; @@ -1177,14 +1177,14 @@ static v8::Handle<v8::Value> ctx2d_createPattern(const v8::Arguments &args) styleResouce->brush.setTextureImage(patternTexture); QString repetition = engine->toString(args[1]); - if (repetition == "repeat" || repetition.isEmpty()) { + if (repetition == QStringLiteral("repeat") || repetition.isEmpty()) { styleResouce->patternRepeatX = true; styleResouce->patternRepeatY = true; - } else if (repetition == "repeat-x") { + } else if (repetition == QStringLiteral("repeat-x")) { styleResouce->patternRepeatX = true; - } else if (repetition == "repeat-y") { + } else if (repetition == QStringLiteral("repeat-y")) { styleResouce->patternRepeatY = true; - } else if (repetition == "no-repeat") { + } else if (repetition == QStringLiteral("no-repeat")) { styleResouce->patternRepeatY = false; styleResouce->patternRepeatY = false; } else { @@ -3320,7 +3320,7 @@ void QSGContext2D::reset() newState.textAlign = QSGContext2D::Start; newState.textBaseline = QSGContext2D::Alphabetic; - m_fontString = ""; + m_fontString.clear(); m_stateStack.clear(); m_stateStack.push(newState); popState(); @@ -3347,4 +3347,4 @@ void QSGContext2D::setV8Engine(QV8Engine *engine) } } -QT_END_NAMESPACE
\ No newline at end of file +QT_END_NAMESPACE diff --git a/src/declarative/items/qsganimation.cpp b/src/declarative/items/qsganimation.cpp index 59c9fe383b..e57edbd2c8 100644 --- a/src/declarative/items/qsganimation.cpp +++ b/src/declarative/items/qsganimation.cpp @@ -722,8 +722,8 @@ void QSGPathAnimationUpdater::setValue(qreal v) } //### could cache properties rather than reconstructing each time - QDeclarativePropertyPrivate::write(QDeclarativeProperty(target, "x"), currentPos.x(), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); - QDeclarativePropertyPrivate::write(QDeclarativeProperty(target, "y"), currentPos.y(), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(QDeclarativeProperty(target, QStringLiteral("x")), currentPos.x(), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(QDeclarativeProperty(target, QStringLiteral("y")), currentPos.y(), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); //adjust angle according to orientation if (!fixed) { @@ -774,7 +774,7 @@ void QSGPathAnimationUpdater::setValue(qreal v) else if (v > exitStart) angle = endRotation * (v - exitStart) / exitInterval + angle * (exitInterval - (v - exitStart)) / exitInterval; } - QDeclarativePropertyPrivate::write(QDeclarativeProperty(target, "rotation"), angle, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(QDeclarativeProperty(target, QStringLiteral("rotation")), angle, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } /* diff --git a/src/declarative/items/qsgspriteimage.cpp b/src/declarative/items/qsgspriteimage.cpp index 8f3256efb6..1814bc1d2c 100644 --- a/src/declarative/items/qsgspriteimage.cpp +++ b/src/declarative/items/qsgspriteimage.cpp @@ -98,11 +98,11 @@ class SpriteMaterialData : public QSGMaterialShader public: SpriteMaterialData(const char *vertexFile = 0, const char *fragmentFile = 0) { - QFile vf(vertexFile ? vertexFile : ":defaultshaders/spriteimagevertex.shader"); + QFile vf(vertexFile ? QLatin1String(vertexFile) : QLatin1String(":defaultshaders/spriteimagevertex.shader")); vf.open(QFile::ReadOnly); m_vertex_code = vf.readAll(); - QFile ff(fragmentFile ? fragmentFile : ":defaultshaders/spriteimagefragment.shader"); + QFile ff(fragmentFile ? QLatin1String(fragmentFile) : QLatin1String(":defaultshaders/spriteimagefragment.shader")); ff.open(QFile::ReadOnly); m_fragment_code = ff.readAll(); diff --git a/src/declarative/particles/qsgparticlesmodule.cpp b/src/declarative/particles/qsgparticlesmodule.cpp index f880842acb..362a361c66 100644 --- a/src/declarative/particles/qsgparticlesmodule.cpp +++ b/src/declarative/particles/qsgparticlesmodule.cpp @@ -106,10 +106,14 @@ void QSGParticlesModule::defineModule() qmlRegisterType<QSGTargetAffector>(uri, 2, 0 , "Target"); //Exposed just for completeness - qmlRegisterUncreatableType<QSGParticleAffector>(uri, 2, 0, "ParticleAffector", "Abstract type. Use one of the inheriting types instead."); - qmlRegisterUncreatableType<QSGParticlePainter>(uri, 2, 0, "ParticlePainter", "Abstract type. Use one of the inheriting types instead."); - qmlRegisterUncreatableType<QSGParticleExtruder>(uri, 2, 0, "ParticleExtruder", "Abstract type. Use one of the inheriting types instead."); - qmlRegisterUncreatableType<QSGDirection>(uri, 2, 0, "NullVector", "Abstract type. Use one of the inheriting types instead."); + qmlRegisterUncreatableType<QSGParticleAffector>(uri, 2, 0, "ParticleAffector", + QStringLiteral("Abstract type. Use one of the inheriting types instead.")); + qmlRegisterUncreatableType<QSGParticlePainter>(uri, 2, 0, "ParticlePainter", + QStringLiteral("Abstract type. Use one of the inheriting types instead.")); + qmlRegisterUncreatableType<QSGParticleExtruder>(uri, 2, 0, "ParticleExtruder", + QStringLiteral("Abstract type. Use one of the inheriting types instead.")); + qmlRegisterUncreatableType<QSGDirection>(uri, 2, 0, "NullVector", + QStringLiteral("Abstract type. Use one of the inheriting types instead.")); } QT_END_NAMESPACE diff --git a/src/declarative/particles/qsgparticlesystem.cpp b/src/declarative/particles/qsgparticlesystem.cpp index 78e37e7fff..9190bd47d3 100644 --- a/src/declarative/particles/qsgparticlesystem.cpp +++ b/src/declarative/particles/qsgparticlesystem.cpp @@ -635,7 +635,7 @@ void QSGParticleSystem::initGroups() QSGParticleGroupData* gd = new QSGParticleGroupData(0, this);//Default group groupData.insert(0,gd); - groupIds.insert("",0); + groupIds.insert(QString(), 0); m_nextGroupId = 1; } @@ -802,7 +802,7 @@ void QSGParticleSystem::loadPainter(QObject *p) int particleCount = 0; if (painter->groups().isEmpty()){//Uses default particle QStringList def; - def << ""; + def << QString(); painter->setGroups(def); particleCount += groupData[0]->size(); groupData[0]->painters << painter; diff --git a/src/declarative/particles/qsgturbulence.cpp b/src/declarative/particles/qsgturbulence.cpp index a5a2410315..1cac833170 100644 --- a/src/declarative/particles/qsgturbulence.cpp +++ b/src/declarative/particles/qsgturbulence.cpp @@ -140,7 +140,7 @@ void QSGTurbulenceAffector::initializeGrid() if (!m_noiseSource.isEmpty()) image = QImage(m_noiseSource.toLocalFile()).scaled(QSize(m_gridSize, m_gridSize)); if (image.isNull()) - image = QImage(":defaultshaders/noise.png").scaled(QSize(m_gridSize, m_gridSize)); + image = QImage(QStringLiteral(":defaultshaders/noise.png")).scaled(QSize(m_gridSize, m_gridSize)); for (int i=0; i<m_gridSize; i++) for (int j=0; j<m_gridSize; j++) |