From: Oswald Buddenhagen Date: Mon, 19 Aug 2013 16:54:03 +0000 (+0200) Subject: collect messages from INSTALL and DEPLOYMENT file lists X-Git-Tag: accepted/tizen/20131212.181521~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=140fa19ad926f15246c8a501f8a3ccdeda4c5420;p=platform%2Fupstream%2Fqttools.git collect messages from INSTALL and DEPLOYMENT file lists Task-number: QTBUG-14056 Change-Id: I1e014885f92b8587462d926e552834915fc1be60 Reviewed-by: hjk Reviewed-by: Oswald Buddenhagen --- diff --git a/src/linguist/lupdate/main.cpp b/src/linguist/lupdate/main.cpp index dd2133d..c0d20fa 100644 --- a/src/linguist/lupdate/main.cpp +++ b/src/linguist/lupdate/main.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -437,6 +438,41 @@ static QStringList getSources(const ProFileEvaluator &visitor, const QString &pr vPathsInc.removeDuplicates(); sourceFiles += visitor.absoluteFileValues(QLatin1String("HEADERS"), projectDir, vPathsInc, 0); + QStringList installs = visitor.values(QLatin1String("INSTALLS")) + + visitor.values(QLatin1String("DEPLOYMENT")); + installs.removeDuplicates(); + QDir baseDir(projectDir); + foreach (const QString inst, installs) { + foreach (const QString &file, visitor.values(inst + QLatin1String(".files"))) { + QFileInfo info(file); + if (!info.isAbsolute()) + info.setFile(baseDir.absoluteFilePath(file)); + QStringList nameFilter; + QString searchPath; + if (info.isDir()) { + nameFilter << QLatin1String("*"); + searchPath = info.filePath(); + } else { + nameFilter << info.fileName(); + searchPath = info.path(); + } + + QDirIterator iterator(searchPath, nameFilter, + QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks, + QDirIterator::Subdirectories); + while (iterator.hasNext()) { + iterator.next(); + QFileInfo cfi = iterator.fileInfo(); + QString ext = cfi.suffix(); + if (ext == QLatin1String("qml") + || ext == QLatin1String("js") || ext == QLatin1String("qs") + || ext == QLatin1String("ui") || ext == QLatin1String("jui")) { + sourceFiles << cfi.filePath(); + } + } + } + } + sourceFiles.removeDuplicates(); sourceFiles.sort(); diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/main.qml b/tests/auto/linguist/lupdate/testdata/good/proparsing/main.qml new file mode 100644 index 0000000..36cc5f0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/main.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +QtObject { + function translate() { + qsTr("From QML file in root"); + } +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro index a63c4e3..7c6ad99 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.pro @@ -28,4 +28,7 @@ if (exists($$member($$(PATH), 0))) { SOURCES += main_dependpath.cpp } +inst.files = qml *.qml +INSTALLS += inst + TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.ts.result index eb9119d..391f2f9 100644 --- a/tests/auto/linguist/lupdate/testdata/good/proparsing/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/project.ts.result @@ -61,4 +61,20 @@ + + main + + + From QML file in root + + + + + notmain + + + From QML file in qml + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/excluded.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/excluded.cpp new file mode 100644 index 0000000..2d1b144 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/excluded.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +int main(int argc, char **argv) +{ + QString fake = QApplication::tr("fake", "This message will not be collected"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/notmain.qml b/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/notmain.qml new file mode 100644 index 0000000..1a40221 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/proparsing/qml/notmain.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +QtObject { + function translate() { + qsTr("From QML file in qml"); + } +}