diff --git a/scripts/dblinc.py b/scripts/dblinc.py index 4a2f169da..6b95e9f1c 100755 --- a/scripts/dblinc.py +++ b/scripts/dblinc.py @@ -1,6 +1,8 @@ #!/usr/bin/python -import sys, os, re +import os, re + +regex = re.compile('(#include [<|"](?:.*)[>|"])') cppfiles = [] for root, dirs, files in os.walk(os.curdir): @@ -14,7 +16,7 @@ for cpp in cppfiles: with open(cpp, 'r') as f: cppcontent = f.read() includes = [] - for match in re.findall('(#include [<|"](?:.*)[>|"])', cppcontent): + for match in regex.findall(cppcontent): if match in includes: print('multiple inclusions of: %s, in %s' % (match, cpp)) continue diff --git a/scripts/incfsck.py b/scripts/incfsck.py index a2edbe061..c32c2c2d0 100755 --- a/scripts/incfsck.py +++ b/scripts/incfsck.py @@ -367,7 +367,6 @@ for cpp in cppfiles: inc1 = '%s/%s' % (key, key2) inc2 = key2 replacement = '#include <%s/%s>' % (key, incmap[key][key2]) - # print(inc1, inc2, replacement) for match in re.findall('(#include [<|"](?:%s|%s)[>|"])' % (inc1, inc2), cppcontent): with open(cpp, 'w') as f: if replacement in replaced: diff --git a/scripts/namefsck.py b/scripts/namefsck.py index 7bfda31fa..ea2d3249c 100755 --- a/scripts/namefsck.py +++ b/scripts/namefsck.py @@ -1,6 +1,6 @@ #!/usr/bin/python -import sys, os, re +import os, re # generated via find /usr/include/katie/ -name 'Q*' -printf ' "%f",\n' | sort -u classlist = { diff --git a/scripts/pragmafsck.py b/scripts/pragmafsck.py index 20df7fc75..69f52eda9 100755 --- a/scripts/pragmafsck.py +++ b/scripts/pragmafsck.py @@ -1,23 +1,23 @@ #!/usr/bin/python -import sys, os, re +import os, re regex = re.compile('(#ifndef (?:.*)_H\n#define .*$)', re.MULTILINE) -cppfiles = [] +hppfiles = [] for root, dirs, files in os.walk(os.curdir): for f in files: if f.endswith(('.hpp', '.h')): - cppfiles.append('%s/%s' % (root, f)) + hppfiles.append('%s/%s' % (root, f)) -for cpp in cppfiles: - cpp = os.path.realpath(cpp) - with open(cpp, 'r') as f: +for hpp in hppfiles: + hpp = os.path.realpath(hpp) + with open(hpp, 'r') as f: cppcontent = f.read() if '#pragma once' in cppcontent: continue for match in regex.findall(cppcontent): - with open(cpp, 'w') as f: - print('adding pragma once to: %s' % cpp) + with open(hpp, 'w') as f: + print('adding pragma once to: %s' % hpp) cppcontent = cppcontent.replace(match, '#pragma once\n\n%s' % match) f.write(cppcontent) diff --git a/src/core/global/qendian.h b/src/core/global/qendian.h index 1a12aeac3..ec8463964 100644 --- a/src/core/global/qendian.h +++ b/src/core/global/qendian.h @@ -76,49 +76,6 @@ template inline void qToUnaligned(const T src, uchar *dest) * and return the value in host-endian encoding. * There is no requirement that \a src must be aligned. */ -#if defined Q_CC_SUN -inline quint64 qFromLittleEndian_helper(const uchar *src, quint64 *dest) -{ - return 0 - | src[0] - | src[1] * Q_UINT64_C(0x0000000000000100) - | src[2] * Q_UINT64_C(0x0000000000010000) - | src[3] * Q_UINT64_C(0x0000000001000000) - | src[4] * Q_UINT64_C(0x0000000100000000) - | src[5] * Q_UINT64_C(0x0000010000000000) - | src[6] * Q_UINT64_C(0x0001000000000000) - | src[7] * Q_UINT64_C(0x0100000000000000); -} - -inline quint32 qFromLittleEndian_helper(const uchar *src, quint32 *dest) -{ - return 0 - | src[0] - | src[1] * quint32(0x00000100) - | src[2] * quint32(0x00010000) - | src[3] * quint32(0x01000000); -} - -inline quint16 qFromLittleEndian_helper(const uchar *src, quint16 *dest) -{ - return 0 - | src[0] - | src[1] * 0x0100; -} - -inline qint64 qFromLittleEndian_helper(const uchar *src, qint64 * dest) -{ return static_cast(qFromLittleEndian_helper(src, reinterpret_cast(0))); } -inline qint32 qFromLittleEndian_helper(const uchar *src, qint32 * dest) -{ return static_cast(qFromLittleEndian_helper(src, reinterpret_cast(0))); } -inline qint16 qFromLittleEndian_helper(const uchar *src, qint16 * dest) -{ return static_cast(qFromLittleEndian_helper(src, reinterpret_cast(0))); } - -template inline T qFromLittleEndian(const uchar *src) -{ - return qFromLittleEndian_helper(src, reinterpret_cast(0)); -} - -#else template inline T qFromLittleEndian(const uchar *src); template <> inline quint64 qFromLittleEndian(const uchar *src) { @@ -158,56 +115,11 @@ template <> inline qint32 qFromLittleEndian(const uchar *src) template <> inline qint16 qFromLittleEndian(const uchar *src) { return static_cast(qFromLittleEndian(src)); } -#endif /* This function will read a big-endian (also known as network order) encoded value from \a src * and return the value in host-endian encoding. * There is no requirement that \a src must be aligned. */ -#if defined Q_CC_SUN -inline quint64 qFromBigEndian_helper(const uchar *src, quint64 *dest) -{ - return 0 - | src[7] - | src[6] * Q_UINT64_C(0x0000000000000100) - | src[5] * Q_UINT64_C(0x0000000000010000) - | src[4] * Q_UINT64_C(0x0000000001000000) - | src[3] * Q_UINT64_C(0x0000000100000000) - | src[2] * Q_UINT64_C(0x0000010000000000) - | src[1] * Q_UINT64_C(0x0001000000000000) - | src[0] * Q_UINT64_C(0x0100000000000000); -} - -inline quint32 qFromBigEndian_helper(const uchar *src, quint32 * dest) -{ - return 0 - | src[3] - | src[2] * quint32(0x00000100) - | src[1] * quint32(0x00010000) - | src[0] * quint32(0x01000000); -} - -inline quint16 qFromBigEndian_helper(const uchar *src, quint16 * des) -{ - return 0 - | src[1] - | src[0] * 0x0100; -} - - -inline qint64 qFromBigEndian_helper(const uchar *src, qint64 * dest) -{ return static_cast(qFromBigEndian_helper(src, reinterpret_cast(0))); } -inline qint32 qFromBigEndian_helper(const uchar *src, qint32 * dest) -{ return static_cast(qFromBigEndian_helper(src, reinterpret_cast(0))); } -inline qint16 qFromBigEndian_helper(const uchar *src, qint16 * dest) -{ return static_cast(qFromBigEndian_helper(src, reinterpret_cast(0))); } - -template inline T qFromBigEndian(const uchar *src) -{ - return qFromBigEndian_helper(src, reinterpret_cast(0)); -} - -#else template inline T qFromBigEndian(const uchar *src); template<> inline quint64 qFromBigEndian(const uchar *src) @@ -251,7 +163,7 @@ template <> inline qint32 qFromBigEndian(const uchar *src) template <> inline qint16 qFromBigEndian(const uchar *src) { return static_cast(qFromBigEndian(src)); } -#endif + /* * T qbswap(T source). * Changes the byte order of a value from big endian to little endian or vice versa. diff --git a/src/core/global/qglobal.cpp b/src/core/global/qglobal.cpp index a1ac15280..8fcd96bbe 100644 --- a/src/core/global/qglobal.cpp +++ b/src/core/global/qglobal.cpp @@ -464,11 +464,11 @@ QT_BEGIN_NAMESPACE The header file provides a range of macros (Q_CC_*) that are defined if the application is compiled using the - specified platforms. For example, the Q_CC_SUN macro is defined if - the application is compiled using Forte Developer, or Sun Studio - C++. The header file also declares a range of macros (Q_OS_*) - that are defined for the specified platforms. For example, - Q_OS_WIN32 which is defined for Microsoft Windows. + specified platforms. For example, the Q_CC_GNU macro is defined + if the application is compiled using GNU Compiler Collection. + The header file also declares a range of macros (Q_OS_*) that + are defined for the specified platforms. For example, Q_OS_WIN32 + which is defined for Microsoft Windows. The purpose of these macros is to enable programmers to add compiler or platform specific code to their application. diff --git a/src/core/global/qnamespace.h b/src/core/global/qnamespace.h index 9c0cb98b4..632fca65c 100644 --- a/src/core/global/qnamespace.h +++ b/src/core/global/qnamespace.h @@ -997,8 +997,7 @@ public: enum TextFormat { PlainText, RichText, - AutoText, - LogText + AutoText }; enum AspectRatioMode { diff --git a/src/core/global/qnamespace.qdoc b/src/core/global/qnamespace.qdoc index baeb7c8c2..76b16ded8 100644 --- a/src/core/global/qnamespace.qdoc +++ b/src/core/global/qnamespace.qdoc @@ -2171,9 +2171,6 @@ \value AutoText The text string is interpreted as for Qt::RichText if Qt::mightBeRichText() returns true, otherwise as Qt::PlainText. - - \value LogText A special, limited text format which is only used - by Q3TextEdit in an optimized mode. */ /*! diff --git a/src/core/tools/qvector.h b/src/core/tools/qvector.h index a64484be9..73bba7c0c 100644 --- a/src/core/tools/qvector.h +++ b/src/core/tools/qvector.h @@ -74,11 +74,7 @@ class QVector typedef QVectorTypedData Data; union { QVectorData *d; -#if defined(Q_CC_SUN) && (__SUNPRO_CC <= 0x550) - QVectorTypedData *p; -#else Data *p; -#endif }; public: diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 133a77846..7587f5367 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -250,7 +250,7 @@ void QDeclarativeTextEdit::setText(const QString &text) if (QDeclarativeTextEdit::text() == text) return; - d->richText = d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(text)); + d->richText = d->format == Qt::RichText || (d->format == Qt::AutoText && Qt::mightBeRichText(text)); if (d->richText) { #ifndef QT_NO_TEXTHTMLPARSER d->control->setHtml(text); @@ -264,17 +264,17 @@ void QDeclarativeTextEdit::setText(const QString &text) } /*! - \qmlproperty enumeration TextEdit::textFormat + \qmlproperty enumeration Qt::textFormat The way the text property should be displayed. \list - \o TextEdit.AutoText - \o TextEdit.PlainText - \o TextEdit.RichText + \o Qt.AutoText + \o Qt.PlainText + \o Qt.RichText \endlist - The default is TextEdit.AutoText. If the text format is TextEdit.AutoText the text edit + The default is Qt.AutoText. If the text format is Qt.AutoText the text edit will automatically determine whether the text should be treated as rich text. This determination is made using Qt::mightBeRichText(). @@ -289,12 +289,12 @@ Column { } TextEdit { font.pointSize: 24 - textFormat: TextEdit.RichText + textFormat: Qt.RichText text: "Hello World!" } TextEdit { font.pointSize: 24 - textFormat: TextEdit.PlainText + textFormat: Qt.PlainText text: "Hello World!" } } @@ -302,19 +302,19 @@ Column { \o \image declarative-textformat.png \endtable */ -QDeclarativeTextEdit::TextFormat QDeclarativeTextEdit::textFormat() const +Qt::TextFormat QDeclarativeTextEdit::textFormat() const { Q_D(const QDeclarativeTextEdit); return d->format; } -void QDeclarativeTextEdit::setTextFormat(TextFormat format) +void QDeclarativeTextEdit::setTextFormat(Qt::TextFormat format) { Q_D(QDeclarativeTextEdit); if (format == d->format) return; bool wasRich = d->richText; - d->richText = format == RichText || (format == AutoText && Qt::mightBeRichText(d->text)); + d->richText = format == Qt::RichText || (format == Qt::AutoText && Qt::mightBeRichText(d->text)); if (wasRich && !d->richText) { d->control->setPlainText(d->text); @@ -328,7 +328,7 @@ void QDeclarativeTextEdit::setTextFormat(TextFormat format) updateSize(); } d->format = format; - d->control->setAcceptRichText(d->format != PlainText); + d->control->setAcceptRichText(d->format != Qt::PlainText); emit textFormatChanged(d->format); } diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 5cecd072b..96cb0d014 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -54,7 +54,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa Q_OBJECT Q_ENUMS(VAlignment) Q_ENUMS(HAlignment) - Q_ENUMS(TextFormat) Q_ENUMS(WrapMode) Q_ENUMS(SelectionMode) @@ -69,7 +68,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged) Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged) - Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged) + Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) @@ -102,12 +101,6 @@ public: AlignVCenter = Qt::AlignVCenter }; - enum TextFormat { - PlainText = Qt::PlainText, - RichText = Qt::RichText, - AutoText = Qt::AutoText - }; - enum WrapMode { NoWrap = QTextOption::NoWrap, WordWrap = QTextOption::WordWrap, WrapAnywhere = QTextOption::WrapAnywhere, @@ -126,8 +119,8 @@ public: QString text() const; void setText(const QString &); - TextFormat textFormat() const; - void setTextFormat(TextFormat format); + Qt::TextFormat textFormat() const; + void setTextFormat(Qt::TextFormat format); QFont font() const; void setFont(const QFont &font); @@ -224,7 +217,7 @@ Q_SIGNALS: void verticalAlignmentChanged(VAlignment alignment); void wrapModeChanged(); void lineCountChanged(); - void textFormatChanged(TextFormat textFormat); + void textFormatChanged(Qt::TextFormat textFormat); void readOnlyChanged(bool isReadOnly); void cursorVisibleChanged(bool isCursorVisible); void cursorDelegateChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h index 976875184..085e7634b 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h @@ -61,10 +61,10 @@ class QDeclarativeTextEditPrivate : public QDeclarativeImplicitSizePaintedItemPr public: QDeclarativeTextEditPrivate() : color("black"), hAlign(QDeclarativeTextEdit::AlignLeft), vAlign(QDeclarativeTextEdit::AlignTop), - imgDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true), + dirty(false), richText(false), cursorVisible(false), focusOnPress(true), showInputPanelOnFocus(true), clickCausedFocus(false), persistentSelection(true), requireImplicitWidth(false), hAlignImplicit(true), rightToLeftText(false), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), - cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText), document(0), wrapMode(QDeclarativeTextEdit::NoWrap), + cursorComponent(0), cursor(0), format(Qt::AutoText), document(0), wrapMode(QDeclarativeTextEdit::NoWrap), mouseSelectionMode(QDeclarativeTextEdit::SelectCharacters), lineCount(0), selectByMouse(false), canPaste(false), yoff(0) { @@ -87,29 +87,24 @@ public: QColor color; QColor selectionColor; QColor selectedTextColor; - QString style; - QColor styleColor; - QPixmap imgCache; - QPixmap imgStyleCache; QDeclarativeTextEdit::HAlignment hAlign; QDeclarativeTextEdit::VAlignment vAlign; - bool imgDirty : 1; - bool dirty : 1; - bool richText : 1; - bool cursorVisible : 1; - bool focusOnPress : 1; - bool showInputPanelOnFocus : 1; - bool clickCausedFocus : 1; - bool persistentSelection : 1; - bool requireImplicitWidth:1; - bool hAlignImplicit:1; - bool rightToLeftText:1; + bool dirty; + bool richText; + bool cursorVisible; + bool focusOnPress; + bool showInputPanelOnFocus; + bool clickCausedFocus; + bool persistentSelection; + bool requireImplicitWidth; + bool hAlignImplicit; + bool rightToLeftText; qreal textMargin; int lastSelectionStart; int lastSelectionEnd; QDeclarativeComponent* cursorComponent; QDeclarativeItem* cursor; - QDeclarativeTextEdit::TextFormat format; + Qt::TextFormat format; QTextDocument *document; QTextControl *control; QDeclarativeTextEdit::WrapMode wrapMode; diff --git a/src/designer/shared/richtexteditor.cpp b/src/designer/shared/richtexteditor.cpp index b9017d4b9..a26ca741f 100644 --- a/src/designer/shared/richtexteditor.cpp +++ b/src/designer/shared/richtexteditor.cpp @@ -728,7 +728,6 @@ void RichTextEditor::setDefaultFont(QFont font) QString RichTextEditor::text(Qt::TextFormat format) const { switch (format) { - case Qt::LogText: case Qt::PlainText: return toPlainText(); case Qt::RichText: diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index 426c20ea3..d1beeb089 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -424,7 +424,7 @@ QTextHtmlImporter::QTextHtmlImporter(QTextDocument *_doc, const QString &_html, QString html = _html; const int startFragmentPos = html.indexOf(QLatin1String("")); if (startFragmentPos != -1) { - QString qt3RichTextHeader(QLatin1String("")); + QLatin1String qt3RichTextHeader(""); // Hack for Qt3 const bool hasQtRichtextMetaTag = html.contains(qt3RichTextHeader); diff --git a/src/gui/widgets/qcombobox_p.h b/src/gui/widgets/qcombobox_p.h index 17acccbd3..5167fd9fe 100644 --- a/src/gui/widgets/qcombobox_p.h +++ b/src/gui/widgets/qcombobox_p.h @@ -298,9 +298,8 @@ protected: const QModelIndex &index) const { if (isSeparator(index)) { QRect rect = option.rect; - if (const QStyleOptionViewItemV3 *v3 = qstyleoption_cast(&option)) - if (const QAbstractItemView *view = qobject_cast(v3->widget)) - rect.setWidth(view->viewport()->width()); + if (const QAbstractItemView *view = qobject_cast(option.widget)) + rect.setWidth(view->viewport()->width()); QStyleOption opt; opt.rect = rect; mCombo->style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator, &opt, painter, mCombo); diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index c2768b0e8..9766903df 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -2384,7 +2384,7 @@ void QTextEdit::setText(const QString &text) { Qt::TextFormat format = Qt::mightBeRichText(text) ? Qt::RichText : Qt::PlainText; #ifndef QT_NO_TEXTHTMLPARSER - if (format == Qt::RichText || format == Qt::LogText) + if (format == Qt::RichText) setHtml(text); else #endif