Merge remote branch 'origin/2.0'

Conflicts:
	src/shared/proparser/profileevaluator.cpp
This commit is contained in:
Oswald Buddenhagen
2010-06-24 15:17:28 +02:00
4 changed files with 39 additions and 9 deletions

View File

@@ -10,6 +10,7 @@ class QmlProjectItemPrivate : public QObject {
public: public:
QString sourceDirectory; QString sourceDirectory;
QStringList importPaths; QStringList importPaths;
QStringList absoluteImportPaths;
QList<QmlFileFilterItem*> qmlFileFilters() const; QList<QmlFileFilterItem*> qmlFileFilters() const;
@@ -77,23 +78,34 @@ void QmlProjectItem::setSourceDirectory(const QString &directoryPath)
} }
} }
setImportPaths(d->importPaths);
emit sourceDirectoryChanged(); emit sourceDirectoryChanged();
} }
QStringList QmlProjectItem::importPaths() const QStringList QmlProjectItem::importPaths() const
{ {
Q_D(const QmlProjectItem); Q_D(const QmlProjectItem);
return d->importPaths; return d->absoluteImportPaths;
} }
void QmlProjectItem::setImportPaths(const QStringList &importPaths) void QmlProjectItem::setImportPaths(const QStringList &importPaths)
{ {
Q_D(QmlProjectItem); Q_D(QmlProjectItem);
if (d->importPaths == importPaths) if (d->importPaths != importPaths)
d->importPaths = importPaths;
// convert to absolute paths
QStringList absoluteImportPaths;
const QDir sourceDir(sourceDirectory());
foreach (const QString &importPath, importPaths)
absoluteImportPaths += QDir::cleanPath(sourceDir.absoluteFilePath(importPath));
if (d->absoluteImportPaths == absoluteImportPaths)
return; return;
d->importPaths = importPaths; d->absoluteImportPaths = absoluteImportPaths;
emit importPathsChanged(); emit importPathsChanged();
} }

View File

@@ -1048,11 +1048,29 @@ void ProFileEvaluator::Private::visitProVariable(
m_filevaluemap[currentProFile()][varName] = varVal; m_filevaluemap[currentProFile()][varName] = varVal;
} }
} else { } else {
// We are greedy for values.
zipEmpty(&varVal); zipEmpty(&varVal);
valuesRef(varName) += varVal; if (!varVal.isEmpty()) {
// We are greedy for values. But avoid exponential growth.
ProStringList &v = valuesRef(varName);
if (v.isEmpty()) {
v = varVal;
} else {
ProStringList old = v;
v = varVal;
QSet<ProString> has;
has.reserve(v.size());
foreach (const ProString &s, v)
has.insert(s);
v.reserve(v.size() + old.size());
foreach (const ProString &s, old)
if (!has.contains(s))
v << s;
}
// These values will not be used for further processing inside
// the evaluator. Duplicate elimination happens later.
m_filevaluemap[currentProFile()][varName] += varVal; m_filevaluemap[currentProFile()][varName] += varVal;
} }
}
break; break;
case TokAppendUnique: // *= case TokAppendUnique: // *=
if (!m_skipLevel || m_cumulative) { if (!m_skipLevel || m_cumulative) {
@@ -3140,7 +3158,7 @@ ProFileEvaluator::TemplateType ProFileEvaluator::templateType() const
{ {
const ProStringList &templ = d->values(statics.strTEMPLATE); const ProStringList &templ = d->values(statics.strTEMPLATE);
if (templ.count() >= 1) { if (templ.count() >= 1) {
const QString &t = templ.last().toQString(); const QString &t = templ.at(0).toQString();
if (!t.compare(QLatin1String("app"), Qt::CaseInsensitive)) if (!t.compare(QLatin1String("app"), Qt::CaseInsensitive))
return TT_Application; return TT_Application;
if (!t.compare(QLatin1String("lib"), Qt::CaseInsensitive)) if (!t.compare(QLatin1String("lib"), Qt::CaseInsensitive))