diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-04-03 03:01:15 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-04-03 03:01:15 +0200 |
commit | 25fae19bbfdc3d296e4a36a1dfdbf95e9bb6886f (patch) | |
tree | f153c2f206ad1cb797c382e63a99bd5beb061d05 | |
parent | 0779a2ee5db5eb009e027ba08628e2172b2e7632 (diff) | |
parent | f1c59c4e73236f8a93489776f3746d72dde94cc4 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I88c539e807e21613fad838dc5230ab26994ed749
-rw-r--r-- | src/linguist/lupdate/qdeclarative.cpp | 14 | ||||
-rw-r--r-- | src/qdoc/clangcodeparser.cpp | 2 | ||||
-rw-r--r-- | src/qdoc/config.cpp | 7 | ||||
-rw-r--r-- | src/qdoc/location.cpp | 7 | ||||
-rw-r--r-- | src/qdoc/main.cpp | 2 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/testdata/good/tr_function_alias/lupdatecmd | 2 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/testdata/good/tr_function_alias/main.qml | 4 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/testdata/good/tr_function_alias/project.ts.result | 8 |
8 files changed, 35 insertions, 11 deletions
diff --git a/src/linguist/lupdate/qdeclarative.cpp b/src/linguist/lupdate/qdeclarative.cpp index 11d37259d..40af15566 100644 --- a/src/linguist/lupdate/qdeclarative.cpp +++ b/src/linguist/lupdate/qdeclarative.cpp @@ -90,10 +90,20 @@ protected: void endVisit(AST::CallExpression *node) { - if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(node->base)) { + QString name; + AST::ExpressionNode *base = node->base; + + while (base && base->kind == AST::Node::Kind_FieldMemberExpression) { + auto memberExpr = static_cast<AST::FieldMemberExpression *>(base); + name.prepend(memberExpr->name); + name.prepend(QLatin1Char('.')); + base = memberExpr->base; + } + + if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(base)) { processComments(idExpr->identifierToken.begin()); - const QString name = idExpr->name.toString(); + name = idExpr->name.toString() + name; const int identLineNo = idExpr->identifierToken.startLine; switch (trFunctionAliasManager.trFunctionByName(name)) { case TrFunctionAliasManager::Function_qsTr: diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index 77055ca9f..ec145c736 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -1176,7 +1176,7 @@ void ClangCodeParser::getMoreArgs() */ void ClangCodeParser::buildPCH() { - if (!pchFileDir_) { + if (!pchFileDir_ && !moduleHeader().isEmpty()) { pchFileDir_.reset(new QTemporaryDir(QDir::tempPath() + QLatin1String("/qdoc_pch"))); if (pchFileDir_->isValid()) { //const QByteArray module = qdb_->primaryTreeRoot()->tree()->camelCaseModuleName().toUtf8(); diff --git a/src/qdoc/config.cpp b/src/qdoc/config.cpp index de7f23ce6..64c8786f6 100644 --- a/src/qdoc/config.cpp +++ b/src/qdoc/config.cpp @@ -397,12 +397,17 @@ QSet<QString> Config::getOutputFormats() const If \a var is not contained in the location map it returns \a defaultString. + + \note By default, \a defaultString is a null string. If \a var + is found but contains an empty string, that is returned instead. + This allows determining whether a configuration variable is + undefined (null string) or defined as empty (empty string). */ QString Config::getString(const QString& var, const QString& defaultString) const { QList<ConfigVar> configVars = configVars_.values(var); if (!configVars.empty()) { - QString value; + QString value(""); int i = configVars.size() - 1; while (i >= 0) { const ConfigVar& cv = configVars[i]; diff --git a/src/qdoc/location.cpp b/src/qdoc/location.cpp index 51fb45b54..cb12e6ea4 100644 --- a/src/qdoc/location.cpp +++ b/src/qdoc/location.cpp @@ -463,11 +463,8 @@ QString Location::toString() const QString Location::top() const { - QString str = filePath(); - if (!QDir::isAbsolutePath(str)) { - QDir path(str); - str = path.absolutePath(); - } + QDir path(filePath()); + QString str = path.absolutePath(); if (lineNo() >= 1) { str += QLatin1Char(':'); str += QString::number(lineNo()); diff --git a/src/qdoc/main.cpp b/src/qdoc/main.cpp index 79cde7950..563915d49 100644 --- a/src/qdoc/main.cpp +++ b/src/qdoc/main.cpp @@ -366,7 +366,7 @@ static void processQdocconfFile(const QString &fileName) qdb->newPrimaryTree(project); else qdb->setPrimaryTree(project); - if (!moduleHeader.isEmpty()) + if (!moduleHeader.isNull()) clangParser_->setModuleHeader(moduleHeader); else clangParser_->setModuleHeader(project); diff --git a/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/lupdatecmd index 7996a444a..e2f91b5f1 100644 --- a/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/lupdatecmd +++ b/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/lupdatecmd @@ -1 +1 @@ -lupdate main.cpp -tr-function-alias QT_TRANSLATE_NOOP+=QT_TRANSLATE_NOOP_ALIAS,QT_TRANSLATE_NOOP_UTF8+=QT_TRANSLATE_NOOP_UTF8_ALIAS,QT_TRANSLATE_NOOP3+=QT_TRANSLATE_NOOP3_ALIAS,QT_TRANSLATE_NOOP3_UTF8+=QT_TRANSLATE_NOOP3_UTF8_ALIAS,QT_TRID_NOOP+=QT_TRID_NOOP_ALIAS,Q_DECLARE_TR_FUNCTIONS+=Q_DECLARE_TR_FUNCTIONS_ALIAS,qtTrId+=qtTrId_alias,QT_TR_NOOP+=QT_TR_NOOP_ALIAS,QT_TR_NOOP_UTF8+=QT_TR_NOOP_UTF8_ALIAS,tr+=tr_alias,trUtf8+=trUtf8_alias,translate+=translate_alias -ts project.ts +lupdate main.cpp main.qml -tr-function-alias QT_TRANSLATE_NOOP+=QT_TRANSLATE_NOOP_ALIAS,QT_TRANSLATE_NOOP_UTF8+=QT_TRANSLATE_NOOP_UTF8_ALIAS,QT_TRANSLATE_NOOP3+=QT_TRANSLATE_NOOP3_ALIAS,QT_TRANSLATE_NOOP3_UTF8+=QT_TRANSLATE_NOOP3_UTF8_ALIAS,QT_TRID_NOOP+=QT_TRID_NOOP_ALIAS,Q_DECLARE_TR_FUNCTIONS+=Q_DECLARE_TR_FUNCTIONS_ALIAS,qtTrId+=qtTrId_alias,QT_TR_NOOP+=QT_TR_NOOP_ALIAS,QT_TR_NOOP_UTF8+=QT_TR_NOOP_UTF8_ALIAS,tr+=tr_alias,trUtf8+=trUtf8_alias,translate+=translate_alias,qsTr=MySingletonCustomTranslator.subObject.tr -ts project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/main.qml b/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/main.qml new file mode 100644 index 000000000..3fd65ce9f --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/main.qml @@ -0,0 +1,4 @@ +import MyModuleWithSingleton 1.0 +Text { + text: MySingletonCustomTranslator.subObject.tr("xxx") +} diff --git a/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/project.ts.result index 93e5b9781..974c4523b 100644 --- a/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/tr_function_alias/project.ts.result @@ -130,6 +130,14 @@ </message> </context> <context> + <name>main</name> + <message> + <location filename="main.qml" line="3"/> + <source>xxx</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>scope</name> <message> <location filename="main.cpp" line="34"/> |