diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-01-27 16:25:41 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-01-27 16:33:53 (GMT) |
commit | f300f5cfdf3b32e687191b071c30e14ac2721fc8 (patch) | |
tree | caadd977fc6485da3d5b1600473b6d5c1b998978 /tools/linguist | |
parent | 2a8fd7584590016dbe22fb74f440e71a2578dc81 (diff) | |
download | Qt-f300f5cfdf3b32e687191b071c30e14ac2721fc8.zip Qt-f300f5cfdf3b32e687191b071c30e14ac2721fc8.tar.gz Qt-f300f5cfdf3b32e687191b071c30e14ac2721fc8.tar.bz2 |
add directories with sources to list of project roots
if the pro file for the translations lives in a sibling tree of the
actual source tree, messages from included headers wouldn't have been
collected, as they were not considered part of the project.
Task-number: QTBUG-7495
Diffstat (limited to 'tools/linguist')
-rw-r--r-- | tools/linguist/lupdate/main.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index fd9c696..a50c97a 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -317,9 +317,18 @@ static void processProject( cd.m_codecForSource = codecForSource; cd.m_includePath = visitor.values(QLatin1String("INCLUDEPATH")); QStringList sourceFiles = getSources(visitor, pfi.absolutePath()); - QSet<QString> projectRoots; - projectRoots.insert(QDir::cleanPath(pfi.absolutePath()) + QLatin1Char('/')); - cd.m_projectRoots = projectRoots; + QSet<QString> sourceDirs; + sourceDirs.insert(QDir::cleanPath(pfi.absolutePath()) + QLatin1Char('/')); + foreach (const QString &sf, sourceFiles) + sourceDirs.insert(sf.left(sf.lastIndexOf(QLatin1Char('/')) + 1)); + QStringList rootList = sourceDirs.toList(); + rootList.sort(); + for (int prev = 0, curr = 1; curr < rootList.length(); ) + if (rootList.at(curr).startsWith(rootList.at(prev))) + rootList.removeAt(curr); + else + prev = curr++; + cd.m_projectRoots = QSet<QString>::fromList(rootList); processSources(*fetchedTor, sourceFiles, cd); } } |