diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-29 16:03:03 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-29 16:03:03 (GMT) |
commit | 6820fc145dd1eb9a22384eed63a5a11d4118f147 (patch) | |
tree | 8f6777026e5aa7b35942c14cee1322484229a9cd | |
parent | 844171ae6d0a3a02cfb9a39ff18a27d7204a8755 (diff) | |
parent | 7258ad9817ae811808ea89c790b059474d145654 (diff) | |
download | Qt-6820fc145dd1eb9a22384eed63a5a11d4118f147.zip Qt-6820fc145dd1eb9a22384eed63a5a11d4118f147.tar.gz Qt-6820fc145dd1eb9a22384eed63a5a11d4118f147.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
warn about stray meta data
don't complain multiple times about same abuse of //% meta strings
fix double percent sign after migration to yyMsg()
Improved QCommandLinkButton's vertical spacing
syncqt: abort on permission error writing to include/Qt
added a comment for QByteArray::replace(..)
-rwxr-xr-x | bin/syncqt | 6 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/qcommandlinkbutton.cpp | 18 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt | 3 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp | 13 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result | 12 | ||||
-rw-r--r-- | tools/linguist/lupdate/cpp.cpp | 16 |
7 files changed, 60 insertions, 13 deletions
@@ -834,12 +834,12 @@ foreach (@modules_to_sync) { # write forwarding headers to include/Qt if ("$lib" ne "phonon" && "$subdir" =~ /^$basedir\/src/) { my $file_name = "$out_basedir/include/Qt/$header"; + my $file_op = '>'; my $header_content = ''; if (exists $colliding_headers{$file_name}) { - $file_name = ">>$file_name"; + $file_op = '>>'; } else { $colliding_headers{$file_name} = 1; - $file_name = ">$file_name"; my $warning_msg = 'Inclusion of header files from include/Qt is deprecated.'; $header_content = "#ifndef QT_NO_QT_INCLUDE_WARN\n" . " #if defined(__GNUC__)\n" . @@ -850,7 +850,7 @@ foreach (@modules_to_sync) { "#endif\n\n"; } $header_content .= '#include "' . "../$lib/$header" . "\"\n"; - open HEADERFILE, $file_name; + open HEADERFILE, $file_op, $file_name or die "unable to open '$file_name' : $!\n"; print HEADERFILE $header_content; close HEADERFILE; } diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 05d38f6..b46af1f 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1805,6 +1805,11 @@ QByteArray &QByteArray::replace(int pos, int len, const QByteArray &after) /*! \fn QByteArray &QByteArray::replace(int pos, int len, const char *after) \overload + + Replaces \a len bytes from index position \a pos with the zero terminated + string \a after. + + Notice: this can change the lenght of the byte array. */ QByteArray &QByteArray::replace(int pos, int len, const char *after) { diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp index e8fe299..d3b5869 100644 --- a/src/gui/widgets/qcommandlinkbutton.cpp +++ b/src/gui/widgets/qcommandlinkbutton.cpp @@ -118,7 +118,7 @@ public: int topMargin() const { return 10; } int leftMargin() const { return 7; } int rightMargin() const { return 4; } - int bottomMargin() const { return 4; } + int bottomMargin() const { return 10; } QString description; QColor currentColor; @@ -174,8 +174,15 @@ QFont QCommandLinkButtonPrivate::descriptionFont() const QRect QCommandLinkButtonPrivate::titleRect() const { Q_Q(const QCommandLinkButton); - return q->rect().adjusted(textOffset(), topMargin(), - -rightMargin(), 0); + QRect r = q->rect().adjusted(textOffset(), topMargin(), -rightMargin(), 0); + if (description.isEmpty()) + { + QFontMetrics fm(titleFont()); + r.setTop(r.top() + qMax(0, (q->icon().actualSize(q->iconSize()).height() + - fm.height()) / 2)); + } + + return r; } QRect QCommandLinkButtonPrivate::descriptionRect() const @@ -254,7 +261,7 @@ QSize QCommandLinkButton::minimumSizeHint() const Q_D(const QCommandLinkButton); QSize size = sizeHint(); int minimumHeight = qMax(d->descriptionOffset() + d->bottomMargin(), - iconSize().height() + d->topMargin()); + icon().actualSize(iconSize()).height() + d->topMargin()); size.setHeight(minimumHeight); return size; } @@ -328,7 +335,8 @@ int QCommandLinkButton::heightForWidth(int width) const int heightWithoutDescription = d->descriptionOffset() + d->bottomMargin(); // find the width available for the description area return qMax(heightWithoutDescription + d->descriptionHeight(width), - iconSize().height() + d->topMargin() + d->bottomMargin()); + icon().actualSize(iconSize()).height() + d->topMargin() + + d->bottomMargin()); } /*! \reimp */ diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt index 195c0e6..d4ebe49 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt @@ -2,3 +2,6 @@ .*/lupdate/testdata/good/parsecpp2/main.cpp:55: Excess closing brace .* .*/lupdate/testdata/good/parsecpp2/main.cpp:61: Excess closing brace .* .*/lupdate/testdata/good/parsecpp2/main.cpp:65: Excess closing brace .* +.*/lupdate/testdata/good/parsecpp2/main.cpp:120: //% cannot be used with tr\(\) / QT_TR_NOOP\(\)\. Ignoring +.*/lupdate/testdata/good/parsecpp2/main.cpp:123: //% cannot be used with translate\(\) / QT_TRANSLATE_NOOP\(\)\. Ignoring +.*/lupdate/testdata/good/parsecpp2/main.cpp:126: Discarding unconsumed meta data diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp index feb885c..06e6fe0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp @@ -112,3 +112,16 @@ void ToBeUsed::caller() { tr("NameSpace::ToBeUsed"); } + + + +// QTBUG-11818 +//% "Foo" +QObject::tr("Hello World"); +QObject::tr("Hello World"); +//% "Bar" +QApplication::translate("QObject", "Hello World"); +QApplication::translate("QObject", "Hello World"); +//% "Baz" +clear = me; +QObject::tr("Hello World"); diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result index 6f48e27..806f56f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result @@ -10,6 +10,18 @@ </message> </context> <context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="120"/> + <location filename="main.cpp" line="121"/> + <location filename="main.cpp" line="123"/> + <location filename="main.cpp" line="124"/> + <location filename="main.cpp" line="127"/> + <source>Hello World</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>TopLevel</name> <message> <location filename="main.cpp" line="82"/> diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index b3e7e84..609bd3d 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1761,7 +1761,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (!tor) goto case_default; if (!sourcetext.isEmpty()) - yyMsg() << "//%% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n"; + yyMsg() << "//% cannot be used with tr() / QT_TR_NOOP(). Ignoring\n"; utf8 = (yyTok == Tok_trUtf8); line = yyLineNo; yyTok = getToken(); @@ -1858,6 +1858,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) gotctx: recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural); } + sourcetext.clear(); // Will have warned about that already extracomment.clear(); msgid.clear(); extra.clear(); @@ -1867,7 +1868,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) if (!tor) goto case_default; if (!sourcetext.isEmpty()) - yyMsg() << "//%% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n"; + yyMsg() << "//% cannot be used with translate() / QT_TRANSLATE_NOOP(). Ignoring\n"; utf8 = (yyTok == Tok_translateUtf8); line = yyLineNo; yyTok = getToken(); @@ -1913,6 +1914,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) } recordMessage(line, context, text, comment, extracomment, msgid, extra, utf8, plural); } + sourcetext.clear(); // Will have warned about that already extracomment.clear(); msgid.clear(); extra.clear(); @@ -2079,9 +2081,13 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) case Tok_Semicolon: prospectiveContext.clear(); prefix.clear(); - extracomment.clear(); - msgid.clear(); - extra.clear(); + if (!sourcetext.isEmpty() || !extracomment.isEmpty() || !msgid.isEmpty() || !extra.isEmpty()) { + yyMsg() << "Discarding unconsumed meta data\n"; + sourcetext.clear(); + extracomment.clear(); + msgid.clear(); + extra.clear(); + } yyTokColonSeen = false; yyTok = getToken(); break; |