26 #include "hblayoutparameters_p.h" |
26 #include "hblayoutparameters_p.h" |
27 #include "hbsharedcache_p.h" |
27 #include "hbsharedcache_p.h" |
28 #include "hbmemoryutils_p.h" |
28 #include "hbmemoryutils_p.h" |
29 #include "hbdeviceprofile.h" |
29 #include "hbdeviceprofile.h" |
30 #include "hbmemorymanager_p.h" |
30 #include "hbmemorymanager_p.h" |
|
31 #include "hbhash_p.h" |
31 #include <QtAlgorithms> |
32 #include <QtAlgorithms> |
32 |
33 |
33 static const QString GLOBAL_PARAMETERS_LOCATION = |
34 static const QString GLOBAL_PARAMETERS_LOCATION = |
34 QLatin1String(":/themes/style/hbdefault/variables/layout/zoom/0/hbglobalparameters.css"); |
35 QLatin1String(":/themes/style/hbdefault/variables/layout/zoom/0/hbglobalparameters.css"); |
35 |
36 |
138 const HbVector<HbCss::Declaration> &decls = styleSheet->variableRules.at(i).declarations; |
139 const HbVector<HbCss::Declaration> &decls = styleSheet->variableRules.at(i).declarations; |
139 const int declsCount = decls.count(); |
140 const int declsCount = decls.count(); |
140 for (int j = 0; j < declsCount; ++j) { |
141 for (int j = 0; j < declsCount; ++j) { |
141 const HbCss::Declaration &decl = decls.at(j); |
142 const HbCss::Declaration &decl = decls.at(j); |
142 QString parameterName(decl.property); |
143 QString parameterName(decl.property); |
143 quint32 hash = HbSharedCache::hash(QStringRef(¶meterName)); |
144 quint32 hash = hbHash(QStringRef(¶meterName)); |
144 qptrdiff valueOffset = manager->alloc(sizeof(HbCss::Value)); |
145 qptrdiff valueOffset = manager->alloc(sizeof(HbCss::Value)); |
145 new ((char*)manager->base() + valueOffset) HbCss::Value(decl.values.at(0)); |
146 new ((char*)manager->base() + valueOffset) HbCss::Value(decl.values.at(0)); |
146 mItems.append(HbParameterItem(hash, valueOffset, mNames.size(), false)); |
147 mItems.append(HbParameterItem(hash, valueOffset, mNames.size(), false)); |
147 QByteArray latinName(parameterName.toLatin1()); |
148 QByteArray latinName(parameterName.toLatin1()); |
148 mNames.append(latinName.constData(), latinName.length() + 1); |
149 mNames.append(latinName.constData(), latinName.length() + 1); |
149 } |
150 } |
150 } |
151 } |
151 //add special variables |
152 //add special variables |
152 for(int i = 0; i < specialVariables.count(); ++i) { |
153 for(int i = 0; i < specialVariables.count(); ++i) { |
153 quint32 hash = HbSharedCache::hash(QStringRef(&specialVariables.at(i))); |
154 quint32 hash = hbHash(QStringRef(&specialVariables.at(i))); |
154 mItems.append(HbParameterItem(hash, i, mNames.size(), true)); |
155 mItems.append(HbParameterItem(hash, i, mNames.size(), true)); |
155 QByteArray latinName(specialVariables.at(0).toLatin1()); |
156 QByteArray latinName(specialVariables.at(0).toLatin1()); |
156 mNames.append(latinName.constData(), latinName.length() + 1); |
157 mNames.append(latinName.constData(), latinName.length() + 1); |
157 } |
158 } |
158 |
159 |
184 } |
185 } |
185 } |
186 } |
186 |
187 |
187 HbLayoutParameters::const_iterator HbLayoutParameters::find(const QString ¶meter) const |
188 HbLayoutParameters::const_iterator HbLayoutParameters::find(const QString ¶meter) const |
188 { |
189 { |
189 quint32 parameterHash = HbSharedCache::hash(QStringRef(¶meter)); |
190 return find(hbHash(parameter)); |
190 return qBinaryFind(begin(), end(), HbParameterItem(parameterHash, 0, 0, 0)); |
191 } |
|
192 |
|
193 HbLayoutParameters::const_iterator HbLayoutParameters::find(quint32 hashValue) const |
|
194 { |
|
195 return qBinaryFind(begin(), end(), HbParameterItem(hashValue, 0, 0, 0)); |
191 } |
196 } |
192 |
197 |
193 #endif //#ifndef HB_BIN_CSS |
198 #endif //#ifndef HB_BIN_CSS |