diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-06-27 16:33:48 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-06-27 16:33:48 +0200 |
commit | 9603be3007cd24b1e7944be46d32e6a9ab6f8b1e (patch) | |
tree | 1414088244874ef5dadc5bedc863160037efb141 | |
parent | 18f9ac9e9489e48ea756bd89f6f40dd4499c42a3 (diff) | |
parent | e42dd0a13ebf37f7402a4cf09a6fb62b8c740c76 (diff) | |
download | qttools-9603be3007cd24b1e7944be46d32e6a9ab6f8b1e.tar.gz |
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
.qmake.conf
Change-Id: I3a828f7cf61510f0bb179b760c8a335629d3c852
-rw-r--r-- | dist/changes-5.12.4 | 33 | ||||
-rw-r--r-- | src/distancefieldgenerator/distancefieldmodelworker.cpp | 4 | ||||
-rw-r--r-- | src/distancefieldgenerator/mainwindow.cpp | 25 | ||||
-rw-r--r-- | src/linguist/linguist/doc/cmake-macros.qdoc | 114 | ||||
-rw-r--r-- | src/linguist/linguist/doc/snippets/cmake-macros/examples.cmake | 13 | ||||
-rw-r--r-- | src/qdoc/htmlgenerator.cpp | 24 |
6 files changed, 190 insertions, 23 deletions
diff --git a/dist/changes-5.12.4 b/dist/changes-5.12.4 new file mode 100644 index 000000000..4796a3828 --- /dev/null +++ b/dist/changes-5.12.4 @@ -0,0 +1,33 @@ +Qt 5.12.4 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.12.0 through 5.12.3. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.12 series is binary compatible with the 5.11.x series. +Applications compiled for 5.11 will continue to run with 5.12. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* lupdate * +**************************************************************************** + + - lupdate will now generate an error if it is asked to update a .ts file + with translations, but without a target language. This is to ensure that + plural translations are not destroyed. + +**************************************************************************** +* qdoc * +**************************************************************************** + + - [QTBUG-73058] qdoc now uses #! as a snippet marker in .cmake, + CMakeLists.txt files. diff --git a/src/distancefieldgenerator/distancefieldmodelworker.cpp b/src/distancefieldgenerator/distancefieldmodelworker.cpp index 373cb05ab..b76f3b707 100644 --- a/src/distancefieldgenerator/distancefieldmodelworker.cpp +++ b/src/distancefieldgenerator/distancefieldmodelworker.cpp @@ -129,7 +129,7 @@ static void readCmapSubtable(DistanceFieldModelWorker *worker, const QByteArray return; } - const void *end = cmap.constData() + tableOffset + subtable->length; + const void *end = cmap.constData() + tableOffset + length; worker->readCmapSubtable(subtable, end); } @@ -148,7 +148,7 @@ void DistanceFieldModelWorker::readCmapSubtable(const CmapSubtable4 *subtable, c const qint16 *idDeltas = reinterpret_cast<const qint16 *>(startCodes + segCount); const quint16 *idRangeOffsets = reinterpret_cast<const quint16 *>(idDeltas + segCount); const quint16 *glyphIdArray = idRangeOffsets + segCount; - if (glyphIdArray >= end) { + if (glyphIdArray > end) { emit error(tr("End of cmap table reached when parsing subtable format '4'")); return; } diff --git a/src/distancefieldgenerator/mainwindow.cpp b/src/distancefieldgenerator/mainwindow.cpp index 763aeaa6b..3717330b4 100644 --- a/src/distancefieldgenerator/mainwindow.cpp +++ b/src/distancefieldgenerator/mainwindow.cpp @@ -417,10 +417,20 @@ QByteArray MainWindow::createSfntTable() header.minorVersion = 12; header.pixelSize = qToBigEndian(quint16(qRound(m_model->pixelSize()))); + const quint8 padding = 2; + qreal scaleFactor = qreal(1) / QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution()); + const int radius = QT_DISTANCEFIELD_RADIUS(m_model->doubleGlyphResolution()) + / QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution()); + quint32 textureSize = ui->sbMaximumTextureSize->value(); + + // Since we are using a single area allocator that spans all textures, we need + // to split the textures one row before the actual maximum size, otherwise + // glyphs that fall on the edge between two textures will expand the texture + // they are assigned to, and this will end up being larger than the max. + textureSize -= quint32(qCeil(m_model->pixelSize() * scaleFactor) + radius * 2 + padding * 2); header.textureSize = qToBigEndian(textureSize); - const quint8 padding = 2; header.padding = padding; header.flags = m_model->doubleGlyphResolution() ? 1 : 0; header.numGlyphs = qToBigEndian(quint32(list.size())); @@ -428,7 +438,6 @@ QByteArray MainWindow::createSfntTable() sizeof(QtdfHeader)); // Maximum height allocator to find optimal number of textures - QRect allocatedArea; QVector<QRect> allocatedAreaPerTexture; struct GlyphData { @@ -443,13 +452,9 @@ QByteArray MainWindow::createSfntTable() int textureCount = 0; { - qreal scaleFactor = qreal(1) / QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution()); QTransform scaleDown; scaleDown.scale(scaleFactor, scaleFactor); - const int radius = QT_DISTANCEFIELD_RADIUS(m_model->doubleGlyphResolution()) - / QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution()); - { bool foundOptimalSize = false; while (!foundOptimalSize) { @@ -466,6 +471,7 @@ QByteArray MainWindow::createSfntTable() glyphData.boundingRect = scaleDown.mapRect(path.boundingRect()); int glyphWidth = qCeil(glyphData.boundingRect.width()) + radius * 2; int glyphHeight = qCeil(glyphData.boundingRect.height()) + radius * 2; + glyphData.glyphSize = QSize(glyphWidth + padding * 2, glyphHeight + padding * 2); if (glyphData.glyphSize.width() > qint32(textureSize) @@ -482,15 +488,14 @@ QByteArray MainWindow::createSfntTable() break; glyphData.textureIndex = rect.y() / textureSize; - if (glyphData.textureIndex >= allocatedAreaPerTexture.size()) - allocatedAreaPerTexture.resize(glyphData.textureIndex + 1); + while (glyphData.textureIndex >= allocatedAreaPerTexture.size()) + allocatedAreaPerTexture.append(QRect(0, 0, 1, 1)); + allocatedAreaPerTexture[glyphData.textureIndex] |= QRect(rect.x(), rect.y() % textureSize, rect.width(), rect.height()); - allocatedArea |= rect; - glyphData.texCoord.xMargin = QT_DISTANCEFIELD_RADIUS(m_model->doubleGlyphResolution()) / qreal(QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution())); glyphData.texCoord.yMargin = QT_DISTANCEFIELD_RADIUS(m_model->doubleGlyphResolution()) / qreal(QT_DISTANCEFIELD_SCALE(m_model->doubleGlyphResolution())); glyphData.texCoord.x = rect.x() + padding; diff --git a/src/linguist/linguist/doc/cmake-macros.qdoc b/src/linguist/linguist/doc/cmake-macros.qdoc new file mode 100644 index 000000000..68eb849f5 --- /dev/null +++ b/src/linguist/linguist/doc/cmake-macros.qdoc @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qtlinguist-cmake-qt5-add-translation.html +\ingroup cmake-macros-qtlinguisttools + +\title qt5_add_translation + +\brief Compiles Qt Linguist .ts files into .qm files. + +\section1 Synopsis + +\badcode +qt5_add_translation(<VAR> file1.ts [file2.ts ...] + [OPTIONS ...]) +\endcode + +\section1 Description + +Calls \c{lrelease} on each \c{.ts} file passed as an argument, generating +\c{.qm} files. The paths of the generated files are added to \c{<VAR>}. + +\section1 Options + +You can set additional \c{OPTIONS} that should be passed when \c{lrelease} is +invoked. You can find possible options in the \l{lrelease}{lrelease documentation}. + +By default, the \c{qm} files will be placed in the root level of the build +directory. To change this, you can set \c{OUTPUT_LOCATION} as a property +of the source \c{.ts} file. + +\section1 Examples + +Generating \c{helloworld_en.qm}, \c{helloworld_de.qm} in the build +directory: + +\snippet cmake-macros/examples.cmake qt5_add_translation + +Generating \c{helloworld_en.qm}, \c{helloworld_de.qm} in a \c{l10n} +sub-directory: + +\snippet cmake-macros/examples.cmake qt5_add_translation_output_location +*/ + +/*! +\page qtlinguist-cmake-qt5-create-translation.html +\ingroup cmake-macros-qtlinguisttools + +\title qt5_create_translation + +\brief Sets up the Qt Linguist translation toolchain. + +\section1 Synopsis + +\badcode +qt5_create_translation(<VAR> ts-file-or-sources [ts-file-or-sources2 ...] + [OPTIONS ...]) +\endcode + +\section1 Description + +Processes given sources (directories or individual files) to generate +Qt Linguist \c{.ts} files. The \c{.ts} files are in turn compiled into \c{.qm} +files of the same base name that are stored in the build +directory. Paths to the generated \c{.qm} files are added to \c{<VAR>}. + +The translation files to create or update need to have a \c{.ts} suffix. If +the given file path is not absolute it is resolved relative to the current +source directory. If no \c{.ts} file is passed as an argument, the macro +does nothing. + +Any arguments that do not have a \c{.ts} suffix are passed as input to the +\c{lupdate}. \c{lupdate} accepts directories and source files as input. +See also the \l{lupdate}{lupdate documentation} on further details. + +\section1 Options + +You can set additional \c{OPTIONS} that should be passed when \c{lupdate} is +invoked. You can find possible options in the \l{lupdate}{lupdate documentation}. + +\section1 Examples + +Recursively look up Qt translations from source files in current directory and +generate or update \c{helloworld_en.ts} and \c{helloworld_de.ts} file using +\c{lupdate}. Compile said files into \c{helloworld_en.qm} and \c{helloworld.de.qm} +files in the build directory: + +\snippet cmake-macros/examples.cmake qt5_create_translation +*/ diff --git a/src/linguist/linguist/doc/snippets/cmake-macros/examples.cmake b/src/linguist/linguist/doc/snippets/cmake-macros/examples.cmake new file mode 100644 index 000000000..542ba7a6f --- /dev/null +++ b/src/linguist/linguist/doc/snippets/cmake-macros/examples.cmake @@ -0,0 +1,13 @@ +#! [qt5_add_translation] +qt5_add_translation(qmFiles helloworld_en.ts helloworld_de.ts) +#! [qt5_add_translation] + +#! [qt5_add_translation_output_location] +set(TS_FILES helloworld_en.ts helloworld_de.ts) +set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "l10n") +qt5_add_translation(qmFiles ${TS_FILES}) +#! [qt5_add_translation_output_location] + +#! [qt5_create_translation] +qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} helloworld_en.ts helloworld_de.ts) +#! [qt5_create_translation] diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index bd66d387f..f22a9d130 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -46,6 +46,7 @@ #include <qtextcodec.h> #include <quuid.h> #include <qmap.h> +#include <QtCore/qversionnumber.h> QT_BEGIN_NAMESPACE @@ -2106,8 +2107,6 @@ void HtmlGenerator::generateHeader(const QString& title, if (node && !node->doc().location().isEmpty()) out() << "<!-- " << node->doc().location().fileName() << " -->\n"; - QString projectVersion = qdb_->version(); - //determine the rest of the <title> element content: "title | titleSuffix version" QString titleSuffix; if (!landingtitle.isEmpty()) { @@ -2129,15 +2128,9 @@ void HtmlGenerator::generateHeader(const QString& title, //default: "title | Qt version" titleSuffix = QLatin1String("Qt "); - //for pages that duplicate the title and suffix (landing pages, home pages, - // and module landing pages, clear the duplicate if (title == titleSuffix) titleSuffix.clear(); - //for pages that duplicate the version, clear the duplicate - if (title.contains(projectVersion) || titleSuffix.contains(projectVersion)) - projectVersion.clear(); - QString divider; if (!titleSuffix.isEmpty() && !title.isEmpty()) divider = QLatin1String(" | "); @@ -2148,9 +2141,18 @@ void HtmlGenerator::generateHeader(const QString& title, << divider << titleSuffix; - if (!projectVersion.isEmpty()) - out() << QLatin1Char(' ') << projectVersion; - + // append a full version to the suffix if neither suffix nor title + // include (a prefix of) version information + QVersionNumber projectVersion = QVersionNumber::fromString(qdb_->version()); + if (!projectVersion.isNull()) { + QVersionNumber titleVersion; + QRegExp re("\\d+\\.\\d+"); + const QString &versionedTitle = titleSuffix.isEmpty() ? title : titleSuffix; + if (versionedTitle.contains(re)) + titleVersion = QVersionNumber::fromString(re.cap()); + if (titleVersion.isNull() || !titleVersion.isPrefixOf(projectVersion)) + out() << QLatin1Char(' ') << projectVersion.toString(); + } out() << "</title>\n"; // Include style sheet and script links. |