From d3f6e14066219a957f48d24e9f39d3d0c5a61f53 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Tue, 29 Jun 2010 10:33:03 +0200 Subject: added a comment for QByteArray::replace(..) Reviewed-by: Thomas Zander Task-number: QTBUG-8370 --- src/corelib/tools/qbytearray.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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) { -- cgit v0.12 From 704f8c2ccde7a01d5ecc6c13ff5cc1d5f5b09519 Mon Sep 17 00:00:00 2001 From: Arvid Picciani Date: Tue, 29 Jun 2010 13:48:35 +0200 Subject: syncqt: abort on permission error writing to include/Qt Merge-request: 707 Reviewed-by: Joerg Bornemann --- bin/syncqt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/syncqt b/bin/syncqt index f499bbc..11b1d72 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -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; } -- cgit v0.12 From 43498a0994eb949e94e9635be68b88567e55831c Mon Sep 17 00:00:00 2001 From: John Brooks Date: Tue, 29 Jun 2010 14:01:38 +0200 Subject: Improved QCommandLinkButton's vertical spacing When no description is present, the text is centered alongside the icon. The top and bottom margins are now an equal 10px. Merge-request: 2424 Reviewed-by: Jens Bache-Wiig --- src/gui/widgets/qcommandlinkbutton.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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 */ -- cgit v0.12 From 3f68329ba1b1c691ecf3ec7b96cd10d0d27f23f8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Jun 2010 16:41:38 +0200 Subject: fix double percent sign after migration to yyMsg() --- tools/linguist/lupdate/cpp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index b3e7e84..028a64f 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1761,7 +1761,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &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(); @@ -1867,7 +1867,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &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(); -- cgit v0.12 From f08b60f4ca52d525c1dc9890cb0c6661ee34b069 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Jun 2010 16:36:04 +0200 Subject: don't complain multiple times about same abuse of //% meta strings Reviewed-by: Kent Hansen Task-number: QTBUG-11818 --- .../lupdate/testdata/good/parsecpp2/expectedoutput.txt | 2 ++ .../auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp | 13 +++++++++++++ .../lupdate/testdata/good/parsecpp2/project.ts.result | 12 ++++++++++++ tools/linguist/lupdate/cpp.cpp | 3 +++ 4 files changed, 30 insertions(+) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt index 195c0e6..959938c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt @@ -2,3 +2,5 @@ .*/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 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 @@ + QObject + + + + + + + Hello World + + + + TopLevel diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 028a64f..25e162f 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1858,6 +1858,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &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(); @@ -1913,6 +1914,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &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,6 +2081,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) case Tok_Semicolon: prospectiveContext.clear(); prefix.clear(); + sourcetext.clear(); extracomment.clear(); msgid.clear(); extra.clear(); -- cgit v0.12 From 7258ad9817ae811808ea89c790b059474d145654 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 29 Jun 2010 16:33:40 +0200 Subject: warn about stray meta data --- .../lupdate/testdata/good/parsecpp2/expectedoutput.txt | 1 + tools/linguist/lupdate/cpp.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt index 959938c..d4ebe49 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/expectedoutput.txt @@ -4,3 +4,4 @@ .*/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/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 25e162f..609bd3d 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -2081,10 +2081,13 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) case Tok_Semicolon: prospectiveContext.clear(); prefix.clear(); - sourcetext.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; -- cgit v0.12