summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-05-18 14:31:07 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-05-18 14:31:07 (GMT)
commitf3988241faa59596c1702b31e7bec9538f33ee79 (patch)
tree39cc06b8455545cd1fd754c44838afcc3a0bdaac /src
parent7e4d4474d10cb17047d95e3a4820388468c74507 (diff)
parent5c25207628fbcc94e92b129ac7660af14613ad85 (diff)
downloadQt-f3988241faa59596c1702b31e7bec9538f33ee79.zip
Qt-f3988241faa59596c1702b31e7bec9538f33ee79.tar.gz
Qt-f3988241faa59596c1702b31e7bec9538f33ee79.tar.bz2
Merge commit 'origin/4.5'
Conflicts: src/corelib/kernel/qobject.cpp src/corelib/kernel/qobject_p.h src/network/access/qhttpnetworkconnection.cpp
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qobject.cpp13
-rw-r--r--src/gui/dialogs/qwizard.cpp4
-rw-r--r--src/gui/dialogs/qwizard_win.cpp5
-rw-r--r--src/gui/dialogs/qwizard_win_p.h2
-rw-r--r--src/gui/embedded/qsoundqss_qws.cpp40
-rw-r--r--src/gui/kernel/qwidget_mac.mm4
-rw-r--r--src/gui/painting/qtransform.cpp8
-rw-r--r--src/gui/text/qcssparser.cpp19
-rw-r--r--src/gui/widgets/qcalendarwidget.cpp2
-rw-r--r--src/gui/widgets/qmainwindow.cpp8
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp46
-rw-r--r--src/svg/qsvghandler.cpp15
-rw-r--r--src/xmlpatterns/expr/qxsltsimplecontentconstructor.cpp2
13 files changed, 114 insertions, 54 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 287ac30..9f803fa 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -752,14 +752,18 @@ QObject::~QObject()
}
// disconnect all senders
- for (int i = 0; i < d->senders.count(); ++i) {
+ for (int i = 0; i < d->senders.count(); ) {
QObjectPrivate::Connection *s = d->senders[i];
- if (!s->sender)
- continue;
QMutex *m = &s->sender->d_func()->threadData->mutex;
bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m);
- s = d->senders[i];
+ if (m < locker.mutex()) {
+ if (i >= d->senders.count() || s != d->senders[i]) {
+ if (needToUnlock)
+ m->unlock();
+ continue;
+ }
+ }
s->receiver = 0;
if (s->sender) {
QObjectConnectionListVector *senderLists = s->sender->d_func()->connectionLists;
@@ -769,6 +773,7 @@ QObject::~QObject()
if (needToUnlock)
m->unlock();
+ ++i;
}
d->senders.clear();
diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp
index 2c29ebf..b2ed983 100644
--- a/src/gui/dialogs/qwizard.cpp
+++ b/src/gui/dialogs/qwizard.cpp
@@ -1469,7 +1469,7 @@ void QWizardPrivate::handleAeroStyleChange()
return; // prevent recursion
inHandleAeroStyleChange = true;
- vistaHelper->backButton()->disconnect();
+ vistaHelper->disconnectBackButton();
q->removeEventFilter(vistaHelper);
if (isVistaThemeEnabled()) {
@@ -1495,7 +1495,7 @@ void QWizardPrivate::handleAeroStyleChange()
q->setMouseTracking(true); // ### original value possibly different
q->unsetCursor(); // ### ditto
antiFlickerWidget->move(0, 0);
- vistaHelper->backButton()->hide();
+ vistaHelper->hideBackButton();
vistaHelper->setTitleBarIconAndCaptionVisible(true);
}
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index 64696de..8aad4af 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -239,9 +239,11 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
QVistaHelper::QVistaHelper(QWizard *wizard)
: pressed(false)
, wizard(wizard)
+ , backButton_(0)
{
is_vista = resolveSymbols();
- backButton_ = new QVistaBackButton(wizard);
+ if (is_vista)
+ backButton_ = new QVistaBackButton(wizard);
}
QVistaHelper::~QVistaHelper()
@@ -310,6 +312,7 @@ void QVistaHelper::drawTitleBar(QPainter *painter)
QRect(0, 0, wizard->width(), titleBarSize() + topOffset()),
painter->paintEngine()->getDC());
+ Q_ASSERT(backButton_);
const int btnTop = backButton_->mapToParent(QPoint()).y();
const int btnHeight = backButton_->size().height();
const int verticalCenter = (btnTop + btnHeight / 2);
diff --git a/src/gui/dialogs/qwizard_win_p.h b/src/gui/dialogs/qwizard_win_p.h
index cbb3b17..148be26 100644
--- a/src/gui/dialogs/qwizard_win_p.h
+++ b/src/gui/dialogs/qwizard_win_p.h
@@ -94,6 +94,8 @@ public:
void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event);
QVistaBackButton *backButton() const { return backButton_; }
+ void disconnectBackButton() { if (backButton_) backButton_->disconnect(); }
+ void hideBackButton() { if (backButton_) backButton_->hide(); }
void setWindowPosHack();
QColor basicWindowFrameColor();
enum VistaState { VistaAero, VistaBasic, Classic, Dirty };
diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp
index c72ea91..283bbd3 100644
--- a/src/gui/embedded/qsoundqss_qws.cpp
+++ b/src/gui/embedded/qsoundqss_qws.cpp
@@ -52,6 +52,7 @@
#include <qalgorithms.h>
#include <qtimer.h>
#include <qpointer.h>
+#include <qendian.h>
#include <unistd.h>
#include <stdlib.h>
@@ -335,7 +336,13 @@ public:
virtual int readySamples(int) = 0;
int getSample(int off, int bps) {
- return (bps == 1) ? (data[out+off] - 128) * 128 : ((short*)data)[(out/2)+off];
+
+ //
+ // 16-bit audio data is converted to native endian so that it can be scaled
+ // Yes, this is ugly on a BigEndian machine
+ // Perhaps it shouldn't be scaled at all
+ //
+ return (bps == 1) ? (data[out+off] - 128) * 128 : qToLittleEndian(((short*)data)[(out/2)+off]);
}
int add(int* mixl, int* mixr, int count)
@@ -547,7 +554,7 @@ public:
wavedata_remaining = 0;
mFinishedRead = true;
} else if ( qstrncmp(chunk.id,"data",4) == 0 ) {
- wavedata_remaining = chunk.size;
+ wavedata_remaining = qToLittleEndian( chunk.size );
//out = max = sound_buffer_size;
@@ -572,10 +579,23 @@ public:
//qDebug("couldn't ready chunkdata");
mFinishedRead = true;
}
+
#define WAVE_FORMAT_PCM 1
- else if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) {
- //qDebug("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag);
- mFinishedRead = true;
+ else
+ {
+ /*
+ ** Endian Fix the chuck data
+ */
+ chunkdata.formatTag = qToLittleEndian( chunkdata.formatTag );
+ chunkdata.channels = qToLittleEndian( chunkdata.channels );
+ chunkdata.samplesPerSec = qToLittleEndian( chunkdata.samplesPerSec );
+ chunkdata.avgBytesPerSec = qToLittleEndian( chunkdata.avgBytesPerSec );
+ chunkdata.blockAlign = qToLittleEndian( chunkdata.blockAlign );
+ chunkdata.wBitsPerSample = qToLittleEndian( chunkdata.wBitsPerSample );
+ if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) {
+ qWarning("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag);
+ mFinishedRead = true;
+ }
}
} else {
// ignored chunk
@@ -1166,9 +1186,15 @@ bool QWSSoundServerPrivate::openDevice()
if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &v))
qWarning("Could not set fragments to %08x",v);
#ifdef QT_QWS_SOUND_16BIT
- v=AFMT_S16_LE; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v))
+ //
+ // Use native endian
+ // Since we have manipulated the data volume the data
+ // is now in native format, even though its stored
+ // as little endian in the WAV file
+ //
+ v=AFMT_S16_NE; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v))
qWarning("Could not set format %d",v);
- if (AFMT_S16_LE != v)
+ if (AFMT_S16_NE != v)
qDebug("Want format %d got %d", AFMT_S16_LE, v);
#else
v=AFMT_U8; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v))
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index cc291e3..8243f32 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -4025,8 +4025,8 @@ void QWidgetPrivate::applyMaxAndMinSizeOnWindow()
NSSize max = NSMakeSize(SF(extra->maxw), SF(extra->maxh));
NSSize min = NSMakeSize(SF(extra->minw), SF(extra->minh));
#undef SF
- [qt_mac_window_for(q) setMinSize:min];
- [qt_mac_window_for(q) setMaxSize:max];
+ [qt_mac_window_for(q) setContentMinSize:min];
+ [qt_mac_window_for(q) setContentMaxSize:max];
#endif
}
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 4a33b92..ec8c1dc 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -1425,7 +1425,8 @@ static inline QHomogeneousCoordinate mapHomogeneous(const QTransform &transform,
return c;
}
-static inline bool lineTo_clipped(QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b, bool needsMoveTo)
+static inline bool lineTo_clipped(QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b,
+ bool needsMoveTo, bool needsLineTo = true)
{
QHomogeneousCoordinate ha = mapHomogeneous(transform, a);
QHomogeneousCoordinate hb = mapHomogeneous(transform, b);
@@ -1458,7 +1459,8 @@ static inline bool lineTo_clipped(QPainterPath &path, const QTransform &transfor
if (needsMoveTo)
path.moveTo(ha.toPoint());
- path.lineTo(hb.toPoint());
+ if (needsLineTo)
+ path.lineTo(hb.toPoint());
return true;
}
@@ -1525,7 +1527,7 @@ static QPainterPath mapProjective(const QTransform &transform, const QPainterPat
}
if (path.elementCount() > 0 && lastMoveTo != last)
- lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo);
+ lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo, false);
return result;
}
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 8214e54..38621c1 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -1161,13 +1161,20 @@ static bool setFontWeightFromValue(const Value &value, QFont *font)
return true;
}
-static bool setFontFamilyFromValues(const QVector<Value> &values, QFont *font)
+/** \internal
+ * parse the font family from the values (starting from index \a start)
+ * and set it the \a font
+ * \returns true if a family was extracted.
+ */
+static bool setFontFamilyFromValues(const QVector<Value> &values, QFont *font, int start = 0)
{
QString family;
- for (int i = 0; i < values.count(); ++i) {
+ for (int i = start; i < values.count(); ++i) {
const Value &v = values.at(i);
- if (v.type == Value::TermOperatorComma)
- break;
+ if (v.type == Value::TermOperatorComma) {
+ family += QLatin1Char(',');
+ continue;
+ }
const QString str = v.variant.toString();
if (str.isEmpty())
break;
@@ -1221,9 +1228,7 @@ static void parseShorthandFontProperty(const QVector<Value> &values, QFont *font
}
if (i < values.count()) {
- QString fam = values.at(i).variant.toString();
- if (!fam.isEmpty())
- font->setFamily(fam);
+ setFontFamilyFromValues(values, font, i);
}
}
diff --git a/src/gui/widgets/qcalendarwidget.cpp b/src/gui/widgets/qcalendarwidget.cpp
index 92c12a5..4436c04 100644
--- a/src/gui/widgets/qcalendarwidget.cpp
+++ b/src/gui/widgets/qcalendarwidget.cpp
@@ -2791,7 +2791,7 @@ QTextCharFormat QCalendarWidget::dateTextFormat(const QDate &date) const
void QCalendarWidget::setDateTextFormat(const QDate &date, const QTextCharFormat &format)
{
Q_D(QCalendarWidget);
- if ( date.isNull() && !format.isValid() )
+ if (date.isNull())
d->m_model->m_dateFormats.clear();
else
d->m_model->m_dateFormats[date] = format;
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 502c1e9..558ba42 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -1408,10 +1408,10 @@ bool QMainWindow::event(QEvent *event)
This property is false by default and only has any effect on Mac OS X 10.4 or higher.
- If set to true, then the top toolbar area is replaced with a Carbon
- HIToolbar and all toolbars in the top toolbar area are moved to that. Any
- toolbars added afterwards will also be added to the Carbon HIToolbar. This
- means a couple of things.
+ If set to true, then the top toolbar area is replaced with a Carbon HIToolbar
+ or a Cocoa NSToolbar (depending on whether Qt was built with Carbon or Cocoa).
+ All toolbars in the top toolbar area and any toolbars added afterwards are
+ moved to that. This means a couple of things.
\list
\i QToolBars in this toolbar area are not movable and you cannot drag other
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index d4bf008..161e6e9 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -703,27 +703,36 @@ void QHttpNetworkConnectionPrivate::handleStatus(QAbstractSocket *socket, QHttpN
switch (statusCode) {
case 401:
case 407:
- handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend);
- if (resend) {
- int i = indexOf(socket);
-
- QNonContiguousByteDevice* uploadByteDevice = channels[i].request.uploadByteDevice();
- if (uploadByteDevice) {
- if (uploadByteDevice->reset()) {
- channels[i].written = 0;
- } else {
- emitReplyError(socket, reply, QNetworkReply::ContentReSendError);
- break;
+ if (handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend)) {
+ if (resend) {
+ int i = indexOf(socket);
+
+ QNonContiguousByteDevice* uploadByteDevice = channels[i].request.uploadByteDevice();
+ if (uploadByteDevice) {
+ if (uploadByteDevice->reset()) {
+ channels[i].written = 0;
+ } else {
+ emitReplyError(socket, reply, QNetworkReply::ContentReSendError);
+ break;
+ }
}
- }
-
- eraseData(reply);
- // also use async _q_startNextRequest so we dont break with closed
- // proxy or server connections..
- channels[i].resendCurrent = true;
- QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
+ eraseData(reply);
+ // also use async _q_startNextRequest so we dont break with closed
+ // proxy or server connections..
+ channels[i].resendCurrent = true;
+ QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection);
+ } else {
+ int i = indexOf(socket);
+ emit channels[i].reply->headerChanged();
+ emit channels[i].reply->readyRead();
+ QNetworkReply::NetworkError errorCode = (statusCode == 407)
+ ? QNetworkReply::ProxyAuthenticationRequiredError
+ : QNetworkReply::AuthenticationRequiredError;
+ reply->d_func()->errorString = errorDetail(errorCode, socket);
+ emit q->error(errorCode, reply->d_func()->errorString);
+ emit channels[i].reply->finished();
}
break;
default:
@@ -826,7 +835,6 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
// authentication is cancelled, send the current contents to the user.
emit channels[i].reply->headerChanged();
emit channels[i].reply->readyRead();
- emit channels[i].reply->finished();
QNetworkReply::NetworkError errorCode =
isProxy
? QNetworkReply::ProxyAuthenticationRequiredError
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index cb07c53..c5026b8 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -1673,10 +1673,19 @@ static void parseCSStoXMLAttrs(const QVector<QCss::Declaration> &declarations,
const QCss::Declaration &decl = declarations.at(i);
if (decl.d->property.isEmpty())
continue;
- if (decl.d->values.count() != 1)
- continue;
QCss::Value val = decl.d->values.first();
- QString valueStr = val.toString();
+ QString valueStr;
+ if (decl.d->values.count() != 1) {
+ for (int i=0; i<decl.d->values.count(); ++i) {
+ const QString &value = decl.d->values[i].toString();
+ if (value.isEmpty())
+ valueStr += QLatin1Char(',');
+ else
+ valueStr += value;
+ }
+ } else {
+ valueStr = val.toString();
+ }
if (val.type == QCss::Value::Uri) {
valueStr.prepend(QLatin1String("url("));
valueStr.append(QLatin1Char(')'));
diff --git a/src/xmlpatterns/expr/qxsltsimplecontentconstructor.cpp b/src/xmlpatterns/expr/qxsltsimplecontentconstructor.cpp
index ef77c76..104c5cc 100644
--- a/src/xmlpatterns/expr/qxsltsimplecontentconstructor.cpp
+++ b/src/xmlpatterns/expr/qxsltsimplecontentconstructor.cpp
@@ -105,7 +105,7 @@ Item XSLTSimpleContentConstructor::evaluateSingleton(const DynamicContext::Ptr &
QString result;
bool previousIsText = false;
- bool discard;
+ bool discard = false;
if(next)
{