From 50af55095afe1ba048dde357b771485ef2188778 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Wed, 7 Sep 2011 11:58:54 +0200 Subject: Replace explicit surrogate handlers by inline methods of QChar class Merge-request: 1284 Reviewed-by: Oswald Buddenhagen --- src/corelib/codecs/qutfcodec.cpp | 8 ++++---- src/gui/kernel/qkeysequence.cpp | 16 ++++++++-------- src/gui/text/qfontengine.cpp | 3 +-- src/gui/text/qfontengine_ft.cpp | 13 +++++-------- src/gui/text/qfontengine_mac.mm | 23 ++++++++--------------- src/gui/text/qfontengine_qpa.cpp | 13 +++++-------- src/gui/text/qfontengine_qpf.cpp | 13 +++++-------- src/gui/text/qfontengine_qws.cpp | 13 +++++-------- src/gui/text/qfontengine_s60.cpp | 13 +++++-------- src/gui/text/qfontengine_win.cpp | 13 +++++-------- src/gui/text/qfontengine_x11.cpp | 4 +--- src/gui/text/qfontenginedirectwrite.cpp | 13 +++++-------- src/gui/text/qtextcursor.cpp | 4 ++-- src/gui/text/qtextengine.cpp | 3 +-- src/gui/text/qtexthtmlparser.cpp | 12 ++++-------- src/gui/widgets/qlinecontrol.cpp | 6 ++---- src/plugins/codecs/cn/qgb18030codec.cpp | 14 +++++++------- 17 files changed, 73 insertions(+), 111 deletions(-) diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp index f59f404..aaebec3 100644 --- a/src/corelib/codecs/qutfcodec.cpp +++ b/src/corelib/codecs/qutfcodec.cpp @@ -90,8 +90,8 @@ QByteArray QUtf8::convertFromUnicode(const QChar *uc, int len, QTextCodec::Conve while (ch < end) { uint u = ch->unicode(); if (surrogate_high >= 0) { - if (u >= 0xdc00 && u < 0xe000) { - u = (surrogate_high - 0xd800)*0x400 + (u - 0xdc00) + 0x10000; + if (ch->isLowSurrogate()) { + u = QChar::surrogateToUcs4(surrogate_high, u); surrogate_high = -1; } else { // high surrogate without low @@ -101,13 +101,13 @@ QByteArray QUtf8::convertFromUnicode(const QChar *uc, int len, QTextCodec::Conve surrogate_high = -1; continue; } - } else if (u >= 0xdc00 && u < 0xe000) { + } else if (ch->isLowSurrogate()) { // low surrogate without high *cursor = replacement; ++ch; ++invalid; continue; - } else if (u >= 0xd800 && u < 0xdc00) { + } else if (ch->isHighSurrogate()) { surrogate_high = u; ++ch; continue; diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 117b72f..2350f16 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1381,11 +1381,11 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat QString p; if (key && key < Qt::Key_Escape && key != Qt::Key_Space) { - if (key < 0x10000) { - p = QChar(key & 0xffff).toUpper(); + if (!QChar::requiresSurrogates(key)) { + p = QChar(ushort(key)).toUpper(); } else { - p = QChar((key-0x10000)/0x400+0xd800); - p += QChar((key-0x10000)%400+0xdc00); + p += QChar(QChar::highSurrogate(key)); + p += QChar(QChar::lowSurrogate(key)); } } else if (key >= Qt::Key_F1 && key <= Qt::Key_F35) { p = nativeText ? QShortcut::tr("F%1").arg(key - Qt::Key_F1 + 1) @@ -1418,11 +1418,11 @@ NonSymbol: // Or else characters like Qt::Key_aring may not get displayed // (Really depends on you locale) if (!keyname[i].name) { - if (key < 0x10000) { - p = QChar(key & 0xffff).toUpper(); + if (!QChar::requiresSurrogates(key)) { + p = QChar(ushort(key)).toUpper(); } else { - p = QChar((key-0x10000)/0x400+0xd800); - p += QChar((key-0x10000)%400+0xdc00); + p += QChar(QChar::highSurrogate(key)); + p += QChar(QChar::lowSurrogate(key)); } } } diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index dec0982..b4c58b5 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1335,8 +1335,7 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, int glyph_pos = 0; for (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); + bool surrogate = (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()); if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) { QGlyphLayoutInstance tmp = glyphs->instance(glyph_pos); diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 9a5d9d6..b7d1e5d 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1418,15 +1418,12 @@ void QFontEngineFT::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_me static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } bool QFontEngineFT::canRender(const QChar *string, int len) diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index 9d9eaed..6186b2f 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -257,10 +257,8 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS #if !defined(QT_NO_DEBUG) int surrogates = 0; const QChar *str = item->string; - for (int i = item->from; i < item->from + item->length - 1; ++i) { - surrogates += (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00 - && str[i+1].unicode() >= 0xdc00 && str[i+1].unicode() < 0xe000); - } + for (int i = item->from; i < item->from + item->length - 1; ++i) + surrogates += (str[i].isHighSurrogate() && str[i+1].isLowSurrogate()); #endif for (nextCharStop = item->from; nextCharStop < item->from + item->length; ++nextCharStop) if (item->charAttributes[nextCharStop].charStop) @@ -328,10 +326,8 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS if (charOffset < item->length - 1) { QChar current = item->string[item->from + charOffset]; QChar next = item->string[item->from + charOffset + 1]; - if (current.unicode() >= 0xd800 && current.unicode() < 0xdc00 - && next.unicode() >= 0xdc00 && next.unicode() < 0xe000) { + if (current.isHighSurrogate() && next.isLowSurrogate()) item->log_clusters[charOffset + 1] = currentClusterGlyph; - } } } } @@ -738,15 +734,12 @@ QFontEngineMac::~QFontEngineMac() static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } // Not used directly for shaping, only used to calculate m_averageCharWidth diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index cb1e7d6..c829c2f 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -226,15 +226,12 @@ QVariant QFontEngineQPA::extractHeaderField(const uchar *data, HeaderTag request static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data) diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index 30a1623..3db5ce1 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -278,15 +278,12 @@ QList QFontEngineQPF::cleanUpAfterClientCrash(const QList &cras static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } #ifdef QT_FONTS_ARE_RESOURCES QFontEngineQPF::QFontEngineQPF(const QFontDef &def, const uchar *bytes, int size) diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp index 237842b..ade283f 100644 --- a/src/gui/text/qfontengine_qws.cpp +++ b/src/gui/text/qfontengine_qws.cpp @@ -83,15 +83,12 @@ QT_BEGIN_NAMESPACE static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } #define FM_SMOOTH 1 diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index b0824cb..203b6e1 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -233,15 +233,12 @@ bool QSymbianTypeFaceExtras::symbianFontTableApiAvailable() // duplicated from qfontengine_xyz.cpp static inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } extern QString qt_symbian_fontNameWithAppFontMarker(const QString &fontName); // qfontdatabase_s60.cpp diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index aef2145..fc11387 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -224,15 +224,12 @@ void QFontEngineWin::getCMap() inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); } - return uc; + return ucs4; } int QFontEngineWin::getGlyphIndexes(const QChar *str, int numChars, QGlyphLayout *glyphs, bool mirrored) const diff --git a/src/gui/text/qfontengine_x11.cpp b/src/gui/text/qfontengine_x11.cpp index 490866c..6e87f4c 100644 --- a/src/gui/text/qfontengine_x11.cpp +++ b/src/gui/text/qfontengine_x11.cpp @@ -358,9 +358,7 @@ bool QFontEngineXLFD::stringToCMap(const QChar *s, int len, QGlyphLayout *glyphs QVarLengthArray _s(len); QChar *str = (QChar *)_s.data(); for (int i = 0; i < len; ++i) { - if (i < len - 1 - && s[i].unicode() >= 0xd800 && s[i].unicode() < 0xdc00 - && s[i+1].unicode() >= 0xdc00 && s[i].unicode() < 0xe000) { + if (s[i].isHighSurrogate() && i < len-1 && s[i+1].isLowSurrogate()) { *str = QChar(); ++i; } else { diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp index d693273..5bac117 100644 --- a/src/gui/text/qfontenginedirectwrite.cpp +++ b/src/gui/text/qfontenginedirectwrite.cpp @@ -269,15 +269,12 @@ QFixed QFontEngineDirectWrite::emSquareSize() const inline unsigned int getChar(const QChar *str, int &i, const int len) { - unsigned int uc = str[i].unicode(); - if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { - uint low = str[i+1].unicode(); - if (low >= 0xdc00 && low < 0xe000) { - uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; - ++i; - } + uint ucs4 = str[i].unicode(); + if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { + ++i; + ucs4 = QChar::surrogateToUcs4( ucs4, str[i].unicode()); } - return uc; + return ucs4; } bool QFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index 7e7ca6c..acef9fa 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -1511,11 +1511,11 @@ void QTextCursor::deletePreviousChar() const QTextFragmentData * const frag = fragIt.value(); int fpos = fragIt.position(); QChar uc = d->priv->buffer().at(d->anchor - fpos + frag->stringPosition); - if (d->anchor > fpos && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { + if (d->anchor > fpos && uc.isLowSurrogate()) { // second half of a surrogate, check if we have the first half as well, // if yes delete both at once uc = d->priv->buffer().at(d->anchor - 1 - fpos + frag->stringPosition); - if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) + if (uc.isHighSurrogate()) --d->anchor; } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index aa4a20d..732b821 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -993,8 +993,7 @@ static void heuristicSetGlyphAttributes(const QChar *uc, int length, QGlyphLayou int glyph_pos = 0; for (int i = 0; i < length; i++) { - if (uc[i].unicode() >= 0xd800 && uc[i].unicode() < 0xdc00 && i < length-1 - && uc[i+1].unicode() >= 0xdc00 && uc[i+1].unicode() < 0xe000) { + if (uc[i].isHighSurrogate() && i < length-1 && uc[i+1].isLowSurrogate()) { logClusters[i] = glyph_pos; logClusters[++i] = glyph_pos; } else { diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 5b60dfa..d130c61 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -820,15 +820,11 @@ QString QTextHtmlParser::parseEntity() if (uc >= 0x80 && uc < 0x80 + (sizeof(windowsLatin1ExtendedCharacters)/sizeof(windowsLatin1ExtendedCharacters[0]))) uc = windowsLatin1ExtendedCharacters[uc - 0x80]; QString str; - if (uc > 0xffff) { - // surrogate pair - uc -= 0x10000; - ushort high = uc/0x400 + 0xd800; - ushort low = uc%0x400 + 0xdc00; - str.append(QChar(high)); - str.append(QChar(low)); + if (QChar::requiresSurrogates(uc)) { + str += QChar(QChar::highSurrogate(uc)); + str += QChar(QChar::lowSurrogate(uc)); } else { - str.append(QChar(uc)); + str = QChar(uc); } return str; } diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index b6e2f90..873630a 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -198,12 +198,10 @@ void QLineControl::backspace() --m_cursor; if (m_maskData) m_cursor = prevMaskBlank(m_cursor); - QChar uc = m_text.at(m_cursor); - if (m_cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { + if (m_cursor > 0 && m_text.at(m_cursor).isLowSurrogate()) { // second half of a surrogate, check if we have the first half as well, // if yes delete both at once - uc = m_text.at(m_cursor - 1); - if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) { + if (m_text.at(m_cursor - 1).isHighSurrogate()) { internalDelete(true); --m_cursor; } diff --git a/src/plugins/codecs/cn/qgb18030codec.cpp b/src/plugins/codecs/cn/qgb18030codec.cpp index 0a45eeb..d12f5d9 100644 --- a/src/plugins/codecs/cn/qgb18030codec.cpp +++ b/src/plugins/codecs/cn/qgb18030codec.cpp @@ -108,10 +108,10 @@ QByteArray QGb18030Codec::convertFromUnicode(const QChar *uc, int len, Converter int len; uchar buf[4]; if (high >= 0) { - if (ch >= 0xdc00 && ch < 0xe000) { + if (uc[i].isLowSurrogate()) { // valid surrogate pair ++i; - uint u = (high-0xd800)*0x400+(ch-0xdc00)+0x10000; + uint u = QChar::surrogateToUcs4(high, uc[i].unicode()); len = qt_UnicodeToGb18030(u, buf); if (len >= 2) { for (int j=0; j= 0xd800 && ch < 0xdc00)) { + } else if (uc[i].isHighSurrogate()) { // surrogates area. check for correct encoding // we need at least one more character, first the high surrogate, then the low one high = ch; @@ -181,7 +181,7 @@ QString QGb18030Codec::convertToUnicode(const char* chars, int len, ConverterSta uchar ch = chars[i]; switch (nbuf) { case 0: - if (ch < 0x80) { + if (IsLatin(ch)) { // ASCII resultData[unicodeLen] = ch; ++unicodeLen; @@ -339,7 +339,7 @@ QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState * uchar ch = chars[i]; switch (nbuf) { case 0: - if (ch < 0x80) { + if (IsLatin(ch)) { // ASCII resultData[unicodeLen] = ch; ++unicodeLen; @@ -487,7 +487,7 @@ QString QGb2312Codec::convertToUnicode(const char* chars, int len, ConverterStat uchar ch = chars[i]; switch (nbuf) { case 0: - if (ch < 0x80) { + if (IsLatin(ch)) { // ASCII resultData[unicodeLen] = ch; ++unicodeLen; -- cgit v0.12 From 4aff9e52efc7c6fc6124972efb3b381f85c45e4f Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 7 Sep 2011 19:51:23 +0200 Subject: QSettings: use the common appdata dir when bootstrapping qmake on win QSystemLibrary doesn't depend on QObject, so nothing could stop us Merge-request: 1341 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qsettings.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 79b2728..9f9802c 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -66,13 +66,12 @@ #ifndef QT_NO_QOBJECT #include "qcoreapplication.h" +#endif #ifdef Q_OS_WIN // for homedirpath reading from registry #include "qt_windows.h" #include - -#endif // Q_OS_WIN -#endif // QT_NO_QOBJECT +#endif #ifdef Q_OS_VXWORKS # include @@ -1024,9 +1023,6 @@ static QString windowsConfigPath(int type) { QString result; -#ifndef QT_NO_QOBJECT - // We can't use QLibrary if there is QT_NO_QOBJECT is defined - // This only happens when bootstrapping qmake. #ifndef Q_OS_WINCE QSystemLibrary library(QLatin1String("shell32")); #else @@ -1040,8 +1036,6 @@ static QString windowsConfigPath(int type) result = QString::fromWCharArray(path); } -#endif // QT_NO_QOBJECT - if (result.isEmpty()) { switch (type) { #ifndef Q_OS_WINCE -- cgit v0.12 From 38b4b059e83bca2fe82a0826bdf69fd8b02b2827 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 7 Sep 2011 19:51:24 +0200 Subject: QSettings: don't assume XDG_CONFIG_HOME is latin1-encoded use QFile::decodeName() instead Merge-request: 1341 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qsettings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 9f9802c..547bbeb 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -1108,11 +1108,11 @@ static void initDefaultPaths(QMutexLocker *locker) userPath += QLatin1String(".config"); #endif } else if (*env == '/') { - userPath = QLatin1String(env); + userPath = QFile::decodeName(env); } else { userPath = homePath; userPath += QLatin1Char('/'); - userPath += QLatin1String(env); + userPath += QFile::decodeName(env); } userPath += QLatin1Char('/'); -- cgit v0.12 From b3de52be29a54aa23a446c7689a48f73206a7cbc Mon Sep 17 00:00:00 2001 From: Markku Heikkila Date: Wed, 7 Sep 2011 20:08:34 +0200 Subject: Perl check for windows configure. Works for Windows, *nix check is done by bash shell. Task-number: QTBUG-5710 Merge-request: 1362 Reviewed-by: Oswald Buddenhagen --- tools/configure/configureapp.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 31c359e..e6d8526 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3599,17 +3599,21 @@ void Configure::displayConfig() #if !defined(EVAL) void Configure::generateHeaders() { - if (dictionary["SYNCQT"] == "yes" - && findFile("perl.exe")) { - cout << "Running syncqt..." << endl; - QStringList args; - args += buildPath + "/bin/syncqt.bat"; - QStringList env; - env += QString("QTDIR=" + sourcePath); - env += QString("PATH=" + buildPath + "/bin/;" + qgetenv("PATH")); - int retc = Environment::execute(args, env, QStringList()); - if (retc) { - cout << "syncqt failed, return code " << retc << endl << endl; + if (dictionary["SYNCQT"] == "yes") { + if (findFile("perl.exe")) { + cout << "Running syncqt..." << endl; + QStringList args; + args += buildPath + "/bin/syncqt.bat"; + QStringList env; + env += QString("QTDIR=" + sourcePath); + env += QString("PATH=" + buildPath + "/bin/;" + qgetenv("PATH")); + int retc = Environment::execute(args, env, QStringList()); + if (retc) { + cout << "syncqt failed, return code " << retc << endl << endl; + dictionary["DONE"] = "error"; + } + } else { + cout << "Perl not found in environment - cannot run syncqt." << endl; dictionary["DONE"] = "error"; } } -- cgit v0.12 From 248ec0d94a6e58a679cb757d2dd32f6fd59a2b6d Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 7 Sep 2011 20:28:31 +0200 Subject: runonphone: Add a missing space between a message and the file name Merge-request: 2670 Reviewed-by: Oswald Buddenhagen --- tools/runonphone/trksignalhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/runonphone/trksignalhandler.cpp b/tools/runonphone/trksignalhandler.cpp index 59ff22c..52de3c8 100644 --- a/tools/runonphone/trksignalhandler.cpp +++ b/tools/runonphone/trksignalhandler.cpp @@ -106,7 +106,7 @@ void TrkSignalHandler::canNotCloseFile(const QString &filename, const QString &e void TrkSignalHandler::installingStarted(const QString &packageName) { if (d->loglevel > 0) - d->out << "Installing" << packageName << "..." << endl; + d->out << "Installing " << packageName << "..." << endl; } void TrkSignalHandler::canNotInstall(const QString &packageFilename, const QString &errorMessage) -- cgit v0.12 From 270c20490813fa943b4fbf0feb1aecb98f0b19ba Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 7 Sep 2011 20:40:48 +0200 Subject: Ensure that the proxystyle is used over the style's own functions When calling a style function such as pixelMetric() then this should be done via the proxy style and not on the style directly. This is so that the proxy style always has a chance to override the original style's implementation and still preserve the fallback to the base style. Task-number: QTBUG-20849 Merge-request: 2645 Reviewed-by: olivier --- src/gui/styles/qcommonstyle.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index ad0e151..327bedf 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -837,14 +837,12 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, int role) const { - Q_Q(const QCommonStyle); - const QWidget *widget = option->widget; switch (role) { case Qt::CheckStateRole: if (option->features & QStyleOptionViewItemV2::HasCheckIndicator) - return QSize(q->pixelMetric(QStyle::PM_IndicatorWidth, option, widget), - q->pixelMetric(QStyle::PM_IndicatorHeight, option, widget)); + return QSize(proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth, option, widget), + proxyStyle->pixelMetric(QStyle::PM_IndicatorHeight, option, widget)); break; case Qt::DisplayRole: if (option->features & QStyleOptionViewItemV2::HasDisplay) { @@ -855,7 +853,7 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, in textLayout.setFont(option->font); textLayout.setText(option->text); const bool wrapText = option->features & QStyleOptionViewItemV2::WrapText; - const int textMargin = q->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget) + 1; + const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget) + 1; QRect bounds = option->rect; switch (option->decorationPosition) { case QStyleOptionViewItem::Left: @@ -919,9 +917,8 @@ static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth) void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewItemV4 *option, const QRect &rect) const { - Q_Q(const QCommonStyle); const QWidget *widget = option->widget; - const int textMargin = q->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1; + const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1; QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding const bool wrapText = option->features & QStyleOptionViewItemV2::WrapText; @@ -999,7 +996,6 @@ void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewIt void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRect *checkRect, QRect *pixmapRect, QRect *textRect, bool sizehint) const { - Q_Q(const QCommonStyle); Q_ASSERT(checkRect && pixmapRect && textRect); *pixmapRect = QRect(QPoint(0, 0), viewItemSize(opt, Qt::DecorationRole)); *textRect = QRect(QPoint(0, 0), viewItemSize(opt, Qt::DisplayRole)); @@ -1009,9 +1005,9 @@ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRe const bool hasCheck = checkRect->isValid(); const bool hasPixmap = pixmapRect->isValid(); const bool hasText = textRect->isValid(); - const int textMargin = hasText ? q->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; - const int pixmapMargin = hasPixmap ? q->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; - const int checkMargin = hasCheck ? q->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; + const int textMargin = hasText ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; + const int pixmapMargin = hasPixmap ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; + const int checkMargin = hasCheck ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; int x = opt->rect.left(); int y = opt->rect.top(); int w, h; -- cgit v0.12 From 2a1e82452a192c88bcf0250f5976492f6dc3b65f Mon Sep 17 00:00:00 2001 From: Jan Arne Petersen Date: Wed, 7 Sep 2011 21:38:21 +0200 Subject: Split CFLAGS from pkg-config properly Add support for DEFINES and INCLUDEPATH to link_pkgconfig so moc uses the cflags properly. Task-number: QTBUG-19922 Merge-request: 2674 Reviewed-by: ossi --- mkspecs/features/link_pkgconfig.prf | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/link_pkgconfig.prf b/mkspecs/features/link_pkgconfig.prf index a3dbd1f..91683f6 100644 --- a/mkspecs/features/link_pkgconfig.prf +++ b/mkspecs/features/link_pkgconfig.prf @@ -5,8 +5,21 @@ for(PKGCONFIG_LIB, $$list($$unique(PKGCONFIG))) { # don't proceed if the .pro asks for a package we don't have! !packagesExist($$PKGCONFIG_LIB):error("Package $$PKGCONFIG_LIB not found") - QMAKE_CXXFLAGS += $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB) - QMAKE_CFLAGS += $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB) + PKGCONFIG_CFLAGS = $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB) + + PKGCONFIG_INCLUDEPATH = $$find(PKGCONFIG_CFLAGS, ^-I.*) + PKGCONFIG_INCLUDEPATH ~= s/^-I(.*)/\\1/g + + PKGCONFIG_DEFINES = $$find(PKGCONFIG_CFLAGS, ^-D.*) + PKGCONFIG_DEFINES ~= s/^-D(.*)/\\1/g + + PKGCONFIG_CFLAGS ~= s/^-[ID].*//g + + INCLUDEPATH *= $$PKGCONFIG_INCLUDEPATH + DEFINES *= $$PKGCONFIG_DEFINES + + QMAKE_CXXFLAGS += $$PKGCONFIG_CFLAGS + QMAKE_CFLAGS += $$PKGCONFIG_CFLAGS LIBS += $$system($$PKG_CONFIG --libs $$PKGCONFIG_LIB) } -- cgit v0.12