From eb26efd476faa6e6986e62de12c24527a5476fd3 Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Thu, 1 Oct 2009 16:49:23 +1000 Subject: Fixes: Phonon-gst: use correct URLs for different disk types. RevBy: Andrew den Exter Details: Phonon gstreamer backend used cdda:// URL and corresponding gst source element regardless of disk type. --- src/3rdparty/phonon/gstreamer/mediaobject.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.cpp b/src/3rdparty/phonon/gstreamer/mediaobject.cpp index 13f9734..71cd87f 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.cpp +++ b/src/3rdparty/phonon/gstreamer/mediaobject.cpp @@ -904,8 +904,21 @@ void MediaObject::setSource(const MediaSource &source) case MediaSource::Disc: // CD tracks can be specified by setting the url in the following way uri=cdda:4 { - QUrl cdurl(QLatin1String("cdda://")); - if (createPipefromURL(cdurl)) + QUrl url; + switch (source.discType()) { + case Phonon::Cd: + url = QUrl(QLatin1String("cdda://")); + break; + case Phonon::Dvd: + url = QUrl(QLatin1String("dvd://")); + break; + case Phonon::Vcd: + url = QUrl(QLatin1String("vcd://")); + break; + default: + break; + } + if (!url.isEmpty() && createPipefromURL(url)) m_loading = true; else setError(tr("Could not open media source.")); -- cgit v0.12 From 58344e4fc4503e20c1eb0f8d97986bae5f1f4f71 Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Thu, 1 Oct 2009 16:56:53 +1000 Subject: Fixes: Phonon-gst: Respect device MediaSource property. Task: QT-1027 RevBy: Andrew den Exter Details: All gst disk sources support setting device name with "device" property, otherwise the default device is used. --- src/3rdparty/phonon/gstreamer/mediaobject.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.cpp b/src/3rdparty/phonon/gstreamer/mediaobject.cpp index 71cd87f..5dcbd42 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.cpp +++ b/src/3rdparty/phonon/gstreamer/mediaobject.cpp @@ -369,6 +369,11 @@ bool MediaObject::createPipefromURL(const QUrl &url) if (!m_datasource) return false; + // Set the device for MediaSource::Disc + QByteArray mediaDevice = QFile::encodeName(m_source.deviceName()); + if (!mediaDevice.isEmpty()) + g_object_set (m_datasource, "device", mediaDevice.constData(), (const char*)NULL); + // Link data source into pipeline gst_bin_add(GST_BIN(m_pipeline), m_datasource); if (!gst_element_link(m_datasource, m_decodebin)) { -- cgit v0.12 From 0b24f1996debc24a9af2bd1dc921f347506ac32c Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 1 Oct 2009 14:03:31 +0200 Subject: QNAM HTTP Code: Always send an Accept-Language header Send a header that we accept every language. Works around a bug in some broken websites and is hopefully of no harm for us. Task-number: QT-952 Reviewed-by: Thiago --- src/network/access/qhttpnetworkconnection.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 4fcbc1f..aef1258 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -244,6 +244,15 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) request.d->autoDecompress = false; #endif } + + // some websites mandate an accept-language header and fail + // if it is not sent. This is a problem with the website and + // not with us, but we work around this by setting a + // universal one always. + value = request.headerField("accept-language"); + if (value.isEmpty()) + request.setHeaderField("accept-language", "en,*"); + // set the User Agent value = request.headerField("user-agent"); if (value.isEmpty()) -- cgit v0.12 From ec05eed4fa68b7b1af2dead4fdbb83cd3a758ac0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 1 Oct 2009 12:51:41 +0200 Subject: make -help reflect reality --- tools/linguist/lupdate/main.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 8818b50..8560c7d 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -119,12 +119,11 @@ static void printUsage() " Name of a .pro file. Useful for files with .pro\n" " file syntax but different file suffix\n" " -source-language [_]\n" - " Specify/override the language of the source strings. Defaults to\n" - " POSIX if not specified and the file does not name it yet.\n" + " Specify the language of the source strings for new files.\n" + " Defaults to POSIX if not specified.\n" " -target-language [_]\n" - " Specify/override the language of the translation.\n" - " The target language is guessed from the file name if this option\n" - " is not specified and the file contents name no language yet.\n" + " Specify the language of the translations for new files.\n" + " Guessed from the file name if not specified.\n" " -version\n" " Display the version of lupdate and exit.\n" ).arg(m_defaultExtensions)); -- cgit v0.12 From ce7cf03ab1346b5f447db3d849d2c183abce0138 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 1 Oct 2009 13:37:21 +0200 Subject: make -{source,target}-language actually override values from files -help says it does, and it kinda makes sense --- tools/linguist/lconvert/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index c342def..3cc9509 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -215,10 +215,6 @@ int main(int argc, char *argv[]) return usage(args); tr.setLanguageCode(Translator::guessLanguageCodeFromFileName(inFiles[0].name)); - if (!targetLanguage.isEmpty()) - tr.setLanguageCode(targetLanguage); - if (!sourceLanguage.isEmpty()) - tr.setSourceLanguageCode(sourceLanguage); if (!tr.load(inFiles[0].name, cd, inFiles[0].format)) { qWarning() << qPrintable(cd.error()); @@ -237,6 +233,10 @@ int main(int argc, char *argv[]) tr.replaceSorted(tr2.message(j)); } + if (!targetLanguage.isEmpty()) + tr.setLanguageCode(targetLanguage); + if (!sourceLanguage.isEmpty()) + tr.setSourceLanguageCode(sourceLanguage); if (noObsolete) tr.stripObsoleteMessages(); if (noFinished) -- cgit v0.12 From da53926fe3e910941d0112072fcbeba565b967fe Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 1 Oct 2009 12:56:31 +0200 Subject: Fixes clipboard handling on X11. This fixes handling selection requests for invalid targets - when someone asks for a target that is not supported by the clipboard content we shouldn't do anything (unless it's MULTIPLE). Fixes copying data when using Synergy which tries to get all targets it knows about even if they are not listed in TARGETS. Task-number: QTBUG-4652 Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qdnd_x11.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index d1ef810..d5a6095 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -506,6 +506,7 @@ bool QX11Data::xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data *atomFormat = textprop.encoding; *dataFormat = textprop.format; *data = QByteArray((const char *) textprop.value, textprop.nitems * textprop.format / 8); + ret = true; DEBUG(" textprop type %lx\n" " textprop name '%s'\n" @@ -541,10 +542,11 @@ bool QX11Data::xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data dm->xdndMimeTransferedPixmap[dm->xdndMimeTransferedPixmapIndex] = pm; dm->xdndMimeTransferedPixmapIndex = (dm->xdndMimeTransferedPixmapIndex + 1) % 2; + ret = true; } } } - return data; + return ret && data != 0; } //$$$ -- cgit v0.12 From 984fe9ebfc6d9582d21bcf1d09cb0578fd163f54 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 29 Sep 2009 15:37:33 +0200 Subject: Fixed Designer property editor selection bug. When the editor had been created inside the QtPropertyEditorView (inheriting QTreeWidget), the subsequent show sent a synthetic mouse move event down to the QLineEdit, and a new selection was made on the text because the mouse button was marked as pressed in the event. QApplicationPrivate::sendSyntheticEnterLeave() now sends a mouse move event without any button pressed. Auto-test included in tst_QWidget. Task-number: QTBUG-4055 Task-number: 253159 Task-number: QT-659 Task-number: 245398 Reviewed-by: bnilsen --- src/gui/kernel/qapplication.cpp | 2 +- tests/auto/qwidget/tst_qwidget.cpp | 82 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 3715059..832d829 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -3002,7 +3002,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) qt_button_down = 0; // Send enter/leave events followed by a mouse move on the entered widget. - QMouseEvent e(QEvent::MouseMove, pos, globalPos, Qt::NoButton, mouse_buttons, modifier_buttons); + QMouseEvent e(QEvent::MouseMove, pos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); sendMouseEvent(widgetUnderCursor, &e, widgetUnderCursor, tlw, &qt_button_down, qt_last_mouse_receiver); #endif // QT_NO_CURSOR } diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 8d7e5fe..fe863fb 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -342,6 +342,7 @@ private slots: void maskedUpdate(); #if defined(Q_WS_WIN) || defined(Q_WS_X11) void syntheticEnterLeave(); + void taskQTBUG_4055_sendSyntheticEnterLeave(); #endif void windowFlags(); void initialPosForDontShowOnScreenWidgets(); @@ -8851,6 +8852,87 @@ void tst_QWidget::syntheticEnterLeave() QCOMPARE(window.numEnterEvents, 0); QCOMPARE(child1->numEnterEvents, 1); } + +void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() +{ + class SELParent : public QWidget + { + public: + SELParent(QWidget *parent = 0): QWidget(parent) { } + + void mousePressEvent(QMouseEvent *) { child->show(); } + QWidget *child; + }; + + class SELChild : public QWidget + { + public: + SELChild(QWidget *parent = 0) : QWidget(parent), numEnterEvents(0), numMouseMoveEvents(0) {} + void enterEvent(QEvent *) { ++numEnterEvents; } + void mouseMoveEvent(QMouseEvent *event) + { + QCOMPARE(event->button(), Qt::NoButton); + QCOMPARE(event->buttons(), Qt::MouseButtons(Qt::NoButton)); + ++numMouseMoveEvents; + } + void reset() { numEnterEvents = numMouseMoveEvents = 0; } + int numEnterEvents, numMouseMoveEvents; + }; + + SELParent parent; + parent.resize(200, 200); + SELChild child(&parent); + child.resize(200, 200); + parent.show(); + #ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&parent); + #endif + QTest::qWait(100); + + QCursor::setPos(child.mapToGlobal(QPoint(100, 100))); + QTest::qWait(100); + // Make sure the cursor has entered the child. + QVERIFY(child.numEnterEvents > 0); + + child.hide(); + child.reset(); + child.show(); + + // Make sure the child gets enter event and no mouse move event. + QCOMPARE(child.numEnterEvents, 1); + QCOMPARE(child.numMouseMoveEvents, 0); + + child.hide(); + child.reset(); + child.setMouseTracking(true); + child.show(); + + // Make sure the child gets enter event and mouse move event. + // Note that we verify event->button() and event->buttons() + // in SELChild::mouseMoveEvent(). + QCOMPARE(child.numEnterEvents, 1); + QCOMPARE(child.numMouseMoveEvents, 1); + + // Sending synthetic enter/leave trough the parent's mousePressEvent handler. + parent.child = &child; + + child.hide(); + child.reset(); + QTest::mouseClick(&parent, Qt::LeftButton); + + // Make sure the child gets enter event and one mouse move event. + QCOMPARE(child.numEnterEvents, 1); + QCOMPARE(child.numMouseMoveEvents, 1); + + child.hide(); + child.reset(); + child.setMouseTracking(false); + QTest::mouseClick(&parent, Qt::LeftButton); + + // Make sure the child gets enter event and no mouse move event. + QCOMPARE(child.numEnterEvents, 1); + QCOMPARE(child.numMouseMoveEvents, 0); + } #endif void tst_QWidget::windowFlags() -- cgit v0.12