From fdefbb820f1ebf9fbde0f683ea6d05923e8c04e4 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 20 May 2009 13:25:27 +0200 Subject: QComboBox: style change event should not resets custom item delegates Regression from 4.4 introduced while fixing task 167106 Autotest: tst_QComboBox::task253944_itemDelegateIsReset() Task-number: 253944 Reviewed-by: jbache --- src/gui/widgets/qcombobox.cpp | 22 ++++++++++++++++------ src/gui/widgets/qcombobox_p.h | 6 +++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 09a51fe..a5a98d4 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -947,7 +947,7 @@ QComboBoxPrivateContainer* QComboBoxPrivate::viewContainer() container = new QComboBoxPrivateContainer(new QComboBoxListView(q), q); container->itemView()->setModel(model); container->itemView()->setTextElideMode(Qt::ElideMiddle); - updateDelegate(); + updateDelegate(true); updateLayoutDirection(); QObject::connect(container, SIGNAL(itemSelected(QModelIndex)), q, SLOT(_q_itemSelected(QModelIndex))); @@ -1567,15 +1567,25 @@ bool QComboBox::isEditable() const return d->lineEdit != 0; } -void QComboBoxPrivate::updateDelegate() +/*! \internal + update the default delegate + depending on the style's SH_ComboBox_Popup hint, we use a different default delegate. + + but we do not change the delegate is the combobox use a custom delegate, + unless \a force is set to true. + */ +void QComboBoxPrivate::updateDelegate(bool force) { Q_Q(QComboBox); QStyleOptionComboBox opt; q->initStyleOption(&opt); - if (q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)) - q->setItemDelegate(new QComboMenuDelegate(q->view(), q)); - else - q->setItemDelegate(new QComboBoxDelegate(q->view(), q)); + if (q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)) { + if (force || qobject_cast(q->itemDelegate())) + q->setItemDelegate(new QComboMenuDelegate(q->view(), q)); + } else { + if (force || qobject_cast(q->itemDelegate())) + q->setItemDelegate(new QComboBoxDelegate(q->view(), q)); + } } QIcon QComboBoxPrivate::itemIcon(const QModelIndex &index) const diff --git a/src/gui/widgets/qcombobox_p.h b/src/gui/widgets/qcombobox_p.h index c39a231..a55b439 100644 --- a/src/gui/widgets/qcombobox_p.h +++ b/src/gui/widgets/qcombobox_p.h @@ -256,7 +256,7 @@ private: }; class QComboMenuDelegate : public QAbstractItemDelegate -{ +{ Q_OBJECT public: QComboMenuDelegate(QObject *parent, QComboBox *cmb) : QAbstractItemDelegate(parent), mCombo(cmb) {} @@ -285,7 +285,7 @@ private: // Vista does not use the new theme for combo boxes and there might // be other side effects from using the new class class QComboBoxDelegate : public QItemDelegate -{ +{ Q_OBJECT public: QComboBoxDelegate(QObject *parent, QComboBox *cmb) : QItemDelegate(parent), mCombo(cmb) {} @@ -367,7 +367,7 @@ public: int itemRole() const; void updateLayoutDirection(); void setCurrentIndex(const QModelIndex &index); - void updateDelegate(); + void updateDelegate(bool force = false); void keyboardSearchString(const QString &text); void modelChanged(); -- cgit v0.12 From 27df3cb8c0e547d9174fd0571b16ed554eb2432d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 May 2009 14:25:38 +0200 Subject: qdoc: Moved a qdoc comment to a file that is in all packages. Task-number: 252565 --- src/gui/dialogs/qpagesetupdialog.cpp | 6 ++++++ src/gui/dialogs/qpagesetupdialog_mac.mm | 3 --- src/gui/styles/qmacstyle_mac.mm | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gui/dialogs/qpagesetupdialog.cpp b/src/gui/dialogs/qpagesetupdialog.cpp index 63775d2..682071a 100644 --- a/src/gui/dialogs/qpagesetupdialog.cpp +++ b/src/gui/dialogs/qpagesetupdialog.cpp @@ -180,6 +180,12 @@ void QPageSetupDialog::open(QObject *receiver, const char *member) QDialog::open(); } +#if defined(Q_WS_MAC) || defined(Q_OS_WIN) +/*! \fn void QPageSetupDialog::setVisible(bool visible) + \reimp +*/ +#endif + QT_END_NAMESPACE #endif diff --git a/src/gui/dialogs/qpagesetupdialog_mac.mm b/src/gui/dialogs/qpagesetupdialog_mac.mm index 401d95f..24aef34 100644 --- a/src/gui/dialogs/qpagesetupdialog_mac.mm +++ b/src/gui/dialogs/qpagesetupdialog_mac.mm @@ -251,9 +251,6 @@ QPageSetupDialog::QPageSetupDialog(QWidget *parent) d->ep = static_cast(d->printer->paintEngine())->d_func(); } -/*! - \reimp -*/ void QPageSetupDialog::setVisible(bool visible) { Q_D(QPageSetupDialog); diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 2e47526..e4829dc 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -39,7 +39,7 @@ ** ****************************************************************************/ -/*! +/* Note: The qdoc comments for QMacStyle are contained in .../doc/src/qstyles.qdoc. */ -- cgit v0.12 From 6e03459f72b090695767f263e1d51e5182f5f317 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Wed, 20 May 2009 14:52:23 +0200 Subject: Don't draw an arrow for toolbuttons that are text only and have a menu. I made this change to make things look a bit better on the mac. However, a toolbutton with text only looks strange and as a bonus the arrow covers some of the text, which no one wants. It seems that similar consructions in Cocoa don't show the arrow for text button, so we shouldn't either. Task-number: 253339 Reviewed-by: Jens Bache-Wiig --- src/gui/styles/qmacstyle_mac.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index e4829dc..1be3d6e 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -5104,7 +5104,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex arrowOpt.state = tb->state; arrowOpt.palette = tb->palette; drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget); - } else if (tb->features & QStyleOptionToolButton::HasMenu) { + } else if ((tb->features & QStyleOptionToolButton::HasMenu) + && (tb->toolButtonStyle != Qt::ToolButtonTextOnly && !tb->icon.isNull())) { drawToolbarButtonArrow(tb->rect, tds, cg); } if (tb->state & State_On) { -- cgit v0.12 From f0d465e39eee9f819d0453b1bf66b3b0462383e2 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Wed, 20 May 2009 15:01:04 +0200 Subject: I made test more stable. There was no sens to check hardcoded size of header + file. Now test check only size of the real file content, assuming that it is rather boring (9,5MB of '\0'). It simply skip header. Reviewed by Peter Hartmann --- tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp index f501e78..5ab5064 100644 --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -795,14 +795,14 @@ void tst_QSocks5SocketEngine::downloadBigFile() if (QTestEventLoop::instance().timeout()) QFAIL("Network operation timed out"); - QCOMPARE(bytesAvailable, qint64(10000309)); + QCOMPARE(bytesAvailable, qint64(10000000)); QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState); - qDebug("\t\t%.1fMB/%.1fs: %.1fMB/s", + /*qDebug("\t\t%.1fMB/%.1fs: %.1fMB/s", bytesAvailable / (1024.0 * 1024.0), stopWatch.elapsed() / 1024.0, - (bytesAvailable / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); + (bytesAvailable / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));*/ delete tmpSocket; tmpSocket = 0; @@ -816,7 +816,10 @@ void tst_QSocks5SocketEngine::exitLoopSlot() void tst_QSocks5SocketEngine::downloadBigFileSlot() { - bytesAvailable += tmpSocket->readAll().size(); + QByteArray tmp=tmpSocket->readAll(); + int correction=tmp.indexOf((char)0,0); //skip header + if (correction==-1) correction=0; + bytesAvailable += (tmp.size()-correction); if (bytesAvailable >= 10000000) QTestEventLoop::instance().exitLoop(); } -- cgit v0.12 From 81780cd10a0901966a34d2805e56d106464e124d Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 20 May 2009 16:41:38 +0200 Subject: Make the range controls accessible --- src/plugins/accessible/widgets/rangecontrols.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/accessible/widgets/rangecontrols.h b/src/plugins/accessible/widgets/rangecontrols.h index aea91e1..57073ee 100644 --- a/src/plugins/accessible/widgets/rangecontrols.h +++ b/src/plugins/accessible/widgets/rangecontrols.h @@ -60,6 +60,7 @@ class QDial; #ifndef QT_NO_SPINBOX class QAccessibleAbstractSpinBox: public QAccessibleWidgetEx, public QAccessibleValueInterface { + Q_ACCESSIBLE_OBJECT public: explicit QAccessibleAbstractSpinBox(QWidget *w); @@ -132,6 +133,7 @@ protected: class QAccessibleAbstractSlider: public QAccessibleWidgetEx, public QAccessibleValueInterface { + Q_ACCESSIBLE_OBJECT public: explicit QAccessibleAbstractSlider(QWidget *w, Role r = Slider); -- cgit v0.12 From d46fd15e337421c723d56fd62582ac4ccc76395a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 20 May 2009 17:07:06 +0200 Subject: Compile on Solaris with broken GL headers. Reviewed-by: Samuel --- demos/boxes/glextensions.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/demos/boxes/glextensions.h b/demos/boxes/glextensions.h index 74617d6..7ba3b32 100644 --- a/demos/boxes/glextensions.h +++ b/demos/boxes/glextensions.h @@ -120,8 +120,11 @@ glUnmapBuffer //#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A #endif +#ifndef GL_ARB_vertex_buffer_object +typedef ptrdiff_t GLsizeiptrARB; +#endif + #ifndef GL_VERSION_1_5 -typedef ptrdiff_t GLsizeiptr; #define GL_ARRAY_BUFFER 0x8892 #define GL_ELEMENT_ARRAY_BUFFER 0x8893 #define GL_READ_WRITE 0x88BA @@ -185,7 +188,7 @@ typedef void (APIENTRY *_glTexImage3D) (GLenum, GLint, GLenum, GLsizei, GLsizei, typedef void (APIENTRY *_glGenBuffers) (GLsizei, GLuint *); typedef void (APIENTRY *_glBindBuffer) (GLenum, GLuint); -typedef void (APIENTRY *_glBufferData) (GLenum, GLsizeiptr, const GLvoid *, GLenum); +typedef void (APIENTRY *_glBufferData) (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); typedef void (APIENTRY *_glDeleteBuffers) (GLsizei, const GLuint *); typedef void *(APIENTRY *_glMapBuffer) (GLenum, GLenum); typedef GLboolean (APIENTRY *_glUnmapBuffer) (GLenum); -- cgit v0.12 From 3bcc706cabb61d58d7e6c005f5268747a5e65307 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Wed, 20 May 2009 17:39:21 +0200 Subject: Fix a wrong compiler define (was a typo). The typo was in commit 30f7edc0aab629499b74263391ae529ad31b2ff8. --- src/gui/painting/qtransform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 4ea1be3..4a33969 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -322,7 +322,7 @@ inline QTransform &QTransform::operator-=(qreal num) # if Q_CC_GNU_VERSION >= 0x040201 # pragma GCC diagnostic warning "-Wfloat-equal" # endif -# undef Q_GCC_GNU_VERSION +# undef Q_CC_GNU_VERSION #endif /****** stream functions *******************/ -- cgit v0.12 From 56a8e78869325453010fb6c41a5e2b9e6f8f1c95 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 20 May 2009 17:56:51 +0200 Subject: Fix a compile error on MSVC 64bits due to qhash casting a pointer. I tested it with 32 bits compilation and there is no warning any more. Task-number: 247325 Reviewed-by: ogoffart --- src/corelib/tools/qhash.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index a18b531..632c422 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -97,10 +97,7 @@ Q_CORE_EXPORT uint qHash(const QBitArray &key); #endif template inline uint qHash(const T *key) { - if (sizeof(const T *) > sizeof(uint)) - return qHash(reinterpret_cast(key)); - else - return uint(reinterpret_cast(key)); + return qHash(reinterpret_cast(key)); } #if defined(Q_CC_MSVC) #pragma warning( pop ) -- cgit v0.12 From d94ed47b7748826fc2b9fba774cce51a54c24880 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 21 May 2009 11:44:19 +1000 Subject: Fixes conditional jump on uninitialised value As found by valgrind. Also add error reporting that was missing. Reviewed-by: Justin McPherson --- src/sql/drivers/oci/qsql_oci.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index d63c482..a7031b1 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -1789,7 +1789,7 @@ bool QOCIResult::prepare(const QString& query) bool QOCIResult::exec() { int r = 0; - ub2 stmtType; + ub2 stmtType=0; ub4 iters; ub4 mode; QList tmpStorage; @@ -1803,6 +1803,16 @@ bool QOCIResult::exec() OCI_ATTR_STMT_TYPE, d->err); + if (r != OCI_SUCCESS && r != OCI_SUCCESS_WITH_INFO) { + qOraWarning("QOCIResult::exec: Unable to get statement type:", d->err); + setLastError(qMakeError(QCoreApplication::translate("QOCIResult", + "Unable to get statement type"), QSqlError::StatementError, d->err)); +#ifdef QOCI_DEBUG + qDebug() << "lastQuery()" << lastQuery(); +#endif + return false; + } + if (stmtType == OCI_STMT_SELECT) { iters = 0; mode = OCI_DEFAULT; -- cgit v0.12 From 2cb36aed053147ecc91f72ed76074962a66b76f0 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 21 May 2009 14:08:02 +1000 Subject: Fix build regression caused by ba5fb9f05c891feac8ab69006189de1aaafebc18. The previous "fix" caused the effect of the line before the change to be discarded, which breaks the mac binary package builds. When reviewing changes, please read the lines of context given in the patch - they are included for a reason. Acked-by: Lincoln Ramsay Acked-by: Rohan McGovern --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 20bf457..c882b29 100755 --- a/configure +++ b/configure @@ -2717,7 +2717,7 @@ if [ "$PLATFORM_MAC" = "yes" ]; then # Build commmand line arguments we can pass to the compiler during configure tests # by prefixing each arch with "-arch". CFG_MAC_ARCHS_GCC_FORMAT="${CFG_MAC_ARCHS/x86/i386}" - CFG_MAC_ARCHS_GCC_FORMAT="${CFG_MAC_ARCHS/i386_64/x86_64}" + CFG_MAC_ARCHS_GCC_FORMAT="${CFG_MAC_ARCHS_GCC_FORMAT/i386_64/x86_64}" for ARCH in $CFG_MAC_ARCHS_GCC_FORMAT; do MAC_ARCHS_COMMANDLINE="$MAC_ARCHS_COMMANDLINE -arch $ARCH" done -- cgit v0.12 From 7383e03bfd473f6e79718f3da7d504977a677541 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 21 May 2009 14:27:27 +1000 Subject: Fixes one of the fields of mysql bound params not initialised. Found by valgrind, value isn't set but is used, fixes this. Reviewed-by: Justin McPherson --- src/sql/drivers/mysql/qsql_mysql.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index 51fc306..53645c9 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -927,6 +927,7 @@ bool QMYSQLResult::exec() nullVector[i] = static_cast(val.isNull()); currBind->is_null = &nullVector[i]; currBind->length = 0; + currBind->is_unsigned = 0; switch (val.type()) { case QVariant::ByteArray: @@ -973,7 +974,6 @@ bool QMYSQLResult::exec() currBind->buffer_type = MYSQL_TYPE_DOUBLE; currBind->buffer = data; currBind->buffer_length = sizeof(double); - currBind->is_unsigned = 0; break; case QVariant::LongLong: case QVariant::ULongLong: @@ -989,7 +989,6 @@ bool QMYSQLResult::exec() currBind->buffer_type = MYSQL_TYPE_STRING; currBind->buffer = const_cast(ba.constData()); currBind->buffer_length = ba.length(); - currBind->is_unsigned = 0; break; } } } -- cgit v0.12 From 4ea52386e0281700e6143e0ba946314e7dd30608 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 21 May 2009 16:03:41 -0700 Subject: Removed warning Explicitly cast to integer. Reviewed-by: Shane McLaughlin --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 989a37a..a68bc8f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -383,7 +383,7 @@ void QDirectFBPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) { Q_D(QDirectFBPaintEngine); d->dirtyClip = true; - const QPoint bottom = d->transform.map(QPoint(0, path.controlPointRect().y2)); + const QPoint bottom = d->transform.map(QPoint(0, int(path.controlPointRect().y2))); if (bottom.y() >= d->lastLockedHeight) d->lock(); QRasterPaintEngine::clip(path, op); -- cgit v0.12 From c8e632f96a942590ab9936d136dcf2f7eb17fef8 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Fri, 22 May 2009 10:01:35 +0200 Subject: configure script fix, -h should display help and not just h. Reviewed-by:cduclos --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index c882b29..32efd86 100755 --- a/configure +++ b/configure @@ -202,7 +202,7 @@ earlyArgParse() VAL=$1 fi ;; - h|help|--help|-help) + -h|help|--help|-help) if [ "$VAL" = "yes" ]; then OPT_HELP="$VAL" COMMERCIAL_USER="no" #doesn't matter we will display the help -- cgit v0.12 From 5cd9be6c2702ce1f4292003ac3e864f08a0311f3 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Fri, 22 May 2009 10:49:32 +0200 Subject: Fix toolbutton text incorrectly clipped on windows In 4.5 the toolbutton icon rendering was changed somewhat and the bottom line of text for tool buttons icons with TextUnderIcon set is incorrectly clipped on Windows. The style reserves only 5 pixels but tries to use 6 pixels for text and icon spacing, hence we adjust the text rect one pixel up. This should be safe considering the fact that we have a margin on both sides of the icon already and avoids actually moving the icon positioning. Task-number: 252554 Reviewed-by: trond --- src/gui/styles/qcommonstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 3cae08a..f3d1537 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -1693,7 +1693,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (toolbutton->toolButtonStyle == Qt::ToolButtonTextUnderIcon) { pr.setHeight(pmSize.height() + 6); - tr.adjust(0, pr.height(), 0, -3); + tr.adjust(0, pr.height() - 1, 0, -3); pr.translate(shiftX, shiftY); if (!hasArrow) { drawItemPixmap(p, pr, Qt::AlignCenter, pm); -- cgit v0.12 From 308a105bf6ae6eb5702440728428a96b5806b085 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Fri, 22 May 2009 11:08:38 +0200 Subject: Revert "Ignore GCC warning of unsafe floating point comparisons." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 30f7edc0aab629499b74263391ae529ad31b2ff8. There is no way to restore float-equal warning using the pragma trick. This means (as it was mentioned in the said commit log) anyone that includes qtransform.h will be forced to deal with float-equal. Reviewed-by: Samuel Rødal --- src/gui/painting/qtransform.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 4a33969..c76409b 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -255,13 +255,6 @@ inline qreal QTransform::dy() const return affine._dy; } -#if defined(Q_CC_GNU) -# define Q_CC_GNU_VERSION (((__GNUC__)<<16)|((__GNUC_MINOR__)<<8)|(__GNUC_PATCHLEVEL__)) -# if Q_CC_GNU_VERSION >= 0x040201 -# pragma GCC diagnostic ignored "-Wfloat-equal" -# endif -#endif - inline QTransform &QTransform::operator*=(qreal num) { if (num == 1.) @@ -318,13 +311,6 @@ inline QTransform &QTransform::operator-=(qreal num) return *this; } -#if defined(Q_CC_GNU_VERSION) -# if Q_CC_GNU_VERSION >= 0x040201 -# pragma GCC diagnostic warning "-Wfloat-equal" -# endif -# undef Q_CC_GNU_VERSION -#endif - /****** stream functions *******************/ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTransform &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTransform &); -- cgit v0.12 From 815a8c4a297cde2b8f778c4afa36958e324f8ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 22 May 2009 11:17:29 +0200 Subject: Fixed an issue with text drawing to QImages on Mac/Cocoa. We currently don't support subpixel hinting when drawing text to a QImage on Mac. The alpha map that is returned by the font engine is a plain 8 bit gray mask, which means we have to switch off subpixel hinting when we draw the glyph for caching. Task-number: 249178 Reviewed-by: Samuel --- src/gui/text/qfontengine_mac.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index 425cab2..d397e4a 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -553,7 +553,9 @@ QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph) 8, im.bytesPerLine(), colorspace, cgflags); CGContextSetFontSize(ctx, fontDef.pixelSize); - CGContextSetShouldAntialias(ctx, fontDef.pointSize > qt_antialiasing_threshold && !(fontDef.styleStrategy & QFont::NoAntialias)); + CGContextSetShouldAntialias(ctx, fontDef.pointSize > qt_antialiasing_threshold + && !(fontDef.styleStrategy & QFont::NoAntialias)); + CGContextSetShouldSmoothFonts(ctx, false); CGAffineTransform oldTextMatrix = CGContextGetTextMatrix(ctx); CGAffineTransform cgMatrix = CGAffineTransformMake(1, 0, 0, 1, 0, 0); -- cgit v0.12 From 6c1d7e57ee8d7988ab9592e4112b1f28fd1d03ce Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 4 May 2009 20:49:41 +0200 Subject: Fixed strict aliasing breaks with sockaddr_XXX structs. This case it was possible to fix by using a union of the types when we actually declare the variable. Besides, this avoids a bunch of #ifdef for IPv6 functionality. Reviewed-By: Oswald Buddenhagen --- src/network/socket/qnativesocketengine_p.h | 9 ++++ src/network/socket/qnativesocketengine_unix.cpp | 61 ++++++++----------------- 2 files changed, 29 insertions(+), 41 deletions(-) diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 3366f2d..825c333 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -90,6 +90,15 @@ static inline int qt_socket_socket(int domain, int type, int protocol) #endif +union qt_sockaddr { + sockaddr a; + sockaddr_in a4; +#if !defined(QT_NO_IPV6) + sockaddr_in6 a6; +#endif + sockaddr_storage storage; +}; + class QNativeSocketEnginePrivate; class Q_AUTOTEST_EXPORT QNativeSocketEngine : public QAbstractSocketEngine diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index cc372a6..2b11e8e 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -114,36 +114,34 @@ static void qt_ignore_sigpipe() Extracts the port and address from a sockaddr, and stores them in \a port and \a addr if they are non-null. */ -static inline void qt_socket_getPortAndAddress(struct sockaddr *sa, quint16 *port, QHostAddress *addr) +static inline void qt_socket_getPortAndAddress(const qt_sockaddr *s, quint16 *port, QHostAddress *addr) { #if !defined(QT_NO_IPV6) - if (sa->sa_family == AF_INET6) { - struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa; + if (s->a.sa_family == AF_INET6) { Q_IPV6ADDR tmp; - memcpy(&tmp, &sa6->sin6_addr.s6_addr, sizeof(tmp)); + memcpy(&tmp, &s->a6.sin6_addr.s6_addr, sizeof(tmp)); if (addr) { QHostAddress tmpAddress; tmpAddress.setAddress(tmp); *addr = tmpAddress; #ifndef QT_NO_IPV6IFNAME char scopeid[IFNAMSIZ]; - if (::if_indextoname(sa6->sin6_scope_id, scopeid) > 0) { + if (::if_indextoname(s->a6.sin6_scope_id, scopeid) > 0) { addr->setScopeId(QLatin1String(scopeid)); } else #endif - addr->setScopeId(QString::number(sa6->sin6_scope_id)); + addr->setScopeId(QString::number(s->a6.sin6_scope_id)); } if (port) - *port = ntohs(sa6->sin6_port); + *port = ntohs(s->a6.sin6_port); return; } #endif - struct sockaddr_in *sa4 = (struct sockaddr_in *)sa; if (port) - *port = ntohs(sa4->sin_port); + *port = ntohs(s->a4.sin_port); if (addr) { QHostAddress tmpAddress; - tmpAddress.setAddress(ntohl(sa4->sin_addr.s_addr)); + tmpAddress.setAddress(ntohl(s->a4.sin_addr.s_addr)); *addr = tmpAddress; } } @@ -521,26 +519,16 @@ qint64 QNativeSocketEnginePrivate::nativeBytesAvailable() const bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const { // Create a sockaddr struct and reset its port number. -#if !defined(QT_NO_IPV6) - struct sockaddr_storage storage; - sockaddr_in6 *storagePtrIPv6 = reinterpret_cast(&storage); - storagePtrIPv6->sin6_port = 0; -#else - struct sockaddr storage; -#endif - sockaddr *storagePtr = reinterpret_cast(&storage); - storagePtr->sa_family = 0; - - sockaddr_in *storagePtrIPv4 = reinterpret_cast(&storage); - storagePtrIPv4->sin_port = 0; + qt_sockaddr storage; QT_SOCKLEN_T storageSize = sizeof(storage); + memset(&storage, 0, storageSize); // Peek 0 bytes into the next message. The size of the message may // well be 0, so we can't check recvfrom's return value. ssize_t readBytes; do { char c; - readBytes = ::recvfrom(socketDescriptor, &c, 1, MSG_PEEK, storagePtr, &storageSize); + readBytes = ::recvfrom(socketDescriptor, &c, 1, MSG_PEEK, &storage.a, &storageSize); } while (readBytes == -1 && errno == EINTR); // If there's no error, or if our buffer was too small, there must be a @@ -583,11 +571,7 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxSize, QHostAddress *address, quint16 *port) { -#if !defined(QT_NO_IPV6) - struct sockaddr_storage aa; -#else - struct sockaddr_in aa; -#endif + qt_sockaddr aa; memset(&aa, 0, sizeof(aa)); QT_SOCKLEN_T sz; sz = sizeof(aa); @@ -596,13 +580,13 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS do { char c; recvFromResult = ::recvfrom(socketDescriptor, maxSize ? data : &c, maxSize ? maxSize : 1, - 0, (struct sockaddr *)&aa, &sz); + 0, &aa.a, &sz); } while (recvFromResult == -1 && errno == EINTR); if (recvFromResult == -1) { setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString); } else if (port || address) { - qt_socket_getPortAndAddress((struct sockaddr *) &aa, port, address); + qt_socket_getPortAndAddress(&aa, port, address); } #if defined (QNATIVESOCKETENGINE_DEBUG) @@ -682,21 +666,16 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters() if (socketDescriptor == -1) return false; -#if !defined(QT_NO_IPV6) - struct sockaddr_storage sa; -#else - struct sockaddr_in sa; -#endif - struct sockaddr *sockAddrPtr = (struct sockaddr *) &sa; + qt_sockaddr sa; QT_SOCKLEN_T sockAddrSize = sizeof(sa); // Determine local address memset(&sa, 0, sizeof(sa)); - if (::getsockname(socketDescriptor, sockAddrPtr, &sockAddrSize) == 0) { - qt_socket_getPortAndAddress(sockAddrPtr, &localPort, &localAddress); + if (::getsockname(socketDescriptor, &sa.a, &sockAddrSize) == 0) { + qt_socket_getPortAndAddress(&sa, &localPort, &localAddress); // Determine protocol family - switch (sockAddrPtr->sa_family) { + switch (sa.a.sa_family) { case AF_INET: socketProtocol = QAbstractSocket::IPv4Protocol; break; @@ -716,8 +695,8 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters() } // Determine the remote address - if (!::getpeername(socketDescriptor, sockAddrPtr, &sockAddrSize)) - qt_socket_getPortAndAddress(sockAddrPtr, &peerPort, &peerAddress); + if (!::getpeername(socketDescriptor, &sa.a, &sockAddrSize)) + qt_socket_getPortAndAddress(&sa, &peerPort, &peerAddress); // Determine the socket type (UDP/TCP) int value = 0; -- cgit v0.12 From 5a62f2add2cba756a132f94a114d770285f01d9c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 19 May 2009 18:10:06 +0200 Subject: Add an autotest to check that the network test server works MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test verifies that the network test server is behaving as expected. I think I caught all the services we need testing in the server, but there's still some work to be done: 1) verify that the FTP files are there where they're supposed to be 2) verify that FTP writable areas are writable 3) verify that the HTTP server has the correct files too 4) verify that the HTTP server requests credentials for the protected area 5) attempt to do NTLM authentication to verify the password (probably can't be done with netChat) 6) add Windows SMB tests (//qt-test-server/etc.) 7) add SQL tests (connecting to the SQL server ports) It would be good as well if we could not use QtNetwork. If you break QtNetwork, this test breaks too, so we don't know where the fault is. However, rewriting networking code will add another source of bugs (same for the NTLM authentication). Reviewed-By: João Abecasis --- tests/auto/_networkselftest/_networkselftest.pro | 6 + .../auto/_networkselftest/tst_networkselftest.cpp | 592 +++++++++++++++++++++ tests/auto/auto.pro | 3 +- 3 files changed, 600 insertions(+), 1 deletion(-) create mode 100644 tests/auto/_networkselftest/_networkselftest.pro create mode 100644 tests/auto/_networkselftest/tst_networkselftest.cpp diff --git a/tests/auto/_networkselftest/_networkselftest.pro b/tests/auto/_networkselftest/_networkselftest.pro new file mode 100644 index 0000000..9e2ad0e --- /dev/null +++ b/tests/auto/_networkselftest/_networkselftest.pro @@ -0,0 +1,6 @@ +load(qttest_p4) + +SOURCES += tst_networkselftest.cpp +QT = core network +DEFINES += SRCDIR=\\\"$$PWD\\\" + diff --git a/tests/auto/_networkselftest/tst_networkselftest.cpp b/tests/auto/_networkselftest/tst_networkselftest.cpp new file mode 100644 index 0000000..dab4433 --- /dev/null +++ b/tests/auto/_networkselftest/tst_networkselftest.cpp @@ -0,0 +1,592 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include "../network-settings.h" + +class tst_NetworkSelfTest: public QObject +{ + Q_OBJECT +private slots: + void hostTest(); + void dnsResolution_data(); + void dnsResolution(); + void serverReachability(); + void remotePortsOpen_data(); + void remotePortsOpen(); + + // specific protocol tests + void ftpServer(); + void imapServer(); + void httpServer(); + void httpsServer(); + void httpProxy(); + void httpProxyBasicAuth(); + void httpProxyNtlmAuth(); + void socks5Proxy(); + void socks5ProxyAuth(); +}; + +class Chat +{ +public: + enum Type { + Reconnect, + Send, + Expect, + SkipBytes, + DiscardUntil, + DiscardUntilDisconnect, + Disconnect, + RemoteDisconnect, + StartEncryption + }; + Chat(Type t, const QByteArray &d) + : data(d), type(t) + { + } + Chat(Type t, int val = 0) + : value(val), type(t) + { + } + + static inline Chat send(const QByteArray &data) + { return Chat(Send, data); } + static inline Chat expect(const QByteArray &data) + { return Chat(Expect, data); } + static inline Chat discardUntil(const QByteArray &data) + { return Chat(DiscardUntil, data); } + static inline Chat skipBytes(int count) + { return Chat(SkipBytes, count); } + + QByteArray data; + int value; + Type type; +}; + +static QString prettyByteArray(const QByteArray &array) +{ + // any control chars? + QString result; + result.reserve(array.length() + array.length() / 3); + for (int i = 0; i < array.length(); ++i) { + char c = array.at(i); + switch (c) { + case '\n': + result += "\\n"; + continue; + case '\r': + result += "\\r"; + continue; + case '\t': + result += "\\t"; + continue; + case '"': + result += "\\\""; + continue; + default: + break; + } + + if (c < 0x20 || uchar(c) >= 0x7f) { + result += '\\'; + result += QString::number(uchar(c), 8); + } else { + result += c; + } + } + return result; +} + +static bool doSocketRead(QTcpSocket *socket, int minBytesAvailable, int timeout = 2000) +{ + QTime timer; + timer.start(); + forever { + if (socket->bytesAvailable() >= minBytesAvailable) + return true; + if (socket->state() == QAbstractSocket::UnconnectedState + || timer.elapsed() >= timeout) + return false; + if (!socket->waitForReadyRead(timeout - timer.elapsed())) + return false; + } +} + +static bool doSocketFlush(QTcpSocket *socket, int timeout = 2000) +{ +#ifndef QT_NO_OPENSSL + QSslSocket *sslSocket = qobject_cast(socket); +#endif + QTime timer; + timer.start(); + forever { + if (socket->bytesToWrite() == 0 +#ifndef QT_NO_OPENSSL + && sslSocket->encryptedBytesToWrite() == 0 +#endif + ) + return true; + if (socket->state() == QAbstractSocket::UnconnectedState + || timer.elapsed() >= timeout) + return false; + if (!socket->waitForBytesWritten(timeout - timer.elapsed())) + return false; + } +} + +static void netChat(int port, const QList &chat) +{ +#ifndef QT_NO_OPENSSL + QSslSocket socket; +#else + QTcpSocket socket; +#endif + + socket.connectToHost(QtNetworkSettings::serverName(), port); + qDebug() << 0 << "Connecting to server on port" << port; + QVERIFY2(socket.waitForConnected(10000), + QString("Failed to connect to server in step 0: %1").arg(socket.errorString()).toLocal8Bit()); + + // now start the chat + QList::ConstIterator it = chat.constBegin(); + for (int i = 1; it != chat.constEnd(); ++it, ++i) { + if (it->type != Chat::Reconnect + && socket.state() != QAbstractSocket::ConnectedState + && socket.state() != QAbstractSocket::ClosingState) + QFAIL(QString("Internal error: socket is in invalid state %1 in step %2") + .arg(socket.state()).arg(i).toLocal8Bit()); + + switch (it->type) { + case Chat::Expect: { + qDebug() << i << "Expecting" << prettyByteArray(it->data); + if (!doSocketRead(&socket, it->data.length())) + QFAIL(QString("Failed to receive data in step %1: timeout").arg(i).toLocal8Bit()); + + // pop that many bytes off the socket + QByteArray received = socket.read(it->data.length()); + + // is it what we expected? + QVERIFY2(received == it->data, + QString("Did not receive expected data in step %1: data received was:\n%2") + .arg(i).arg(prettyByteArray(received)).toLocal8Bit()); + + break; + } + + case Chat::DiscardUntil: + qDebug() << i << "Discarding until" << prettyByteArray(it->data); + while (true) { + // scan the buffer until we have our string + if (!doSocketRead(&socket, it->data.length())) + QFAIL(QString("Failed to receive data in step %1: timeout").arg(i).toLocal8Bit()); + + QByteArray buffer; + buffer.resize(socket.bytesAvailable()); + socket.peek(buffer.data(), socket.bytesAvailable()); + + int pos = buffer.indexOf(it->data); + if (pos == -1) { + // data not found, keep trying + continue; + } + + buffer = socket.read(pos + it->data.length()); + qDebug() << i << "Discarded" << prettyByteArray(buffer); + break; + } + break; + + case Chat::SkipBytes: { + qDebug() << i << "Skipping" << it->value << "bytes"; + if (!doSocketRead(&socket, it->value)) + QFAIL(QString("Failed to receive data in step %1: timeout").arg(i).toLocal8Bit()); + + // now discard the bytes + QByteArray buffer = socket.read(it->value); + qDebug() << i << "Skipped" << prettyByteArray(buffer); + break; + } + + case Chat::Send: { + qDebug() << i << "Sending" << prettyByteArray(it->data); + socket.write(it->data); + if (!doSocketFlush(&socket)) { + QVERIFY2(socket.state() == QAbstractSocket::ConnectedState, + QString("Socket disconnected while sending data in step %1").arg(i).toLocal8Bit()); + QFAIL(QString("Failed to send data in step %1: timeout").arg(i).toLocal8Bit()); + } + break; + } + + case Chat::Disconnect: + qDebug() << i << "Disconnecting from host"; + socket.disconnectFromHost(); + + // is this the last command? + if (it + 1 != chat.constEnd()) + break; + + // fall through: + case Chat::RemoteDisconnect: + case Chat::DiscardUntilDisconnect: + qDebug() << i << "Waiting for remote disconnect"; + if (socket.state() != QAbstractSocket::UnconnectedState) + socket.waitForDisconnected(10000); + QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, + QString("Socket did not disconnect as expected in step %1").arg(i).toLocal8Bit()); + + // any data left? + if (it->type == Chat::DiscardUntilDisconnect) { + QByteArray buffer = socket.readAll(); + qDebug() << i << "Discarded in the process:" << prettyByteArray(buffer); + } + + if (socket.bytesAvailable() != 0) + QFAIL(QString("Unexpected bytes still on buffer when disconnecting in step %1:\n%2") + .arg(i).arg(prettyByteArray(socket.readAll())).toLocal8Bit()); + break; + + case Chat::Reconnect: + qDebug() << i << "Reconnecting to server on port" << port; + socket.connectToHost(QtNetworkSettings::serverName(), port); + QVERIFY2(socket.waitForConnected(10000), + QString("Failed to reconnect to server in step %1: %2").arg(i).arg(socket.errorString()).toLocal8Bit()); + break; + + case Chat::StartEncryption: +#ifdef QT_NO_OPENSSL + QFAIL("Internal error: SSL required for this test"); +#else + qDebug() << i << "Starting client encryption"; + socket.ignoreSslErrors(); + socket.startClientEncryption(); + QVERIFY2(socket.waitForEncrypted(5000), + QString("Failed to start client encryption in step %1: %2").arg(i) + .arg(socket.errorString()).toLocal8Bit()); + break; +#endif + } + } +} + +void tst_NetworkSelfTest::hostTest() +{ + // this is a localhost self-test + QHostInfo localhost = QHostInfo::fromName("localhost"); + QCOMPARE(localhost.error(), QHostInfo::NoError); + QVERIFY(!localhost.addresses().isEmpty()); + + QTcpServer server; + QVERIFY(server.listen()); + + QTcpSocket socket; + socket.connectToHost("127.0.0.1", server.serverPort()); + QVERIFY(socket.waitForConnected(10000)); +} + +void tst_NetworkSelfTest::dnsResolution_data() +{ + QTest::addColumn("hostName"); + QTest::newRow("local-name") << QtNetworkSettings::serverLocalName(); + QTest::newRow("fqdn") << QtNetworkSettings::serverName(); +} + +void tst_NetworkSelfTest::dnsResolution() +{ + QFETCH(QString, hostName); + QHostInfo resolved = QHostInfo::fromName(hostName); + QVERIFY2(resolved.error() == QHostInfo::NoError, + QString("Failed to resolve hostname %1: %2").arg(hostName, resolved.errorString()).toLocal8Bit()); +} + +void tst_NetworkSelfTest::serverReachability() +{ + // check that we get a proper error connecting to port 1 + QTcpSocket socket; + socket.connectToHost(QtNetworkSettings::serverName(), 1); + socket.waitForConnected(10000); + QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, "Socket connected unexpectedly!"); + QVERIFY2(socket.error() == QAbstractSocket::ConnectionRefusedError, + QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit()); +} + +void tst_NetworkSelfTest::remotePortsOpen_data() +{ + QTest::addColumn("portNumber"); + QTest::newRow("ftp") << 21; + QTest::newRow("ssh") << 22; + QTest::newRow("imap") << 143; + QTest::newRow("http") << 80; + QTest::newRow("https") << 443; + QTest::newRow("http-proxy") << 3128; + QTest::newRow("http-proxy-auth-basic") << 3129; + QTest::newRow("http-proxy-auth-ntlm") << 3130; + QTest::newRow("socks5-proxy") << 1080; + QTest::newRow("socks5-proxy-auth") << 1081; +} + +void tst_NetworkSelfTest::remotePortsOpen() +{ + QFETCH(int, portNumber); + QTcpSocket socket; + socket.connectToHost(QtNetworkSettings::serverName(), portNumber); + + if (!socket.waitForConnected(10000)) { + if (socket.error() == QAbstractSocket::SocketTimeoutError) + QFAIL(QString("Network timeout connecting to the server on port %1").arg(portNumber).toLocal8Bit()); + else + QFAIL(QString("Error connecting to server on port %1: %2").arg(portNumber).arg(socket.errorString()).toLocal8Bit()); + } + QVERIFY(socket.state() == QAbstractSocket::ConnectedState); +} + +static QList ftpChat() +{ + return QList() << Chat::expect("220") + << Chat::discardUntil("\r\n") + << Chat::send("USER anonymous\r\n") + << Chat::expect("331") + << Chat::discardUntil("\r\n") + << Chat::send("PASS user@hostname\r\n") + << Chat::expect("230") + << Chat::discardUntil("\r\n") + << Chat::send("QUIT\r\n") + << Chat::expect("221") + << Chat::discardUntil("\r\n") + << Chat::RemoteDisconnect; +} + +void tst_NetworkSelfTest::ftpServer() +{ + netChat(21, ftpChat()); +} + +void tst_NetworkSelfTest::imapServer() +{ + netChat(143, QList() + << Chat::expect("* OK ") + << Chat::discardUntil("\r\n") + << Chat::send("1 CAPABILITY\r\n") + << Chat::expect("* CAPABILITY ") + << Chat::discardUntil("1 OK") + << Chat::discardUntil("\r\n") + << Chat::send("2 LOGOUT\r\n") + << Chat::discardUntil("2 OK") + << Chat::discardUntil("\r\n") + << Chat::RemoteDisconnect); +} + +void tst_NetworkSelfTest::httpServer() +{ + netChat(80, QList() + // HTTP/0.9 chat: + << Chat::send("GET /\r\n") + << Chat::DiscardUntilDisconnect + + // HTTP/1.0 chat: + << Chat::Reconnect + << Chat::send("GET / HTTP/1.0\r\n" + "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" + "Connection: close\r\n" + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("200 ") + << Chat::DiscardUntilDisconnect + + // HTTP/1.0 POST: + << Chat::Reconnect + << Chat::send("POST / HTTP/1.0\r\n" + "Content-Length: 5\r\n" + "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" + "Connection: close\r\n" + "\r\n" + "Hello") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("200 ") + << Chat::DiscardUntilDisconnect + ); +} + +void tst_NetworkSelfTest::httpsServer() +{ +#ifndef QT_NO_OPENSSL + netChat(443, QList() + << Chat::StartEncryption + << Chat::send("GET / HTTP/1.0\r\n" + "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" + "Connection: close\r\n" + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("200 ") + << Chat::DiscardUntilDisconnect); +#else + QSKIP("SSL not enabled, cannot test"); +#endif +} + +void tst_NetworkSelfTest::httpProxy() +{ + netChat(3128, QList() + // proxy GET + << Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n" + "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" + "Proxy-connection: close\r\n" + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("200 ") + << Chat::DiscardUntilDisconnect + + // proxy CONNECT + << Chat::Reconnect + << Chat::send("CONNECT " + QtNetworkSettings::serverName().toLatin1() + ":21 HTTP/1.0\r\n" + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("200 ") + << Chat::discardUntil("\r\n\r\n") + << ftpChat()); +} + +void tst_NetworkSelfTest::httpProxyBasicAuth() +{ + netChat(3129, QList() + // test auth required response + << Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n" + "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" + "Proxy-connection: close\r\n" + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("407 ") + << Chat::discardUntil("\r\nProxy-Authenticate: Basic realm=\"") + << Chat::DiscardUntilDisconnect + + // now try sending our credentials + << Chat::Reconnect + << Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n" + "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" + "Proxy-connection: close\r\n" + "Proxy-Authorization: Basic cXNvY2tzdGVzdDpwYXNzd29yZA==\r\n" + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("200 ") + << Chat::DiscardUntilDisconnect); +} + +void tst_NetworkSelfTest::httpProxyNtlmAuth() +{ + netChat(3130, QList() + // test auth required response + << Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n" + "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" + "Proxy-connection: keep-alive\r\n" // NTLM auth will disconnect + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("407 ") + << Chat::discardUntil("\r\nProxy-Authenticate: NTLM\r\n") + << Chat::DiscardUntilDisconnect + ); +} + +// SOCKSv5 is a binary protocol +static const char handshakeNoAuth[] = "\5\1\0"; +static const char handshakeOkNoAuth[] = "\5\0"; +static const char handshakeAuthPassword[] = "\5\1\2\1\12qsockstest\10password"; +static const char handshakeOkPasswdAuth[] = "\5\2\1\0"; +static const char handshakeAuthNotOk[] = "\5\377"; +static const char connect1[] = "\5\1\0\1\177\0\0\1\0\25"; // Connect IPv4 127.0.0.1 port 21 +static const char connect2[] = "\5\1\0\3\11localhost\0\25"; // Connect hostname localhost 21 +static const char connected[] = "\5\0\0"; + +void tst_NetworkSelfTest::socks5Proxy() +{ + netChat(1080, QList() + // IP address connection + << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) + << Chat::expect(QByteArray(handshakeOkNoAuth, -1 + sizeof handshakeOkNoAuth)) + << Chat::send(QByteArray(connect1, -1 + sizeof connect1)) + << Chat::expect(QByteArray(connected, -1 + sizeof connected)) + << Chat::expect("\1") // IPv4 address following + << Chat::skipBytes(6) // the server's local address and port + << ftpChat() + + // hostname connection + << Chat::Reconnect + << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) + << Chat::expect(QByteArray(handshakeOkNoAuth, -1 + sizeof handshakeOkNoAuth)) + << Chat::send(QByteArray(connect2, -1 + sizeof connect2)) + << Chat::expect(QByteArray(connected, -1 + sizeof connected)) + << Chat::expect("\1") // IPv4 address following + << Chat::skipBytes(6) // the server's local address and port + << ftpChat() + ); +} + +void tst_NetworkSelfTest::socks5ProxyAuth() +{ + netChat(1081, QList() + // unauthenticated connect -- will get error + << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) + << Chat::expect(QByteArray(handshakeAuthNotOk, -1 + sizeof handshakeAuthNotOk)) + << Chat::RemoteDisconnect + + // now try to connect with authentication + << Chat::Reconnect + << Chat::send(QByteArray(handshakeAuthPassword, -1 + sizeof handshakeAuthPassword)) + << Chat::expect(QByteArray(handshakeOkPasswdAuth, -1 + sizeof handshakeOkPasswdAuth)) + << Chat::send(QByteArray(connect1, -1 + sizeof connect1)) + << Chat::expect(QByteArray(connected, -1 + sizeof connected)) + << Chat::expect("\1") // IPv4 address following + << Chat::skipBytes(6) // the server's local address and port + << ftpChat() + ); +} + +QTEST_MAIN(tst_NetworkSelfTest) +#include "tst_networkselftest.moc" diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 60e6657..1cdb840 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -4,7 +4,8 @@ TEMPLATE = subdirs !wince*:SUBDIRS += \ headers -SUBDIRS += bic \ +SUBDIRS += _networkselftest \ + bic \ collections \ compile \ compilerwarnings \ -- cgit v0.12 From 0babd12eb7e982f47b379fe70f011daffbb8c6e8 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Fri, 22 May 2009 12:57:57 +0200 Subject: Updated WebKit from /home/ariya/dev/webkit/qtwebkit-4.5 to origin/qtwebkit-4.5 ( 4ee8af9348b3f57d3c0f3575ae0a58336cf07a92 ) Changes in WebKit since the last update: ++ b/LayoutTests/ChangeLog 2009-05-20 Holger Hans Peter Freyther Reviewed by Anders Carlsson. https://bugs.webkit.org/show_bug.cgi?id=24510 Add a test case that Netscape Plugin can properly determine if a given object has a specific method and property. The test will ask the plugin to call hasproperty and hasmethod and will compare the result with what is expected. This approach is taken from netscape-get-property-return-value.html * plugins/netscape-invoke-browserfuncs-expected.txt: Added. * plugins/netscape-invoke-browserfuncs.html: Added. ++ b/WebCore/ChangeLog 2009-05-19 Kenneth Rohde Christiansen Reviewed by Simon Hausmann. Do not call the parent implementation (Widget::) in show() and hide() of the PluginViewQt, as it always changes the visible state of the platformWidget (equal to the platformPluginWidget in the Qt port), thus ignoring the isParentVisible() test. * plugins/qt/PluginViewQt.cpp: (WebCore::PluginView::show): (WebCore::PluginView::hide): 2009-04-22 Tamas Szirbucz Reviewed by Ariya Hidayat. https://bugs.webkit.org/show_bug.cgi?id=25023 Delete reply in QNetworkReplyHandler::abort() to avoid leak. * platform/network/qt/QNetworkReplyHandler.cpp: (WebCore::QNetworkReplyHandler::abort): 2009-05-20 Holger Hans Peter Freyther Reviewed by Anders Carlsson. https://bugs.webkit.org/show_bug.cgi?id=24510 Fix a bug where the browserfuncs were not properly assigned, make hasproperty use _NP_HasProperty and hasmethod _NP_HasMethod. Test: plugins/netscape-invoke-browserfuncs.html * plugins/gtk/PluginPackageGtk.cpp: (WebCore::PluginPackage::load): Fix assignment * plugins/qt/PluginPackageQt.cpp: (WebCore::PluginPackage::load): Fix assignment ++ b/WebKit/qt/ChangeLog 2009-05-19 Kenneth Rohde Christiansen Reviewed by Simon Hausmann. Fix a plugin bug in the WebKit code, similar to the one in WebCore. The problem is when a non visible QtPluginWidget would show it self in a sibling frame. The problem was due to our clipping. In Qt, if setMask is set with an empty QRegion, no clipping will be performed, so in that case we hide the PluginContainer * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::): ++ b/WebKitTools/ChangeLog 2009-05-14 Holger Hans Peter Freyther Reviewed by Anders Carlsson. https://bugs.webkit.org/show_bug.cgi?id=24510 where Add testHasProperty and testHasMethod to the existing functions of the PluginObject to be able to test the browser hasproperty and hasmethod implementation. Invoke them from pluginInvoke. Change the defines to an enum to avoid manually updating NUM_METHOD_IDENTIFIERS and assigning numbers. * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp: (testHasProperty): test hasproperty (testHasMethod): test hasmethod (pluginInvoke): invoke the two --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 39 ++++++++++++++++++++++ .../platform/network/qt/QNetworkReplyHandler.cpp | 1 + .../webkit/WebCore/plugins/qt/PluginPackageQt.cpp | 4 +-- .../webkit/WebCore/plugins/qt/PluginViewQt.cpp | 8 +++-- src/3rdparty/webkit/WebKit/qt/ChangeLog | 14 ++++++++ .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 8 ++++- 7 files changed, 70 insertions(+), 6 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 7adbd6f..7d5d1c5 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 40b523e9eaaba38c182e5a9c319f0069ebf98330 + 4ee8af9348b3f57d3c0f3575ae0a58336cf07a92 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index a4cb62d..072beee 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,42 @@ +2009-05-19 Kenneth Rohde Christiansen + + Reviewed by Simon Hausmann. + + Do not call the parent implementation (Widget::) in show() and hide() + of the PluginViewQt, as it always changes the visible state of the + platformWidget (equal to the platformPluginWidget in the Qt port), + thus ignoring the isParentVisible() test. + + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::show): + (WebCore::PluginView::hide): + +2009-04-22 Tamas Szirbucz + + Reviewed by Ariya Hidayat. + + https://bugs.webkit.org/show_bug.cgi?id=25023 + Delete reply in QNetworkReplyHandler::abort() to avoid leak. + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::abort): + +2009-05-20 Holger Hans Peter Freyther + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=24510 + + Fix a bug where the browserfuncs were not properly assigned, + make hasproperty use _NP_HasProperty and hasmethod _NP_HasMethod. + + Test: plugins/netscape-invoke-browserfuncs.html + + * plugins/gtk/PluginPackageGtk.cpp: + (WebCore::PluginPackage::load): Fix assignment + * plugins/qt/PluginPackageQt.cpp: + (WebCore::PluginPackage::load): Fix assignment + 2009-05-11 Yael Aharon Reviewed by Holger Freyther. diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 2c730a6..3e9b239 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -174,6 +174,7 @@ void QNetworkReplyHandler::abort() if (m_reply) { QNetworkReply* reply = release(); reply->abort(); + reply->deleteLater(); deleteLater(); } } diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp index 4387813..13f5394 100644 --- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp @@ -151,8 +151,8 @@ bool PluginPackage::load() m_browserFuncs.getproperty = _NPN_GetProperty; m_browserFuncs.setproperty = _NPN_SetProperty; m_browserFuncs.removeproperty = _NPN_RemoveProperty; - m_browserFuncs.hasproperty = _NPN_HasMethod; - m_browserFuncs.hasmethod = _NPN_HasProperty; + m_browserFuncs.hasproperty = _NPN_HasProperty; + m_browserFuncs.hasmethod = _NPN_HasMethod; m_browserFuncs.setexception = _NPN_SetException; m_browserFuncs.enumerate = _NPN_Enumerate; m_browserFuncs.construct = _NPN_Construct; diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp index 43c772f..e856f92 100644 --- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp @@ -113,7 +113,9 @@ void PluginView::show() if (isParentVisible() && platformPluginWidget()) platformPluginWidget()->setVisible(true); - Widget::show(); + // do not call parent impl. here as it will set the platformWidget + // (same as platformPluginWidget in the Qt port) to visible, even + // when parent isn't visible. } void PluginView::hide() @@ -123,7 +125,9 @@ void PluginView::hide() if (isParentVisible() && platformPluginWidget()) platformPluginWidget()->setVisible(false); - Widget::hide(); + // do not call parent impl. here as it will set the platformWidget + // (same as platformPluginWidget in the Qt port) to invisible, even + // when parent isn't visible. } void PluginView::paint(GraphicsContext* context, const IntRect& rect) diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 2aeb8da..d9f925a 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,17 @@ +2009-05-19 Kenneth Rohde Christiansen + + Reviewed by Simon Hausmann. + + Fix a plugin bug in the WebKit code, similar to the one in WebCore. + + The problem is when a non visible QtPluginWidget would show it self + in a sibling frame. The problem was due to our clipping. In Qt, + if setMask is set with an empty QRegion, no clipping will + be performed, so in that case we hide the PluginContainer + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::): + 2009-03-27 Erik L. Bunce Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index c421d42..a2b33c0 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -1058,7 +1058,13 @@ public: IntRect clipRect(static_cast(parentScrollView)->windowClipRect()); clipRect.move(-windowRect.x(), -windowRect.y()); clipRect.intersect(platformWidget()->rect()); - platformWidget()->setMask(QRegion(clipRect.x(), clipRect.y(), clipRect.width(), clipRect.height())); + + QRegion clipRegion = QRegion(clipRect); + platformWidget()->setMask(clipRegion); + + // if setMask is set with an empty QRegion, no clipping will + // be performed, so in that case we hide the platformWidget + platformWidget()->setVisible(!clipRegion.isEmpty()); } }; -- cgit v0.12 From ec8c6b9f5a25f9d4c437fbb13f073aeebc09cb3f Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Fri, 22 May 2009 13:09:17 +0200 Subject: Updates QtWebKit sections in changes-4.5.2 after commit 0babd12e. --- dist/changes-4.5.2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.5.2 b/dist/changes-4.5.2 index b3e808f..1e00208 100644 --- a/dist/changes-4.5.2 +++ b/dist/changes-4.5.2 @@ -42,8 +42,8 @@ Third party components Memory (r41527, r43764, r43828, r43830) JavaScript (r39882, r40086, r40131, r40133) Rendering (r41285, r41296, r41659, r42887) - Network (r41664, r42516) - Plugins (r41346, r43550) + Network (r41664, r42516, r42747) + Plugins (r41346, r43550, r43915, r43917, r43923) Clipboard (r41360) **************************************************************************** -- cgit v0.12 From bc498cd027dff6ff16032868c6bb00e634749cd6 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Fri, 22 May 2009 13:52:47 +0200 Subject: Fix Qt does not compile when glibc < 2.3.2 on linux Rather than try to resolve functions or impose configure time limitations we simply remove the dependancy entirely and rely on the fallbac for all platforms. Task-number: 250731 Reviewed-by: thiago --- src/gui/styles/gtksymbols.cpp | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index 0842ec7..d8a67c2 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -633,31 +633,14 @@ GtkStyle* QGtk::gtkStyle(const QString &path) return 0; } -#ifdef Q_OS_LINUX -QT_END_NAMESPACE - -int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); -int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); - -QT_BEGIN_NAMESPACE -#endif - void QGtk::initGtkWidgets() { // From gtkmain.c - - uid_t ruid, rgid, euid, egid, suid, sgid; - -#ifdef Q_OS_LINUX - if (getresuid (&ruid, &euid, &suid) != 0 || getresgid (&rgid, &egid, &sgid) != 0) -#endif - { - suid = ruid = getuid (); - sgid = rgid = getgid (); - euid = geteuid (); - egid = getegid (); - } - if (ruid != euid || ruid != suid || rgid != egid || rgid != sgid) { + uid_t ruid = getuid (); + uid_t rgid = getgid (); + uid_t euid = geteuid (); + uid_t egid = getegid (); + if (ruid != euid || rgid != egid) { qWarning("\nThis process is currently running setuid or setgid.\nGTK+ does not allow this " "therefore Qt cannot use the GTK+ integration.\nTry launching your app using \'gksudo\', " "\'kdesudo\' or a similar tool.\n\n" -- cgit v0.12 From b89efc8e7f3289ff85a5076297e4357283dd24a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 22 May 2009 12:27:48 +0200 Subject: Fixed text shaping bugs with ligatures and multiple font engines. If Harfbuzz shaping adds or merges glyphs we need to move the remaining glyphs in the glyph layout to compensate. Task-number: 253783 Reviewed-by: Simon Hausmann --- src/gui/text/qtextengine.cpp | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 80a5425..da1ab25 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1099,6 +1099,16 @@ void QTextEngine::shapeTextWithCE(int item) const } #endif +static inline void moveGlyphData(const QGlyphLayout &destination, const QGlyphLayout &source, int num) +{ + if (num > 0 && destination.glyphs != source.glyphs) { + memmove(destination.glyphs, source.glyphs, num * sizeof(HB_Glyph)); + memmove(destination.attributes, source.attributes, num * sizeof(HB_GlyphAttributes)); + memmove(destination.advances_x, source.advances_x, num * sizeof(HB_Fixed)); + memmove(destination.offsets, source.offsets, num * sizeof(HB_FixedPoint)); + } +} + /// take the item from layoutData->items and void QTextEngine::shapeTextWithHarfbuzz(int item) const { @@ -1189,7 +1199,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const - int initial_glyph_pos = 0; + int remaining_glyphs = entire_shaper_item.num_glyphs; int glyph_pos = 0; // for each item shape using harfbuzz and store the results in our layoutData's glyphs array. for (int k = 0; k < itemBoundaries.size(); k += 2) { // for the +2, see the comment at the definition of itemBoundaries @@ -1209,7 +1219,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const QFontEngine *actualFontEngine = font; uint engineIdx = 0; if (font->type() == QFontEngine::Multi) { - engineIdx = uint(initialGlyphs.glyphs[itemBoundaries[k + 1]] >> 24); + engineIdx = uint(initialGlyphs.glyphs[glyph_pos] >> 24); actualFontEngine = static_cast(font)->engine(engineIdx); } @@ -1219,16 +1229,18 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const shaper_item.glyphIndicesPresent = true; + remaining_glyphs -= shaper_item.initialGlyphCount; + do { - ensureSpace(glyph_pos + shaper_item.num_glyphs); - initialGlyphs = availableGlyphs(&si).mid(0, entire_shaper_item.num_glyphs); - shaper_item.num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used - glyph_pos; + ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs); - const QGlyphLayout g = availableGlyphs(&si); - shaper_item.glyphs = g.glyphs + glyph_pos; - shaper_item.attributes = g.attributes + glyph_pos; - shaper_item.advances = reinterpret_cast(g.advances_x + glyph_pos); - shaper_item.offsets = reinterpret_cast(g.offsets + glyph_pos); + const QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos); + moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); + + shaper_item.glyphs = g.glyphs; + shaper_item.attributes = g.attributes; + shaper_item.advances = reinterpret_cast(g.advances_x); + shaper_item.offsets = reinterpret_cast(g.offsets); if (shaper_item.glyphIndicesPresent) { for (hb_uint32 i = 0; i < shaper_item.initialGlyphCount; ++i) @@ -1241,18 +1253,18 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const } while (!qShapeItem(&shaper_item)); // this does the actual shaping via harfbuzz. QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos, shaper_item.num_glyphs); + moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); - for (hb_uint32 i = 0; i < shaper_item.item.length; ++i) { + for (hb_uint32 i = 0; i < shaper_item.num_glyphs; ++i) g.glyphs[i] = g.glyphs[i] | (engineIdx << 24); + + for (hb_uint32 i = 0; i < shaper_item.item.length; ++i) shaper_item.log_clusters[i] += glyph_pos; - } if (kerningEnabled && !shaper_item.kerning_applied) font->doKerning(&g, option.useDesignMetrics() ? QFlag(QTextEngine::DesignMetrics) : QFlag(0)); glyph_pos += shaper_item.num_glyphs; - - initial_glyph_pos += shaper_item.initialGlyphCount; } // qDebug(" -> item: script=%d num_glyphs=%d", shaper_item.script, shaper_item.num_glyphs); -- cgit v0.12 From 759b7ee720fa365f93fe02ecb5b842adce81d02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 22 May 2009 14:14:31 +0200 Subject: Fixed potential bug caused by change b89efc8e7f32. If ensureSpace causes the layoutData to reallocate then the initialGlyphs pointers will no longer be valid. Reviewed-by: Simon Hausmann --- src/gui/text/qtextengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index da1ab25..d41d414 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1219,7 +1219,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const QFontEngine *actualFontEngine = font; uint engineIdx = 0; if (font->type() == QFontEngine::Multi) { - engineIdx = uint(initialGlyphs.glyphs[glyph_pos] >> 24); + engineIdx = uint(availableGlyphs(&si).glyphs[glyph_pos] >> 24); actualFontEngine = static_cast(font)->engine(engineIdx); } -- cgit v0.12 From 1cfb5bcaa2cab142479ee975e25d9f605f852dad Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 22 May 2009 14:30:01 +0200 Subject: Don't loop around sigaction because it can't return EINTR. Asked by Oswald. Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_unix.cpp | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 33d4a47..1fedd55 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -140,15 +140,6 @@ static void qt_native_close(int fd) } while (ret == -1 && errno == EINTR); } -static void qt_native_sigaction(int signum, const struct sigaction *act, - struct sigaction *oldact) -{ - int ret; - do { - ret = ::sigaction(signum, act, oldact); - } while (ret == -1 && errno == EINTR); -} - static void qt_native_dup2(int oldfd, int newfd) { int ret; @@ -255,7 +246,7 @@ QProcessManager::QProcessManager() memset(&action, 0, sizeof(action)); action.sa_handler = qt_sa_sigchld_handler; action.sa_flags = SA_NOCLDSTOP; - qt_native_sigaction(SIGCHLD, &action, &oldAction); + ::sigaction(SIGCHLD, &action, &oldAction); if (oldAction.sa_handler != qt_sa_sigchld_handler) qt_sa_old_sigchld_handler = oldAction.sa_handler; } @@ -282,9 +273,9 @@ QProcessManager::~QProcessManager() memset(&action, 0, sizeof(action)); action.sa_handler = qt_sa_old_sigchld_handler; action.sa_flags = SA_NOCLDSTOP; - qt_native_sigaction(SIGCHLD, &action, &oldAction); + ::sigaction(SIGCHLD, &action, &oldAction); if (oldAction.sa_handler != qt_sa_sigchld_handler) { - qt_native_sigaction(SIGCHLD, &oldAction, 0); + ::sigaction(SIGCHLD, &oldAction, 0); } } @@ -900,7 +891,7 @@ static void qt_ignore_sigpipe() struct sigaction noaction; memset(&noaction, 0, sizeof(noaction)); noaction.sa_handler = SIG_IGN; - qt_native_sigaction(SIGPIPE, &noaction, 0); + ::sigaction(SIGPIPE, &noaction, 0); } } @@ -1270,7 +1261,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a struct sigaction noaction; memset(&noaction, 0, sizeof(noaction)); noaction.sa_handler = SIG_IGN; - qt_native_sigaction(SIGPIPE, &noaction, 0); + ::sigaction(SIGPIPE, &noaction, 0); ::setsid(); @@ -1316,7 +1307,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a struct sigaction noaction; memset(&noaction, 0, sizeof(noaction)); noaction.sa_handler = SIG_IGN; - qt_native_sigaction(SIGPIPE, &noaction, 0); + ::sigaction(SIGPIPE, &noaction, 0); // '\1' means execv failed char c = '\1'; @@ -1327,7 +1318,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a struct sigaction noaction; memset(&noaction, 0, sizeof(noaction)); noaction.sa_handler = SIG_IGN; - qt_native_sigaction(SIGPIPE, &noaction, 0); + ::sigaction(SIGPIPE, &noaction, 0); // '\2' means internal error char c = '\2'; -- cgit v0.12 From 562adecf4f938f593674f03b425a79b89e238518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 15 Apr 2009 14:17:20 +0200 Subject: Don't block copy sequential files in QFile::rename Block copying a sequential file is potentially a destructive operation, because there is no guarantee copy+remove will succeed. In these cases the fallback should not be tried. The user is better equipped to decide how to handle such failures and to ensure no data losses occur, e.g., copy without removing the original file. Reviewed-by: MariusSO Reviewed-by: Peter Hartmann Reviewed-by: Thiago --- src/corelib/io/qfile.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index d7da800..4110494 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -718,6 +718,11 @@ QFile::rename(const QString &newName) return true; } + if (isSequential()) { + d->setError(QFile::RenameError, tr("Will not rename sequential file using block copy")); + return false; + } + QFile in(fileName()); QFile out(newName); if (in.open(QIODevice::ReadOnly)) { -- cgit v0.12 From f1e9c0f3d22d611bfaa14c30a34e6042500a0cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 15 Apr 2009 14:24:43 +0200 Subject: Allow renaming QTemporaryFiles on windows Changed the fallback implementation to use 'this' instead of a new QFile. This allows a QTemporaryFile to be block-copied to the destination and the source to be removed (QTemporaryFile is special because it isn't really closed). Reviewed-by: Peter Hartmann Reviewed-by: Thiago --- src/corelib/io/qfile.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 4110494..d3cee9a 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -723,26 +723,25 @@ QFile::rename(const QString &newName) return false; } - QFile in(fileName()); QFile out(newName); - if (in.open(QIODevice::ReadOnly)) { + if (open(QIODevice::ReadOnly)) { if (out.open(QIODevice::WriteOnly | QIODevice::Truncate)) { bool error = false; char block[4096]; - qint64 read; - while ((read = in.read(block, sizeof(block))) > 0) { - if (read != out.write(block, read)) { + qint64 bytes; + while ((bytes = read(block, sizeof(block))) > 0) { + if (bytes != out.write(block, bytes)) { d->setError(QFile::RenameError, out.errorString()); error = true; break; } } - if (read == -1) { - d->setError(QFile::RenameError, in.errorString()); + if (bytes == -1) { + d->setError(QFile::RenameError, errorString()); error = true; } if(!error) { - if (!in.remove()) { + if (!remove()) { d->setError(QFile::RenameError, tr("Cannot remove source file")); error = true; } @@ -751,10 +750,12 @@ QFile::rename(const QString &newName) out.remove(); else setFileName(newName); + close(); return !error; } + close(); } - d->setError(QFile::RenameError, out.isOpen() ? in.errorString() : out.errorString()); + d->setError(QFile::RenameError, out.isOpen() ? errorString() : out.errorString()); } return false; } -- cgit v0.12 From fd7cb7faa765835de6e7beb24f018c417d9ad7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 13 May 2009 17:13:48 +0200 Subject: QFile::copy: close source file when using fallback mechanism Also added check in test case for rename fallback. Task-number: 165920 Reviewed-by: Thiago --- src/corelib/io/qfile.cpp | 1 + tests/auto/qfile/copy-fallback.qrc | 5 +++++ tests/auto/qfile/test/test.pro | 2 +- tests/auto/qfile/tst_qfile.cpp | 30 ++++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/auto/qfile/copy-fallback.qrc diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index d3cee9a..a0bd8b4 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -914,6 +914,7 @@ QFile::copy(const QString &newName) out.setAutoRemove(false); #endif } + close(); } if(!error) { QFile::setPermissions(newName, permissions()); diff --git a/tests/auto/qfile/copy-fallback.qrc b/tests/auto/qfile/copy-fallback.qrc new file mode 100644 index 0000000..864491f --- /dev/null +++ b/tests/auto/qfile/copy-fallback.qrc @@ -0,0 +1,5 @@ + + + copy-fallback.qrc + + diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/qfile/test/test.pro index 68f4c05..8d26f5e 100644 --- a/tests/auto/qfile/test/test.pro +++ b/tests/auto/qfile/test/test.pro @@ -17,7 +17,7 @@ QT = core network DEFINES += SRCDIR=\\\"$$PWD/../\\\" } -RESOURCES += ../qfile.qrc ../rename-fallback.qrc +RESOURCES += ../qfile.qrc ../rename-fallback.qrc ../copy-fallback.qrc TARGET = ../tst_qfile diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index 98e1859..7e28d12 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -125,6 +125,7 @@ private slots: void copy(); void copyRemovesTemporaryFile() const; void copyShouldntOverwrite(); + void copyFallback(); void link(); void linkToDir(); void absolutePathLinkToRelativePath(); @@ -213,6 +214,9 @@ void tst_QFile::cleanup() // TODO: Add cleanup code here. // This will be executed immediately after each test is run. + // for copyFallback() + QFile::remove("file-copy-destination.txt"); + // for renameFallback() QFile::remove("file-rename-destination.txt"); @@ -907,6 +911,31 @@ void tst_QFile::copyShouldntOverwrite() QFile::remove("tst_qfile.cpy"); } +void tst_QFile::copyFallback() +{ + // Using a resource file to trigger QFile::copy's fallback handling + QFile file(":/copy-fallback.qrc"); + QFile::remove("file-copy-destination.txt"); + + QVERIFY2(file.exists(), "test precondition"); + QVERIFY2(!QFile::exists("file-copy-destination.txt"), "test precondition"); + + // Fallback copy of closed file. + QVERIFY(file.copy("file-copy-destination.txt")); + QVERIFY(QFile::exists("file-copy-destination.txt")); + QVERIFY(!file.isOpen()); + + QVERIFY(QFile::remove("file-copy-destination.txt")); + + // Fallback copy of open file. + QVERIFY(file.open(QIODevice::ReadOnly)); + QVERIFY(file.copy("file-copy-destination.txt")); + QVERIFY(QFile::exists("file-copy-destination.txt")); + QVERIFY(!file.isOpen()); + + QFile::remove("file-copy-destination.txt"); +} + #ifdef Q_OS_WIN #include #include @@ -2081,6 +2110,7 @@ void tst_QFile::renameFallback() QVERIFY(!file.rename("file-rename-destination.txt")); QVERIFY(!QFile::exists("file-rename-destination.txt")); + QVERIFY(!file.isOpen()); } void tst_QFile::renameMultiple() -- cgit v0.12 From 3580f5b4d002cca714d443054f8cdd6aefca3287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 15 Apr 2009 14:30:47 +0200 Subject: QFile::rename fallback: reset permissions and error state on success Fallback implementation for rename operation should try to copy permissions from the original file to the destination file. Note that failures at this point are not treated as errors. Errors previously set by the native fileEngine are also reset before returning. Reviewed-by: Peter Hartmann Reviewed-by: Thiago --- src/corelib/io/qfile.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index a0bd8b4..10b812b 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -748,8 +748,11 @@ QFile::rename(const QString &newName) } if (error) out.remove(); - else + else { + setPermissions(permissions()); + unsetError(); setFileName(newName); + } close(); return !error; } -- cgit v0.12 From 3672deb3b35fc0660c58a8ecc741b989dd0bfc8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 19 May 2009 14:02:12 +0200 Subject: Fix auto test When copying a resource file to the native file system the (read-only) permissions also get copied. On Windows platforms, this was preventing a test file from being deleted. Reviewed-by: Peter Hartmann Reviewed-by: Thiago --- tests/auto/qfile/tst_qfile.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index 7e28d12..9ee4d7c 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -215,7 +215,11 @@ void tst_QFile::cleanup() // This will be executed immediately after each test is run. // for copyFallback() - QFile::remove("file-copy-destination.txt"); + if (QFile::exists("file-copy-destination.txt")) { + QFile::setPermissions("file-copy-destination.txt", + QFile::ReadOwner | QFile::WriteOwner); + QFile::remove("file-copy-destination.txt"); + } // for renameFallback() QFile::remove("file-rename-destination.txt"); @@ -925,6 +929,9 @@ void tst_QFile::copyFallback() QVERIFY(QFile::exists("file-copy-destination.txt")); QVERIFY(!file.isOpen()); + // Need to reset permissions on Windows to be able to delete + QVERIFY(QFile::setPermissions("file-copy-destination.txt", + QFile::ReadOwner | QFile::WriteOwner)); QVERIFY(QFile::remove("file-copy-destination.txt")); // Fallback copy of open file. -- cgit v0.12 From 662e8997e9777c6661dde2134e43e35963a12cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 15 Apr 2009 14:34:57 +0200 Subject: QTemporaryFile: don't clear filePath if remove fails Reviewed-by: MariusSO Reviewed-by: Peter Hartmann Reviewed-by: Thiago --- src/corelib/io/qtemporaryfile.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 6a9125c..b0809c6 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -364,9 +364,11 @@ bool QTemporaryFileEngine::remove() // Since the QTemporaryFileEngine::close() does not really close the file, // we must explicitly call QFSFileEngine::close() before we remove it. QFSFileEngine::close(); - bool removed = QFSFileEngine::remove(); - d->filePath.clear(); - return removed; + if (QFSFileEngine::remove()) { + d->filePath.clear(); + return true; + } + return false; } bool QTemporaryFileEngine::close() -- cgit v0.12 From cfa01206e38d120c0ddb17aec7358aadff30b6f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 18 May 2009 12:40:01 +0200 Subject: QTemporaryFile would forget fileName while file was "closed" Note: this showed even if the file descriptor was kept open. Reviewed-by: Peter Hartmann Reviewed-by: Thiago --- src/corelib/io/qtemporaryfile.cpp | 3 ++- tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index b0809c6..11e88e2 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -603,7 +603,8 @@ void QTemporaryFile::setAutoRemove(bool b) QString QTemporaryFile::fileName() const { - if(!isOpen()) + Q_D(const QTemporaryFile); + if(d->fileName.isEmpty()) return QString(); return fileEngine()->fileName(QAbstractFileEngine::DefaultName); } diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index 2daa0f6..c6a43ff 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -77,6 +77,7 @@ private slots: void fileTemplate_data(); void getSetCheck(); void fileName(); + void fileNameIsEmpty(); void autoRemove(); void write(); void openCloseOpenClose(); @@ -189,6 +190,27 @@ void tst_QTemporaryFile::fileName() QCOMPARE(absoluteFilePath, absoluteTempPath); } +void tst_QTemporaryFile::fileNameIsEmpty() +{ + QString filename; + { + QTemporaryFile file; + QVERIFY(file.fileName().isEmpty()); + + QVERIFY(file.open()); + QVERIFY(!file.fileName().isEmpty()); + + filename = file.fileName(); + QVERIFY(QFile::exists(filename)); + + file.close(); + QVERIFY(!file.isOpen()); + QVERIFY(QFile::exists(filename)); + QVERIFY(!file.fileName().isEmpty()); + } + QVERIFY(!QFile::exists(filename)); +} + void tst_QTemporaryFile::autoRemove() { // Test auto remove @@ -358,6 +380,7 @@ void tst_QTemporaryFile::rename() QVERIFY(file.rename("temporary-file.txt")); QVERIFY(!dir.exists(tempname)); QVERIFY(dir.exists("temporary-file.txt")); + QCOMPARE(file.fileName(), QString("temporary-file.txt")); } QVERIFY(!dir.exists(tempname)); -- cgit v0.12 From 70f616238e77d866420f2c6e12afe04b529fe808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 20 May 2009 20:13:51 +0200 Subject: Documentation fix We souldn't be returning an empty string for the fileName, just because the file is closed. E.g., after a rename, the file will be closed, but should still have a name. Reviewed-by: Thiago --- src/corelib/io/qtemporaryfile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 11e88e2..e83d7e9 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -432,8 +432,8 @@ QTemporaryFilePrivate::~QTemporaryFilePrivate() file will exist and be kept open internally by QTemporaryFile. The file name of the temporary file can be found by calling fileName(). - Note that this is only defined while the file is open; the function returns - an empty string before the file is opened and after it is closed. + Note that this is only defined after the file is first opened; the function + returns an empty string before this. A temporary file will have some static part of the name and some part that is calculated to be unique. The default filename \c -- cgit v0.12 From 5cb1ed45ba55dbc9752e0f6f47cc6d1525464646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 18 May 2009 13:01:52 +0200 Subject: QTemporaryFile: handle failures from QFSFileEngine::open(mode, fd) For now, this only happens if Append mode is requested and we're unable to seek to the end of the file. Theoretically, this could change in the future so it's better to err on the safe side. Reviewed-by: Thiago --- src/corelib/io/qtemporaryfile.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index e83d7e9..b6eff94 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -322,7 +322,6 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) qfilename += QLatin1String(".XXXXXX"); int suffixLength = qfilename.length() - (qfilename.lastIndexOf(QLatin1String("XXXXXX"), -1, Qt::CaseSensitive) + 6); - d->closeFileHandle = true; char *filename = qstrdup(qfilename.toLocal8Bit()); #ifndef Q_WS_WIN @@ -330,16 +329,19 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) if (fd != -1) { // First open the fd as an external file descriptor to // initialize the engine properly. - QFSFileEngine::open(openMode, fd); + if (QFSFileEngine::open(openMode, fd)) { - // Allow the engine to close the handle even if it's "external". - d->closeFileHandle = true; + // Allow the engine to close the handle even if it's "external". + d->closeFileHandle = true; - // Restore the file names (open() resets them). - d->filePath = QString::fromLocal8Bit(filename); //changed now! - d->nativeInitFileName(); - delete [] filename; - return true; + // Restore the file names (open() resets them). + d->filePath = QString::fromLocal8Bit(filename); //changed now! + d->nativeInitFileName(); + delete [] filename; + return true; + } + + QT_CLOSE(fd); } delete [] filename; setError(errno == EMFILE ? QFile::ResourceError : QFile::OpenError, qt_error_string(errno)); -- cgit v0.12 From f1793cbff8aa9b4adcb5fd511e495f7e96811e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 18 May 2009 14:58:44 +0200 Subject: Unconditionally open temporary files in ReadWrite mode Although QTemporaryFile hides QFile::open(OpenMode), this function is still available when accessing instance methods through the base class. Unconditionally setting ReadWrite allows the temporary file to be re-opened with different flags. Task-number: 248223 Reviewed-by: Thiago --- src/corelib/io/qtemporaryfile.cpp | 1 + tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index b6eff94..3f8f978 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -720,6 +720,7 @@ bool QTemporaryFile::open(OpenMode flags) return true; } + flags |= QIODevice::ReadWrite; if (QFile::open(flags)) { d->fileName = d->fileEngine->fileName(QAbstractFileEngine::DefaultName); return true; diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index c6a43ff..26f5f40 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -87,6 +87,8 @@ private slots: void stressTest(); void rename(); void renameFdLeak(); + void reOpenThroughQFile(); + public: }; @@ -424,5 +426,18 @@ void tst_QTemporaryFile::renameFdLeak() #endif } +void tst_QTemporaryFile::reOpenThroughQFile() +{ + QByteArray data("abcdefghij"); + + QTemporaryFile file; + QVERIFY(((QFile &)file).open(QIODevice::WriteOnly)); + QCOMPARE(file.write(data), (qint64)data.size()); + + file.close(); + QVERIFY(file.open()); + QCOMPARE(file.readAll(), data); +} + QTEST_MAIN(tst_QTemporaryFile) #include "tst_qtemporaryfile.moc" -- cgit v0.12 From 27369e563263e82a9c5747da54370eb0a225b3d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 18 May 2009 18:40:03 +0200 Subject: QTemporaryFile: really (re)open file if it has been really closed... In some circumstances, the file descriptor in QTemporaryFile is actually closed and setOpenMode alone won't give us reOpen semantics. Added function to QTemporaryFileEngine that checks if we have open file handles. On open, if we currently hold no handles, re-open the file. Trying to open a new file while we hold open handles would lead to leaks, so added an assert there, to be on the safe side. Reviewed-by: Thiago --- src/corelib/io/qtemporaryfile.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 3f8f978..5e08ed8 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -294,6 +294,7 @@ public: QTemporaryFileEngine(const QString &file) : QFSFileEngine(file) { } ~QTemporaryFileEngine(); + bool isReallyOpen(); void setFileName(const QString &file); bool open(QIODevice::OpenMode flags); @@ -306,6 +307,21 @@ QTemporaryFileEngine::~QTemporaryFileEngine() QFSFileEngine::close(); } +bool QTemporaryFileEngine::isReallyOpen() +{ + Q_D(QFSFileEngine); + + if (!((0 == d->fh) && (-1 == d->fd) +#if defined Q_OS_WIN + && (INVALID_HANDLE_VALUE == d->fileHandle) +#endif + )) + return true; + + return false; + +} + void QTemporaryFileEngine::setFileName(const QString &file) { // Really close the file, so we don't leak @@ -316,6 +332,7 @@ void QTemporaryFileEngine::setFileName(const QString &file) bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) { Q_D(QFSFileEngine); + Q_ASSERT(!isReallyOpen()); QString qfilename = d->filePath; if(!qfilename.contains(QLatin1String("XXXXXX"))) @@ -716,8 +733,10 @@ bool QTemporaryFile::open(OpenMode flags) { Q_D(QTemporaryFile); if (!d->fileName.isEmpty()) { - setOpenMode(flags); - return true; + if (static_cast(fileEngine())->isReallyOpen()) { + setOpenMode(flags); + return true; + } } flags |= QIODevice::ReadWrite; -- cgit v0.12 From 84cbe8ffa4a7189c46efca9bb6387e80ab889c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 15 Apr 2009 14:37:35 +0200 Subject: QTemporaryFile: there's no need to keep another pointer to the engine here Lifetime of the engine is already handled by the native engine. Reviewed-by: Thiago --- src/corelib/io/qtemporaryfile.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 5e08ed8..ec539d4 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -409,17 +409,14 @@ protected: bool autoRemove; QString templateName; - mutable QTemporaryFileEngine *fileEngine; }; -QTemporaryFilePrivate::QTemporaryFilePrivate() : autoRemove(true), fileEngine(0) +QTemporaryFilePrivate::QTemporaryFilePrivate() : autoRemove(true) { } QTemporaryFilePrivate::~QTemporaryFilePrivate() { - delete fileEngine; - fileEngine = 0; } //************* QTemporaryFile -- cgit v0.12 From 1044e75822270d702a3e9f14a87954321984c942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 18 May 2009 20:24:20 +0200 Subject: QTemporaryFileEngine now tracks if a fileName has been generated With recent changes to QTemporaryFile, allowing the file to be closed, the engine has to keep track of whether a fileName has already been generated, so we don't generate new files after the first one. If the file is closed but we already have a name for it, then just forward the call to the base file engine. Reviewed-by: Thiago --- src/corelib/io/qtemporaryfile.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index ec539d4..564ec59 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -291,7 +291,11 @@ class QTemporaryFileEngine : public QFSFileEngine { Q_DECLARE_PRIVATE(QFSFileEngine) public: - QTemporaryFileEngine(const QString &file) : QFSFileEngine(file) { } + QTemporaryFileEngine(const QString &file, bool fileIsTemplate = true) + : QFSFileEngine(file), filePathIsTemplate(fileIsTemplate) + { + } + ~QTemporaryFileEngine(); bool isReallyOpen(); @@ -300,6 +304,8 @@ public: bool open(QIODevice::OpenMode flags); bool remove(); bool close(); + + bool filePathIsTemplate; }; QTemporaryFileEngine::~QTemporaryFileEngine() @@ -334,6 +340,9 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) Q_D(QFSFileEngine); Q_ASSERT(!isReallyOpen()); + if (!filePathIsTemplate) + return QFSFileEngine::open(openMode); + QString qfilename = d->filePath; if(!qfilename.contains(QLatin1String("XXXXXX"))) qfilename += QLatin1String(".XXXXXX"); @@ -353,6 +362,7 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) // Restore the file names (open() resets them). d->filePath = QString::fromLocal8Bit(filename); //changed now! + filePathIsTemplate = false; d->nativeInitFileName(); delete [] filename; return true; @@ -370,6 +380,7 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) } d->filePath = QString::fromLocal8Bit(filename); + filePathIsTemplate = false; d->nativeInitFileName(); d->closeFileHandle = true; delete [] filename; @@ -714,8 +725,12 @@ QTemporaryFile *QTemporaryFile::createLocalFile(QFile &file) QAbstractFileEngine *QTemporaryFile::fileEngine() const { Q_D(const QTemporaryFile); - if(!d->fileEngine) - d->fileEngine = new QTemporaryFileEngine(d->templateName); + if(!d->fileEngine) { + if (d->fileName.isEmpty()) + d->fileEngine = new QTemporaryFileEngine(d->templateName); + else + d->fileEngine = new QTemporaryFileEngine(d->fileName, false); + } return d->fileEngine; } -- cgit v0.12 From ba706d2564f1181fa4cc596a46bb2a041c62c28f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 18 May 2009 13:08:04 +0200 Subject: QTemporaryFile: really close files before renaming This gets temporary file renaming working on Windows, without requiring block-copying. While we could #ifdef this behavior for Windows, it's preferrable to maintain consistency in the exposed interface. Reviewed-by: Thiago --- src/corelib/io/qtemporaryfile.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 564ec59..7c0b018 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -303,6 +303,7 @@ public: bool open(QIODevice::OpenMode flags); bool remove(); + bool rename(const QString &newName); bool close(); bool filePathIsTemplate; @@ -401,6 +402,12 @@ bool QTemporaryFileEngine::remove() return false; } +bool QTemporaryFileEngine::rename(const QString &newName) +{ + QFSFileEngine::close(); + return QFSFileEngine::rename(newName); +} + bool QTemporaryFileEngine::close() { // Don't close the file, just seek to the front. -- cgit v0.12 From a0396c8c68aca446e68434e516bd46d749093b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 18 May 2009 11:51:12 +0200 Subject: Reset openMode to NotOpen when returning false from QFile::open() When connecting to an open file descriptor, set the openMode in the file system engine, as is done for file handles. Reviewed-by: Thiago --- src/corelib/io/qfsfileengine.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 61ea7cc..1c8f0e9 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -312,6 +312,10 @@ bool QFSFileEnginePrivate::openFh(QIODevice::OpenMode openMode, FILE *fh) if (ret == -1) { q->setError(errno == EMFILE ? QFile::ResourceError : QFile::OpenError, qt_error_string(int(errno))); + + this->openMode = QIODevice::NotOpen; + this->fh = 0; + return false; } } @@ -335,6 +339,7 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode, int fd) if ((openMode & QFile::WriteOnly) && !(openMode & (QFile::ReadOnly | QFile::Append))) openMode |= QFile::Truncate; + d->openMode = openMode; d->lastFlushFailed = false; d->closeFileHandle = false; d->nativeFilePath.clear(); @@ -367,6 +372,10 @@ bool QFSFileEnginePrivate::openFd(QIODevice::OpenMode openMode, int fd) if (ret == -1) { q->setError(errno == EMFILE ? QFile::ResourceError : QFile::OpenError, qt_error_string(int(errno))); + + this->openMode = QIODevice::NotOpen; + this->fd = -1; + return false; } } -- cgit v0.12 From 8b2a16bd7f434a159e34e93dbffc983927a0a143 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 22 May 2009 13:20:10 +0200 Subject: Fixed compilation with -qtnamespace Task-number: 254333 Reviewed-by: Andy Shaw --- src/corelib/io/qtemporaryfile.cpp | 4 +++- src/corelib/kernel/qsharedmemory_unix.cpp | 4 ++-- src/corelib/kernel/qsystemsemaphore_p.h | 4 ++-- src/corelib/kernel/qtranslator.cpp | 4 ++-- src/network/access/qhttp.cpp | 4 ++-- src/network/kernel/qnetworkproxy.cpp | 4 ++-- src/network/kernel/qurlinfo.cpp | 4 ++-- src/network/socket/qhttpsocketengine.cpp | 4 ++-- src/scripttools/debugging/qscriptenginedebugger.cpp | 13 ++++++++++--- 9 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 7c0b018..b4d8a48 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -766,6 +766,8 @@ bool QTemporaryFile::open(OpenMode flags) return false; } +QT_END_NAMESPACE + #endif // QT_NO_TEMPORARYFILE -QT_END_NAMESPACE + diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index 487c653..61d56f4 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -49,10 +49,10 @@ #include -QT_BEGIN_NAMESPACE - #ifndef QT_NO_SHAREDMEMORY +QT_BEGIN_NAMESPACE + #include #include #include diff --git a/src/corelib/kernel/qsystemsemaphore_p.h b/src/corelib/kernel/qsystemsemaphore_p.h index 81d4f10..a4a7389 100644 --- a/src/corelib/kernel/qsystemsemaphore_p.h +++ b/src/corelib/kernel/qsystemsemaphore_p.h @@ -101,9 +101,9 @@ public: QSystemSemaphore::SystemSemaphoreError error; }; -#endif // QT_NO_SYSTEMSEMAPHORE +QT_END_NAMESPACE +#endif // QT_NO_SYSTEMSEMAPHORE -QT_END_NAMESPACE #endif // QSYSTEMSEMAPHORE_P_H diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 77d6599..3e4b467 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -819,6 +819,6 @@ bool QTranslator::isEmpty() const Use translate(\a context, \a sourceText, \a comment) instead. */ -#endif // QT_NO_TRANSLATION - QT_END_NAMESPACE + +#endif // QT_NO_TRANSLATION diff --git a/src/network/access/qhttp.cpp b/src/network/access/qhttp.cpp index 7d14ab6..30befb3 100644 --- a/src/network/access/qhttp.cpp +++ b/src/network/access/qhttp.cpp @@ -64,10 +64,10 @@ # include "qtimer.h" #endif -QT_BEGIN_NAMESPACE - #ifndef QT_NO_HTTP +QT_BEGIN_NAMESPACE + class QHttpNormalRequest; class QHttpRequest { diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 62bdfc7..fd3a85a 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -1258,6 +1258,6 @@ QList QNetworkProxyFactory::proxyForQuery(const QNetworkProxyQuer return globalNetworkProxy()->proxyForQuery(query); } -#endif // QT_NO_NETWORKPROXY - QT_END_NAMESPACE + +#endif // QT_NO_NETWORKPROXY diff --git a/src/network/kernel/qurlinfo.cpp b/src/network/kernel/qurlinfo.cpp index 255c9ea..d90c480 100644 --- a/src/network/kernel/qurlinfo.cpp +++ b/src/network/kernel/qurlinfo.cpp @@ -726,6 +726,6 @@ bool QUrlInfo::isValid() const return d != 0; } -#endif // QT_NO_URLINFO - QT_END_NAMESPACE + +#endif // QT_NO_URLINFO diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index 540c443..5a2a746 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -768,6 +768,6 @@ QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(int, QObject return 0; } -#endif - QT_END_NAMESPACE + +#endif diff --git a/src/scripttools/debugging/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp index e35bd1d..0f8b600 100644 --- a/src/scripttools/debugging/qscriptenginedebugger.cpp +++ b/src/scripttools/debugging/qscriptenginedebugger.cpp @@ -63,16 +63,23 @@ #include #include +// this has to be outside the namespace +static void initScriptEngineDebuggerResources() +{ + Q_INIT_RESOURCE(scripttools_debugging); +} + +QT_BEGIN_NAMESPACE + class QtScriptDebuggerResourceInitializer { public: QtScriptDebuggerResourceInitializer() { - Q_INIT_RESOURCE(scripttools_debugging); + // call outside-the-namespace function + initScriptEngineDebuggerResources(); } }; -QT_BEGIN_NAMESPACE - /*! \since 4.5 \class QScriptEngineDebugger -- cgit v0.12 From 751e0f1b70cb0c80e88f99e5137329d6f4b76562 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 22 May 2009 14:58:06 +0200 Subject: qdoc: Moved some qdoc comments into the .cpp file common to all packages. Task-number: 252494 --- src/corelib/io/qfsfileengine.cpp | 113 +++++++++++++++++++++++++++++++++++ src/corelib/io/qfsfileengine_win.cpp | 83 ------------------------- 2 files changed, 113 insertions(+), 83 deletions(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 61ea7cc..99c1909 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -868,6 +868,119 @@ bool QFSFileEngine::supportsExtension(Extension extension) const return false; } +/*! \fn bool QFSFileEngine::caseSensitive() const + Returns true for Windows, false for Unix. +*/ + +/*! \fn bool QFSFileEngine::copy(const QString ©Name) + + For windows, copy the file to file \a copyName. + + Not implemented for Unix. +*/ + +/*! \fn QString QFSFileEngine::currentPath(const QString &fileName) + For Unix, returns the current working directory for the file + engine. + + For Windows, returns the canonicalized form of the current path used + by the file engine for the drive specified by \a fileName. On + Windows, each drive has its own current directory, so a different + path is returned for file names that include different drive names + (e.g. A: or C:). + + \sa setCurrentPath() +*/ + +/*! \fn QFileInfoList QFSFileEngine::drives() + For Windows, returns the list of drives in the file system as a list + of QFileInfo objects. On unix, Mac OS X and Windows CE, only the + root path is returned. On Windows, this function returns all drives + (A:\, C:\, D:\, etc.). + + For Unix, the list contains just the root path "/". +*/ + +/*! \fn QString QFSFileEngine::fileName(FileName file) const + \reimp +*/ + +/*! \fn QDateTime QFSFileEngine::fileTime(FileTime time) const + \reimp +*/ + +/*! \fn QString QFSFileEngine::homePath() + Returns the home path of the current user. + + \sa rootPath() +*/ + +/*! \fn bool QFSFileEngine::isRelativePath() const + \reimp +*/ + +/*! \fn bool QFSFileEngine::link(const QString &newName) + + Creates a link from the file currently specified by fileName() to + \a newName. What a link is depends on the underlying filesystem + (be it a shortcut on Windows or a symbolic link on Unix). Returns + true if successful; otherwise returns false. +*/ + +/*! \fn bool QFSFileEngine::mkdir(const QString &name, bool createParentDirectories) const + \reimp +*/ + +/*! \fn uint QFSFileEngine::ownerId(FileOwner own) const + In Unix, if stat() is successful, the \c uid is returned if + \a own is the owner. Otherwise the \c gid is returned. If stat() + is unsuccessful, -2 is reuturned. + + For Windows, -2 is always returned. +*/ + +/*! \fn QString QFSFileEngine::owner() const + \reimp +*/ + +/*! \fn bool QFSFileEngine::remove() + \reimp +*/ + +/*! \fn bool QFSFileEngine::rename(const QString &newName) + \reimp +*/ + +/*! \fn bool QFSFileEngine::rmdir(const QString &name, bool recurseParentDirectories) const + \reimp +*/ + +/*! \fn QString QFSFileEngine::rootPath() + Returns the root path. + + \sa homePath() +*/ + +/*! \fn bool QFSFileEngine::setCurrentPath(const QString &path) + Sets the current path (e.g., for QDir), to \a path. Returns true if the + new path exists; otherwise this function does nothing, and returns false. + + \sa currentPath() +*/ + +/*! \fn bool QFSFileEngine::setPermissions(uint perms) + \reimp +*/ + +/*! \fn bool QFSFileEngine::setSize(qint64 size) + \reimp +*/ + +/*! \fn QString QFSFileEngine::tempPath() + Returns the temporary path (i.e., a path in which it is safe + to store temporary files). +*/ + QT_END_NAMESPACE #endif // QT_NO_FSFILEENGINE diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 63506c2..b22d6c7 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -946,9 +946,6 @@ bool QFSFileEnginePrivate::nativeIsSequential() const return false; } -/*! - \reimp -*/ bool QFSFileEngine::remove() { Q_D(QFSFileEngine); @@ -959,9 +956,6 @@ bool QFSFileEngine::remove() }); } -/*! - \reimp -*/ bool QFSFileEngine::copy(const QString ©Name) { Q_D(QFSFileEngine); @@ -974,9 +968,6 @@ bool QFSFileEngine::copy(const QString ©Name) }); } -/*! - \reimp -*/ bool QFSFileEngine::rename(const QString &newName) { Q_D(QFSFileEngine); @@ -1017,9 +1008,6 @@ static inline bool mkDir(const QString &path) }); } -/*! - \reimp -*/ static inline bool rmDir(const QString &path) { QT_WA({ @@ -1029,9 +1017,6 @@ static inline bool rmDir(const QString &path) }); } -/*! - \reimp -*/ static inline bool isDirPath(const QString &dirPath, bool *existed) { QString path = dirPath; @@ -1054,9 +1039,6 @@ static inline bool isDirPath(const QString &dirPath, bool *existed) return fileAttrib & FILE_ATTRIBUTE_DIRECTORY; } -/*! - \reimp -*/ bool QFSFileEngine::mkdir(const QString &name, bool createParentDirectories) const { QString dirName = name; @@ -1097,9 +1079,6 @@ bool QFSFileEngine::mkdir(const QString &name, bool createParentDirectories) con return mkDir(name); } -/*! - \reimp -*/ bool QFSFileEngine::rmdir(const QString &name, bool recurseParentDirectories) const { QString dirName = name; @@ -1120,20 +1099,11 @@ bool QFSFileEngine::rmdir(const QString &name, bool recurseParentDirectories) co return rmDir(name); } -/*! - \reimp -*/ bool QFSFileEngine::caseSensitive() const { return false; } -/*! - Sets the current path (e.g., for QDir), to \a path. Returns true if the - new path exists; otherwise this function does nothing, and returns false. - - \sa currentPath() -*/ bool QFSFileEngine::setCurrentPath(const QString &path) { if (!QDir(path).exists()) @@ -1153,16 +1123,6 @@ bool QFSFileEngine::setCurrentPath(const QString &path) #endif } -/*! - Returns the canonicalized form of the current path used by the file - engine for the drive specified by \a fileName. - - On Windows, each drive has its own current directory, so a different - path is returned for file names that include different drive names - (e.g. A: or C:). - - \sa setCurrentPath() -*/ QString QFSFileEngine::currentPath(const QString &fileName) { #if !defined(Q_OS_WINCE) @@ -1219,11 +1179,6 @@ QString QFSFileEngine::currentPath(const QString &fileName) #endif } -/*! - Returns the home path of the current user. - - \sa rootPath() -*/ QString QFSFileEngine::homePath() { QString ret; @@ -1277,11 +1232,6 @@ QString QFSFileEngine::homePath() return QDir::fromNativeSeparators(ret); } -/*! - Returns the root path. - - \sa homePath() -*/ QString QFSFileEngine::rootPath() { #if defined(Q_OS_WINCE) @@ -1299,10 +1249,6 @@ QString QFSFileEngine::rootPath() return ret; } -/*! - Returns the temporary path (i.e., a path in which it is safe to store - temporary files). -*/ QString QFSFileEngine::tempPath() { QString ret; @@ -1330,11 +1276,6 @@ QString QFSFileEngine::tempPath() return ret; } -/*! - Returns the list of drives in the file system as a list of QFileInfo - objects. On unix, Mac OS X and Windows CE, only the root path is returned. - On Windows, this function returns all drives (A:\, C:\, D:\, etc.). -*/ QFileInfoList QFSFileEngine::drives() { QFileInfoList ret; @@ -1556,9 +1497,6 @@ QString QFSFileEnginePrivate::getLink() const return readLink(filePath); } -/*! - \reimp -*/ bool QFSFileEngine::link(const QString &newName) { #if !defined(Q_OS_WINCE) @@ -1816,9 +1754,6 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(QAbstractFileEngine::Fil return ret; } -/*! - \reimp -*/ QString QFSFileEngine::fileName(FileName file) const { Q_D(const QFSFileEngine); @@ -1912,9 +1847,6 @@ QString QFSFileEngine::fileName(FileName file) const return d->filePath; } -/*! - \reimp -*/ bool QFSFileEngine::isRelativePath() const { Q_D(const QFSFileEngine); @@ -1924,18 +1856,12 @@ bool QFSFileEngine::isRelativePath() const || (d->filePath.at(0) == QLatin1Char('/') && d->filePath.at(1) == QLatin1Char('/'))))); // drive, e.g. a: } -/*! - \reimp -*/ uint QFSFileEngine::ownerId(FileOwner /*own*/) const { static const uint nobodyID = (uint) -2; return nobodyID; } -/*! - \reimp -*/ QString QFSFileEngine::owner(FileOwner own) const { #if !defined(QT_NO_LIBRARY) @@ -1974,9 +1900,6 @@ QString QFSFileEngine::owner(FileOwner own) const return QString(QLatin1String("")); } -/*! - \reimp -*/ bool QFSFileEngine::setPermissions(uint perms) { Q_D(QFSFileEngine); @@ -2003,9 +1926,6 @@ bool QFSFileEngine::setPermissions(uint perms) return ret; } -/*! - \reimp -*/ bool QFSFileEngine::setSize(qint64 size) { Q_D(QFSFileEngine); @@ -2075,9 +1995,6 @@ static inline QDateTime fileTimeToQDateTime(const FILETIME *time) return ret; } -/*! - \reimp -*/ QDateTime QFSFileEngine::fileTime(FileTime time) const { Q_D(const QFSFileEngine); -- cgit v0.12 From 327d94ce8054718d0ce157604594e470e90d6cb4 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Fri, 22 May 2009 15:14:11 +0200 Subject: Fixes a potential crash when changing system palette with QGtkStyle The problem was that we installed an eventfilter regardless if the gtk symbols were defined or not. Instead we now initialize and check for the symbols before we install the filter. Task-number: 254342 Reviewed-by: ogoffart --- src/gui/styles/qgtkstyle.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index ca71da2..86653df 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -140,10 +140,7 @@ static const char * const dock_widget_restore_xpm[] = class QGtkStyleFilter : public QObject { public: - QGtkStyleFilter() { - qApp->installEventFilter(this); - } - + QGtkStyleFilter() {} private: bool eventFilter(QObject *obj, QEvent *e); }; @@ -167,7 +164,12 @@ class QGtkStylePrivate : public QCleanlooksStylePrivate public: QGtkStylePrivate() : QCleanlooksStylePrivate() - {} + { + QGtk::initGtkWidgets(); + if (QGtk::isThemeAvailable()) + qApp->installEventFilter(&filter); + + } QGtkStyleFilter filter; }; @@ -243,7 +245,6 @@ static QString uniqueName(const QString &key, const QStyleOption *option, const QGtkStyle::QGtkStyle() : QCleanlooksStyle(*new QGtkStylePrivate) { - QGtk::initGtkWidgets(); } /*! -- cgit v0.12 From 93106a55db7bd781cde889425912ebc4a277eb8f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 22 Apr 2009 19:03:52 +0200 Subject: Fix syntax of the fcntl system call: this is not setsockopt Reviewed-By: Oswald Buddenhagen --- src/corelib/io/qfsfileengine_unix.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 18b92e2..459725c 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -273,9 +273,8 @@ qint64 QFSFileEnginePrivate::nativeRead(char *data, qint64 len) int oldFlags = fcntl(QT_FILENO(fh), F_GETFL); for (int i = 0; i < 2; ++i) { // Unix: Make the underlying file descriptor non-blocking - int v = 1; if ((oldFlags & O_NONBLOCK) == 0) - fcntl(QT_FILENO(fh), F_SETFL, oldFlags | O_NONBLOCK, &v, sizeof(v)); + fcntl(QT_FILENO(fh), F_SETFL, oldFlags | O_NONBLOCK); // Cross platform stdlib read size_t read = 0; @@ -293,8 +292,7 @@ qint64 QFSFileEnginePrivate::nativeRead(char *data, qint64 len) // Unix: Restore the blocking state of the underlying socket if ((oldFlags & O_NONBLOCK) == 0) { - int v = 1; - fcntl(QT_FILENO(fh), F_SETFL, oldFlags, &v, sizeof(v)); + fcntl(QT_FILENO(fh), F_SETFL, oldFlags); if (readBytes == 0) { int readByte = 0; do { @@ -311,8 +309,7 @@ qint64 QFSFileEnginePrivate::nativeRead(char *data, qint64 len) } // Unix: Restore the blocking state of the underlying socket if ((oldFlags & O_NONBLOCK) == 0) { - int v = 1; - fcntl(QT_FILENO(fh), F_SETFL, oldFlags, &v, sizeof(v)); + fcntl(QT_FILENO(fh), F_SETFL, oldFlags); } if (readBytes == 0 && !feof(fh)) { // if we didn't read anything and we're not at EOF, it must be an error -- cgit v0.12 From 049135667302482af66eeaf9a2323d5ee1551132 Mon Sep 17 00:00:00 2001 From: Kavindra Devi Palaraja Date: Fri, 22 May 2009 15:42:31 +0200 Subject: Doc - updating the screenshot Reviewed-By: TrustMe --- doc/src/images/inputdialogs.png | Bin 4244 -> 30369 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/doc/src/images/inputdialogs.png b/doc/src/images/inputdialogs.png index 135c2f6..8bda185 100644 Binary files a/doc/src/images/inputdialogs.png and b/doc/src/images/inputdialogs.png differ -- cgit v0.12 From fc7a43cceba63b79a40183334ab97527483113e3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 22 May 2009 16:55:28 +0200 Subject: Fix compilation breakage on Windows caused by 6c1d7e57. On Windows, QT_NO_IPV6 isn't defined, but the necessary includes were missing. So #include winsock2.h and also use our own structures. Reviewed-By: Trust Me --- src/network/socket/qnativesocketengine_p.h | 36 +++++++++++++++++++++---- src/network/socket/qnativesocketengine_unix.cpp | 2 +- src/network/socket/qnativesocketengine_win.cpp | 35 ------------------------ 3 files changed, 32 insertions(+), 41 deletions(-) diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 825c333..eb031d3 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -56,7 +56,9 @@ #include "QtNetwork/qhostaddress.h" #include "private/qabstractsocketengine_p.h" #ifndef Q_OS_WIN -#include "qplatformdefs.h" +# include "qplatformdefs.h" +#else +# include #endif QT_BEGIN_NAMESPACE @@ -90,13 +92,37 @@ static inline int qt_socket_socket(int domain, int type, int protocol) #endif +// Use our own defines and structs which we know are correct +# define QT_SS_MAXSIZE 128 +# define QT_SS_ALIGNSIZE (sizeof(qint64)) +# define QT_SS_PAD1SIZE (QT_SS_ALIGNSIZE - sizeof (short)) +# define QT_SS_PAD2SIZE (QT_SS_MAXSIZE - (sizeof (short) + QT_SS_PAD1SIZE + QT_SS_ALIGNSIZE)) +struct qt_sockaddr_storage { + short ss_family; + char __ss_pad1[QT_SS_PAD1SIZE]; + qint64 __ss_align; + char __ss_pad2[QT_SS_PAD2SIZE]; +}; + +// sockaddr_in6 size changed between old and new SDK +// Only the new version is the correct one, so always +// use this structure. +struct qt_in6_addr { + quint8 qt_s6_addr[16]; +}; +struct qt_sockaddr_in6 { + short sin6_family; /* AF_INET6 */ + quint16 sin6_port; /* Transport level port number */ + quint32 sin6_flowinfo; /* IPv6 flow information */ + struct qt_in6_addr sin6_addr; /* IPv6 address */ + quint32 sin6_scope_id; /* set of interfaces for a scope */ +}; + union qt_sockaddr { sockaddr a; sockaddr_in a4; -#if !defined(QT_NO_IPV6) - sockaddr_in6 a6; -#endif - sockaddr_storage storage; + qt_sockaddr_in6 a6; + qt_sockaddr_storage storage; }; class QNativeSocketEnginePrivate; diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 2b11e8e..75b5a64 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -119,7 +119,7 @@ static inline void qt_socket_getPortAndAddress(const qt_sockaddr *s, quint16 *po #if !defined(QT_NO_IPV6) if (s->a.sa_family == AF_INET6) { Q_IPV6ADDR tmp; - memcpy(&tmp, &s->a6.sin6_addr.s6_addr, sizeof(tmp)); + memcpy(&tmp, &s->a6.sin6_addr, sizeof(tmp)); if (addr) { QHostAddress tmpAddress; tmpAddress.setAddress(tmp); diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index d140be2..b08d7b0 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -149,41 +149,6 @@ static QByteArray qt_prettyDebug(const char *data, int len, int maxLength) #endif -#if !defined (QT_NO_IPV6) - -// Use our own defines and structs which we know are correct -# define QT_SS_MAXSIZE 128 -# define QT_SS_ALIGNSIZE (sizeof(__int64)) -# define QT_SS_PAD1SIZE (QT_SS_ALIGNSIZE - sizeof (short)) -# define QT_SS_PAD2SIZE (QT_SS_MAXSIZE - (sizeof (short) + QT_SS_PAD1SIZE + QT_SS_ALIGNSIZE)) -struct qt_sockaddr_storage { - short ss_family; - char __ss_pad1[QT_SS_PAD1SIZE]; - __int64 __ss_align; - char __ss_pad2[QT_SS_PAD2SIZE]; -}; - -// sockaddr_in6 size changed between old and new SDK -// Only the new version is the correct one, so always -// use this structure. -struct qt_in6_addr { - u_char qt_s6_addr[16]; -}; -typedef struct { - short sin6_family; /* AF_INET6 */ - u_short sin6_port; /* Transport level port number */ - u_long sin6_flowinfo; /* IPv6 flow information */ - struct qt_in6_addr sin6_addr; /* IPv6 address */ - u_long sin6_scope_id; /* set of interfaces for a scope */ -} qt_sockaddr_in6; - -#else - -typedef void * qt_sockaddr_in6 ; - - -#endif - #ifndef AF_INET6 #define AF_INET6 23 /* Internetwork Version 6 */ #endif -- cgit v0.12 From 701bdcbc8b7751834f6d24844bcb91a23cbdc409 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 22 May 2009 15:48:23 +0200 Subject: Pressing enter in a QPlainTextEdit embedded on a itemview should insert a newline Do the same special case as for QTextEdit (yes, this is a pitty that we have special cases like that Reviewed-by: Thierry Task-number: 252532 --- src/gui/itemviews/qitemdelegate.cpp | 3 +- src/gui/itemviews/qstyleditemdelegate.cpp | 3 +- tests/auto/qitemdelegate/tst_qitemdelegate.cpp | 78 ++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index 3b7eb2d..a748199 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -1194,7 +1195,7 @@ bool QItemDelegate::eventFilter(QObject *object, QEvent *event) case Qt::Key_Enter: case Qt::Key_Return: #ifndef QT_NO_TEXTEDIT - if (qobject_cast(editor)) + if (qobject_cast(editor) || qobject_cast(editor)) return false; // don't filter enter key events for QTextEdit // We want the editor to be able to process the key press // before committing the data (e.g. so it can do diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp index be0971b..7f2c8ed 100644 --- a/src/gui/itemviews/qstyleditemdelegate.cpp +++ b/src/gui/itemviews/qstyleditemdelegate.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -646,7 +647,7 @@ bool QStyledItemDelegate::eventFilter(QObject *object, QEvent *event) case Qt::Key_Enter: case Qt::Key_Return: #ifndef QT_NO_TEXTEDIT - if (qobject_cast(editor)) + if (qobject_cast(editor) || qobject_cast(editor)) return false; // don't filter enter key events for QTextEdit // We want the editor to be able to process the key press // before committing the data (e.g. so it can do diff --git a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp index 27741e0..615ac01 100644 --- a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp @@ -59,6 +59,8 @@ #include #include +#include +#include Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint) @@ -226,6 +228,8 @@ private slots: void decoration(); void editorEvent_data(); void editorEvent(); + void enterKey_data(); + void enterKey(); }; @@ -1048,6 +1052,80 @@ void tst_QItemDelegate::editorEvent() QCOMPARE(index.data(Qt::CheckStateRole).toInt(), expectedCheckState); } +void tst_QItemDelegate::enterKey_data() +{ + QTest::addColumn("widget"); + QTest::addColumn("key"); + QTest::addColumn("expectedFocus"); + + QTest::newRow("lineedit enter") << 1 << int(Qt::Key_Enter) << false; + QTest::newRow("textedit enter") << 2 << int(Qt::Key_Enter) << true; + QTest::newRow("plaintextedit enter") << 3 << int(Qt::Key_Enter) << true; + QTest::newRow("plaintextedit return") << 3 << int(Qt::Key_Return) << true; + QTest::newRow("plaintextedit tab") << 3 << int(Qt::Key_Tab) << false; + QTest::newRow("lineedit tab") << 1 << int(Qt::Key_Tab) << false; +} + +void tst_QItemDelegate::enterKey() +{ + QFETCH(int, widget); + QFETCH(int, key); + QFETCH(bool, expectedFocus); + + QStandardItemModel model; + model.appendRow(new QStandardItem()); + + QListView view; + view.setModel(&model); + view.show(); + QApplication::setActiveWindow(&view); + view.setFocus(); + QTest::qWait(30); + + struct TestDelegate : public QItemDelegate + { + int widgetType; + virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& /*option*/, const QModelIndex& /*index*/) const + { + QWidget *editor = 0; + switch(widgetType) { + case 1: + editor = new QLineEdit(parent); + break; + case 2: + editor = new QTextEdit(parent); + break; + case 3: + editor = new QPlainTextEdit(parent); + break; + } + editor->setObjectName(QString::fromLatin1("TheEditor")); + return editor; + } + } delegate; + + delegate.widgetType = widget; + + view.setItemDelegate(&delegate); + QModelIndex index = model.index(0, 0); + view.setCurrentIndex(index); // the editor will only selectAll on the current index + view.edit(index); + QTest::qWait(30); + + QList lineEditors = qFindChildren(view.viewport(), QString::fromLatin1("TheEditor")); + QCOMPARE(lineEditors.count(), 1); + + QWidget *editor = lineEditors.at(0); + QCOMPARE(editor->hasFocus(), true); + + QTest::keyClick(editor, Qt::Key(key)); + QApplication::processEvents(); + + QCOMPARE(editor->hasFocus(), expectedFocus); +} + + + // ### _not_ covered: // editing with a custom editor factory -- cgit v0.12 From a5104ef77f71b068228ffe6d7c64845889c18c81 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 23 May 2009 13:18:23 +0200 Subject: Fix another compilation breakage introduced by the fix to the compilation breakage introduced in 6c1d7e57. The fix in fc7a43cce did fix the failure, but created another one because qhostinfo_win.cpp also had a copy of qt_sockaddr_in6 Reviewed-by: Jason McDonald --- src/network/kernel/qhostinfo_win.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp index 0a34e2b..472bc4b 100644 --- a/src/network/kernel/qhostinfo_win.cpp +++ b/src/network/kernel/qhostinfo_win.cpp @@ -72,21 +72,6 @@ struct qt_addrinfo qt_addrinfo *ai_next; }; -// sockaddr_in6 size changed between old and new SDK -// Only the new version is the correct one, so always -// use this structure. -struct qt_in6_addr { - uchar qt_s6_addr[16]; -}; - -struct qt_sockaddr_in6 { - short sin6_family; /* AF_INET6 */ - u_short sin6_port; /* Transport level port number */ - u_long sin6_flowinfo; /* IPv6 flow information */ - struct qt_in6_addr sin6_addr; /* IPv6 address */ - u_long sin6_scope_id; /* set of interfaces for a scope */ -}; - //### #define QT_SOCKLEN_T int #ifndef NI_MAXHOST // already defined to 1025 in ws2tcpip.h? -- cgit v0.12 From 26302d22f4dbf3482aacad89ad65bf5b7ed6ae53 Mon Sep 17 00:00:00 2001 From: axasia Date: Sat, 23 May 2009 23:33:49 +0900 Subject: Update japanese translation of Qt Assistant 4.5 --- translations/assistant_ja.ts | 395 ++++++++++++++++++++++--------------------- 1 file changed, 203 insertions(+), 192 deletions(-) diff --git a/translations/assistant_ja.ts b/translations/assistant_ja.ts index 1853155..5e4d2c9 100644 --- a/translations/assistant_ja.ts +++ b/translations/assistant_ja.ts @@ -1,12 +1,12 @@ - + AboutDialog &Close - + 閉じる(&C) @@ -14,18 +14,19 @@ Warning - + 警告 Unable to launch external application. - + 外部アプリケーションを起動できません。 + OK - + OK @@ -37,42 +38,42 @@ Bookmarks - + ブックマーク Add Bookmark - + ブックマークの追加 Bookmark: - + ブックマーク: Add in Folder: - + 追加先フォルダ: + - + + New Folder - + 新しいフォルダ Delete Folder - + フォルダを削除 Rename Folder - + フォルダの名前変更 @@ -80,23 +81,23 @@ Bookmarks - + ブックマーク Remove - + 削除 You are going to delete a Folder, this will also<br>remove it's content. Are you sure to continue? - + フォルダを削除すると中身も削除されますが、続けてよろしいですか? New Folder - + 新しいフォルダ @@ -104,47 +105,47 @@ Filter: - + フィルタ: Remove - + 削除 Delete Folder - + フォルダを削除 Rename Folder - + フォルダの名前変更 Show Bookmark - + ブックマークを開く Show Bookmark in New Tab - + ブックマークを新しいタブで開く Delete Bookmark - + ブックマークを削除 Rename Bookmark - + ブックマークの名前変更 Add - + 追加 @@ -152,48 +153,48 @@ Add new page - + 新しいページの追加 Close current page - + 現在のページを閉じる Print Document - + ドキュメントを印刷 unknown - + 不明 Add New Page - + 新しいページの追加 Close This Page - + このページを閉じる Close Other Pages - + 他のページを閉じる Add Bookmark for this Page... - + このページをブックマークに追加... Search - + 検索 @@ -201,12 +202,12 @@ Open Link - + リンクを開く Open Link in New Tab - + リンクを新しいタブで開く @@ -214,12 +215,12 @@ Add Filter Name - + フィルタ名を追加 Filter Name: - + フィルタ名: @@ -227,27 +228,27 @@ Previous - + 戻る Next - + 進む Case Sensitive - + 大文字/小文字を区別する Whole words - + 単語単位で検索する <img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped - + <img src=":/trolltech/assistant/images/wrap.png">&nbsp;見つからなければ先頭から検索する @@ -255,27 +256,27 @@ Font - + フォント &Writing system - + 文字セット(&W) &Family - + フォント名(&F) &Style - + スタイル(&S) &Point size - + サイズ(&P) @@ -283,38 +284,39 @@ Help - + ヘルプ OK - + OK <title>Error 404...</title><div align="center"><br><br><h1>The page could not be found</h1><br><h3>'%1'</h3></div> - + <title>Error 404...</title><div align="center"><br><br><h1>ページが見つかりませんでした</h1><br><h3>'%1'</h3></div> Copy &Link Location - + リンクのURLをコピー(&L) Open Link in New Tab Ctrl+LMB - + リンクを新しいタブで開く Ctrl+LMB Open Link in New Tab - + リンクを新しいタブで開く Unable to launch external application. - + 外部アプリケーションを起動できません。 + @@ -322,17 +324,17 @@ &Look for: - + 検索文字列(&L): Open Link - + リンクを開く Open Link in New Tab - + リンクを新しいタブで開く @@ -341,97 +343,98 @@ Install Documentation - + ドキュメントのインストール Downloading documentation info... - + ドキュメント情報をダウンロード中... Download canceled. - + ダウンロードを中止しました。 Done. - + 完了. The file %1 already exists. Do you want to overwrite it? - + %1 は既に存在します。上書きしますか? Unable to save the file %1: %2. - + ファイルを保存できません。%1: %2. Downloading %1... - + %1 をダウンロード中... Download failed: %1. - + ダウンロード失敗: %1. Documentation info file is corrupt! - + ドキュメント情報ファイルが不正です! Download failed: Downloaded file is corrupted. - + ダウンロード失敗: ダウンロードしたファイルが不正です。 Installing documentation %1... - + %1 のドキュメントをインストール中... Error while installing documentation: %1 - + ドキュメントのインストール中にエラーが発生しました: +%1 Available Documentation: - + 使用可能なドキュメント: Install - + インストール Cancel - + キャンセル Close - + 閉じる Installation Path: - + インストール先のパス: ... - + ... @@ -440,298 +443,298 @@ Index - + インデックス Contents - + コンテンツ Bookmarks - + ブックマーク Search - + 検索 Qt Assistant - + Qt Assistant Unfiltered - + フィルタなし Page Set&up... - + ページ設定(&U)... Print Preview... - + 印刷プレビュー... &Print... - + 印刷(&P)... New &Tab - + 新しいタブ(&T) &Close Tab - + タブを閉じる(&C) &Quit - + 終了(&Q) CTRL+Q - + CTRL+Q &Copy selected Text - + 選択中の文字をコピー(&C) &Find in Text... - + 検索(&F)... Find &Next - + 次を検索(&N) Find &Previous - + 前を検索(&P) Preferences... - + 設定... Zoom &in - + 拡大(&I) Zoom &out - + 縮小(&O) Normal &Size - + 普通の大きさ(&S) Ctrl+0 - + Ctrl+0 ALT+C - + ALT+C ALT+I - + ALT+I ALT+S - + ALT+S &Home - + ホーム(&H) Ctrl+Home - + Ctrl+Home &Back - + 戻る(&B) &Forward - + 進む(&F) Sync with Table of Contents - + 内容と目次を同期する Next Page - + 次のページ Ctrl+Alt+Right - + Ctrl+Alt+Right Previous Page - + 前のページ Ctrl+Alt+Left - + Ctrl+Alt+Left Add Bookmark... - + ブックマークの追加... About... - + Qt Assistant について... Navigation Toolbar - + ナビゲーション ツールバー Toolbars - + ツールバー Filter Toolbar - + フィルター ツールバー Filtered by: - + フィルタ条件: Address Toolbar - + アドレス ツールバー Address: - + アドレス: Could not find the associated content item. - + 関連付いた内容が見つかりません。 About %1 - + %1 について Updating search index - + 検索インデックスを更新中 Looking for Qt Documentation... - + Qt ドキュメントを探しています... &Window - + ウィンドウ(&W) Minimize - + 最小化 Ctrl+M - + Ctrl+M Zoom - + ズーム &File - + ファイル(&F) &Edit - + 編集(&E) &View - + 表示(&V) &Go - + ジャンプ(&G) &Bookmarks - + ブックマーク(&B) &Help - + ヘルプ(&H) ALT+O - + ALT+O CTRL+D - + CTRL+D @@ -741,47 +744,47 @@ Add Documentation - + ドキュメントの追加 Qt Compressed Help Files (*.qch) - + 圧縮済み Qt ヘルプファイル (*.qch) The specified file is not a valid Qt Help File! - + 指定されたファイルは有効な Qt ヘルプ ファイルではありません! The namespace %1 is already registered! - + ネームスペース %1 は既に登録済みです! Remove Documentation - + ドキュメントの除去 Some documents currently opened in Assistant reference the documentation you are attempting to remove. Removing the documentation will close those documents. - + 除去しようとしているいくつかのドキュメントは Assistant 上で参照されています。除去すると、これらのドキュメントは閉じられます。 Cancel - + キャンセル OK - + OK Use custom settings - + 独自設定を使用する @@ -789,92 +792,92 @@ Preferences - + 設定 Fonts - + フォント Font settings: - + フォント設定: Browser - + ブラウザー Application - + アプリケーション Filters - + フィルタ Filter: - + フィルタ: Attributes: - + 属性: 1 - + 1 Add - + 追加 Remove - + 削除 Documentation - + ドキュメント Registered Documentation: - + 登録済みドキュメント: Add... - + 追加... Options - + オプション Current Page - + 現在のページ Restore to default - + デフォルト設定に戻す Homepage - + ホームページ @@ -882,64 +885,64 @@ The specified collection file does not exist! - + 指定されたコレクションファイルは存在しません! Missing collection file! - + コレクションファイルが見つかりません! Invalid URL! - + 不正なURLです! Missing URL! - + URLが見つかりません! Unknown widget: %1 - + 不明なウィジェット: %1 Missing widget! - + ウィジェットが見つかりません! The specified Qt help file does not exist! - + 指定された Qt ヘルプ ファイルが存在しません! Missing help file! - + ヘルプファイルが見つかりません! Missing filter argument! - + フィルタ引数が不足しています! Unknown option: %1 - + 不明なオプション: %1 Qt Assistant - + Qt Assistant @@ -948,12 +951,16 @@ Reason: %2 - + ドキュメントファイルを登録できませんでした。 +%1 + +原因: +%2 Documentation successfully registered. - + ドキュメントの登録に成功しました。 @@ -962,28 +969,32 @@ Reason: Reason: %2 - + ドキュメントファイルを解除できませんでした。 +%1 + +原因: +%2 Documentation successfully unregistered. - + ドキュメントの解放に成功しました。 Cannot load sqlite database driver! - + SQLite データベース ドライバーをロードできません! The specified collection file could not be read! - + 指定されたコレクションファイルは読み込めません! Bookmark - + ブックマーク @@ -991,12 +1002,12 @@ Reason: Debugging Remote Control - + リモート コントロールをデバッグ中 Received Command: %1 %2 - + 受信したコマンド: %1 %2 @@ -1004,28 +1015,28 @@ Reason: &Copy - + コピー(&C) Copy &Link Location - + リンクのURLをコピー(&L) Open Link in New Tab - + リンクを新しいタブで開く Select All - + すべてを選択 Open Link - + リンクを開く @@ -1033,27 +1044,27 @@ Reason: Choose a topic for <b>%1</b>: - + <b>%1</b> の検索先トピックを選択してください: Choose Topic - + トピックを選択 &Topics - + トピック(&T) &Display - + 表示(&D) &Close - + 閉じる(&C) -- cgit v0.12 From 531274c741aed51946398a30a7be691ef98999bf Mon Sep 17 00:00:00 2001 From: Lincoln Ramsay Date: Mon, 25 May 2009 15:46:50 +1000 Subject: BT: Clean up Mac -arch handling Instead of the multiple character-string replacements, just check for the discrete -arch values that we want to find. This makes the code clearer and should reduce the chance of subtle errors. Reviewed-by: Jason McDonald --- configure | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/configure b/configure index 32efd86..4cf7499 100755 --- a/configure +++ b/configure @@ -2703,23 +2703,24 @@ fi if [ "$PLATFORM_MAC" = "yes" ]; then # check -arch arguments for validity. ALLOWED="x86 ppc x86_64 ppc64 i386" - for i in $CFG_MAC_ARCHS + # Save the list so we can re-write it using only valid values + CFG_MAC_ARCHS_IN="$CFG_MAC_ARCHS" + CFG_MAC_ARCHS= + for i in $CFG_MAC_ARCHS_IN do if echo "$ALLOWED" | grep -w -v "$i" > /dev/null 2>&1; then echo "Unknown architecture: \"$i\". Supported architectures: x86[i386] ppc x86_64 ppc64"; exit 2; fi - done - -# replace "i386" with "x86" to support configuring with -arch i386 as an alias for x86. - CFG_MAC_ARCHS="${CFG_MAC_ARCHS/i386/x86}" - -# Build commmand line arguments we can pass to the compiler during configure tests -# by prefixing each arch with "-arch". - CFG_MAC_ARCHS_GCC_FORMAT="${CFG_MAC_ARCHS/x86/i386}" - CFG_MAC_ARCHS_GCC_FORMAT="${CFG_MAC_ARCHS_GCC_FORMAT/i386_64/x86_64}" - for ARCH in $CFG_MAC_ARCHS_GCC_FORMAT; do - MAC_ARCHS_COMMANDLINE="$MAC_ARCHS_COMMANDLINE -arch $ARCH" + if [ "$i" = "i386" -o "$i" = "x86" ]; then + # These are synonymous values + # CFG_MAC_ARCHS requires x86 while GCC requires i386 + CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86" + MAC_ARCHS_COMMANDLINE="$MAC_ARCHS_COMMANDLINE -arch i386" + else + CFG_MAC_ARCHS="$CFG_MAC_ARCHS $i" + MAC_ARCHS_COMMANDLINE="$MAC_ARCHS_COMMANDLINE -arch $i" + fi done fi @@ -4129,14 +4130,14 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)" EXTRA_OBJS="qsettings_mac.o qcore_mac.o" EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\"" - if echo "$CFG_MAC_ARCHS" | grep x86 > /dev/null 2>&1; then + if echo "$CFG_MAC_ARCHS" | grep x86 > /dev/null 2>&1; then # matches both x86 and x86_64 X86_CFLAGS="-arch i386" X86_LFLAGS="-arch i386" EXTRA_CFLAGS="$X86_CFLAGS $EXTRA_CFLAGS" EXTRA_CXXFLAGS="$X86_CFLAGS $EXTRA_CXXFLAGS" EXTRA_LFLAGS="$EXTRA_LFLAGS $X86_LFLAGS" fi - if echo "$CFG_MAC_ARCHS" | grep ppc > /dev/null 2>&1; then + if echo "$CFG_MAC_ARCHS" | grep ppc > /dev/null 2>&1; then # matches both ppc and ppc64 PPC_CFLAGS="-arch ppc" PPC_LFLAGS="-arch ppc" EXTRA_CFLAGS="$PPC_CFLAGS $EXTRA_CFLAGS" -- cgit v0.12 From 878ccb0645e7f1416daeddd6acdc37fea16b5e25 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 May 2009 10:12:27 +0200 Subject: qdoc: Added some missing qdoc comments. Task-number: 252493 --- src/gui/painting/qcolormap_mac.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/painting/qcolormap_mac.cpp b/src/gui/painting/qcolormap_mac.cpp index 96da90f..afe0378 100644 --- a/src/gui/painting/qcolormap_mac.cpp +++ b/src/gui/painting/qcolormap_mac.cpp @@ -55,11 +55,17 @@ public: }; static QColormap *qt_mac_global_map = 0; +/*! + Creates the class's internal colormap. + */ void QColormap::initialize() { qt_mac_global_map = new QColormap; } +/*! + Deletes the class's internal colormap. + */ void QColormap::cleanup() { delete qt_mac_global_map; -- cgit v0.12 From fa2371e705621b95307f0dbc1988ba048cec6520 Mon Sep 17 00:00:00 2001 From: axasia Date: Sat, 23 May 2009 23:33:49 +0900 Subject: Update japanese translation of Qt Assistant 4.5 --- translations/assistant_ja.ts | 395 ++++++++++++++++++++++--------------------- 1 file changed, 203 insertions(+), 192 deletions(-) diff --git a/translations/assistant_ja.ts b/translations/assistant_ja.ts index 1853155..5e4d2c9 100644 --- a/translations/assistant_ja.ts +++ b/translations/assistant_ja.ts @@ -1,12 +1,12 @@ - + AboutDialog &Close - + 閉じる(&C) @@ -14,18 +14,19 @@ Warning - + 警告 Unable to launch external application. - + 外部アプリケーションを起動できません。 + OK - + OK @@ -37,42 +38,42 @@ Bookmarks - + ブックマーク Add Bookmark - + ブックマークの追加 Bookmark: - + ブックマーク: Add in Folder: - + 追加先フォルダ: + - + + New Folder - + 新しいフォルダ Delete Folder - + フォルダを削除 Rename Folder - + フォルダの名前変更 @@ -80,23 +81,23 @@ Bookmarks - + ブックマーク Remove - + 削除 You are going to delete a Folder, this will also<br>remove it's content. Are you sure to continue? - + フォルダを削除すると中身も削除されますが、続けてよろしいですか? New Folder - + 新しいフォルダ @@ -104,47 +105,47 @@ Filter: - + フィルタ: Remove - + 削除 Delete Folder - + フォルダを削除 Rename Folder - + フォルダの名前変更 Show Bookmark - + ブックマークを開く Show Bookmark in New Tab - + ブックマークを新しいタブで開く Delete Bookmark - + ブックマークを削除 Rename Bookmark - + ブックマークの名前変更 Add - + 追加 @@ -152,48 +153,48 @@ Add new page - + 新しいページの追加 Close current page - + 現在のページを閉じる Print Document - + ドキュメントを印刷 unknown - + 不明 Add New Page - + 新しいページの追加 Close This Page - + このページを閉じる Close Other Pages - + 他のページを閉じる Add Bookmark for this Page... - + このページをブックマークに追加... Search - + 検索 @@ -201,12 +202,12 @@ Open Link - + リンクを開く Open Link in New Tab - + リンクを新しいタブで開く @@ -214,12 +215,12 @@ Add Filter Name - + フィルタ名を追加 Filter Name: - + フィルタ名: @@ -227,27 +228,27 @@ Previous - + 戻る Next - + 進む Case Sensitive - + 大文字/小文字を区別する Whole words - + 単語単位で検索する <img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped - + <img src=":/trolltech/assistant/images/wrap.png">&nbsp;見つからなければ先頭から検索する @@ -255,27 +256,27 @@ Font - + フォント &Writing system - + 文字セット(&W) &Family - + フォント名(&F) &Style - + スタイル(&S) &Point size - + サイズ(&P) @@ -283,38 +284,39 @@ Help - + ヘルプ OK - + OK <title>Error 404...</title><div align="center"><br><br><h1>The page could not be found</h1><br><h3>'%1'</h3></div> - + <title>Error 404...</title><div align="center"><br><br><h1>ページが見つかりませんでした</h1><br><h3>'%1'</h3></div> Copy &Link Location - + リンクのURLをコピー(&L) Open Link in New Tab Ctrl+LMB - + リンクを新しいタブで開く Ctrl+LMB Open Link in New Tab - + リンクを新しいタブで開く Unable to launch external application. - + 外部アプリケーションを起動できません。 + @@ -322,17 +324,17 @@ &Look for: - + 検索文字列(&L): Open Link - + リンクを開く Open Link in New Tab - + リンクを新しいタブで開く @@ -341,97 +343,98 @@ Install Documentation - + ドキュメントのインストール Downloading documentation info... - + ドキュメント情報をダウンロード中... Download canceled. - + ダウンロードを中止しました。 Done. - + 完了. The file %1 already exists. Do you want to overwrite it? - + %1 は既に存在します。上書きしますか? Unable to save the file %1: %2. - + ファイルを保存できません。%1: %2. Downloading %1... - + %1 をダウンロード中... Download failed: %1. - + ダウンロード失敗: %1. Documentation info file is corrupt! - + ドキュメント情報ファイルが不正です! Download failed: Downloaded file is corrupted. - + ダウンロード失敗: ダウンロードしたファイルが不正です。 Installing documentation %1... - + %1 のドキュメントをインストール中... Error while installing documentation: %1 - + ドキュメントのインストール中にエラーが発生しました: +%1 Available Documentation: - + 使用可能なドキュメント: Install - + インストール Cancel - + キャンセル Close - + 閉じる Installation Path: - + インストール先のパス: ... - + ... @@ -440,298 +443,298 @@ Index - + インデックス Contents - + コンテンツ Bookmarks - + ブックマーク Search - + 検索 Qt Assistant - + Qt Assistant Unfiltered - + フィルタなし Page Set&up... - + ページ設定(&U)... Print Preview... - + 印刷プレビュー... &Print... - + 印刷(&P)... New &Tab - + 新しいタブ(&T) &Close Tab - + タブを閉じる(&C) &Quit - + 終了(&Q) CTRL+Q - + CTRL+Q &Copy selected Text - + 選択中の文字をコピー(&C) &Find in Text... - + 検索(&F)... Find &Next - + 次を検索(&N) Find &Previous - + 前を検索(&P) Preferences... - + 設定... Zoom &in - + 拡大(&I) Zoom &out - + 縮小(&O) Normal &Size - + 普通の大きさ(&S) Ctrl+0 - + Ctrl+0 ALT+C - + ALT+C ALT+I - + ALT+I ALT+S - + ALT+S &Home - + ホーム(&H) Ctrl+Home - + Ctrl+Home &Back - + 戻る(&B) &Forward - + 進む(&F) Sync with Table of Contents - + 内容と目次を同期する Next Page - + 次のページ Ctrl+Alt+Right - + Ctrl+Alt+Right Previous Page - + 前のページ Ctrl+Alt+Left - + Ctrl+Alt+Left Add Bookmark... - + ブックマークの追加... About... - + Qt Assistant について... Navigation Toolbar - + ナビゲーション ツールバー Toolbars - + ツールバー Filter Toolbar - + フィルター ツールバー Filtered by: - + フィルタ条件: Address Toolbar - + アドレス ツールバー Address: - + アドレス: Could not find the associated content item. - + 関連付いた内容が見つかりません。 About %1 - + %1 について Updating search index - + 検索インデックスを更新中 Looking for Qt Documentation... - + Qt ドキュメントを探しています... &Window - + ウィンドウ(&W) Minimize - + 最小化 Ctrl+M - + Ctrl+M Zoom - + ズーム &File - + ファイル(&F) &Edit - + 編集(&E) &View - + 表示(&V) &Go - + ジャンプ(&G) &Bookmarks - + ブックマーク(&B) &Help - + ヘルプ(&H) ALT+O - + ALT+O CTRL+D - + CTRL+D @@ -741,47 +744,47 @@ Add Documentation - + ドキュメントの追加 Qt Compressed Help Files (*.qch) - + 圧縮済み Qt ヘルプファイル (*.qch) The specified file is not a valid Qt Help File! - + 指定されたファイルは有効な Qt ヘルプ ファイルではありません! The namespace %1 is already registered! - + ネームスペース %1 は既に登録済みです! Remove Documentation - + ドキュメントの除去 Some documents currently opened in Assistant reference the documentation you are attempting to remove. Removing the documentation will close those documents. - + 除去しようとしているいくつかのドキュメントは Assistant 上で参照されています。除去すると、これらのドキュメントは閉じられます。 Cancel - + キャンセル OK - + OK Use custom settings - + 独自設定を使用する @@ -789,92 +792,92 @@ Preferences - + 設定 Fonts - + フォント Font settings: - + フォント設定: Browser - + ブラウザー Application - + アプリケーション Filters - + フィルタ Filter: - + フィルタ: Attributes: - + 属性: 1 - + 1 Add - + 追加 Remove - + 削除 Documentation - + ドキュメント Registered Documentation: - + 登録済みドキュメント: Add... - + 追加... Options - + オプション Current Page - + 現在のページ Restore to default - + デフォルト設定に戻す Homepage - + ホームページ @@ -882,64 +885,64 @@ The specified collection file does not exist! - + 指定されたコレクションファイルは存在しません! Missing collection file! - + コレクションファイルが見つかりません! Invalid URL! - + 不正なURLです! Missing URL! - + URLが見つかりません! Unknown widget: %1 - + 不明なウィジェット: %1 Missing widget! - + ウィジェットが見つかりません! The specified Qt help file does not exist! - + 指定された Qt ヘルプ ファイルが存在しません! Missing help file! - + ヘルプファイルが見つかりません! Missing filter argument! - + フィルタ引数が不足しています! Unknown option: %1 - + 不明なオプション: %1 Qt Assistant - + Qt Assistant @@ -948,12 +951,16 @@ Reason: %2 - + ドキュメントファイルを登録できませんでした。 +%1 + +原因: +%2 Documentation successfully registered. - + ドキュメントの登録に成功しました。 @@ -962,28 +969,32 @@ Reason: Reason: %2 - + ドキュメントファイルを解除できませんでした。 +%1 + +原因: +%2 Documentation successfully unregistered. - + ドキュメントの解放に成功しました。 Cannot load sqlite database driver! - + SQLite データベース ドライバーをロードできません! The specified collection file could not be read! - + 指定されたコレクションファイルは読み込めません! Bookmark - + ブックマーク @@ -991,12 +1002,12 @@ Reason: Debugging Remote Control - + リモート コントロールをデバッグ中 Received Command: %1 %2 - + 受信したコマンド: %1 %2 @@ -1004,28 +1015,28 @@ Reason: &Copy - + コピー(&C) Copy &Link Location - + リンクのURLをコピー(&L) Open Link in New Tab - + リンクを新しいタブで開く Select All - + すべてを選択 Open Link - + リンクを開く @@ -1033,27 +1044,27 @@ Reason: Choose a topic for <b>%1</b>: - + <b>%1</b> の検索先トピックを選択してください: Choose Topic - + トピックを選択 &Topics - + トピック(&T) &Display - + 表示(&D) &Close - + 閉じる(&C) -- cgit v0.12 From e5615b9cf4c981bb8d0fec48eacd6c11c124a3b0 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 May 2009 11:57:30 +0200 Subject: qdoc: Added some missing qdoc comments. Task-number: 252491 --- src/corelib/io/qfsfileengine.cpp | 2 +- src/gui/painting/qcolor.cpp | 8 +++++++ src/gui/painting/qcolormap_mac.cpp | 6 ----- src/gui/painting/qcolormap_x11.cpp | 4 ---- src/opengl/qgl.cpp | 48 +++++++++++++++++++++++++++++++++----- src/opengl/qgl_win.cpp | 16 +++---------- src/opengl/qgl_wince.cpp | 3 --- src/opengl/qgl_x11.cpp | 30 +++++------------------- 8 files changed, 60 insertions(+), 57 deletions(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index e79d867..07f3c9c 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -948,7 +948,7 @@ bool QFSFileEngine::supportsExtension(Extension extension) const For Windows, -2 is always returned. */ -/*! \fn QString QFSFileEngine::owner() const +/*! \fn QString QFSFileEngine::owner(FileOwner own) const \reimp */ diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 1723a19..c50004e 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -2241,4 +2241,12 @@ QDataStream &operator>>(QDataStream &stream, QColor &color) \sa QColor::rgb(), QColor::rgba() */ +/*! \fn void QColormap::initialize() + \internal +*/ + +/*! \fn void QColormap::cleanup() + \internal +*/ + QT_END_NAMESPACE diff --git a/src/gui/painting/qcolormap_mac.cpp b/src/gui/painting/qcolormap_mac.cpp index afe0378..96da90f 100644 --- a/src/gui/painting/qcolormap_mac.cpp +++ b/src/gui/painting/qcolormap_mac.cpp @@ -55,17 +55,11 @@ public: }; static QColormap *qt_mac_global_map = 0; -/*! - Creates the class's internal colormap. - */ void QColormap::initialize() { qt_mac_global_map = new QColormap; } -/*! - Deletes the class's internal colormap. - */ void QColormap::cleanup() { delete qt_mac_global_map; diff --git a/src/gui/painting/qcolormap_x11.cpp b/src/gui/painting/qcolormap_x11.cpp index ccf6955..c9186b1 100644 --- a/src/gui/painting/qcolormap_x11.cpp +++ b/src/gui/painting/qcolormap_x11.cpp @@ -337,8 +337,6 @@ static void init_direct(QColormapPrivate *d, bool ownColormap) static QColormap **cmaps = 0; -/*! \internal -*/ void QColormap::initialize() { Display *display = QX11Info::display(); @@ -578,8 +576,6 @@ void QColormap::initialize() } } -/*! \internal -*/ void QColormap::cleanup() { Display *display = QX11Info::display(); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 8f963f8..ca5c732 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2504,6 +2504,42 @@ const QGLContext* QGLContext::currentContext() visual. On other platforms it may work differently. */ +/*! \fn int QGLContext::choosePixelFormat(void* dummyPfd, HDC pdc) + + \bold{Win32 only:} This virtual function chooses a pixel format + that matches the OpenGL \link setFormat() format\endlink. + Reimplement this function in a subclass if you need a custom + context. + + \warning The \a dummyPfd pointer and \a pdc are used as a \c + PIXELFORMATDESCRIPTOR*. We use \c void to avoid using + Windows-specific types in our header files. + + \sa chooseContext() +*/ + +/*! \fn void *QGLContext::chooseVisual() + + \bold{X11 only:} This virtual function tries to find a visual that + matches the format, reducing the demands if the original request + cannot be met. + + The algorithm for reducing the demands of the format is quite + simple-minded, so override this method in your subclass if your + application has spcific requirements on visual selection. + + \sa chooseContext() +*/ + +/*! \fn void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth) + \internal + + \bold{X11 only:} This virtual function chooses a visual that matches + the OpenGL \link format() format\endlink. Reimplement this function + in a subclass if you need a custom visual. + + \sa chooseContext() +*/ /*! \fn void QGLContext::reset() @@ -3020,11 +3056,10 @@ void QGLWidget::setFormat(const QGLFormat &format) */ /* - \obsolete - \fn void QGLWidget::setContext(QGLContext *context, - const QGLContext* shareContext, - bool deleteOldContext) + const QGLContext* shareContext, + bool deleteOldContext) + \obsolete Sets a new context for this widget. The QGLContext \a context must be created using \e new. QGLWidget will delete \a context when @@ -3174,9 +3209,10 @@ void QGLWidget::resizeOverlayGL(int, int) { } - +/*! \fn bool QGLWidget::event(QEvent *e) + \reimp +*/ #if !defined(Q_OS_WINCE) && !defined(Q_WS_QWS) -/*! \reimp */ bool QGLWidget::event(QEvent *e) { Q_D(QGLWidget); diff --git a/src/opengl/qgl_win.cpp b/src/opengl/qgl_win.cpp index bd8569a..217b0fc 100644 --- a/src/opengl/qgl_win.cpp +++ b/src/opengl/qgl_win.cpp @@ -884,19 +884,9 @@ static bool qLogEq(bool a, bool b) return (((!a) && (!b)) || (a && b)); } -/*! - \bold{Win32 only:} This virtual function chooses a pixel - format that matches the OpenGL \link setFormat() format\endlink. - Reimplement this function in a subclass if you need a custom - context. - - \warning The \a dummyPfd pointer and \a pdc are used as a \c - PIXELFORMATDESCRIPTOR*. We use \c void to avoid using - Windows-specific types in our header files. - - \sa chooseContext() -*/ - +/* + See qgl.cpp for qdoc comment. + */ int QGLContext::choosePixelFormat(void* dummyPfd, HDC pdc) { Q_D(QGLContext); diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp index cb51598..7429071 100644 --- a/src/opengl/qgl_wince.cpp +++ b/src/opengl/qgl_wince.cpp @@ -552,9 +552,6 @@ void QGLWidgetPrivate::updateColormap() ReleaseDC(q->winId(), hdc); } -/*! - \reimp -\*/ bool QGLWidget::event(QEvent *e) { Q_D(QGLWidget); diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index 28c34de..7ed7a23 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -443,19 +443,9 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) return true; } - -/*! - \bold{X11 only:} This virtual function tries to find a - visual that matches the format, reducing the demands if the original - request cannot be met. - - The algorithm for reducing the demands of the format is quite - simple-minded, so override this method in your subclass if your - application has spcific requirements on visual selection. - - \sa chooseContext() -*/ - +/* + See qgl.cpp for qdoc comment. + */ void *QGLContext::chooseVisual() { Q_D(QGLContext); @@ -519,17 +509,9 @@ void *QGLContext::chooseVisual() return vis; } - -/*! - \internal - - \bold{X11 only:} This virtual function chooses a visual - that matches the OpenGL \link format() format\endlink. Reimplement this - function in a subclass if you need a custom visual. - - \sa chooseContext() -*/ - +/* + See qgl.cpp for qdoc comment. + */ void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth) { Q_D(QGLContext); -- cgit v0.12 From 44d992ca150d9448cb7b9114b2bc489b441c7b76 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 May 2009 12:25:28 +0200 Subject: qdoc: Added some missing qdoc comments. Task-number: 252489 --- src/gui/text/qfont.cpp | 14 ++++++++++++++ src/gui/text/qfont_x11.cpp | 11 ----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index f73ffb5..c5096bf 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1897,6 +1897,20 @@ void QFont::insertSubstitutions(const QString &familyName, } } +/*! \fn void QFont::initialize() + \internal + + Internal function that initializes the font system. The font cache + and font dict do not alloc the keys. The key is a QString which is + shared between QFontPrivate and QXFontName. +*/ + +/*! \fn void QFont::cleanup() + \internal + + Internal function that cleans up the font system. +*/ + // ### mark: should be called removeSubstitutions() /*! Removes all the substitutions for \a familyName. diff --git a/src/gui/text/qfont_x11.cpp b/src/gui/text/qfont_x11.cpp index 710792c..6b0e46c 100644 --- a/src/gui/text/qfont_x11.cpp +++ b/src/gui/text/qfont_x11.cpp @@ -129,13 +129,6 @@ Q_GUI_EXPORT void qt_x11_set_fallback_font_family(int script, const QString &fam int QFontPrivate::defaultEncodingID = -1; -/*! - Internal function that initializes the font system. - - \internal - The font cache and font dict do not alloc the keys. The key is a QString - which is shared between QFontPrivate and QXFontName. -*/ void QFont::initialize() { extern int qt_encoding_id_for_mib(int mib); // from qfontdatabase_x11.cpp @@ -184,10 +177,6 @@ void QFont::initialize() QFontPrivate::defaultEncodingID = qt_encoding_id_for_mib(mib); } -/*! \internal - - Internal function that cleans up the font system. -*/ void QFont::cleanup() { QFontCache::cleanup(); -- cgit v0.12