diff options
author | Liang Qi <liang.qi@qt.io> | 2019-04-24 10:52:39 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-04-24 11:55:36 +0200 |
commit | 4399a1683a016794e22ecdd03eafca07b93af4e2 (patch) | |
tree | d1a4da3ad9a57d60da2c7c71ae03a13701c67f16 | |
parent | d91ecc26252f42641a23e25f6a6a18495e0e7700 (diff) | |
parent | 97075ce49ee73609330804b8bbbc12fabbb30766 (diff) | |
download | qttools-4399a1683a016794e22ecdd03eafca07b93af4e2.tar.gz |
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
.qmake.conf
src/qdoc/qmlmarkupvisitor.h
src/qdoc/qmlvisitor.h
tests/auto/qtattributionsscanner/testdata/good/expected.json
Done-With: Kai Koehne <kai.koehne@qt.io>
Change-Id: I180ee214d1e5999fc1279b092bd9214b6bf8f858
47 files changed, 338 insertions, 121 deletions
diff --git a/dist/changes-5.12.3 b/dist/changes-5.12.3 new file mode 100644 index 000000000..b1ea2fe33 --- /dev/null +++ b/dist/changes-5.12.3 @@ -0,0 +1,24 @@ +Qt 5.12.3 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.12.0 through 5.12.2. + +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. + +**************************************************************************** +* makeqpf * +**************************************************************************** + + - Fix assert when rendering font using debug build of Qt diff --git a/src/assistant/assistant/bookmarkmanager.cpp b/src/assistant/assistant/bookmarkmanager.cpp index f15e23a6e..331cea864 100644 --- a/src/assistant/assistant/bookmarkmanager.cpp +++ b/src/assistant/assistant/bookmarkmanager.cpp @@ -526,7 +526,8 @@ void BookmarkManager::focusInEventOccurred() void BookmarkManager::managerWidgetAboutToClose() { - delete bookmarkManagerWidget; + if (bookmarkManagerWidget) + bookmarkManagerWidget->deleteLater(); bookmarkManagerWidget = nullptr; storeBookmarks(); diff --git a/src/assistant/assistant/main.cpp b/src/assistant/assistant/main.cpp index 3f4390450..3ddbdbc29 100644 --- a/src/assistant/assistant/main.cpp +++ b/src/assistant/assistant/main.cpp @@ -268,6 +268,7 @@ void setupTranslations() int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QCoreApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton); TRACE_OBJ QScopedPointer<QCoreApplication> a(createApplication(argc, argv)); diff --git a/src/assistant/help/qhelpsearchresultwidget.cpp b/src/assistant/help/qhelpsearchresultwidget.cpp index 86e56b733..b7d61b494 100644 --- a/src/assistant/help/qhelpsearchresultwidget.cpp +++ b/src/assistant/help/qhelpsearchresultwidget.cpp @@ -43,6 +43,7 @@ #include <QtCore/QString> #include <QtCore/QPointer> #include <QtCore/QStringList> +#include <QtCore/QTextStream> #include <QtWidgets/QLabel> #include <QtWidgets/QLayout> @@ -71,39 +72,39 @@ public: void showResultPage(const QVector<QHelpSearchResult> results, bool isIndexing) { - QString htmlFile = QString(QLatin1String("<html><head><title>%1" - "</title></head><body>")).arg(tr("Search Results")); + QString htmlFile; + QTextStream str(&htmlFile); + str << "<html><head><title>" << tr("Search Results") << "</title></head><body>"; const int count = results.count(); if (count != 0) { - if (isIndexing) - htmlFile += QString(QLatin1String("<div style=\"text-align:left;" - " font-weight:bold; color:red\">" - "%1 <span style=\"font-weight:normal; color:black\">" - "%2</span></div></div><br>")).arg(tr("Note:")) - .arg(tr("The search results may not be complete since the " - "documentation is still being indexed.")); + if (isIndexing) { + str << "<div style=\"text-align:left;" + " font-weight:bold; color:red\">" << tr("Note:") + << " <span style=\"font-weight:normal; color:black\">" + << tr("The search results may not be complete since the " + "documentation is still being indexed.") + << "</span></div></div><br>"; + } for (const QHelpSearchResult &result : results) { - htmlFile += QString(QLatin1String("<div style=\"text-align:left;" - " font-weight:bold\"><a href=\"%1\">%2</a>" + str << "<div style=\"text-align:left; font-weight:bold\"><a href=\"" + << result.url().toString() << "\">" << result.title() << "</a>" "<div style=\"color:green; font-weight:normal;" - " margin:5px\">%3</div></div><p></p>")) - .arg(result.url().toString(), result.title(), - result.snippet()); + " margin:5px\">" << result.snippet() << "</div></div><p></p>"; } } else { - htmlFile += QLatin1String("<div align=\"center\"><br><br><h2>") - + tr("Your search did not match any documents.") - + QLatin1String("</h2><div>"); - if (isIndexing) - htmlFile += QLatin1String("<div align=\"center\"><h3>") - + tr("(The reason for this might be that the documentation " - "is still being indexed.)") - + QLatin1String("</h3><div>"); + str << "<div align=\"center\"><br><br><h2>" + << tr("Your search did not match any documents.") + << "</h2><div>"; + if (isIndexing) { + str << "<div align=\"center\"><h3>" + << tr("(The reason for this might be that the documentation " + "is still being indexed.)") << "</h3><div>"; + } } - htmlFile += QLatin1String("</body></html>"); + str << "</body></html>"; setHtml(htmlFile); } diff --git a/src/linguist/Qt5LinguistToolsMacros.cmake b/src/linguist/Qt5LinguistToolsMacros.cmake index b99597304..5c357a152 100644 --- a/src/linguist/Qt5LinguistToolsMacros.cmake +++ b/src/linguist/Qt5LinguistToolsMacros.cmake @@ -74,7 +74,8 @@ function(QT5_CREATE_TRANSLATION _qm_files) add_custom_command(OUTPUT ${_ts_file} COMMAND ${Qt5_LUPDATE_EXECUTABLE} ARGS ${_lupdate_options} "@${_ts_lst_file}" -ts ${_ts_file} - DEPENDS ${_my_sources} ${_ts_lst_file} VERBATIM) + DEPENDS ${_my_sources} + BYPRODUCTS ${_ts_lst_file} VERBATIM) endforeach() qt5_add_translation(${_qm_files} ${_my_tsfiles}) set(${_qm_files} ${${_qm_files}} PARENT_SCOPE) diff --git a/src/linguist/lupdate/cpp.cpp b/src/linguist/lupdate/cpp.cpp index aac9a90ff..e96e102af 100644 --- a/src/linguist/lupdate/cpp.cpp +++ b/src/linguist/lupdate/cpp.cpp @@ -239,6 +239,7 @@ private: std::ostream &yyMsg(int line = 0); int getChar(); + TokenType lookAheadToSemicolonOrLeftBrace(); TokenType getToken(); void processComment(); @@ -249,7 +250,6 @@ private: bool matchStringOrNull(QString *s); bool matchExpression(); - QString transcode(const QString &str); void recordMessage( int line, const QString &context, const QString &text, const QString &comment, const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra, @@ -450,6 +450,23 @@ int CppParser::getChar() } } +CppParser::TokenType CppParser::lookAheadToSemicolonOrLeftBrace() +{ + if (*yyInPtr == 0) + return Tok_Eof; + const ushort *uc = yyInPtr + 1; + forever { + ushort c = *uc; + if (!c) + return Tok_Eof; + if (c == ';') + return Tok_Semicolon; + if (c == '{') + return Tok_LeftBrace; + ++uc; + } +} + STRING(Q_OBJECT); STRING(class); STRING(final); @@ -1451,7 +1468,7 @@ bool CppParser::matchString(QString *s) return matches; matches = true; if (yyTok == Tok_String) - *s += transcode(yyWord); + *s += ParserTool::transcode(yyWord); else *s += yyWord; s->detach(); @@ -1532,65 +1549,14 @@ bool CppParser::matchExpression() return true; } -QString CppParser::transcode(const QString &str) -{ - static const char tab[] = "abfnrtv"; - static const char backTab[] = "\a\b\f\n\r\t\v"; - // This function has to convert back to bytes, as C's \0* sequences work at that level. - const QByteArray in = str.toUtf8(); - QByteArray out; - - out.reserve(in.length()); - for (int i = 0; i < in.length();) { - uchar c = in[i++]; - if (c == '\\') { - if (i >= in.length()) - break; - c = in[i++]; - - if (c == '\n') - continue; - - if (c == 'x' || c == 'u' || c == 'U') { - const bool unicode = (c != 'x'); - QByteArray hex; - while (i < in.length() && isxdigit((c = in[i]))) { - hex += c; - i++; - } - if (unicode) - out += QString(QChar(hex.toUInt(nullptr, 16))).toUtf8(); - else - out += hex.toUInt(nullptr, 16); - } else if (c >= '0' && c < '8') { - QByteArray oct; - int n = 0; - oct += c; - while (n < 2 && i < in.length() && (c = in[i]) >= '0' && c < '8') { - i++; - n++; - oct += c; - } - out += oct.toUInt(0, 8); - } else { - const char *p = strchr(tab, c); - out += !p ? c : backTab[p - tab]; - } - } else { - out += c; - } - } - return QString::fromUtf8(out.constData(), out.length()); -} - void CppParser::recordMessage(int line, const QString &context, const QString &text, const QString &comment, const QString &extracomment, const QString &msgid, const TranslatorMessage::ExtraData &extra, bool plural) { TranslatorMessage msg( - transcode(context), text, transcode(comment), QString(), + ParserTool::transcode(context), text, ParserTool::transcode(comment), QString(), yyFileName, line, QStringList(), TranslatorMessage::Unfinished, plural); - msg.setExtraComment(transcode(extracomment.simplified())); + msg.setExtraComment(ParserTool::transcode(extracomment.simplified())); msg.setId(msgid); msg.setExtras(extra); tor->append(msg); @@ -1760,7 +1726,7 @@ void CppParser::handleTrId(bool plural) yyTok = getToken(); if (matchString(&msgid) && !msgid.isEmpty()) { plural |= match(Tok_Comma); - recordMessage(line, QString(), transcode(sourcetext), QString(), extracomment, + recordMessage(line, QString(), ParserTool::transcode(sourcetext), QString(), extracomment, msgid, extra, plural); } sourcetext.clear(); @@ -2182,8 +2148,11 @@ void CppParser::parseInternal(ConversionData &cd, const QStringList &includeStac pendingContext = prospectiveContext; prospectiveContext.clear(); } - if (yyTok == Tok_Colon) - yyTokColonSeen = true; + //ignore colons for bitfields (are usually followed by a semicolon) + if (yyTok == Tok_Colon) { + if (lookAheadToSemicolonOrLeftBrace() != Tok_Semicolon) + yyTokColonSeen = true; + } } metaExpected = true; yyTok = getToken(); @@ -2314,11 +2283,11 @@ void CppParser::processComment() context = comment.left(k); comment.remove(0, k + 1); TranslatorMessage msg( - transcode(context), QString(), - transcode(comment), QString(), + ParserTool::transcode(context), QString(), + ParserTool::transcode(comment), QString(), yyFileName, yyLineNo, QStringList(), TranslatorMessage::Finished, false); - msg.setExtraComment(transcode(extracomment.simplified())); + msg.setExtraComment(ParserTool::transcode(extracomment.simplified())); extracomment.clear(); tor->append(msg); tor->setExtras(extra); diff --git a/src/linguist/lupdate/lupdate.h b/src/linguist/lupdate/lupdate.h index 0d98379d0..bb58cbd1e 100644 --- a/src/linguist/lupdate/lupdate.h +++ b/src/linguist/lupdate/lupdate.h @@ -99,6 +99,11 @@ bool loadQml(Translator &translator, const QString &filename, ConversionData &cd UNARY_MACRO(qsTranslate) \ /*end*/ +class ParserTool +{ +public: + static QString transcode(const QString &str); +}; class TrFunctionAliasManager { public: diff --git a/src/linguist/lupdate/main.cpp b/src/linguist/lupdate/main.cpp index eb81ee9e8..d9c6f7966 100644 --- a/src/linguist/lupdate/main.cpp +++ b/src/linguist/lupdate/main.cpp @@ -134,6 +134,57 @@ QStringList TrFunctionAliasManager::availableFunctionsWithAliases() const TrFunctionAliasManager trFunctionAliasManager; +QString ParserTool::transcode(const QString &str) +{ + static const char tab[] = "abfnrtv"; + static const char backTab[] = "\a\b\f\n\r\t\v"; + // This function has to convert back to bytes, as C's \0* sequences work at that level. + const QByteArray in = str.toUtf8(); + QByteArray out; + + out.reserve(in.length()); + for (int i = 0; i < in.length();) { + uchar c = in[i++]; + if (c == '\\') { + if (i >= in.length()) + break; + c = in[i++]; + + if (c == '\n') + continue; + + if (c == 'x' || c == 'u' || c == 'U') { + const bool unicode = (c != 'x'); + QByteArray hex; + while (i < in.length() && isxdigit((c = in[i]))) { + hex += c; + i++; + } + if (unicode) + out += QString(QChar(hex.toUInt(nullptr, 16))).toUtf8(); + else + out += hex.toUInt(nullptr, 16); + } else if (c >= '0' && c < '8') { + QByteArray oct; + int n = 0; + oct += c; + while (n < 2 && i < in.length() && (c = in[i]) >= '0' && c < '8') { + i++; + n++; + oct += c; + } + out += oct.toUInt(0, 8); + } else { + const char *p = strchr(tab, c); + out += !p ? c : backTab[p - tab]; + } + } else { + out += c; + } + } + return QString::fromUtf8(out.constData(), out.length()); +} + static QString m_defaultExtensions; static void printOut(const QString & out) @@ -314,6 +365,19 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil printErr(LU::tr("lupdate warning: Specified source language '%1' disagrees with" " existing file's language '%2'. Ignoring.\n") .arg(sourceLanguage, tor.sourceLanguageCode())); + // If there is translation in the file, the language should be recognized + // (when the language is not recognized, plural translations are lost) + if (tor.translationsExist()) { + QLocale::Language l; + QLocale::Country c; + tor.languageAndCountry(tor.languageCode(), &l, &c); + QStringList forms; + if (!getNumerusInfo(l, c, 0, &forms, 0)) { + printErr(LU::tr("File %1 won't be updated: it contains translation but the" + " target language is not recognized\n").arg(fileName)); + continue; + } + } } else { if (!targetLanguage.isEmpty()) tor.setLanguageCode(targetLanguage); diff --git a/src/linguist/lupdate/qdeclarative.cpp b/src/linguist/lupdate/qdeclarative.cpp index 0938b86e8..fa8ad260e 100644 --- a/src/linguist/lupdate/qdeclarative.cpp +++ b/src/linguist/lupdate/qdeclarative.cpp @@ -130,11 +130,11 @@ protected: if (!sourcetext.isEmpty()) yyMsg(identLineNo) << qPrintable(LU::tr("//% cannot be used with %1(). Ignoring\n").arg(name)); - TranslatorMessage msg(m_component, source, + TranslatorMessage msg(m_component, ParserTool::transcode(source), comment, QString(), m_fileName, node->firstSourceLocation().startLine, QStringList(), TranslatorMessage::Unfinished, plural); - msg.setExtraComment(extracomment.simplified()); + msg.setExtraComment(ParserTool::transcode(extracomment.simplified())); msg.setId(msgid); msg.setExtras(extra); m_translator->extend(msg, m_cd); @@ -171,11 +171,11 @@ protected: plural = true; } - TranslatorMessage msg(context, source, + TranslatorMessage msg(context, ParserTool::transcode(source), comment, QString(), m_fileName, node->firstSourceLocation().startLine, QStringList(), TranslatorMessage::Unfinished, plural); - msg.setExtraComment(extracomment.simplified()); + msg.setExtraComment(ParserTool::transcode(extracomment.simplified())); msg.setId(msgid); msg.setExtras(extra); m_translator->extend(msg, m_cd); @@ -199,11 +199,11 @@ protected: bool plural = node->arguments->next; - TranslatorMessage msg(QString(), sourcetext, + TranslatorMessage msg(QString(), ParserTool::transcode(sourcetext), QString(), QString(), m_fileName, node->firstSourceLocation().startLine, QStringList(), TranslatorMessage::Unfinished, plural); - msg.setExtraComment(extracomment.simplified()); + msg.setExtraComment(ParserTool::transcode(extracomment.simplified())); msg.setId(id); msg.setExtras(extra); m_translator->extend(msg, m_cd); @@ -221,7 +221,7 @@ private: return std::cerr << qPrintable(m_fileName) << ':' << line << ": "; } - void throwRecursionDepthError() + void throwRecursionDepthError() final { std::cerr << qPrintable(m_fileName) << ": " << qPrintable(LU::tr("Maximum statement or expression depth exceeded")); diff --git a/src/linguist/shared/translator.cpp b/src/linguist/shared/translator.cpp index af669e235..db28ea396 100644 --- a/src/linguist/shared/translator.cpp +++ b/src/linguist/shared/translator.cpp @@ -433,6 +433,17 @@ void Translator::stripUntranslatedMessages() m_indexOk = false; } +bool Translator::translationsExist() +{ + for (TMM::Iterator it = m_messages.begin(); it != m_messages.end(); ) { + if (it->isTranslated()) + return true; + else + ++it; + } + return false; +} + void Translator::stripEmptyContexts() { for (TMM::Iterator it = m_messages.begin(); it != m_messages.end();) diff --git a/src/linguist/shared/translator.h b/src/linguist/shared/translator.h index 8919a13df..5b5d12250 100644 --- a/src/linguist/shared/translator.h +++ b/src/linguist/shared/translator.h @@ -135,6 +135,7 @@ public: void dropTranslations(); void dropUiLines(); void makeFileNamesAbsolute(const QDir &originalPath); + bool translationsExist(); struct Duplicates { QSet<int> byId, byContents; }; Duplicates resolveDuplicates(); diff --git a/src/linguist/shared/ts.cpp b/src/linguist/shared/ts.cpp index 5914319c9..153f9708b 100644 --- a/src/linguist/shared/ts.cpp +++ b/src/linguist/shared/ts.cpp @@ -464,7 +464,7 @@ static QString protect(const QString &str) result += QLatin1String("'"); break; default: - if ((c < 0x20 || (ch > 0x7f && ch.isSpace())) && c != '\r' && c != '\n' && c != '\t') + if ((c < 0x20 || (ch > 0x7f && ch.isSpace())) && c != '\n' && c != '\t') result += numericEntity(c); else // this also covers surrogates result += QChar(c); diff --git a/src/makeqpf/qpf2.cpp b/src/makeqpf/qpf2.cpp index 508afaa33..c56ec391a 100644 --- a/src/makeqpf/qpf2.cpp +++ b/src/makeqpf/qpf2.cpp @@ -402,10 +402,10 @@ static QByteArray generateTrueTypeCMap(QFontEngine *fe) quint32 previousGlyphIndex = 0xfffffffe; bool inSegment = false; - QGlyphLayoutArray<10> layout; + QGlyphLayoutArray<1> layout; for (uint uc = 0; uc < 0x10000; ++uc) { QChar ch(uc); - int nglyphs = 10; + int nglyphs = 1; bool validGlyph = fe->stringToCMap(&ch, 1, &layout, &nglyphs, /*flags*/ 0) && nglyphs == 1 && layout.glyphs[0]; @@ -503,14 +503,14 @@ void QPF::addGlyphs(QFontEngine *fe, const QList<CharacterRange> &ranges) * (sizeof(QFontEngineQPF2::Glyph) + qRound(fe->maxCharWidth() * (fe->ascent() + fe->descent()).toReal()))); - QGlyphLayoutArray<10> layout; + QGlyphLayoutArray<1> layout; for (CharacterRange range : ranges) { if (debugVerbosity > 2) qDebug() << "rendering range from" << range.start << "to" << range.end; for (uint uc = range.start; uc < range.end; ++uc) { QChar ch(uc); - int nglyphs = 10; + int nglyphs = 1; if (!fe->stringToCMap(&ch, 1, &layout, &nglyphs, /*flags*/ 0)) continue; @@ -524,8 +524,12 @@ void QPF::addGlyphs(QFontEngine *fe, const QList<CharacterRange> &ranges) Q_ASSERT(glyphIndex < glyphCount); - QImage img = fe->alphaMapForGlyph(glyphIndex).convertToFormat(QImage::Format_Indexed8); glyph_metrics_t metrics = fe->boundingBox(glyphIndex); + const bool valid = metrics.width.value() != 0 && metrics.height.value() != 0; + + QImage img = valid + ? fe->alphaMapForGlyph(glyphIndex).convertToFormat(QImage::Format_Indexed8) + : QPixmap(0,0).toImage(); const quint32 oldSize = glyphs.size(); glyphs.resize(glyphs.size() + sizeof(QFontEngineQPF2::Glyph) + img.byteCount()); diff --git a/src/qdoc/configure.pri b/src/qdoc/configure.pri index 34ad83f82..e9d7667c0 100644 --- a/src/qdoc/configure.pri +++ b/src/qdoc/configure.pri @@ -57,6 +57,7 @@ defineTest(qtConfTest_libclang) { # Assume libclang is installed on the target system isEmpty(LLVM_INSTALL_DIR) { llvmConfigCandidates = \ + llvm-config-9 \ llvm-config-8 \ llvm-config-7 \ llvm-config-6.0 \ diff --git a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc index 1b6648f90..22b0b4e6b 100644 --- a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc +++ b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc @@ -1767,6 +1767,11 @@ ... \endcode + By default, qdoc looks for \c{//!} as a code snippet marker. + For \c{.pro}, \c{.py}, \c{.cmake}, and \c{CMakeLists.txt} + files, \c {#!} is detected. Finally, \c{<!--} is accepted in + \c{.html}, \c{.qrc}, \c{.ui}, \c{.xml}, \c{.dita}, and \c{.xq} files. + \target codeline-command \section1 \\codeline diff --git a/src/qdoc/qmlmarkupvisitor.h b/src/qdoc/qmlmarkupvisitor.h index ddd80bbec..c752f7264 100644 --- a/src/qdoc/qmlmarkupvisitor.h +++ b/src/qdoc/qmlmarkupvisitor.h @@ -153,7 +153,7 @@ private: void addVerbatim(QQmlJS::AST::SourceLocation first, QQmlJS::AST::SourceLocation last = QQmlJS::AST::SourceLocation()); QString sourceText(QQmlJS::AST::SourceLocation &location); - void throwRecursionDepthError() override; + void throwRecursionDepthError() final; QQmlJS::Engine *engine; QVector<ExtraType> extraTypes; diff --git a/src/qdoc/qmlvisitor.h b/src/qdoc/qmlvisitor.h index 5b985565c..4d32a6bd5 100644 --- a/src/qdoc/qmlvisitor.h +++ b/src/qdoc/qmlvisitor.h @@ -92,7 +92,7 @@ public: bool visit(QQmlJS::AST::UiQualifiedId *) override; void endVisit(QQmlJS::AST::UiQualifiedId *) override; - void throwRecursionDepthError() override; + void throwRecursionDepthError() final; bool hasError() const; private: diff --git a/src/qdoc/quoter.cpp b/src/qdoc/quoter.cpp index 397caf085..408b1b5b0 100644 --- a/src/qdoc/quoter.cpp +++ b/src/qdoc/quoter.cpp @@ -112,7 +112,7 @@ Quoter::Quoter() /* We're going to hard code these delimiters: * C++, Qt, Qt Script, Java: //! [<id>] - * .pro, .py files: + * .pro, .py, CMake files: #! [<id>] * .html, .qrc, .ui, .xq, .xml .dita files: <!-- [<id>] --> @@ -120,6 +120,7 @@ Quoter::Quoter() if (!commentHash.size()) { commentHash["pro"] = "#!"; commentHash["py"] = "#!"; + commentHash["cmake"] = "#!"; commentHash["html"] = "<!--"; commentHash["qrc"] = "<!--"; commentHash["ui"] = "<!--"; @@ -339,8 +340,10 @@ void Quoter::failedAtEnd( const Location& docLocation, const QString& command ) QString Quoter::commentForCode() const { - QString suffix = QFileInfo(codeLocation.fileName()).suffix(); - return commentHash.value(suffix, "//!"); + QFileInfo fi = QFileInfo(codeLocation.fileName()); + if (fi.fileName() == "CMakeLists.txt") + return "#!"; + return commentHash.value(fi.suffix(), "//!"); } QString Quoter::removeSpecialLines(const QString &line, const QString &comment, int unindent) diff --git a/src/qdoc/sections.cpp b/src/qdoc/sections.cpp index 14bf96191..452be566a 100644 --- a/src/qdoc/sections.cpp +++ b/src/qdoc/sections.cpp @@ -717,6 +717,8 @@ void Sections::buildStdRefPageSections() */ void Sections::distributeNodeInSummaryVector(SectionVector &sv, Node *n) { + if (n->isSharedCommentNode()) + return; if (n->isFunction()) { FunctionNode *fn = static_cast<FunctionNode*>(n); if (fn->isRelatedNonmember()) { diff --git a/src/qtattributionsscanner/jsongenerator.cpp b/src/qtattributionsscanner/jsongenerator.cpp index 37d0426af..44fb784aa 100644 --- a/src/qtattributionsscanner/jsongenerator.cpp +++ b/src/qtattributionsscanner/jsongenerator.cpp @@ -58,6 +58,7 @@ static QJsonObject generate(Package package) obj.insert(QStringLiteral("LicenseFile"), package.licenseFile); obj.insert(QStringLiteral("Copyright"), package.copyright); + obj.insert(QStringLiteral("PackageComment"), package.packageComment); return obj; } diff --git a/src/qtattributionsscanner/package.h b/src/qtattributionsscanner/package.h index a0cb82fdd..4a8a9e3e2 100644 --- a/src/qtattributionsscanner/package.h +++ b/src/qtattributionsscanner/package.h @@ -53,6 +53,8 @@ struct Package { QString licenseFile; // path to file containing the license text. Optional. QString copyright; // A list of copyright owners. Mandatory. + + QString packageComment; // Further comments about the package. Optional. }; #endif // PACKAGE_H diff --git a/src/qtattributionsscanner/scanner.cpp b/src/qtattributionsscanner/scanner.cpp index a6c38a3f0..dc7b88fbf 100644 --- a/src/qtattributionsscanner/scanner.cpp +++ b/src/qtattributionsscanner/scanner.cpp @@ -120,6 +120,8 @@ static Package readPackage(const QJsonObject &object, const QString &filePath, L p.licenseFile = QDir(directory).absoluteFilePath(value); } else if (key == QLatin1String("Copyright")) { p.copyright = value; + } else if (key == QLatin1String("PackageComment")) { + p.packageComment = value; } else if (key == QLatin1String("QDocModule")) { p.qdocModule = value; } else if (key == QLatin1String("Description")) { diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before index ce8281033..e72debed9 100644 --- a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.before @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.0"> +<TS version="2.0" language="de_DE"> <context> <name>A</name> <message> diff --git a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result index 155967a52..351bdff7d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/heuristics/project.ts.result @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="de_DE"> <context> <name>A</name> <message> diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.before index 0f84fedb8..ab91cac9d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.before @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS><TS version="1.1"> +<!DOCTYPE TS><TS version="1.1" language="en_EN"> <context> <name>QObject</name> <message> diff --git a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.result index 64ec91076..486abcec4 100644 --- a/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/merge_whitespace/project.ts.result @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="en_EN"> <context> <name>QObject</name> <message> @@ -62,9 +62,9 @@ NEWLINE AT THE START</translation> </message> <message> <location filename="main.cpp" line="49"/> - <source>carriage return and line feed last + <source>carriage return and line feed last<byte value="xd"/> </source> - <translation type="unfinished">CARRIAGE RETURN AND LINE FEED LAST + <translation type="unfinished">CARRIAGE RETURN AND LINE FEED LAST<byte value="xd"/> </translation> </message> </context> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before index feab1694d..f9915e9ba 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE TS><TS version="1.1"> +<!DOCTYPE TS><TS version="1.1" language="en_EN"> <context> <name></name> <message id="keep_id"> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result index a0cdda96a..516072d5e 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="en_EN"> <context> <name></name> <message id="keep_id"> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before index 2af303be4..99443bbad 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<!DOCTYPE TS><TS version="1.1"> +<!DOCTYPE TS><TS version="1.1" language="en_EN"> <context> <name></name> <message id="keep_id"> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result index 1fcfea4e5..b6d47c8dd 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="en_EN"> <context> <name></name> <message id="keep_id"> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before index b96cd4ee9..b9333c9dd 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.before @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<!DOCTYPE TS><TS version="1.1"> +<!DOCTYPE TS><TS version="1.1" language="no_NO"> <context> <name>FindDialog</name> <message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result index 00c70ed94..8d51b197d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui/project.ts.result @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="no_NO"> <context> <name>FindDialog</name> <message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.before index f06c22ca8..d47409c84 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.before @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<!DOCTYPE TS><TS version="1.1"> +<!DOCTYPE TS><TS version="1.1" language="no_NO"> <context> <name>FindDialog</name> <message> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result index 2636ae075..79a6e8c51 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergeui_obsolete/project.ts.result @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="no_NO"> <context> <name>FindDialog</name> <message> diff --git a/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/main.cpp b/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/main.cpp new file mode 100644 index 000000000..157979b70 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/main.cpp @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <QApplication> +#include <QPushButton> +#include <QTranslator> + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QTranslator translator; + app.installTranslator(&translator); + + QObject::tr("un mot","toto",1); + + return app.exec(); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/project.pro b/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/project.pro new file mode 100644 index 000000000..759bea068 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/project.pro @@ -0,0 +1,3 @@ +SOURCES = main.cpp + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/project.ts.before new file mode 100644 index 000000000..7216e069c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/project.ts.before @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1"> +<context> + <name>QObject</name> + <message numerus="yes"> + <location filename="main.cpp" line="39"/> + <source>un mot</source> + <comment>toto</comment> + <translation type="unfinished"> + <numerusform>ein Wort</numerusform> + </translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/project.ts.result new file mode 100644 index 000000000..7216e069c --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/notargetlanguage/project.ts.result @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1"> +<context> + <name>QObject</name> + <message numerus="yes"> + <location filename="main.cpp" line="39"/> + <source>un mot</source> + <comment>toto</comment> + <translation type="unfinished"> + <numerusform>ein Wort</numerusform> + </translation> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp b/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp index 772ebfb29..6cef7a28c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/main.cpp @@ -41,3 +41,16 @@ void Foo::bar() { tr("BAR"); } + +class BitFields : public QObject +{ + int bits : 20; + QString str = tr("text BitFields"); +}; + +Bibi::Bibi() +{ + int bits : 32; + tr("text Bibi"); + Babebi::tr("text Babebi"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result index 7e7e27742..e4f347db2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/prefix/project.ts.result @@ -2,6 +2,30 @@ <!DOCTYPE TS> <TS version="2.1"> <context> + <name>Babebi</name> + <message> + <location filename="main.cpp" line="55"/> + <source>text Babebi</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Bibi</name> + <message> + <location filename="main.cpp" line="54"/> + <source>text Bibi</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>BitFields</name> + <message> + <location filename="main.cpp" line="48"/> + <source>text BitFields</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>Foo</name> <message> <location filename="main.cpp" line="32"/> diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.before index f06c22ca8..d47409c84 100644 --- a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.before @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<!DOCTYPE TS><TS version="1.1"> +<!DOCTYPE TS><TS version="1.1" language="no_NO"> <context> <name>FindDialog</name> <message> diff --git a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result index 2636ae075..79a6e8c51 100644 --- a/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/textsimilarity/project.ts.result @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="no_NO"> <context> <name>FindDialog</name> <message> diff --git a/tests/auto/qtattributionsscanner/testdata/good/complete/qt_attribution_test.json b/tests/auto/qtattributionsscanner/testdata/good/complete/qt_attribution_test.json index f8e7b1c68..8035cefab 100644 --- a/tests/auto/qtattributionsscanner/testdata/good/complete/qt_attribution_test.json +++ b/tests/auto/qtattributionsscanner/testdata/good/complete/qt_attribution_test.json @@ -17,5 +17,6 @@ Usage", "Version": "1.0", "DownloadLocation": "www.qt.io/1.0", "LicenseId": "xxx", - "LicenseFile": "LICENSE" + "LicenseFile": "LICENSE", + "PackageComment": "just a test package" } diff --git a/tests/auto/qtattributionsscanner/testdata/good/expected.json b/tests/auto/qtattributionsscanner/testdata/good/expected.json index f4ad1b360..1f54c13e6 100644 --- a/tests/auto/qtattributionsscanner/testdata/good/expected.json +++ b/tests/auto/qtattributionsscanner/testdata/good/expected.json @@ -10,6 +10,7 @@ "LicenseFile": "", "LicenseId": "", "Name": "Test", + "PackageComment":"", "Path": "%{PWD}/chromium", "QDocModule": "qtwebengine", "QtParts": [ @@ -27,6 +28,7 @@ "LicenseFile": "%{PWD}/complete/LICENSE", "LicenseId": "xxx", "Name": "Complete", + "PackageComment":"just a test package", "Path": "%{PWD}/complete", "Files": "", "QDocModule": "qtest", @@ -44,6 +46,7 @@ "LicenseFile": "", "LicenseId": "", "Name": "Minimal", + "PackageComment":"", "Path": "%{PWD}/minimal", "Files": "", "QDocModule": "qtest", diff --git a/tests/auto/qtattributionsscanner/testdata/good/minimal/expected.json b/tests/auto/qtattributionsscanner/testdata/good/minimal/expected.json index 6a75269c0..8d9a5a31f 100644 --- a/tests/auto/qtattributionsscanner/testdata/good/minimal/expected.json +++ b/tests/auto/qtattributionsscanner/testdata/good/minimal/expected.json @@ -8,6 +8,7 @@ "LicenseFile": "", "LicenseId": "", "Name": "Minimal", + "PackageComment": "", "Path": "%{PWD}", "Files": "", "QDocModule": "qtest", diff --git a/tests/auto/qtattributionsscanner/testdata/warnings/incomplete/expected.json b/tests/auto/qtattributionsscanner/testdata/warnings/incomplete/expected.json index a28547bfe..fa56f2976 100644 --- a/tests/auto/qtattributionsscanner/testdata/warnings/incomplete/expected.json +++ b/tests/auto/qtattributionsscanner/testdata/warnings/incomplete/expected.json @@ -8,6 +8,7 @@ "LicenseFile": "", "LicenseId": "", "Name": "", + "PackageComment": "", "Path": "%{PWD}", "Files": "", "QDocModule": "", diff --git a/tests/auto/qtattributionsscanner/testdata/warnings/unknown/expected.json b/tests/auto/qtattributionsscanner/testdata/warnings/unknown/expected.json index 151af4093..18c1055f2 100644 --- a/tests/auto/qtattributionsscanner/testdata/warnings/unknown/expected.json +++ b/tests/auto/qtattributionsscanner/testdata/warnings/unknown/expected.json @@ -8,6 +8,7 @@ "LicenseFile": "", "LicenseId": "", "Name": "Unknown", + "PackageComment": "", "Path": "%{PWD}", "Files": "", "QDocModule": "qtest", |