From 38f7a788242fcc5ed7e75291bffd2b1b16d76f76 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Thu, 22 Oct 2009 10:20:03 +0200 Subject: QDom autotests: make test fail instead of time out introduce a QFAIL for now until problem is fixed Reviewed-by: Carlos Duclos --- tests/auto/qdom/tst_qdom.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp index 6637202..0d58554e 100644 --- a/tests/auto/qdom/tst_qdom.cpp +++ b/tests/auto/qdom/tst_qdom.cpp @@ -322,6 +322,7 @@ void tst_QDom::toString_01_data() */ void tst_QDom::toString_01() { + QFAIL("make test fail instead of timing out, will be fixed later (QT-2357)"); QFETCH(QString, fileName); QFile f(fileName); -- cgit v0.12 From e546f7b1bfe98436c26fb6aa11a88053ae4eb185 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 21 Oct 2009 14:41:32 +0200 Subject: actually guess the target language from the file name --help says it does, but it didn't really. --- tools/linguist/lupdate/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 6b554e0..bdaec4f 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -160,6 +160,8 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil tor.setCodecName(codecForTr); if (!targetLanguage.isEmpty()) tor.setLanguageCode(targetLanguage); + else + tor.setLanguageCode(Translator::guessLanguageCodeFromFileName(fileName)); if (!sourceLanguage.isEmpty()) tor.setSourceLanguageCode(sourceLanguage); } -- cgit v0.12 From babfff66074573bb34a0abd561052c1cc4df5ef0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 21 Oct 2009 14:42:43 +0200 Subject: id-based: use source strings instead of empty translations only for unfinished messages --- tests/auto/linguist/lrelease/testdata/idbased.ts | 1 + tools/linguist/shared/qm.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/auto/linguist/lrelease/testdata/idbased.ts b/tests/auto/linguist/lrelease/testdata/idbased.ts index 61497de..cd47158 100644 --- a/tests/auto/linguist/lrelease/testdata/idbased.ts +++ b/tests/auto/linguist/lrelease/testdata/idbased.ts @@ -9,6 +9,7 @@ This has no translation. + Foo bar. diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index fefe91c..998d0ac 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -440,9 +440,10 @@ void Releaser::insert(const TranslatorMessage &message, bool forceComment) void Releaser::insertIdBased(const TranslatorMessage &message) { QStringList tlns = message.translations(); - for (int i = 0; i < tlns.size(); ++i) - if (tlns.at(i).isEmpty()) - tlns[i] = message.sourceText(); + if (message.type() == TranslatorMessage::Unfinished) + for (int i = 0; i < tlns.size(); ++i) + if (tlns.at(i).isEmpty()) + tlns[i] = message.sourceText(); ByteTranslatorMessage bmsg("", originalBytes(message.id(), false), "", tlns); m_messages.insert(bmsg, 0); } -- cgit v0.12 From f3d76ae452d1c430bf294a0750318327a866332c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 21 Oct 2009 14:44:42 +0200 Subject: id-based: do not drop unfinished untranslated messages otherwise the fallback to use the source string is rather pointless --- tools/linguist/shared/qm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index 998d0ac..317a07e 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -714,7 +714,7 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData continue; } if (typ == TranslatorMessage::Unfinished) { - if (msg.translation().isEmpty()) { + if (!cd.m_idBased && msg.translation().isEmpty()) { ++untranslated; continue; } else { -- cgit v0.12 From 40b0291252ac07ebac4ba34221728651c887c9b3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 22 Oct 2009 10:31:38 +0200 Subject: consider message id when comparing messages --- tests/auto/linguist/lrelease/testdata/idbased.ts | 6 ++++++ tools/linguist/shared/translatormessage.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/auto/linguist/lrelease/testdata/idbased.ts b/tests/auto/linguist/lrelease/testdata/idbased.ts index cd47158..c7555c8 100644 --- a/tests/auto/linguist/lrelease/testdata/idbased.ts +++ b/tests/auto/linguist/lrelease/testdata/idbased.ts @@ -18,5 +18,11 @@ Drop me! + + + + + + diff --git a/tools/linguist/shared/translatormessage.cpp b/tools/linguist/shared/translatormessage.cpp index 417f6b1..db6f333 100644 --- a/tools/linguist/shared/translatormessage.cpp +++ b/tools/linguist/shared/translatormessage.cpp @@ -151,6 +151,7 @@ bool TranslatorMessage::operator==(const TranslatorMessage& m) const return (m_context == m.m_context) && m_sourcetext == m.m_sourcetext && m_extra[msgIdPlural] == m.m_extra[msgIdPlural] + && m_id == m.m_id && (m_sourcetext.isEmpty() || m_comment == m.m_comment); } @@ -161,7 +162,9 @@ bool TranslatorMessage::operator<(const TranslatorMessage& m) const return m_context < m.m_context; if (m_sourcetext != m.m_sourcetext) return m_sourcetext < m.m_sourcetext; - return m_comment < m.m_comment; + if (m_comment != m.m_comment) + return m_comment < m.m_comment; + return m_id < m.m_id; } int qHash(const TranslatorMessage &msg) @@ -170,7 +173,8 @@ int qHash(const TranslatorMessage &msg) qHash(msg.context()) ^ qHash(msg.sourceText()) ^ qHash(msg.extra(QLatin1String("po-msgid_plural"))) ^ - qHash(msg.comment()); + qHash(msg.comment()) ^ + qHash(msg.id()); } bool TranslatorMessage::hasExtra(const QString &key) const -- cgit v0.12 From dfec518d7636306bb8c96652d4e72b0883c123df Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 21 Oct 2009 16:50:53 +0200 Subject: qfontengine_win.cpp: special Windows CE code removed Reviewed-by: thartman --- src/gui/text/qfontengine_win.cpp | 91 +++++++--------------------------------- 1 file changed, 16 insertions(+), 75 deletions(-) diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index cc555a3..d781c70 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -125,6 +125,7 @@ HDC shared_dc() } #endif +#ifndef Q_WS_WINCE typedef BOOL (WINAPI *PtrGetCharWidthI)(HDC, UINT, UINT, LPWORD, LPINT); static PtrGetCharWidthI ptrGetCharWidthI = 0; static bool resolvedGetCharWidthI = false; @@ -136,6 +137,7 @@ static void resolveGetCharWidthI() resolvedGetCharWidthI = true; ptrGetCharWidthI = (PtrGetCharWidthI)QLibrary::resolve(QLatin1String("gdi32"), "GetCharWidthI"); } +#endif // !defined(Q_WS_WINCE) // defined in qtextengine_win.cpp typedef void *SCRIPT_CACHE; @@ -340,8 +342,10 @@ QFontEngineWin::QFontEngineWin(const QString &name, HFONT _hfont, bool stockFont designAdvances = 0; designAdvancesSize = 0; +#ifndef Q_WS_WINCE if (!resolvedGetCharWidthI) resolveGetCharWidthI(); +#endif } QFontEngineWin::~QFontEngineWin() @@ -381,80 +385,18 @@ bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph if (flags & QTextEngine::GlyphIndicesOnly) return true; -#if defined(Q_WS_WINCE) - HDC hdc = shared_dc(); - if (flags & QTextEngine::DesignMetrics) { - HGDIOBJ oldFont = 0; - int glyph_pos = 0; - for(register int i = 0; i < len; i++) { - bool surrogate = (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00 && i < len-1 - && str[i+1].unicode() >= 0xdc00 && str[i+1].unicode() < 0xe000); - unsigned int glyph = glyphs->glyphs[glyph_pos]; - if(int(glyph) >= designAdvancesSize) { - int newSize = (glyph + 256) >> 8 << 8; - designAdvances = q_check_ptr((QFixed *)realloc(designAdvances, newSize*sizeof(QFixed))); - for(int i = designAdvancesSize; i < newSize; ++i) - designAdvances[i] = -1000000; - designAdvancesSize = newSize; - } - if(designAdvances[glyph] < -999999) { - if(!oldFont) - oldFont = selectDesignFont(); - SIZE size = {0, 0}; - GetTextExtentPoint32(hdc, (wchar_t *)(str+i), surrogate ? 2 : 1, &size); - designAdvances[glyph] = QFixed((int)size.cx)/designToDevice; - } - glyphs->advances_x[glyph_pos] = designAdvances[glyph]; - glyphs->advances_y[glyph_pos] = 0; - if (surrogate) - ++i; - ++glyph_pos; - } - if(oldFont) - DeleteObject(SelectObject(hdc, oldFont)); - } else { - int glyph_pos = 0; - HGDIOBJ oldFont = 0; - - for(register int i = 0; i < len; i++) { - bool surrogate = (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00 && i < len-1 - && str[i+1].unicode() >= 0xdc00 && str[i+1].unicode() < 0xe000); - unsigned int glyph = glyphs->glyphs[glyph_pos]; - - glyphs->advances_y[glyph_pos] = 0; - - if (glyph >= widthCacheSize) { - int newSize = (glyph + 256) >> 8 << 8; - widthCache = q_check_ptr((unsigned char *)realloc(widthCache, - newSize*sizeof(QFixed))); - memset(widthCache + widthCacheSize, 0, newSize - widthCacheSize); - widthCacheSize = newSize; - } - glyphs->advances_x[glyph_pos] = widthCache[glyph]; - // font-width cache failed - if (glyphs->advances_x[glyph_pos] == 0) { - SIZE size = {0, 0}; - if (!oldFont) - oldFont = SelectObject(hdc, hfont); - GetTextExtentPoint32(hdc, (wchar_t *)str + i, surrogate ? 2 : 1, &size); - glyphs->advances_x[glyph_pos] = size.cx; - // if glyph's within cache range, store it for later - if (size.cx > 0 && size.cx < 0x100) - widthCache[glyph] = size.cx; - } - - if (surrogate) - ++i; - ++glyph_pos; - } + recalcAdvances(glyphs, flags); + return true; +} - if (oldFont) - SelectObject(hdc, oldFont); - } +inline void calculateTTFGlyphWidth(HDC hdc, UINT glyph, int &width) +{ +#if defined(Q_WS_WINCE) + GetCharWidth32(hdc, glyph, glyph, &width); #else - recalcAdvances(glyphs, flags); + if (ptrGetCharWidthI) + ptrGetCharWidthI(hdc, glyph, 1, 0, &width); #endif - return true; } void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const @@ -477,8 +419,7 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla oldFont = selectDesignFont(); int width = 0; - if (ptrGetCharWidthI) - ptrGetCharWidthI(hdc, glyph, 1, 0, &width); + calculateTTFGlyphWidth(hdc, glyph, width); designAdvances[glyph] = QFixed(width) / designToDevice; } glyphs->advances_x[i] = designAdvances[glyph]; @@ -517,8 +458,8 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla SIZE size = {0, 0}; GetTextExtentPoint32(hdc, (wchar_t *)ch, chrLen, &size); width = size.cx; - } else if (ptrGetCharWidthI) { - ptrGetCharWidthI(hdc, glyph, 1, 0, &width); + } else { + calculateTTFGlyphWidth(hdc, glyph, width); } glyphs->advances_x[i] = width; // if glyph's within cache range, store it for later -- cgit v0.12 From d4a136dc3f1176665c19eec24fa43f40e5180a89 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 22 Oct 2009 10:52:27 +0200 Subject: qfiledialog2 added to tests/auto/auto.pro Reviewed-by: alexis --- tests/auto/auto.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 8e3ce81..0f7a7f1 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -127,6 +127,7 @@ SUBDIRS += \ qexplicitlyshareddatapointer \ qfile \ qfiledialog \ + qfiledialog2 \ qfileinfo \ qfilesystemwatcher \ qfilesystemmodel \ -- cgit v0.12