From 20d14f201e2066b3d738dd15e5cb1ca3b1d2f925 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 10 Oct 2016 10:20:11 +0200 Subject: windeployqt: Fix temporary file leak Set FILE_FLAG_DELETE_ON_CLOSE on the files used for redirectoring process outputs. Task-number: QTBUG-56268 Change-Id: Ia0b25ed9067e0a40a9b83dc7d10a9cf15ac63b70 Reviewed-by: Maurice Kalinowski --- src/windeployqt/utils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/windeployqt/utils.cpp b/src/windeployqt/utils.cpp index a29b38bbd..7dd19ae07 100644 --- a/src/windeployqt/utils.cpp +++ b/src/windeployqt/utils.cpp @@ -197,7 +197,8 @@ static HANDLE createInheritableTemporaryFile() securityAttributes.bInheritHandle = TRUE; return CreateFile(name, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, &securityAttributes, - TRUNCATE_EXISTING, FILE_ATTRIBUTE_TEMPORARY, NULL); + TRUNCATE_EXISTING, + FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE, NULL); } // runProcess helper: Rewind and read out a temporary file for stdout/stderr. -- cgit v1.2.1 From ce463a102fb6799b825a505cbe4b5bda3d62a369 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 5 Aug 2016 13:37:17 +0200 Subject: Qt Designer: Update logo icon used for iconless custom plugins Replace the single size Qt logo by a series of icons, providing higher resolutions for High DPI. Task-number: QTBUG-55137 Change-Id: Ib128f679a8d9c6ce39ec0ae76c0d569d142aa636 Reviewed-by: Jarek Kobus Reviewed-by: Alessandro Portale --- src/designer/src/components/formeditor/formeditor.qrc | 5 ++++- .../src/components/formeditor/images/qtlogo.png | Bin 594 -> 0 bytes .../src/components/formeditor/images/qtlogo16x16.png | Bin 0 -> 1263 bytes .../src/components/formeditor/images/qtlogo24x24.png | Bin 0 -> 349 bytes .../src/components/formeditor/images/qtlogo32x32.png | Bin 0 -> 15518 bytes .../src/components/formeditor/images/qtlogo64x64.png | Bin 0 -> 1936 bytes 6 files changed, 4 insertions(+), 1 deletion(-) delete mode 100644 src/designer/src/components/formeditor/images/qtlogo.png create mode 100644 src/designer/src/components/formeditor/images/qtlogo16x16.png create mode 100644 src/designer/src/components/formeditor/images/qtlogo24x24.png create mode 100644 src/designer/src/components/formeditor/images/qtlogo32x32.png create mode 100644 src/designer/src/components/formeditor/images/qtlogo64x64.png diff --git a/src/designer/src/components/formeditor/formeditor.qrc b/src/designer/src/components/formeditor/formeditor.qrc index 38fbb6200..351658088 100644 --- a/src/designer/src/components/formeditor/formeditor.qrc +++ b/src/designer/src/components/formeditor/formeditor.qrc @@ -61,7 +61,10 @@ images/mac/forward.png images/mac/down.png images/mac/up.png - images/qtlogo.png + images/qtlogo16x16.png + images/qtlogo24x24.png + images/qtlogo32x32.png + images/qtlogo64x64.png images/qt3logo.png images/resetproperty.png images/cleartext.png diff --git a/src/designer/src/components/formeditor/images/qtlogo.png b/src/designer/src/components/formeditor/images/qtlogo.png deleted file mode 100644 index 7d472572b..000000000 Binary files a/src/designer/src/components/formeditor/images/qtlogo.png and /dev/null differ diff --git a/src/designer/src/components/formeditor/images/qtlogo16x16.png b/src/designer/src/components/formeditor/images/qtlogo16x16.png new file mode 100644 index 000000000..30bcb45ed Binary files /dev/null and b/src/designer/src/components/formeditor/images/qtlogo16x16.png differ diff --git a/src/designer/src/components/formeditor/images/qtlogo24x24.png b/src/designer/src/components/formeditor/images/qtlogo24x24.png new file mode 100644 index 000000000..058bf6972 Binary files /dev/null and b/src/designer/src/components/formeditor/images/qtlogo24x24.png differ diff --git a/src/designer/src/components/formeditor/images/qtlogo32x32.png b/src/designer/src/components/formeditor/images/qtlogo32x32.png new file mode 100644 index 000000000..d609c1e1e Binary files /dev/null and b/src/designer/src/components/formeditor/images/qtlogo32x32.png differ diff --git a/src/designer/src/components/formeditor/images/qtlogo64x64.png b/src/designer/src/components/formeditor/images/qtlogo64x64.png new file mode 100644 index 000000000..3bc03b7c7 Binary files /dev/null and b/src/designer/src/components/formeditor/images/qtlogo64x64.png differ -- cgit v1.2.1 From 6b6b7786cfe0a90aaed359bafb7a9be2bd0502f9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 5 Aug 2016 13:39:22 +0200 Subject: Qt Designer: Introduce utility function for the Qt logo icon Add a function qtLogoIcon() returning a multi-size icon to iconloader_p.h. Adapt the plugin dialog and widget box so that the logo icon is returned for empty icon names. Task-number: QTBUG-55137 Change-Id: If6843e75577b05c3bfcedf976849eba88b914547 Reviewed-by: Jarek Kobus Reviewed-by: Friedemann Kleint --- .../components/widgetbox/widgetboxtreewidget.cpp | 4 +--- src/designer/src/lib/shared/iconloader.cpp | 21 +++++++++++++++++++++ src/designer/src/lib/shared/iconloader_p.h | 1 + src/designer/src/lib/shared/plugindialog.cpp | 11 ++--------- src/designer/src/lib/shared/plugindialog_p.h | 1 - 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp index 9f82dec5e..d331617d4 100644 --- a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp +++ b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp @@ -115,7 +115,7 @@ WidgetBoxTreeWidget::WidgetBoxTreeWidget(QDesignerFormEditorInterface *core, QWi QIcon WidgetBoxTreeWidget::iconForWidget(QString iconName) const { if (iconName.isEmpty()) - iconName = QLatin1String(qtLogoC); + return qdesigner_internal::qtLogoIcon(); if (iconName.startsWith(QLatin1String(iconPrefixC))) { const IconCache::const_iterator it = m_pluginIcons.constFind(iconName); @@ -652,8 +652,6 @@ WidgetBoxTreeWidget::CategoryList WidgetBoxTreeWidget::loadCustomCategoryList() icon_name = iconPrefix; icon_name += pluginName; m_pluginIcons.insert(icon_name, icon); - } else { - icon_name = QLatin1String(qtLogoC); } cat.addWidget(Widget(displayName, dom_xml, icon_name, Widget::Custom)); diff --git a/src/designer/src/lib/shared/iconloader.cpp b/src/designer/src/lib/shared/iconloader.cpp index 5259d93cc..c1c476df1 100644 --- a/src/designer/src/lib/shared/iconloader.cpp +++ b/src/designer/src/lib/shared/iconloader.cpp @@ -65,6 +65,27 @@ QDESIGNER_SHARED_EXPORT QIcon emptyIcon() return QIcon(QStringLiteral(":/qt-project.org/formeditor/images/emptyicon.png")); } +static QIcon buildIcon(const QString &prefix, const int *sizes, size_t sizeCount) +{ + QIcon result; + for (size_t i = 0; i < sizeCount; ++i) { + const QString size = QString::number(sizes[i]); + const QPixmap pixmap(prefix + size + QLatin1Char('x') + size + QStringLiteral(".png")); + Q_ASSERT(!pixmap.size().isEmpty()); + result.addPixmap(pixmap); + } + return result; +} + +QDESIGNER_SHARED_EXPORT QIcon qtLogoIcon() +{ + static const int sizes[] = {16, 24, 32, 64}; + static const QIcon result = + buildIcon(QStringLiteral(":/qt-project.org/formeditor/images/qtlogo"), + sizes, sizeof(sizes) / sizeof(sizes[0])); + return result; +} + } // namespace qdesigner_internal QT_END_NAMESPACE diff --git a/src/designer/src/lib/shared/iconloader_p.h b/src/designer/src/lib/shared/iconloader_p.h index bde7304cc..fe9c5ca07 100644 --- a/src/designer/src/lib/shared/iconloader_p.h +++ b/src/designer/src/lib/shared/iconloader_p.h @@ -56,6 +56,7 @@ namespace qdesigner_internal { QDESIGNER_SHARED_EXPORT QIcon createIconSet(const QString &name); QDESIGNER_SHARED_EXPORT QIcon emptyIcon(); +QDESIGNER_SHARED_EXPORT QIcon qtLogoIcon(); } // namespace qdesigner_internal diff --git a/src/designer/src/lib/shared/plugindialog.cpp b/src/designer/src/lib/shared/plugindialog.cpp index 8102aa872..fd69c105d 100644 --- a/src/designer/src/lib/shared/plugindialog.cpp +++ b/src/designer/src/lib/shared/plugindialog.cpp @@ -34,6 +34,7 @@ #include "plugindialog_p.h" #include "pluginmanager_p.h" +#include "iconloader_p.h" #include #include @@ -134,14 +135,6 @@ void PluginDialog::populateTreeWidget() } } -QIcon PluginDialog::pluginIcon(const QIcon &icon) -{ - if (icon.isNull()) - return QIcon(QStringLiteral(":/qt-project.org/formeditor/images/qtlogo.png")); - - return icon; -} - QTreeWidgetItem* PluginDialog::setTopLevelItem(const QString &itemName) { QTreeWidgetItem *topLevelItem = new QTreeWidgetItem(ui.treeWidget); @@ -175,7 +168,7 @@ void PluginDialog::setItem(QTreeWidgetItem *pluginItem, const QString &name, item->setText(0, name); item->setToolTip(0, toolTip); item->setWhatsThis(0, whatsThis); - item->setIcon(0, pluginIcon(icon)); + item->setIcon(0, icon.isNull() ? qtLogoIcon() : icon); } void PluginDialog::updateCustomWidgetPlugins() diff --git a/src/designer/src/lib/shared/plugindialog_p.h b/src/designer/src/lib/shared/plugindialog_p.h index d5cb36973..77060f9fe 100644 --- a/src/designer/src/lib/shared/plugindialog_p.h +++ b/src/designer/src/lib/shared/plugindialog_p.h @@ -64,7 +64,6 @@ private slots: private: void populateTreeWidget(); - QIcon pluginIcon(const QIcon &icon); QTreeWidgetItem* setTopLevelItem(const QString &itemName); QTreeWidgetItem* setPluginItem(QTreeWidgetItem *topLevelItem, const QString &itemName, const QFont &font); -- cgit v1.2.1 From 64e22217e166861e5f21a4a171357265e9746497 Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Fri, 7 Oct 2016 14:20:05 +0200 Subject: designer-manual.qdoc: Fix typo in documentation Change-Id: I46c41a94ab1429e527ef01e342ee3f6578fa1876 Reviewed-by: Frederik Gladhorn Reviewed-by: Friedemann Kleint --- src/designer/src/designer/doc/src/designer-manual.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/designer/src/designer/doc/src/designer-manual.qdoc b/src/designer/src/designer/doc/src/designer-manual.qdoc index e318229c8..3ab8160d3 100644 --- a/src/designer/src/designer/doc/src/designer-manual.qdoc +++ b/src/designer/src/designer/doc/src/designer-manual.qdoc @@ -89,7 +89,7 @@ Some source code in \QD is licensed under specific highly permissive licenses from the original authors. The Qt team gratefully acknowledges - these contributions to \QD and all uses of \QD should also acknowledge + these contributions to \QD and all users of \QD should also acknowledge these contributions and quote the following license statements in an appendix to the documentation. -- cgit v1.2.1 From 534b2648e6855167004a1afa3516acbb5850c52a Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 24 Oct 2016 12:31:23 +0200 Subject: Doc: Update documentation on \legalese QDoc command The \legalese command is not used in Qt 5 documentation, because it does not support collating license texts across modules. Update the documentation accordingly, and remove the obsolete example on how it's being used in Qt docs. Change-Id: Id3505ccf5b44bd2c2e236b8464dea18d4c7b8a89 Reviewed-by: Martin Smith Reviewed-by: Leena Miettinen --- src/qdoc/doc/qdoc-manual-markupcmds.qdoc | 46 ++++++++------------------------ 1 file changed, 11 insertions(+), 35 deletions(-) diff --git a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc index 2a54c417e..80dde3aec 100644 --- a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc +++ b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc @@ -3277,9 +3277,14 @@ Elsewhere, the documentation identified as \e{\\legalese} command can be accumulated using \l {generatelist-command} {\\generatelist} - with \c {legalese-command} as the argument. This is useful for - generating an overview of the license agreements associated with - the source code. + with \c {legalese} as the argument. This is useful for generating + an overview of the license agreements associated with the source + code. + + \note The output of the \c {\generatelist legalese} command includes + the \\legalese texts in the current documentation project only. If + the current documentation project depends on other modules, their + license texts will not be listed. \target warning-command \section1 \\warning @@ -3536,38 +3541,9 @@ \section2 \c legalese - The \c legalese argument tells QDoc to generate a complete list of - licenses in the documentation. Each license is identified using - the \l {legalese-command} {\\legalese} command. This command is - used to generate the \e {Qt license information} - page this way: - - \code - / *! - \page licenses.html - \title Other Licenses Used in Qt - \ingroup licensing - \brief Information about other licenses used for Qt components and third-party code. - - Qt contains some code that is not provided under the - \l{GNU General Public License (GPL)}, - \l{GNU Lesser General Public License (LGPL)} or the - \l{Qt Commercial Edition}{Qt Commercial License Agreement}, but rather under - specific licenses from the original authors. Some pieces of code were developed - by The Qt Company and others originated from third parties. - This page lists the licenses used, names the authors, and links - to the places where it is used. - - The Qt Company gratefully acknowledges these and other contributions - to Qt. We recommend that programs that use Qt also acknowledge - these contributions, and quote these license statements in an - appendix to the documentation. - - See also: \l{Licenses for Fonts Used in Qt for Embedded Linux} - - \generatelist legalese - * / - \endcode + The \c legalese argument tells QDoc to generate a list of licenses in + the current documentation project. Each license is identified using + the \l {legalese-command} {\\legalese} command. \section2 \c overviews -- cgit v1.2.1 From 44ab895102034e7c88a1adcb8abeb6d7b83813e0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 20 Oct 2016 13:42:06 +0200 Subject: deduplicate test command launching a bit pre-calculate the lrelease/lconvert path once. Change-Id: Ia1603db955ef08e61d123393f6e69c4653d8b6a9 Reviewed-by: Jake Petroules --- tests/auto/linguist/lconvert/tst_lconvert.cpp | 14 ++++++++------ tests/auto/linguist/lrelease/tst_lrelease.cpp | 14 +++++++------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index f0c683f5f..08075b729 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -39,7 +39,9 @@ class tst_lconvert : public QObject Q_OBJECT public: - tst_lconvert() : dataDir(QFINDTESTDATA("data/")), binDir(QLibraryInfo::location(QLibraryInfo::BinariesPath)) {} + tst_lconvert() + : dataDir(QFINDTESTDATA("data/")) + , lconvert(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/lconvert") {} private slots: void initTestCase(); @@ -66,7 +68,7 @@ private: const QList &args); QString dataDir; - QString binDir; + QString lconvert; }; void tst_lconvert::initTestCase() @@ -145,7 +147,7 @@ void tst_lconvert::doCompare(QIODevice *actualDev, const QString &expectedFn) void tst_lconvert::verifyReadFail(const QString &fn) { QProcess cvt; - cvt.start(binDir + "/lconvert", QStringList() << (dataDir + fn)); + cvt.start(lconvert, QStringList() << (dataDir + fn)); QVERIFY(cvt.waitForFinished(10000)); QVERIFY(cvt.exitStatus() == QProcess::NormalExit); QVERIFY2(cvt.exitCode() == 2, "Accepted invalid input"); @@ -172,7 +174,7 @@ void tst_lconvert::convertChain(const QString &_inFileName, const QString &_outF if (!argList.isEmpty()) args += argList[i]; args << "-if" << stations[i] << "-i" << "-" << "-of" << stations[i + 1]; - cvts.at(i)->start(binDir + "/lconvert", args, QIODevice::ReadWrite | QIODevice::Text); + cvts.at(i)->start(lconvert, args, QIODevice::ReadWrite | QIODevice::Text); } int st = 0; foreach (QProcess *cvt, cvts) @@ -238,7 +240,7 @@ void tst_lconvert::converts() QString outFileNameFq = dataDir + outFileName; QProcess cvt; - cvt.start(binDir + "/lconvert", + cvt.start(lconvert, QStringList() << "-i" << (dataDir + inFileName) << "-of" << format, QIODevice::ReadWrite | QIODevice::Text); doWait(&cvt, 0); @@ -333,7 +335,7 @@ void tst_lconvert::merge() QProcess cvt; QStringList args; args << (dataDir + "idxmerge.ts") << (dataDir + "idxmerge-add.ts"); - cvt.start(binDir + "/lconvert", args, QIODevice::ReadWrite | QIODevice::Text); + cvt.start(lconvert, args, QIODevice::ReadWrite | QIODevice::Text); doWait(&cvt, 1); if (!QTest::currentTestFailed()) doCompare(&cvt, dataDir + "idxmerge.ts.out"); diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp index f4935208b..96f0d933f 100644 --- a/tests/auto/linguist/lrelease/tst_lrelease.cpp +++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp @@ -44,7 +44,7 @@ class tst_lrelease : public QObject public: tst_lrelease() - : binDir(QLibraryInfo::location(QLibraryInfo::BinariesPath)) + : lrelease(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/lrelease") , dataDir(QFINDTESTDATA("testdata/")) {} @@ -60,7 +60,7 @@ private slots: private: void doCompare(const QStringList &actual, const QString &expectedFn); - QString binDir; + QString lrelease; QString dataDir; }; @@ -114,7 +114,7 @@ void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedF void tst_lrelease::translate() { - QVERIFY(!QProcess::execute(binDir + "/lrelease " + dataDir + "translate.ts")); + QVERIFY(!QProcess::execute(lrelease + " " + dataDir + "translate.ts")); QTranslator translator; QVERIFY(translator.load(dataDir + "translate.qm")); @@ -164,7 +164,7 @@ void tst_lrelease::translate() void tst_lrelease::compressed() { - QVERIFY(!QProcess::execute(binDir + "/lrelease -compress " + dataDir + "compressed.ts")); + QVERIFY(!QProcess::execute(lrelease + " -compress " + dataDir + "compressed.ts")); QTranslator translator; QVERIFY(translator.load(dataDir + "compressed.qm")); @@ -181,7 +181,7 @@ void tst_lrelease::compressed() void tst_lrelease::idbased() { - QVERIFY(!QProcess::execute(binDir + "/lrelease -idbased " + dataDir + "idbased.ts")); + QVERIFY(!QProcess::execute(lrelease + " -idbased " + dataDir + "idbased.ts")); QTranslator translator; QVERIFY(translator.load(dataDir + "idbased.qm")); @@ -193,7 +193,7 @@ void tst_lrelease::idbased() void tst_lrelease::markuntranslated() { - QVERIFY(!QProcess::execute(binDir + "/lrelease -markuntranslated # -idbased " + dataDir + "idbased.ts")); + QVERIFY(!QProcess::execute(lrelease + " -markuntranslated # -idbased " + dataDir + "idbased.ts")); QTranslator translator; QVERIFY(translator.load(dataDir + "idbased.qm")); @@ -206,7 +206,7 @@ void tst_lrelease::markuntranslated() void tst_lrelease::dupes() { QProcess proc; - proc.start(binDir + "/lrelease " + dataDir + "dupes.ts", QIODevice::ReadWrite | QIODevice::Text); + proc.start(lrelease + " " + dataDir + "dupes.ts", QIODevice::ReadWrite | QIODevice::Text); QVERIFY(proc.waitForFinished()); QVERIFY(proc.exitStatus() == QProcess::NormalExit); doCompare(QString(proc.readAllStandardError()).trimmed().split('\n'), dataDir + "dupes.errors"); -- cgit v1.2.1 From 05b22932560a0e04b8135a1ac32940fe0bfc9f26 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 20 Oct 2016 13:42:50 +0200 Subject: fix test execution in dirs with spaces Change-Id: Ib99cf27f50f32eb23d278f5b9a9c279d10da4ece Reviewed-by: Jake Petroules --- tests/auto/linguist/lrelease/tst_lrelease.cpp | 10 +++++----- tests/auto/linguist/lupdate/tst_lupdate.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp index 96f0d933f..6d39fe252 100644 --- a/tests/auto/linguist/lrelease/tst_lrelease.cpp +++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp @@ -114,7 +114,7 @@ void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedF void tst_lrelease::translate() { - QVERIFY(!QProcess::execute(lrelease + " " + dataDir + "translate.ts")); + QVERIFY(!QProcess::execute(lrelease, QStringList() << (dataDir + "translate.ts"))); QTranslator translator; QVERIFY(translator.load(dataDir + "translate.qm")); @@ -164,7 +164,7 @@ void tst_lrelease::translate() void tst_lrelease::compressed() { - QVERIFY(!QProcess::execute(lrelease + " -compress " + dataDir + "compressed.ts")); + QVERIFY(!QProcess::execute(lrelease, QStringList() << "-compress" << (dataDir + "compressed.ts"))); QTranslator translator; QVERIFY(translator.load(dataDir + "compressed.qm")); @@ -181,7 +181,7 @@ void tst_lrelease::compressed() void tst_lrelease::idbased() { - QVERIFY(!QProcess::execute(lrelease + " -idbased " + dataDir + "idbased.ts")); + QVERIFY(!QProcess::execute(lrelease, QStringList() << "-idbased" << (dataDir + "idbased.ts"))); QTranslator translator; QVERIFY(translator.load(dataDir + "idbased.qm")); @@ -193,7 +193,7 @@ void tst_lrelease::idbased() void tst_lrelease::markuntranslated() { - QVERIFY(!QProcess::execute(lrelease + " -markuntranslated # -idbased " + dataDir + "idbased.ts")); + QVERIFY(!QProcess::execute(lrelease, QStringList() << "-markuntranslated" << "#" << "-idbased" << (dataDir + "idbased.ts"))); QTranslator translator; QVERIFY(translator.load(dataDir + "idbased.qm")); @@ -206,7 +206,7 @@ void tst_lrelease::markuntranslated() void tst_lrelease::dupes() { QProcess proc; - proc.start(lrelease + " " + dataDir + "dupes.ts", QIODevice::ReadWrite | QIODevice::Text); + proc.start(lrelease, QStringList() << (dataDir + "dupes.ts"), QIODevice::ReadWrite | QIODevice::Text); QVERIFY(proc.waitForFinished()); QVERIFY(proc.exitStatus() == QProcess::NormalExit); doCompare(QString(proc.readAllStandardError()).trimmed().split('\n'), dataDir + "dupes.errors"); diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 6d1c3eddb..08ea6ff49 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -288,7 +288,7 @@ void tst_lupdate::good() QProcess proc; proc.setWorkingDirectory(workDir); proc.setProcessChannelMode(QProcess::MergedChannels); - const QString command = m_cmdLupdate + QLatin1Char(' ') + lupdatecmd; + const QString command = QLatin1Char('"') + m_cmdLupdate + QLatin1String("\" ") + lupdatecmd; proc.start(command, QIODevice::ReadWrite | QIODevice::Text); QVERIFY2(proc.waitForStarted(), qPrintable(command + QLatin1String(" :") + proc.errorString())); QVERIFY2(proc.waitForFinished(30000), qPrintable(command)); -- cgit v1.2.1 From 8e7e60dbdea04c943bc6d50290db12d3fefd39f2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 8 Jul 2016 18:52:13 +0200 Subject: prevent .prf files from postponing work to build passes ... as lupdate doesn't execute any. this increases the chance that we will get a complete picture of the project. this is preparation for lupdate interpreting .qrc files. Task-number: QTBUG-53206 Change-Id: I5e10b44637d527799f55c578a99076eb4750f131 Reviewed-by: hjk Reviewed-by: Oswald Buddenhagen --- src/linguist/shared/exclusive_builds.prf | 6 +++++ src/linguist/shared/proparser.pri | 3 +++ src/linguist/shared/proparser.qrc | 5 ++++ src/linguist/shared/qmakeevaluator.cpp | 39 ++++++++++++++++++++------------ 4 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 src/linguist/shared/exclusive_builds.prf create mode 100644 src/linguist/shared/proparser.qrc diff --git a/src/linguist/shared/exclusive_builds.prf b/src/linguist/shared/exclusive_builds.prf new file mode 100644 index 000000000..b312a4c58 --- /dev/null +++ b/src/linguist/shared/exclusive_builds.prf @@ -0,0 +1,6 @@ +# Lupdate doesn't execute the build passes, so prevent that they are +# created in the first place. This tricks for example resources.prf +# into actually creating the QML resource file, so we can scan it. + +defineTest(addExclusiveBuilds) { +} diff --git a/src/linguist/shared/proparser.pri b/src/linguist/shared/proparser.pri index 124227bc4..f3fcad515 100644 --- a/src/linguist/shared/proparser.pri +++ b/src/linguist/shared/proparser.pri @@ -23,3 +23,6 @@ SOURCES += \ $$PWD/qmakeevaluator.cpp \ $$PWD/qmakebuiltins.cpp \ $$PWD/profileevaluator.cpp + +RESOURCES += $$PWD/proparser.qrc +DEFINES += QMAKE_BUILTIN_PRFS QMAKE_OVERRIDE_PRFS diff --git a/src/linguist/shared/proparser.qrc b/src/linguist/shared/proparser.qrc new file mode 100644 index 000000000..77ffd258a --- /dev/null +++ b/src/linguist/shared/proparser.qrc @@ -0,0 +1,5 @@ + + + exclusive_builds.prf + + diff --git a/src/linguist/shared/qmakeevaluator.cpp b/src/linguist/shared/qmakeevaluator.cpp index 9314dabad..7387521d8 100644 --- a/src/linguist/shared/qmakeevaluator.cpp +++ b/src/linguist/shared/qmakeevaluator.cpp @@ -1952,23 +1952,34 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFeatureFile( // needs to be determined. Failed lookups are represented via non-null empty strings. QString *fnp = &m_featureRoots->cache[qMakePair(fn, currFn)]; if (fnp->isNull()) { - int start_root = 0; - const QStringList &paths = m_featureRoots->paths; - if (!currFn.isEmpty()) { - QStringRef currPath = IoUtils::pathName(currFn); - for (int root = 0; root < paths.size(); ++root) - if (currPath == paths.at(root)) { - start_root = root + 1; - break; - } - } - for (int root = start_root; root < paths.size(); ++root) { - QString fname = paths.at(root) + fn; - if (IoUtils::exists(fname)) { - fn = fname; +#ifdef QMAKE_OVERRIDE_PRFS + { + QString ovrfn(QLatin1String(":/qmake/override_features/") + fn); + if (QFileInfo::exists(ovrfn)) { + fn = ovrfn; goto cool; } } +#endif + { + int start_root = 0; + const QStringList &paths = m_featureRoots->paths; + if (!currFn.isEmpty()) { + QStringRef currPath = IoUtils::pathName(currFn); + for (int root = 0; root < paths.size(); ++root) + if (currPath == paths.at(root)) { + start_root = root + 1; + break; + } + } + for (int root = start_root; root < paths.size(); ++root) { + QString fname = paths.at(root) + fn; + if (IoUtils::exists(fname)) { + fn = fname; + goto cool; + } + } + } #ifdef QMAKE_BUILTIN_PRFS fn.prepend(QLatin1String(":/qmake/features/")); if (QFileInfo::exists(fn)) -- cgit v1.2.1 From f2ebd51d96ad49eb826a4e37e67d506fffcbd40c Mon Sep 17 00:00:00 2001 From: Takumi ASAKI Date: Tue, 15 Dec 2015 13:46:09 +0900 Subject: lupdate: Add qrc resource file support lupdate parses qrc files specified by the RESOURCES qmake variable or by command line options, and adds files in them as source files. [ChangeLog][lupdate] Added qrc resource file support Task-number: QTBUG-53206 Change-Id: Id7f952487ab11e062db9c5a419fb2ee3c4716740 Reviewed-by: Oswald Buddenhagen --- src/linguist/linguist/doc/src/linguist-manual.qdoc | 34 +----- src/linguist/lupdate/main.cpp | 132 +++++++++++++++++---- .../lupdate/testdata/good/parseqrc/main.cpp | 42 +++++++ .../lupdate/testdata/good/parseqrc/main.js | 1 + .../lupdate/testdata/good/parseqrc/main.qml | 40 +++++++ .../lupdate/testdata/good/parseqrc/project.pro | 7 ++ .../lupdate/testdata/good/parseqrc/project.qrc | 5 + .../testdata/good/parseqrc/project.ts.result | 25 ++++ .../testdata/good/resources_cmdline/lupdatecmd | 1 + .../testdata/good/resources_cmdline/main.js | 1 + .../testdata/good/resources_cmdline/main.qml | 40 +++++++ .../testdata/good/resources_cmdline/project.qrc | 6 + .../good/resources_cmdline/project.ts.result | 17 +++ 13 files changed, 294 insertions(+), 57 deletions(-) create mode 100644 tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp create mode 100644 tests/auto/linguist/lupdate/testdata/good/parseqrc/main.js create mode 100644 tests/auto/linguist/lupdate/testdata/good/parseqrc/main.qml create mode 100644 tests/auto/linguist/lupdate/testdata/good/parseqrc/project.pro create mode 100644 tests/auto/linguist/lupdate/testdata/good/parseqrc/project.qrc create mode 100644 tests/auto/linguist/lupdate/testdata/good/parseqrc/project.ts.result create mode 100644 tests/auto/linguist/lupdate/testdata/good/resources_cmdline/lupdatecmd create mode 100644 tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.js create mode 100644 tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.qml create mode 100644 tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.qrc create mode 100644 tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.ts.result diff --git a/src/linguist/linguist/doc/src/linguist-manual.qdoc b/src/linguist/linguist/doc/src/linguist-manual.qdoc index 722b853a0..308bc9f1c 100644 --- a/src/linguist/linguist/doc/src/linguist-manual.qdoc +++ b/src/linguist/linguist/doc/src/linguist-manual.qdoc @@ -847,7 +847,8 @@ The \c lupdate tool extracts user interface strings from your application. It reads the application .pro file to identify which source files contain text to be translated. This means your source files must be listed - in the \c SOURCES or \c HEADERS entry in the .pro file. If your files are + in the \c SOURCES or \c HEADERS entry in the .pro file, or in resource + files listed in the \c RESOURCE entry. If your files are not listed, the text in them will not be found. An example of a complete \c .pro file with four translation source @@ -870,37 +871,6 @@ \snippet doc_src_linguist-manual.cpp 3 - \section2 Use a Conditional to Hide QML Source From the Compiler - - The SOURCES variable is intended for C++ source files. If you list QML - or JavaScript source files there, the compiler tries to build them as though - they are C++ files. As a workaround, you can use an \c lupdate_only{...} - conditional statement so the \c lupdate tool sees the .qml files but the C++ - compiler ignores them. - - For example, the following .pro file snippet specifies two .qml files in - the application: - - \code - lupdate_only { - SOURCES = main.qml \ - MainPage.qml - } - \endcode - - You can also specify the .qml source files with a wildcard match. The - search is not recursive so you need to specify each directory where there - are user interface strings in the source code: - - \code - lupdate_only { - SOURCES = *.qml \ - *.js \ - content/*.qml \ - content/*.js - } - \endcode - \section1 Internationalizing Applications Design your application so that it can be adapted to various languages and diff --git a/src/linguist/lupdate/main.cpp b/src/linguist/lupdate/main.cpp index 9fc3d8c80..dd73a9e5b 100644 --- a/src/linguist/lupdate/main.cpp +++ b/src/linguist/lupdate/main.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include @@ -395,6 +396,73 @@ public: static EvalHandler evalHandler; +static bool isSupportedExtension(const QString &ext) +{ + return ext == QLatin1String("qml") + || ext == QLatin1String("js") || ext == QLatin1String("qs") + || ext == QLatin1String("ui") || ext == QLatin1String("jui"); +} + +static QStringList getResources(const QString &resourceFile, QMakeVfs *vfs) +{ + Q_ASSERT(vfs); + if (!vfs->exists(resourceFile)) + return QStringList(); + QString content; + QString errStr; + if (!vfs->readFile(resourceFile, &content, &errStr)) { + printErr(LU::tr("lupdate error: Can not read %1: %2\n").arg(resourceFile, errStr)); + return QStringList(); + } + QStringList fileList; + QString dirPath = QFileInfo(resourceFile).path(); + QXmlStreamReader reader(content); + bool isFileTag = false; + QStringList tagStack; + tagStack << QLatin1String("RCC") << QLatin1String("qresource") << QLatin1String("file"); + int curDepth = 0; + while (!reader.atEnd()) { + QXmlStreamReader::TokenType t = reader.readNext(); + switch (t) { + case QXmlStreamReader::StartElement: + if (curDepth >= tagStack.count() || reader.name() != tagStack.at(curDepth)) { + printErr(LU::tr("unexpected <%1> tag\n").arg(reader.name().toString())); + continue; + } + if (++curDepth == tagStack.count()) + isFileTag = true; + break; + + case QXmlStreamReader::EndElement: + isFileTag = false; + if (curDepth == 0 || reader.name() != tagStack.at(curDepth - 1)) { + printErr(LU::tr("unexpected closing <%1> tag\n").arg(reader.name().toString())); + continue; + } + --curDepth; + break; + + case QXmlStreamReader::Characters: + if (isFileTag) { + QString fn = reader.text().toString(); + if (!QFileInfo(fn).isAbsolute()) + fn = dirPath + QLatin1Char('/') + fn; + QFileInfo cfi(fn); + if (isSupportedExtension(cfi.suffix())) + fileList << cfi.filePath(); + } + break; + + default: + break; + } + } + if (reader.error() != QXmlStreamReader::NoError) + printErr(LU::tr("lupdate error: %1:%2: %3\n") + .arg(resourceFile, QString::number(reader.lineNumber()), reader.errorString())); + return fileList; +} + static QStringList getSources(const char *var, const char *vvar, const QStringList &baseVPaths, const QString &projectDir, const ProFileEvaluator &visitor) { @@ -405,7 +473,7 @@ static QStringList getSources(const char *var, const char *vvar, const QStringLi } static QStringList getSources(const ProFileEvaluator &visitor, const QString &projectDir, - const QStringList &excludes) + const QStringList &excludes, QMakeVfs *vfs) { QStringList baseVPaths; baseVPaths += visitor.absolutePathValues(QLatin1String("VPATH"), projectDir); @@ -420,6 +488,10 @@ static QStringList getSources(const ProFileEvaluator &visitor, const QString &pr sourceFiles += getSources("FORMS", "VPATH_FORMS", baseVPaths, projectDir, visitor); + QStringList resourceFiles = getSources("RESOURCES", "VPATH_RESOURCES", baseVPaths, projectDir, visitor); + foreach (const QString &resource, resourceFiles) + sourceFiles += getResources(resource, vfs); + QStringList installs = visitor.values(QLatin1String("INSTALLS")) + visitor.values(QLatin1String("DEPLOYMENT")); installs.removeDuplicates(); @@ -445,12 +517,8 @@ static QStringList getSources(const ProFileEvaluator &visitor, const QString &pr 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")) { + if (isSupportedExtension(cfi.suffix())) sourceFiles << cfi.filePath(); - } } } } @@ -612,7 +680,7 @@ static void processProject( cd.m_sourceIsUtf16 = options & SourceIsUtf16; cd.m_includePath = visitor.absolutePathValues(QLatin1String("INCLUDEPATH"), proPath); cd.m_excludes = getExcludes(visitor, proPath); - QStringList sourceFiles = getSources(visitor, proPath, cd.m_excludes); + QStringList sourceFiles = getSources(visitor, proPath, cd.m_excludes, vfs); QSet sourceDirs; sourceDirs.insert(proPath + QLatin1Char('/')); foreach (const QString &sf, sourceFiles) @@ -723,7 +791,7 @@ int main(int argc, char **argv) #endif // Q_OS_WIN32 #endif - m_defaultExtensions = QLatin1String("java,jui,ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx,js,qs,qml"); + m_defaultExtensions = QLatin1String("java,jui,ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx,js,qs,qml,qrc"); QStringList args = app.arguments(); QStringList tsFileNames; @@ -733,6 +801,7 @@ int main(int argc, char **argv) QMultiHash allCSources; QSet projectRoots; QStringList sourceFiles; + QStringList resourceFiles; QStringList includePath; QStringList alienFiles; QString targetLanguage; @@ -986,25 +1055,33 @@ int main(int argc, char **argv) int scanRootLen = dir.absolutePath().length(); foreach (const QFileInfo &fi, fileinfolist) { QString fn = QDir::cleanPath(fi.absoluteFilePath()); - sourceFiles << fn; - - if (!fn.endsWith(QLatin1String(".java")) - && !fn.endsWith(QLatin1String(".jui")) - && !fn.endsWith(QLatin1String(".ui")) - && !fn.endsWith(QLatin1String(".js")) - && !fn.endsWith(QLatin1String(".qs")) - && !fn.endsWith(QLatin1String(".qml"))) { - int offset = 0; - int depth = 0; - do { - offset = fn.lastIndexOf(QLatin1Char('/'), offset - 1); - QString ffn = fn.mid(offset + 1); - allCSources.insert(ffn, fn); - } while (++depth < 3 && offset > scanRootLen); + if (fn.endsWith(QLatin1String(".qrc"), Qt::CaseInsensitive)) { + resourceFiles << fn; + } else { + sourceFiles << fn; + + if (!fn.endsWith(QLatin1String(".java")) + && !fn.endsWith(QLatin1String(".jui")) + && !fn.endsWith(QLatin1String(".ui")) + && !fn.endsWith(QLatin1String(".js")) + && !fn.endsWith(QLatin1String(".qs")) + && !fn.endsWith(QLatin1String(".qml"))) { + int offset = 0; + int depth = 0; + do { + offset = fn.lastIndexOf(QLatin1Char('/'), offset - 1); + QString ffn = fn.mid(offset + 1); + allCSources.insert(ffn, fn); + } while (++depth < 3 && offset > scanRootLen); + } } } } else { - sourceFiles << QDir::cleanPath(fi.absoluteFilePath());; + QString fn = QDir::cleanPath(fi.absoluteFilePath()); + if (fn.endsWith(QLatin1String(".qrc"), Qt::CaseInsensitive)) + resourceFiles << fn; + else + sourceFiles << fn; projectRoots.insert(fi.absolutePath() + QLatin1Char('/')); } } @@ -1034,11 +1111,16 @@ int main(int argc, char **argv) cd.m_projectRoots = projectRoots; cd.m_includePath = includePath; cd.m_allCSources = allCSources; + if (!resourceFiles.isEmpty()) { + QMakeVfs vfs; + foreach (const QString &resource, resourceFiles) + sourceFiles << getResources(resource, &vfs); + } processSources(fetchedTor, sourceFiles, cd); updateTsFiles(fetchedTor, tsFileNames, alienFiles, sourceLanguage, targetLanguage, options, &fail); } else { - if (!sourceFiles.isEmpty() || !includePath.isEmpty()) { + if (!sourceFiles.isEmpty() || !resourceFiles.isEmpty() || !includePath.isEmpty()) { printErr(LU::tr("lupdate error:" " Both project and source files / include paths specified.\n")); return 1; diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp new file mode 100644 index 000000000..7108f6784 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.cpp @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + + +void func1() { + QApplication::tr("Hello world"); +} + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.js b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.js new file mode 100644 index 000000000..b2e1dd9e0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.js @@ -0,0 +1 @@ +qsTr("From JavaScript file"); diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.qml new file mode 100644 index 000000000..ea2258343 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/main.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $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/parseqrc/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.pro new file mode 100644 index 000000000..5000c7396 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.pro @@ -0,0 +1,7 @@ + +SOURCES += main.cpp + +RESOURCES += project.qrc +RESOURCES += main.qml + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.qrc b/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.qrc new file mode 100644 index 000000000..87bacf228 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.qrc @@ -0,0 +1,5 @@ + + + main.js + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.ts.result new file mode 100644 index 000000000..6dcd8c2a5 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqrc/project.ts.result @@ -0,0 +1,25 @@ + + + + + QApplication + + + Hello world + + + + + main + + + From JavaScript file + + + + + From QML file in root + + + + diff --git a/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/lupdatecmd new file mode 100644 index 000000000..f3709944b --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/lupdatecmd @@ -0,0 +1 @@ +lupdate project.qrc -ts project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.js b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.js new file mode 100644 index 000000000..b2e1dd9e0 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.js @@ -0,0 +1 @@ +qsTr("From JavaScript file"); diff --git a/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.qml b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.qml new file mode 100644 index 000000000..ea2258343 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/main.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $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/resources_cmdline/project.qrc b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.qrc new file mode 100644 index 000000000..c5bf15067 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.qrc @@ -0,0 +1,6 @@ + + + main.qml + main.js + + diff --git a/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.ts.result new file mode 100644 index 000000000..82719c026 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/resources_cmdline/project.ts.result @@ -0,0 +1,17 @@ + + + + + main + + + From QML file in root + + + + + From JavaScript file + + + + -- cgit v1.2.1 From b5cb222357841b8dad6fc80aa8e6e88047f20c00 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 26 Oct 2016 12:02:50 +0200 Subject: macOS: Handle -qtlibinfix correctly in macdeployqt When Qt is configured with -qtlibinfix then it will insert the specified setting inside the framework names. Therefore QtCore.framework can be called QtCoreLibInfix.framework. This means that we have to account for this in macdeployqt when determining which plugins should be deployed. Change-Id: I30fc7434fa87d1b41c2cacfbc9f76d4ce5491329 Reviewed-by: Timur Pocheptsov --- src/macdeployqt/shared/shared.cpp | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index cb4599df3..23817ef05 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -994,6 +994,22 @@ DeploymentInfo deployQtFrameworks(const QString &appBundlePath, const QStringLis } } +QString getLibInfix(const QStringList &deployedFrameworks) +{ + QString libInfix; + foreach (const QString &framework, deployedFrameworks) { + if (framework.startsWith(QStringLiteral("QtCore"))) { + Q_ASSERT(framework.length() >= 16); + // 16 == "QtCore" + ".framework" + const int lengthOfLibInfix = framework.length() - 16; + if (lengthOfLibInfix) + libInfix = framework.mid(6, lengthOfLibInfix); + break; + } + } + return libInfix; +} + void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pluginSourcePath, const QString pluginDestinationPath, DeploymentInfo deploymentInfo, bool useDebugLibs) { @@ -1011,8 +1027,11 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl // Cocoa print support pluginList.append("printsupport/libcocoaprintersupport.dylib"); + // Check if Qt was configured with -libinfix + const QString libInfixWithFramework = getLibInfix(deploymentInfo.deployedFrameworks) + QStringLiteral(".framework"); + // Network - if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtNetwork.framework"))) { + if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtNetwork") + libInfixWithFramework)) { QStringList bearerPlugins = QDir(pluginSourcePath + QStringLiteral("/bearer")).entryList(QStringList() << QStringLiteral("*.dylib")); foreach (const QString &plugin, bearerPlugins) { if (!plugin.endsWith(QStringLiteral("_debug.dylib"))) @@ -1024,7 +1043,7 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl QStringList imagePlugins = QDir(pluginSourcePath + QStringLiteral("/imageformats")).entryList(QStringList() << QStringLiteral("*.dylib")); foreach (const QString &plugin, imagePlugins) { if (plugin.contains(QStringLiteral("qsvg"))) { - if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtSvg.framework"))) + if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtSvg") + libInfixWithFramework)) pluginList.append(QStringLiteral("imageformats/") + plugin); } else if (!plugin.endsWith(QStringLiteral("_debug.dylib"))) { pluginList.append(QStringLiteral("imageformats/") + plugin); @@ -1032,7 +1051,7 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl } // Sql plugins if QtSql.framework is in use - if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtSql.framework"))) { + if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtSql") + libInfixWithFramework)) { QStringList sqlPlugins = QDir(pluginSourcePath + QStringLiteral("/sqldrivers")).entryList(QStringList() << QStringLiteral("*.dylib")); foreach (const QString &plugin, sqlPlugins) { if (plugin.endsWith(QStringLiteral("_debug.dylib"))) @@ -1052,7 +1071,7 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl } // multimedia plugins if QtMultimedia.framework is in use - if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtMultimedia.framework"))) { + if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtMultimedia") + libInfixWithFramework)) { QStringList plugins = QDir(pluginSourcePath + QStringLiteral("/mediaservice")).entryList(QStringList() << QStringLiteral("*.dylib")); foreach (const QString &plugin, plugins) { if (!plugin.endsWith(QStringLiteral("_debug.dylib"))) @@ -1250,7 +1269,12 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf // 2) QtQuick.Controls is used // The intended failure mode is that libwidgetsplugin.dylib will be present // in the app bundle but not used at run-time. - if (deploymentInfo.deployedFrameworks.contains("QtWidgets.framework") && qtQuickContolsInUse) { + + // Check if Qt was configured with -libinfix + const QString libInfixWithFramework = getLibInfix(deploymentInfo.deployedFrameworks) + QStringLiteral(".framework"); + + if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtWidgets") + libInfixWithFramework) + && qtQuickContolsInUse) { LogNormal() << "Deploying QML import QtQuick.PrivateWidgets"; QString name = "QtQuick/PrivateWidgets"; QString path = qmlImportsPath + QLatin1Char('/') + name; -- cgit v1.2.1