summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/phonon/ds9/videorenderer_evr.cpp12
-rw-r--r--src/3rdparty/phonon/phonon/effectwidget.cpp2
-rw-r--r--src/3rdparty/phonon/phonon/globalconfig.cpp2
-rw-r--r--src/3rdparty/phonon/phonon/mediacontroller.cpp4
-rw-r--r--src/3rdparty/phonon/phonon/pulsesupport.cpp146
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp10
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue.cpp194
-rw-r--r--src/corelib/io/qprocess_symbian.cpp1
-rw-r--r--src/corelib/io/qresource.cpp2
-rw-r--r--src/corelib/tools/qalgorithms.qdoc2
-rw-r--r--src/corelib/tools/qsimd.cpp14
-rw-r--r--src/dbus/qdbusconnection_p.h13
-rw-r--r--src/dbus/qdbusintegrator.cpp35
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice.cpp8
-rw-r--r--src/declarative/declarative.pro5
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp20
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp53
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp72
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h12
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp28
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp11
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextlayout.cpp8
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp337
-rw-r--r--src/declarative/qml/qdeclarativebinding_p.h12
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings.cpp14
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp119
-rw-r--r--src/declarative/qml/qdeclarativecompiler_p.h1
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp5
-rw-r--r--src/declarative/qml/qdeclarativedata_p.h13
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp63
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp30
-rw-r--r--src/declarative/qml/qdeclarativeinstruction.cpp7
-rw-r--r--src/declarative/qml/qdeclarativeinstruction_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp11
-rw-r--r--src/declarative/qml/qdeclarativeparser.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeparser_p.h3
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp209
-rw-r--r--src/declarative/qml/qdeclarativeproperty_p.h8
-rw-r--r--src/declarative/qml/qdeclarativepropertycache.cpp1
-rw-r--r--src/declarative/qml/qdeclarativepropertycache_p.h1
-rw-r--r--src/declarative/qml/qdeclarativevaluetype.cpp46
-rw-r--r--src/declarative/qml/qdeclarativevme.cpp38
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject.cpp47
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject_p.h2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp8
-rw-r--r--src/declarative/util/qdeclarativepixmapcache.cpp2
-rw-r--r--src/gui/dialogs/qdialog.cpp4
-rw-r--r--src/gui/egl/qegl_x11.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp18
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h4
-rw-r--r--src/gui/image/qimage.cpp25
-rw-r--r--src/gui/image/qpixmap_raster.cpp11
-rw-r--r--src/gui/image/qpnghandler.cpp81
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp4
-rw-r--r--src/gui/itemviews/qstandarditemmodel.cpp2
-rw-r--r--src/gui/kernel/qeventdispatcher_s60_p.h7
-rw-r--r--src/gui/painting/qdrawhelper.cpp2
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp9
-rw-r--r--src/gui/painting/qemulationpaintengine_p.h3
-rw-r--r--src/gui/painting/qgrayraster.c36
-rw-r--r--src/gui/painting/qpathclipper.cpp14
-rw-r--r--src/gui/painting/qpdf.cpp4
-rw-r--r--src/gui/styles/qs60style_s60.cpp5
-rw-r--r--src/gui/styles/qstyle.cpp2
-rw-r--r--src/gui/styles/qstyleoption.cpp4
-rw-r--r--src/gui/text/qtextcursor.cpp3
-rw-r--r--src/gui/text/qtextdocument.cpp6
-rw-r--r--src/gui/text/qtextformat.cpp10
-rw-r--r--src/gui/widgets/qdockwidget.cpp17
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp2
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp9
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h4
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp2
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel_p.h2
-rw-r--r--src/network/access/qhttpnetworkreply.cpp6
-rw-r--r--src/network/access/qhttpnetworkreply_p.h1
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp1
-rw-r--r--src/network/access/qnetworkaccessbackend_p.h6
-rw-r--r--src/network/access/qnetworkaccessdatabackend.cpp6
-rw-r--r--src/network/access/qnetworkaccessdatabackend_p.h2
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp140
-rw-r--r--src/network/access/qnetworkaccesshttpbackend_p.h4
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp16
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp47
-rw-r--r--src/network/access/qnetworkrequest.h3
-rw-r--r--src/network/socket/qlocalsocket_win.cpp4
-rw-r--r--src/network/ssl/qsslcertificate.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp19
-rw-r--r--src/opengl/qgl.cpp4
-rw-r--r--src/opengl/qgl_x11egl.cpp3
-rw-r--r--src/opengl/qglpixelbuffer_egl.cpp1
-rw-r--r--src/opengl/qwindowsurface_gl.cpp13
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp1
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp2
-rw-r--r--src/plugins/bearer/icd/proxyconf.cpp22
-rw-r--r--src/plugins/bearer/icd/proxyconf.h1
-rw-r--r--src/plugins/graphicssystems/meego/dithering.cpp11
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp9
-rw-r--r--src/s60installs/eabi/QtGuiu.def6
-rw-r--r--src/xmlpatterns/data/qatomicvalue.cpp2
103 files changed, 1505 insertions, 770 deletions
diff --git a/src/3rdparty/phonon/ds9/videorenderer_evr.cpp b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp
index de3f46f..ff39eccc4 100644
--- a/src/3rdparty/phonon/ds9/videorenderer_evr.cpp
+++ b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp
@@ -62,19 +62,21 @@ namespace Phonon
VideoRendererEVR::VideoRendererEVR(QWidget *target) : m_target(target)
{
+ if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA)
+ return;
m_filter = Filter(CLSID_EnhancedVideoRenderer, IID_IBaseFilter);
if (!m_filter) {
return;
}
ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl);
- if (!filterControl) {
+ if (!filterControl ||
+ FAILED(filterControl->SetVideoWindow(reinterpret_cast<HWND>(target->winId()))) ||
+ FAILED(filterControl->SetAspectRatioMode(MFVideoARMode_None)) || // We're in control of the size
+ !getService<IMFVideoMixerControl>(m_filter, MR_VIDEO_MIXER_SERVICE, IID_IMFVideoMixerControl) ||
+ !getService<IMFVideoProcessor>(m_filter, MR_VIDEO_MIXER_SERVICE, IID_IMFVideoProcessor)) {
m_filter = Filter(); //will release the interface
- return;
}
-
- filterControl->SetVideoWindow(reinterpret_cast<HWND>(target->winId()));
- filterControl->SetAspectRatioMode(MFVideoARMode_None); // We're in control of the size
}
QImage VideoRendererEVR::snapshot() const
diff --git a/src/3rdparty/phonon/phonon/effectwidget.cpp b/src/3rdparty/phonon/phonon/effectwidget.cpp
index a2fe50f..edcbe1f 100644
--- a/src/3rdparty/phonon/phonon/effectwidget.cpp
+++ b/src/3rdparty/phonon/phonon/effectwidget.cpp
@@ -112,7 +112,7 @@ void EffectWidgetPrivate::autogenerateUi()
#endif
QWidget *control = 0;
- switch (para.type()) {
+ switch (int(para.type())) {
case QVariant::String:
{
QComboBox *cb = new QComboBox(q);
diff --git a/src/3rdparty/phonon/phonon/globalconfig.cpp b/src/3rdparty/phonon/phonon/globalconfig.cpp
index be751ce..f83ebc4 100644
--- a/src/3rdparty/phonon/phonon/globalconfig.cpp
+++ b/src/3rdparty/phonon/phonon/globalconfig.cpp
@@ -97,7 +97,7 @@ static void filter(ObjectDescriptionType type, BackendInterface *backendIface, Q
static QList<int> sortDevicesByCategoryPriority(const GlobalConfig *config, const QSettingsGroup *backendConfig, ObjectDescriptionType type, Phonon::Category category, QList<int> &defaultList)
{
- Q_ASSERT(config);
+ Q_ASSERT(config); Q_UNUSED(config);
Q_ASSERT(backendConfig);
Q_ASSERT(type == AudioOutputDeviceType || type == AudioCaptureDeviceType);
diff --git a/src/3rdparty/phonon/phonon/mediacontroller.cpp b/src/3rdparty/phonon/phonon/mediacontroller.cpp
index 59fd5c7..37af3f7 100644
--- a/src/3rdparty/phonon/phonon/mediacontroller.cpp
+++ b/src/3rdparty/phonon/phonon/mediacontroller.cpp
@@ -76,9 +76,9 @@ MediaController::~MediaController()
MediaController::Features MediaController::supportedFeatures() const
{
if (!d || !d->media) {
- return false;
+ return Features();
}
- IFACE false;
+ IFACE Features();
Features ret;
if (iface->hasInterface(AddonInterface::AngleInterface)) {
ret |= Angles;
diff --git a/src/3rdparty/phonon/phonon/pulsesupport.cpp b/src/3rdparty/phonon/phonon/pulsesupport.cpp
index 642843f..b1ba196 100644
--- a/src/3rdparty/phonon/phonon/pulsesupport.cpp
+++ b/src/3rdparty/phonon/phonon/pulsesupport.cpp
@@ -56,7 +56,7 @@ static int debugLevel() {
static int level = -1;
if (level < 1) {
level = 0;
- QString pulseenv = qgetenv("PHONON_PULSEAUDIO_DEBUG");
+ QByteArray pulseenv = qgetenv("PHONON_PULSEAUDIO_DEBUG");
int l = pulseenv.toInt();
if (l > 0)
level = (l > 2 ? 2 : l);
@@ -71,18 +71,18 @@ static void logMessage(const QString &message, int priority, QObject *obj)
QString output;
if (obj) {
// Strip away namespace from className
- QString className(obj->metaObject()->className());
+ QByteArray className(obj->metaObject()->className());
int nameLength = className.length() - className.lastIndexOf(':') - 1;
className = className.right(nameLength);
output.sprintf("%s %s (%s %p)", message.toLatin1().constData(),
obj->objectName().toLatin1().constData(),
- className.toLatin1().constData(), obj);
+ className.constData(), obj);
}
else {
output = message;
}
if (priority <= debugLevel()) {
- qDebug() << QString("PulseSupport(%1): %2").arg(priority).arg(output);
+ qDebug() << QString::fromLatin1("PulseSupport(%1): %2").arg(priority).arg(output);
}
}
}
@@ -96,7 +96,7 @@ class AudioDevice
: pulseName(name), pulseIndex(index)
{
properties["name"] = desc;
- properties["description"] = ""; // We don't have descriptions (well we do, but we use them as the name!)
+ properties["description"] = QLatin1String(""); // We don't have descriptions (well we do, but we use them as the name!)
properties["icon"] = icon;
properties["available"] = (index != PA_INVALID_INDEX);
properties["isAdvanced"] = false; // Nothing is advanced!
@@ -158,8 +158,8 @@ static void createGenericDevices()
s_outputDevices.clear();
s_outputDevicePriorities.clear();
index = s_deviceIndexCounter++;
- s_outputDeviceIndexes.insert("sink:default", index);
- s_outputDevices.insert(index, AudioDevice("sink:default", QObject::tr("PulseAudio Sound Server").toUtf8(), "audio-backend-pulseaudio", 0));
+ s_outputDeviceIndexes.insert(QLatin1String("sink:default"), index);
+ s_outputDevices.insert(index, AudioDevice(QLatin1String("sink:default"), QObject::tr("PulseAudio Sound Server"), QLatin1String("audio-backend-pulseaudio"), 0));
for (int i = Phonon::NoCategory; i <= Phonon::LastCategory; ++i) {
Phonon::Category cat = static_cast<Phonon::Category>(i);
s_outputDevicePriorities[cat].insert(0, index);
@@ -169,8 +169,8 @@ static void createGenericDevices()
s_captureDevices.clear();
s_captureDevicePriorities.clear();
index = s_deviceIndexCounter++;
- s_captureDeviceIndexes.insert("source:default", index);
- s_captureDevices.insert(index, AudioDevice("source:default", QObject::tr("PulseAudio Sound Server").toUtf8(), "audio-backend-pulseaudio", 0));
+ s_captureDeviceIndexes.insert(QLatin1String("source:default"), index);
+ s_captureDevices.insert(index, AudioDevice(QLatin1String("source:default"), QObject::tr("PulseAudio Sound Server"), QLatin1String("audio-backend-pulseaudio"), 0));
for (int i = Phonon::NoCategory; i <= Phonon::LastCategory; ++i) {
Phonon::Category cat = static_cast<Phonon::Category>(i);
s_captureDevicePriorities[cat].insert(0, index);
@@ -397,7 +397,7 @@ void sink_input_cb(pa_context *c, const pa_sink_input_info *i, int eol, void *us
if (pa_context_errno(c) == PA_ERR_NOENTITY)
return;
- logMessage(QString("Sink input callback failure"));
+ logMessage(QLatin1String("Sink input callback failure"));
return;
}
@@ -409,8 +409,8 @@ void sink_input_cb(pa_context *c, const pa_sink_input_info *i, int eol, void *us
// loop through (*i) and extract phonon->streamindex...
const char *t;
if ((t = pa_proplist_gets(i->proplist, "phonon.streamid"))) {
- logMessage(QString("Found PulseAudio stream index %1 for Phonon Output Stream %2").arg(i->index).arg(t));
- s_outputStreamIndexMap[QString(t)] = i->index;
+ logMessage(QString::fromLatin1("Found PulseAudio stream index %1 for Phonon Output Stream %2").arg(i->index).arg(QLatin1String(t)));
+ s_outputStreamIndexMap[QLatin1String(t)] = i->index;
// Find the sink's phonon index and notify whoever cares...
if (PA_INVALID_INDEX != i->sink) {
@@ -426,8 +426,8 @@ void sink_input_cb(pa_context *c, const pa_sink_input_info *i, int eol, void *us
}
if (found) {
// OK so we just emit our signal
- logMessage(QString("Letting the rest of phonon know about this"));
- s_instance->emitUsingDevice(QString(t), device);
+ logMessage(QLatin1String("Letting the rest of phonon know about this"));
+ s_instance->emitUsingDevice(QLatin1String(t), device);
}
}
}
@@ -441,7 +441,7 @@ void source_output_cb(pa_context *c, const pa_source_output_info *i, int eol, vo
if (pa_context_errno(c) == PA_ERR_NOENTITY)
return;
- logMessage(QString("Source output callback failure"));
+ logMessage(QLatin1String("Source output callback failure"));
return;
}
@@ -453,8 +453,8 @@ void source_output_cb(pa_context *c, const pa_source_output_info *i, int eol, vo
// loop through (*i) and extract phonon->streamindex...
const char *t;
if ((t = pa_proplist_gets(i->proplist, "phonon.streamid"))) {
- logMessage(QString("Found PulseAudio stream index %1 for Phonon Capture Stream %2").arg(i->index).arg(t));
- s_captureStreamIndexMap[QString(t)] = i->index;
+ logMessage(QString::fromLatin1("Found PulseAudio stream index %1 for Phonon Capture Stream %2").arg(i->index).arg(QLatin1String(t)));
+ s_captureStreamIndexMap[QLatin1String(t)] = i->index;
// Find the source's phonon index and notify whoever cares...
if (PA_INVALID_INDEX != i->source) {
@@ -470,8 +470,8 @@ void source_output_cb(pa_context *c, const pa_source_output_info *i, int eol, vo
}
if (found) {
// OK so we just emit our signal
- logMessage(QString("Letting the rest of phonon know about this"));
- s_instance->emitUsingDevice(QString(t), device);
+ logMessage(QLatin1String("Letting the rest of phonon know about this"));
+ s_instance->emitUsingDevice(QLatin1String(t), device);
}
}
}
@@ -486,17 +486,17 @@ static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t
QString phononid = s_outputStreamIndexMap.key(index);
if (!phononid.isEmpty()) {
if (s_outputStreamIndexMap.contains(phononid)) {
- logMessage(QString("Phonon Output Stream %1 is gone at the PA end. Marking it as invalid in our cache as we may reuse it.").arg(phononid));
+ logMessage(QString::fromLatin1("Phonon Output Stream %1 is gone at the PA end. Marking it as invalid in our cache as we may reuse it.").arg(phononid));
s_outputStreamIndexMap[phononid] = PA_INVALID_INDEX;
} else {
- logMessage(QString("Removing Phonon Output Stream %1 (it's gone!)").arg(phononid));
+ logMessage(QString::fromLatin1("Removing Phonon Output Stream %1 (it's gone!)").arg(phononid));
s_outputStreamIndexMap.remove(phononid);
}
}
} else {
pa_operation *o;
if (!(o = pa_context_get_sink_input_info(c, index, sink_input_cb, NULL))) {
- logMessage(QString("pa_context_get_sink_input_info() failed"));
+ logMessage(QLatin1String("pa_context_get_sink_input_info() failed"));
return;
}
pa_operation_unref(o);
@@ -508,17 +508,17 @@ static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t
QString phononid = s_captureStreamIndexMap.key(index);
if (!phononid.isEmpty()) {
if (s_captureStreamIndexMap.contains(phononid)) {
- logMessage(QString("Phonon Capture Stream %1 is gone at the PA end. Marking it as invalid in our cache as we may reuse it.").arg(phononid));
+ logMessage(QString::fromLatin1("Phonon Capture Stream %1 is gone at the PA end. Marking it as invalid in our cache as we may reuse it.").arg(phononid));
s_captureStreamIndexMap[phononid] = PA_INVALID_INDEX;
} else {
- logMessage(QString("Removing Phonon Capture Stream %1 (it's gone!)").arg(phononid));
+ logMessage(QString::fromLatin1("Removing Phonon Capture Stream %1 (it's gone!)").arg(phononid));
s_captureStreamIndexMap.remove(phononid);
}
}
} else {
pa_operation *o;
if (!(o = pa_context_get_source_output_info(c, index, source_output_cb, NULL))) {
- logMessage(QString("pa_context_get_sink_input_info() failed"));
+ logMessage(QLatin1String("pa_context_get_sink_input_info() failed"));
return;
}
pa_operation_unref(o);
@@ -528,29 +528,27 @@ static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t
}
-static const char* statename(pa_context_state_t state)
+static QString statename(pa_context_state_t state)
{
switch (state)
{
- case PA_CONTEXT_UNCONNECTED: return "Unconnected";
- case PA_CONTEXT_CONNECTING: return "Connecting";
- case PA_CONTEXT_AUTHORIZING: return "Authorizing";
- case PA_CONTEXT_SETTING_NAME: return "Setting Name";
- case PA_CONTEXT_READY: return "Ready";
- case PA_CONTEXT_FAILED: return "Failed";
- case PA_CONTEXT_TERMINATED: return "Terminated";
+ case PA_CONTEXT_UNCONNECTED: return QLatin1String("Unconnected");
+ case PA_CONTEXT_CONNECTING: return QLatin1String("Connecting");
+ case PA_CONTEXT_AUTHORIZING: return QLatin1String("Authorizing");
+ case PA_CONTEXT_SETTING_NAME: return QLatin1String("Setting Name");
+ case PA_CONTEXT_READY: return QLatin1String("Ready");
+ case PA_CONTEXT_FAILED: return QLatin1String("Failed");
+ case PA_CONTEXT_TERMINATED: return QLatin1String("Terminated");
}
- static QString unknown;
- unknown = QString("Unknown state: %0").arg(state);
- return unknown.toAscii().constData();
+ return QString::fromLatin1("Unknown state: %0").arg(state);
}
static void context_state_callback(pa_context *c, void *)
{
Q_ASSERT(c);
- logMessage(QString("context_state_callback %1").arg(statename(pa_context_get_state(c))));
+ logMessage(QString::fromLatin1("context_state_callback %1").arg(statename(pa_context_get_state(c))));
pa_context_state_t state = pa_context_get_state(c);
if (state == PA_CONTEXT_READY) {
// We've connected to PA, so it is active
@@ -566,7 +564,7 @@ static void context_state_callback(pa_context *c, void *)
if (!(o = pa_context_subscribe(c, (pa_subscription_mask_t)
(PA_SUBSCRIPTION_MASK_SINK_INPUT|
PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT), NULL, NULL))) {
- logMessage(QString("pa_context_subscribe() failed"));
+ logMessage(QLatin1String("pa_context_subscribe() failed"));
return;
}
pa_operation_unref(o);
@@ -639,27 +637,27 @@ PulseSupport::PulseSupport()
{
#ifdef HAVE_PULSEAUDIO
// Initialise our map (is there a better way to do this?)
- s_roleCategoryMap["none"] = Phonon::NoCategory;
- s_roleCategoryMap["video"] = Phonon::VideoCategory;
- s_roleCategoryMap["music"] = Phonon::MusicCategory;
- s_roleCategoryMap["game"] = Phonon::GameCategory;
- s_roleCategoryMap["event"] = Phonon::NotificationCategory;
- s_roleCategoryMap["phone"] = Phonon::CommunicationCategory;
- //s_roleCategoryMap["animation"]; // No Mapping
- //s_roleCategoryMap["production"]; // No Mapping
- s_roleCategoryMap["a11y"] = Phonon::AccessibilityCategory;
+ s_roleCategoryMap[QLatin1String("none")] = Phonon::NoCategory;
+ s_roleCategoryMap[QLatin1String("video")] = Phonon::VideoCategory;
+ s_roleCategoryMap[QLatin1String("music")] = Phonon::MusicCategory;
+ s_roleCategoryMap[QLatin1String("game")] = Phonon::GameCategory;
+ s_roleCategoryMap[QLatin1String("event")] = Phonon::NotificationCategory;
+ s_roleCategoryMap[QLatin1String("phone")] = Phonon::CommunicationCategory;
+ //s_roleCategoryMap[QLatin1String("animation")]; // No Mapping
+ //s_roleCategoryMap[QLatin1String("production")]; // No Mapping
+ s_roleCategoryMap[QLatin1String("a11y")] = Phonon::AccessibilityCategory;
// To allow for easy debugging, give an easy way to disable this pulseaudio check
- QString pulseenv = qgetenv("PHONON_PULSEAUDIO_DISABLE");
+ QByteArray pulseenv = qgetenv("PHONON_PULSEAUDIO_DISABLE");
if (pulseenv.toInt()) {
- logMessage("PulseAudio support disabled: PHONON_PULSEAUDIO_DISABLE is set");
+ logMessage(QLatin1String("PulseAudio support disabled: PHONON_PULSEAUDIO_DISABLE is set"));
return;
}
// We require a glib event loop
- if (QLatin1String(QAbstractEventDispatcher::instance()->metaObject()->className())
- != "QGuiEventDispatcherGlib") {
- logMessage("Disabling PulseAudio integration for lack of GLib event loop.");
+ if (strcmp(QAbstractEventDispatcher::instance()->metaObject()->className(),
+ "QGuiEventDispatcherGlib") != 0) {
+ logMessage(QLatin1String("Disabling PulseAudio integration for lack of GLib event loop."));
return;
}
@@ -667,21 +665,21 @@ PulseSupport::PulseSupport()
// use a fully async integrated mainloop method to connect and get proper support.
pa_mainloop *p_test_mainloop;
if (!(p_test_mainloop = pa_mainloop_new())) {
- logMessage("PulseAudio support disabled: Unable to create mainloop");
+ logMessage(QLatin1String("PulseAudio support disabled: Unable to create mainloop"));
return;
}
pa_context *p_test_context;
if (!(p_test_context = pa_context_new(pa_mainloop_get_api(p_test_mainloop), "libphonon-probe"))) {
- logMessage("PulseAudio support disabled: Unable to create context");
+ logMessage(QLatin1String("PulseAudio support disabled: Unable to create context"));
pa_mainloop_free(p_test_mainloop);
return;
}
- logMessage("Probing for PulseAudio...");
+ logMessage(QLatin1String("Probing for PulseAudio..."));
// (cg) Convert to PA_CONTEXT_NOFLAGS when PulseAudio 0.9.19 is required
if (pa_context_connect(p_test_context, NULL, static_cast<pa_context_flags_t>(0), NULL) < 0) {
- logMessage(QString("PulseAudio support disabled: %1").arg(pa_strerror(pa_context_errno(p_test_context))));
+ logMessage(QString::fromLatin1("PulseAudio support disabled: %1").arg(QString::fromLocal8Bit(pa_strerror(pa_context_errno(p_test_context)))));
pa_context_disconnect(p_test_context);
pa_context_unref(p_test_context);
pa_mainloop_free(p_test_mainloop);
@@ -693,7 +691,7 @@ PulseSupport::PulseSupport()
pa_mainloop_iterate(p_test_mainloop, 1, NULL);
if (!PA_CONTEXT_IS_GOOD(pa_context_get_state(p_test_context))) {
- logMessage("PulseAudio probe complete.");
+ logMessage(QLatin1String("PulseAudio probe complete."));
break;
}
}
@@ -702,12 +700,12 @@ PulseSupport::PulseSupport()
pa_mainloop_free(p_test_mainloop);
if (!s_pulseActive) {
- logMessage("PulseAudio support is not available.");
+ logMessage(QLatin1String("PulseAudio support is not available."));
return;
}
// If we're still here, PA is available.
- logMessage("PulseAudio support enabled");
+ logMessage(QLatin1String("PulseAudio support enabled"));
// Now we connect for real using a proper main loop that we can forget
// all about processing.
@@ -856,7 +854,7 @@ static void setDevicePriority(Category category, QStringList list)
if (role.isEmpty())
return;
- logMessage(QString("Reindexing %1: %2").arg(role).arg(list.join(", ")));
+ logMessage(QString::fromLatin1("Reindexing %1: %2").arg(role).arg(list.join(QLatin1String(", "))));
char **devices;
devices = pa_xnew(char *, list.size()+1);
@@ -926,7 +924,7 @@ void PulseSupport::setStreamPropList(Category category, QString streamUuid)
if (role.isEmpty())
return;
- logMessage(QString("Setting role to %1 for streamindex %2").arg(role).arg(streamUuid));
+ logMessage(QString::fromLatin1("Setting role to %1 for streamindex %2").arg(role).arg(streamUuid));
setenv("PULSE_PROP_media.role", role.toLatin1().constData(), 1);
setenv("PULSE_PROP_phonon.streamid", streamUuid.toLatin1().constData(), 1);
#endif
@@ -952,30 +950,30 @@ bool PulseSupport::setOutputDevice(QString streamUuid, int device) {
return true;
if (!s_outputDevices.contains(device)) {
- logMessage(QString("Attempting to set Output Device for invalid device id %1.").arg(device));
+ logMessage(QString::fromLatin1("Attempting to set Output Device for invalid device id %1.").arg(device));
return false;
}
const QVariant var = s_outputDevices[device].properties["name"];
- logMessage(QString("Attempting to set Output Device to '%1' for Output Stream %2").arg(var.toString()).arg(streamUuid));
+ logMessage(QString::fromLatin1("Attempting to set Output Device to '%1' for Output Stream %2").arg(var.toString()).arg(streamUuid));
// Attempt to look up the pulse stream index.
if (s_outputStreamIndexMap.contains(streamUuid) && s_outputStreamIndexMap[streamUuid] != PA_INVALID_INDEX) {
- logMessage(QString("... Found in map. Moving now"));
+ logMessage(QLatin1String("... Found in map. Moving now"));
uint32_t pulse_device_index = s_outputDevices[device].pulseIndex;
uint32_t pulse_stream_index = s_outputStreamIndexMap[streamUuid];
- logMessage(QString("Moving Pulse Sink Input %1 to '%2' (Pulse Sink %3)").arg(pulse_stream_index).arg(var.toString()).arg(pulse_device_index));
+ logMessage(QString::fromLatin1("Moving Pulse Sink Input %1 to '%2' (Pulse Sink %3)").arg(pulse_stream_index).arg(var.toString()).arg(pulse_device_index));
/// @todo Find a way to move the stream without saving it... We don't want to pollute the stream restore db.
pa_operation* o;
if (!(o = pa_context_move_sink_input_by_index(s_context, pulse_stream_index, pulse_device_index, NULL, NULL))) {
- logMessage(QString("pa_context_move_sink_input_by_index() failed"));
+ logMessage(QLatin1String("pa_context_move_sink_input_by_index() failed"));
return false;
}
pa_operation_unref(o);
} else {
- logMessage(QString("... Not found in map. We will be notified of the device when the stream appears and we can process any moves needed then"));
+ logMessage(QLatin1String("... Not found in map. We will be notified of the device when the stream appears and we can process any moves needed then"));
}
return true;
#endif
@@ -991,30 +989,30 @@ bool PulseSupport::setCaptureDevice(QString streamUuid, int device) {
return true;
if (!s_captureDevices.contains(device)) {
- logMessage(QString("Attempting to set Capture Device for invalid device id %1.").arg(device));
+ logMessage(QString::fromLatin1("Attempting to set Capture Device for invalid device id %1.").arg(device));
return false;
}
const QVariant var = s_captureDevices[device].properties["name"];
- logMessage(QString("Attempting to set Capture Device to '%1' for Capture Stream %2").arg(var.toString()).arg(streamUuid));
+ logMessage(QString::fromLatin1("Attempting to set Capture Device to '%1' for Capture Stream %2").arg(var.toString()).arg(streamUuid));
// Attempt to look up the pulse stream index.
if (s_captureStreamIndexMap.contains(streamUuid) && s_captureStreamIndexMap[streamUuid] == PA_INVALID_INDEX) {
- logMessage(QString("... Found in map. Moving now"));
+ logMessage(QString::fromLatin1("... Found in map. Moving now"));
uint32_t pulse_device_index = s_captureDevices[device].pulseIndex;
uint32_t pulse_stream_index = s_captureStreamIndexMap[streamUuid];
- logMessage(QString("Moving Pulse Source Output %1 to '%2' (Pulse Sink %3)").arg(pulse_stream_index).arg(var.toString()).arg(pulse_device_index));
+ logMessage(QString::fromLatin1("Moving Pulse Source Output %1 to '%2' (Pulse Sink %3)").arg(pulse_stream_index).arg(var.toString()).arg(pulse_device_index));
/// @todo Find a way to move the stream without saving it... We don't want to pollute the stream restore db.
pa_operation* o;
if (!(o = pa_context_move_source_output_by_index(s_context, pulse_stream_index, pulse_device_index, NULL, NULL))) {
- logMessage(QString("pa_context_move_source_output_by_index() failed"));
+ logMessage(QString::fromLatin1("pa_context_move_source_output_by_index() failed"));
return false;
}
pa_operation_unref(o);
} else {
- logMessage(QString("... Not found in map. We will be notified of the device when the stream appears and we can process any moves needed then"));
+ logMessage(QString::fromLatin1("... Not found in map. We will be notified of the device when the stream appears and we can process any moves needed then"));
}
return true;
#endif
@@ -1025,7 +1023,7 @@ void PulseSupport::clearStreamCache(QString streamUuid) {
Q_UNUSED(streamUuid);
return;
#else
- logMessage(QString("Clearing stream cache for stream %1").arg(streamUuid));
+ logMessage(QString::fromLatin1("Clearing stream cache for stream %1").arg(streamUuid));
s_outputStreamIndexMap.remove(streamUuid);
s_captureStreamIndexMap.remove(streamUuid);
#endif
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index 18c3c9f..1e6dcee 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -228,8 +228,14 @@ void QPollingFileSystemWatcherEngine::timeout()
dit.remove();
emit directoryChanged(path, true);
} else if (x.value() != fi) {
- x.value() = fi;
- emit directoryChanged(path, false);
+ fi.refresh();
+ if (!fi.exists()) {
+ dit.remove();
+ emit directoryChanged(path, true);
+ } else {
+ x.value() = fi;
+ emit directoryChanged(path, false);
+ }
}
}
diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
index 378ad20..3664396 100644
--- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp
+++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
@@ -117,67 +117,77 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths,
QStringList *files,
QStringList *directories)
{
- QMutexLocker locker(&mutex);
-
QStringList p = paths;
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
- QString path = it.next();
- int fd;
+ {
+ QMutexLocker locker(&mutex);
+
+ QMutableListIterator<QString> it(p);
+ while (it.hasNext()) {
+ QString path = it.next();
+ int fd;
#if defined(O_EVTONLY)
- fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY);
+ fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY);
#else
- fd = qt_safe_open(QFile::encodeName(path), O_RDONLY);
+ fd = qt_safe_open(QFile::encodeName(path), O_RDONLY);
#endif
- if (fd == -1) {
- perror("QKqueueFileSystemWatcherEngine::addPaths: open");
- continue;
- }
+ if (fd == -1) {
+ perror("QKqueueFileSystemWatcherEngine::addPaths: open");
+ continue;
+ }
+ if (fd >= (int)FD_SETSIZE / 2 && fd < (int)FD_SETSIZE) {
+ int fddup = fcntl(fd, F_DUPFD, FD_SETSIZE);
+ if (fddup != -1) {
+ ::close(fd);
+ fd = fddup;
+ }
+ }
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
- QT_STATBUF st;
- if (QT_FSTAT(fd, &st) == -1) {
- perror("QKqueueFileSystemWatcherEngine::addPaths: fstat");
- ::close(fd);
- continue;
- }
- int id = (S_ISDIR(st.st_mode)) ? -fd : fd;
- if (id < 0) {
- if (directories->contains(path)) {
+ QT_STATBUF st;
+ if (QT_FSTAT(fd, &st) == -1) {
+ perror("QKqueueFileSystemWatcherEngine::addPaths: fstat");
::close(fd);
continue;
}
- } else {
- if (files->contains(path)) {
+ int id = (S_ISDIR(st.st_mode)) ? -fd : fd;
+ if (id < 0) {
+ if (directories->contains(path)) {
+ ::close(fd);
+ continue;
+ }
+ } else {
+ if (files->contains(path)) {
+ ::close(fd);
+ continue;
+ }
+ }
+
+ struct kevent kev;
+ EV_SET(&kev,
+ fd,
+ EVFILT_VNODE,
+ EV_ADD | EV_ENABLE | EV_CLEAR,
+ NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE,
+ 0,
+ 0);
+ if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) {
+ perror("QKqueueFileSystemWatcherEngine::addPaths: kevent");
::close(fd);
continue;
}
- }
- struct kevent kev;
- EV_SET(&kev,
- fd,
- EVFILT_VNODE,
- EV_ADD | EV_ENABLE | EV_ONESHOT,
- NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE,
- 0,
- 0);
- if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) {
- perror("QKqueueFileSystemWatcherEngine::addPaths: kevent");
- ::close(fd);
- continue;
- }
+ it.remove();
+ if (id < 0) {
+ DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path;
+ directories->append(path);
+ } else {
+ DEBUG() << "QKqueueFileSystemWatcherEngine: added file path" << path;
+ files->append(path);
+ }
- it.remove();
- if (id < 0) {
- DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path;
- directories->append(path);
- } else {
- DEBUG() << "QKqueueFileSystemWatcherEngine: added file path" << path;
- files->append(path);
+ pathToID.insert(path, id);
+ idToPath.insert(id, path);
}
-
- pathToID.insert(path, id);
- idToPath.insert(id, path);
}
if (!isRunning())
@@ -192,43 +202,35 @@ QStringList QKqueueFileSystemWatcherEngine::removePaths(const QStringList &paths
QStringList *files,
QStringList *directories)
{
- QMutexLocker locker(&mutex);
-
+ bool isEmpty;
QStringList p = paths;
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
- QString path = it.next();
- int id = pathToID.take(path);
- QString x = idToPath.take(id);
- if (x.isEmpty() || x != path)
- continue;
-
- int fd = id < 0 ? -id : id;
- struct kevent kev;
- EV_SET(&kev,
- fd,
- EVFILT_VNODE,
- EV_DELETE,
- NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE,
- 0,
- 0);
- if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) {
- perror("QKqueueFileSystemWatcherEngine::removeWatch: kevent");
- }
- ::close(fd);
+ {
+ QMutexLocker locker(&mutex);
+ if (pathToID.isEmpty())
+ return p;
+
+ QMutableListIterator<QString> it(p);
+ while (it.hasNext()) {
+ QString path = it.next();
+ int id = pathToID.take(path);
+ QString x = idToPath.take(id);
+ if (x.isEmpty() || x != path)
+ continue;
- it.remove();
- if (id < 0)
- directories->removeAll(path);
- else
- files->removeAll(path);
+ ::close(id < 0 ? -id : id);
+
+ it.remove();
+ if (id < 0)
+ directories->removeAll(path);
+ else
+ files->removeAll(path);
+ }
+ isEmpty = pathToID.isEmpty();
}
- if (pathToID.isEmpty()) {
+ if (isEmpty) {
stop();
- locker.unlock();
wait();
- locker.relock();
} else {
write(kqpipe[1], "@", 1);
}
@@ -243,19 +245,15 @@ void QKqueueFileSystemWatcherEngine::stop()
void QKqueueFileSystemWatcherEngine::run()
{
- static const struct timespec ZeroTimeout = { 0, 0 };
-
forever {
+ int r;
struct kevent kev;
DEBUG() << "QKqueueFileSystemWatcherEngine: waiting for kevents...";
- int r = kevent(kqfd, 0, 0, &kev, 1, 0);
+ EINTR_LOOP(r, kevent(kqfd, 0, 0, &kev, 1, 0));
if (r < 0) {
perror("QKqueueFileSystemWatcherEngine: error during kevent wait");
return;
- }
-
- QMutexLocker locker(&mutex);
- do {
+ } else {
int fd = kev.ident;
DEBUG() << "QKqueueFileSystemWatcherEngine: processing kevent" << kev.ident << kev.filter;
@@ -287,6 +285,8 @@ void QKqueueFileSystemWatcherEngine::run()
break;
}
} else {
+ QMutexLocker locker(&mutex);
+
int id = fd;
QString path = idToPath.value(id);
if (path.isEmpty()) {
@@ -295,12 +295,12 @@ void QKqueueFileSystemWatcherEngine::run()
path = idToPath.value(id);
if (path.isEmpty()) {
DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent for a file we're not watching";
- goto process_next_event;
+ continue;
}
}
if (kev.filter != EVFILT_VNODE) {
DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent with the wrong filter";
- goto process_next_event;
+ continue;
}
if ((kev.fflags & (NOTE_DELETE | NOTE_REVOKE | NOTE_RENAME)) != 0) {
@@ -315,31 +315,15 @@ void QKqueueFileSystemWatcherEngine::run()
else
emit fileChanged(path, true);
} else {
- DEBUG() << path << "changed, re-enabling watch";
+ DEBUG() << path << "changed";
if (id < 0)
emit directoryChanged(path, false);
else
emit fileChanged(path, false);
-
- // renable the watch
- EV_SET(&kev,
- fd,
- EVFILT_VNODE,
- EV_ADD | EV_ENABLE | EV_ONESHOT,
- NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE,
- 0,
- 0);
- if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) {
- perror("QKqueueFileSystemWatcherEngine::processKqueueEvents: kevent EV_ADD");
- }
}
}
-
- // are there any more?
-process_next_event:
- r = kevent(kqfd, 0, 0, &kev, 1, &ZeroTimeout);
- } while (r > 0);
+ }
}
}
diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp
index 003e781..5b283a5 100644
--- a/src/corelib/io/qprocess_symbian.cpp
+++ b/src/corelib/io/qprocess_symbian.cpp
@@ -1050,6 +1050,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
newProc->Resume();
newProc->Close();
+ delete newProc;
return true;
}
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index ce9c57e..b45710c 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -187,7 +187,7 @@ Q_GLOBAL_STATIC(QStringList, resourceSearchPaths)
A QResource can either be loaded with an absolute path, either treated
as a file system rooted with a \c{/} character, or in resource notation
rooted with a \c{:} character. A relative resource can also be opened
- which will be found through the searchPaths().
+ which will be found in the list of paths returned by QDir::searchPaths().
A QResource that is representing a file will have data backing it, this
data can possibly be compressed, in which case qUncompress() must be
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc
index 898f940..cd33f28 100644
--- a/src/corelib/tools/qalgorithms.qdoc
+++ b/src/corelib/tools/qalgorithms.qdoc
@@ -266,7 +266,7 @@
\overload
- This is the same as qFind(\a{container}.begin(), \a{container}.end(), value);
+ This is the same as qFind(\a{container}.constBegin(), \a{container}.constEnd(), value);
*/
/*! \fn void qCount(InputIterator begin, InputIterator end, const T &value, Size &n)
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index 63ebafb..bc5e9e4 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -285,7 +285,13 @@ static inline uint detectProcessorFeatures()
uint features = MMX|SSE|SSE2|CMOV;
uint feature_result = 0;
-#if defined(Q_CC_GNU)
+#if defined (Q_OS_WIN64)
+ {
+ int info[4];
+ __cpuid(info, 1);
+ feature_result = info[2];
+ }
+#elif defined(Q_CC_GNU)
quint64 tmp;
asm ("xchg %%rbx, %1\n"
"cpuid\n"
@@ -294,12 +300,6 @@ static inline uint detectProcessorFeatures()
: "a" (1)
: "%edx"
);
-#elif defined (Q_OS_WIN64)
- {
- int info[4];
- __cpuid(info, 1);
- feature_result = info[2];
- }
#endif
if (feature_result & (1u))
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index 1bd00da..67145b8 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -203,6 +203,8 @@ public:
void disconnectRelay(const QString &service,
const QString &path, const QString &interface,
QDBusAbstractInterface *receiver, const char *signal);
+ void registerService(const QString &serviceName);
+ void unregisterService(const QString &serviceName);
bool handleMessage(const QDBusMessage &msg);
void waitForFinished(QDBusPendingCallPrivate *pcall);
@@ -247,9 +249,11 @@ public slots:
void socketWrite(int);
void objectDestroyed(QObject *o);
void relaySignal(QObject *obj, const QMetaObject *, int signalId, const QVariantList &args);
- void _q_serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
- void registerService(const QString &serviceName);
- void unregisterService(const QString &serviceName);
+
+private slots:
+ void serviceOwnerChangedNoLock(const QString &name, const QString &oldOwner, const QString &newOwner);
+ void registerServiceNoLock(const QString &serviceName);
+ void unregisterServiceNoLock(const QString &serviceName);
signals:
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
@@ -303,6 +307,9 @@ public:
QObject *receiver, const char *signal, int minMIdx,
bool buildSignature);
static DBusHandlerResult messageFilter(DBusConnection *, DBusMessage *, void *);
+ static bool checkReplyForDelivery(QDBusConnectionPrivate *target, QObject *object,
+ int idx, const QList<int> &metaTypes,
+ const QDBusMessage &msg);
static QDBusCallDeliveryEvent *prepareReply(QDBusConnectionPrivate *target, QObject *object,
int idx, const QList<int> &metaTypes,
const QDBusMessage &msg);
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index a5d8ada..1842e5a 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -552,6 +552,9 @@ bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
(*(*list)[i])(amsg);
}
+ if (!ref)
+ return false;
+
switch (amsg.type()) {
case QDBusMessage::SignalMessage:
handleSignal(amsg);
@@ -713,6 +716,8 @@ static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags,
return -1;
}
+static QDBusCallDeliveryEvent * const DIRECT_DELIVERY = (QDBusCallDeliveryEvent *)1;
+
QDBusCallDeliveryEvent* QDBusConnectionPrivate::prepareReply(QDBusConnectionPrivate *target,
QObject *object, int idx,
const QList<int> &metaTypes,
@@ -736,6 +741,8 @@ QDBusCallDeliveryEvent* QDBusConnectionPrivate::prepareReply(QDBusConnectionPriv
// we can deliver
// prepare for the call
+ if (target == object)
+ return DIRECT_DELIVERY;
return new QDBusCallDeliveryEvent(QDBusConnection(target), idx, target, msg, metaTypes);
}
@@ -750,6 +757,12 @@ void QDBusConnectionPrivate::activateSignal(const QDBusConnectionPrivate::Signal
// Slots can optionally have one final parameter that is a QDBusMessage
// Slots receive read-only copies of the message (i.e., pass by value or by const-ref)
QDBusCallDeliveryEvent *call = prepareReply(this, hook.obj, hook.midx, hook.params, msg);
+ if (call == DIRECT_DELIVERY) {
+ // short-circuit delivery
+ Q_ASSERT(this == hook.obj);
+ deliverCall(this, 0, msg, hook.params, hook.midx);
+ return;
+ }
if (call)
postEventToThread(ActivateSignalAction, hook.obj, call);
}
@@ -1207,11 +1220,11 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
q_dbus_message_unref(msg);
}
-void QDBusConnectionPrivate::_q_serviceOwnerChanged(const QString &name,
- const QString &oldOwner, const QString &newOwner)
+void QDBusConnectionPrivate::serviceOwnerChangedNoLock(const QString &name,
+ const QString &oldOwner, const QString &newOwner)
{
Q_UNUSED(oldOwner);
- QDBusWriteLocker locker(UpdateSignalHookOwnerAction, this);
+// QDBusWriteLocker locker(UpdateSignalHookOwnerAction, this);
WatchedServicesHash::Iterator it = watchedServices.find(name);
if (it == watchedServices.end())
return;
@@ -1686,11 +1699,11 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
hook.obj = this;
hook.params << QMetaType::Void << QVariant::String; // both functions take a QString as parameter and return void
- hook.midx = staticMetaObject.indexOfSlot("registerService(QString)");
+ hook.midx = staticMetaObject.indexOfSlot("registerServiceNoLock(QString)");
Q_ASSERT(hook.midx != -1);
signalHooks.insert(QLatin1String("NameAcquired:" DBUS_INTERFACE_DBUS), hook);
- hook.midx = staticMetaObject.indexOfSlot("unregisterService(QString)");
+ hook.midx = staticMetaObject.indexOfSlot("unregisterServiceNoLock(QString)");
Q_ASSERT(hook.midx != -1);
signalHooks.insert(QLatin1String("NameLost:" DBUS_INTERFACE_DBUS), hook);
@@ -2081,7 +2094,7 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook
// we need to watch for this service changing
connectSignal(dbusServiceString(), QString(), dbusInterfaceString(),
QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
- this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
+ this, SLOT(serviceOwnerChangedNoLock(QString,QString,QString)));
data.owner = getNameOwnerNoCache(hook.service);
qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:"
<< data.owner << ")";
@@ -2342,12 +2355,22 @@ QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &pa
void QDBusConnectionPrivate::registerService(const QString &serviceName)
{
QDBusWriteLocker locker(RegisterServiceAction, this);
+ registerServiceNoLock(serviceName);
+}
+
+void QDBusConnectionPrivate::registerServiceNoLock(const QString &serviceName)
+{
serviceNames.append(serviceName);
}
void QDBusConnectionPrivate::unregisterService(const QString &serviceName)
{
QDBusWriteLocker locker(UnregisterServiceAction, this);
+ unregisterServiceNoLock(serviceName);
+}
+
+void QDBusConnectionPrivate::unregisterServiceNoLock(const QString &serviceName)
+{
serviceNames.removeAll(serviceName);
}
diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp
index 8c86ae8..849df73 100644
--- a/src/declarative/debugger/qdeclarativedebugservice.cpp
+++ b/src/declarative/debugger/qdeclarativedebugservice.cpp
@@ -226,9 +226,11 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
server->waitForConnection();
}
} else {
- qWarning(QString::fromAscii("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". "
- "Format is -qmljsdebugger=port:<port>[,block]").arg(
- appD->qmljsDebugArgumentsString()).toAscii().constData());
+ const QString message =
+ QString::fromAscii("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". "
+ "Format is -qmljsdebugger=port:<port>[,block]").
+ arg(appD->qmljsDebugArgumentsString());
+ qWarning("%s", qPrintable(message));
}
}
#endif
diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
index 299ca06..93ad861 100644
--- a/src/declarative/declarative.pro
+++ b/src/declarative/declarative.pro
@@ -25,7 +25,10 @@ include(graphicsitems/graphicsitems.pri)
include(qml/qml.pri)
include(debugger/debugger.pri)
-symbian:TARGET.UID3=0x2001E623
+symbian: {
+ TARGET.UID3=0x2001E623
+ LIBS += -lefsrv
+}
DEFINES += QT_NO_OPENTYPE
INCLUDEPATH += ../3rdparty/harfbuzz/src
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index 649c8fb..c0a7d72 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -509,7 +509,7 @@ void QDeclarativeBorderImage::doUpdate()
void QDeclarativeBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
Q_D(QDeclarativeBorderImage);
- if (d->pix.isNull())
+ if (d->pix.isNull() || d->width() <= 0.0 || d->height() <= 0.0)
return;
bool oldAA = p->testRenderHint(QPainter::Antialiasing);
@@ -518,7 +518,23 @@ void QDeclarativeBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem
p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth);
const QDeclarativeScaleGrid *border = d->getScaleGrid();
- QMargins margins(border->left(), border->top(), border->right(), border->bottom());
+ int left = border->left();
+ int right = border->right();
+ qreal borderWidth = left + right;
+ if (borderWidth > 0.0 && d->width() < borderWidth) {
+ qreal diff = borderWidth - d->width() - 1;
+ left -= qRound(diff * qreal(left) / borderWidth);
+ right -= qRound(diff * qreal(right) / borderWidth);
+ }
+ int top = border->top();
+ int bottom = border->bottom();
+ qreal borderHeight = top + bottom;
+ if (borderHeight > 0.0 && d->height() < borderHeight) {
+ qreal diff = borderHeight - d->height() - 1;
+ top -= qRound(diff * qreal(top) / borderHeight);
+ bottom -= qRound(diff * qreal(bottom) / borderHeight);
+ }
+ QMargins margins(left, top, right, bottom);
QTileRules rules((Qt::TileRule)d->horizontalTileMode, (Qt::TileRule)d->verticalTileMode);
qDrawBorderPixmap(p, QRect(0, 0, (int)d->width(), (int)d->height()), margins, d->pix, d->pix.rect(), margins, rules);
if (d->smooth) {
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 6f38f63..1615b0f 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -219,12 +219,8 @@ public:
}
} else {
qreal pos = (modelIndex / columns) * rowSize();
- if (header) {
- qreal headerSize = flow == QDeclarativeGridView::LeftToRight
- ? header->item->height()
- : header->item->width();
- pos += headerSize;
- }
+ if (header)
+ pos += headerSize();
return pos;
}
return 0;
@@ -291,11 +287,9 @@ public:
if (item->index == -1)
continue;
qreal itemTop = item->rowPos();
- if (item->index == model->count()-1 || (itemTop+rowSize()/2 >= pos))
+ if (itemTop+rowSize()/2 >= pos && itemTop - rowSize()/2 <= pos)
return item;
}
- if (visibleItems.count() && visibleItems.first()->rowPos() <= pos)
- return visibleItems.first();
return 0;
}
@@ -315,6 +309,16 @@ public:
return index;
}
+ qreal headerSize() const {
+ if (!header)
+ return 0.0;
+
+ return flow == QDeclarativeGridView::LeftToRight
+ ? header->item->height()
+ : header->item->width();
+ }
+
+
virtual void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) {
Q_Q(const QDeclarativeGridView);
QDeclarativeFlickablePrivate::itemGeometryChanged(item, newGeometry, oldGeometry);
@@ -878,14 +882,11 @@ void QDeclarativeGridViewPrivate::updateHeader()
if (header) {
if (visibleItems.count()) {
qreal startPos = startPosition();
- qreal headerSize = flow == QDeclarativeGridView::LeftToRight
- ? header->item->height()
- : header->item->width();
if (visibleIndex == 0) {
- header->setPosition(0, startPos - headerSize);
+ header->setPosition(0, startPos - headerSize());
} else {
- if (position() <= startPos || header->rowPos() > startPos - headerSize)
- header->setPosition(0, startPos - headerSize);
+ if (position() <= startPos || header->rowPos() > startPos - headerSize())
+ header->setPosition(0, startPos - headerSize());
}
} else {
header->setPosition(0, 0);
@@ -920,10 +921,14 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
qreal bottomPos = qMax(bottomItem->rowPos() - highlightRangeEnd, -minExtent);
pos = qAbs(data.move + topPos) < qAbs(data.move + bottomPos) ? topPos : bottomPos;
} else if (topItem) {
- pos = qMax(qMin(topItem->rowPos() - highlightRangeStart, -maxExtent), -minExtent);
+ if (topItem->index == 0 && header && position()+highlightRangeStart < header->rowPos()+headerSize()/2)
+ pos = header->rowPos() - highlightRangeStart;
+ else
+ pos = qMax(qMin(topItem->rowPos() - highlightRangeStart, -maxExtent), -minExtent);
} else if (bottomItem) {
pos = qMax(qMin(bottomItem->rowPos() - highlightRangeStart, -maxExtent), -minExtent);
} else {
+ QDeclarativeFlickablePrivate::fixup(data, minExtent, maxExtent);
fixupDuration = oldDuration;
return;
}
@@ -1764,8 +1769,10 @@ void QDeclarativeGridView::setFooter(QDeclarativeComponent *footer)
d->footer = 0;
}
d->footerComponent = footer;
- d->updateFooter();
- d->updateGrid();
+ if (isComponentComplete()) {
+ d->updateFooter();
+ d->updateGrid();
+ }
emit footerChanged();
}
}
@@ -1794,9 +1801,11 @@ void QDeclarativeGridView::setHeader(QDeclarativeComponent *header)
d->header = 0;
}
d->headerComponent = header;
- d->updateHeader();
- d->updateFooter();
- d->updateGrid();
+ if (isComponentComplete()) {
+ d->updateHeader();
+ d->updateFooter();
+ d->updateGrid();
+ }
emit headerChanged();
}
}
@@ -2221,6 +2230,8 @@ void QDeclarativeGridView::componentComplete()
{
Q_D(QDeclarativeGridView);
QDeclarativeFlickable::componentComplete();
+ d->updateHeader();
+ d->updateFooter();
d->updateGrid();
if (d->isValid()) {
refill();
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index 3b08a9b..aa74716 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -461,7 +461,7 @@ QRectF QDeclarativeImage::boundingRect() const
void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
Q_D(QDeclarativeImage);
- if (d->pix.isNull())
+ if (d->pix.pixmap().isNull() )
return;
bool oldAA = p->testRenderHint(QPainter::Antialiasing);
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 93572a0..11286b0 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -421,58 +421,28 @@ void QDeclarativeItemKeyFilter::componentComplete()
\since 4.7
\brief The KeyNavigation attached property supports key navigation by arrow keys.
- It is common in key-based UIs to use arrow keys to navigate
- between focused items. The KeyNavigation property provides a
- convenient way of specifying which item will gain focus
- when an arrow key is pressed. The following example provides
- key navigation for a 2x2 grid of items.
-
- \code
- Grid {
- columns: 2
- width: 100; height: 100
- Rectangle {
- id: item1
- focus: true
- width: 50; height: 50
- color: focus ? "red" : "lightgray"
- KeyNavigation.right: item2
- KeyNavigation.down: item3
- }
- Rectangle {
- id: item2
- width: 50; height: 50
- color: focus ? "red" : "lightgray"
- KeyNavigation.left: item1
- KeyNavigation.down: item4
- }
- Rectangle {
- id: item3
- width: 50; height: 50
- color: focus ? "red" : "lightgray"
- KeyNavigation.right: item4
- KeyNavigation.up: item1
- }
- Rectangle {
- id: item4
- width: 50; height: 50
- color: focus ? "red" : "lightgray"
- KeyNavigation.left: item3
- KeyNavigation.up: item2
- }
- }
- \endcode
+ Key-based user interfaces commonly allow the use of arrow keys to navigate between
+ focusable items. The KeyNavigation attached property enables this behavior by providing a
+ convenient way to specify the item that should gain focus when an arrow or tab key is pressed.
+
+ The following example provides key navigation for a 2x2 grid of items:
- By default KeyNavigation receives key events after the item it is attached to.
- If the item accepts an arrow key event, the KeyNavigation
- attached property will not receive an event for that key. Setting the
- \l priority property to KeyNavigation.BeforeItem allows handling
- of the key events before normal item processing.
+ \snippet doc/src/snippets/declarative/keynavigation.qml 0
- If an item has been set for a direction and the KeyNavigation
- attached property receives the corresponding
- key press and release events, the events will be accepted by
- KeyNavigation and will not propagate any further.
+ The top-left item initially receives focus by setting \l {Item::}{focus} to
+ \c true. When an arrow key is pressed, the focus will move to the
+ appropriate item, as defined by the value that has been set for
+ the KeyNavigation \l left, \l right, \l up or \l down properties.
+
+ Note that if a KeyNavigation attached property receives the key press and release
+ events for a requested arrow or tab key, the event is accepted and does not
+ propagate any further.
+
+ By default, KeyNavigation receives key events after the item to which it is attached.
+ If the item accepts the key event, the KeyNavigation attached property will not
+ receive an event for that key. Setting the \l priority property to
+ \c KeyNavigation.BeforeItem allows the event to be used for key navigation
+ before the item, rather than after.
\sa {Keys}{Keys attached property}
*/
@@ -607,7 +577,7 @@ void QDeclarativeKeyNavigationAttached::setBacktab(QDeclarativeItem *i)
\list
\o KeyNavigation.BeforeItem - process the key events before normal
- item key processing. If the event is accepted it will not
+ item key processing. If the event is used for key navigation, it will be accepted and will not
be passed on to the item.
\o KeyNavigation.AfterItem (default) - process the key events after normal item key
handling. If the item accepts the key event it will not be
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
index f85fa27..a36ee34 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -126,7 +126,7 @@ public:
widthValid(false), heightValid(false),
componentComplete(true), keepMouse(false),
smooth(false), transformOriginDirty(true), doneEventPreHandler(false), keyHandler(0),
- mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0)
+ mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0), hadSubFocusItem(false)
{
QGraphicsItemPrivate::acceptedMouseButtons = 0;
isDeclarativeItem = 1;
@@ -259,7 +259,7 @@ public:
QDeclarativeStateGroup *_states();
QDeclarativeStateGroup *_stateGroup;
- QDeclarativeItem::TransformOrigin origin:4;
+ QDeclarativeItem::TransformOrigin origin:5;
bool widthValid:1;
bool heightValid:1;
bool componentComplete:1;
@@ -275,6 +275,8 @@ public:
qreal implicitWidth;
qreal implicitHeight;
+ bool hadSubFocusItem;
+
QPointF computeTransformOrigin() const;
virtual void setPosHelper(const QPointF &pos)
@@ -288,9 +290,11 @@ public:
// Reimplemented from QGraphicsItemPrivate
virtual void subFocusItemChange()
{
- if (flags & QGraphicsItem::ItemIsFocusScope || !parent)
- emit q_func()->activeFocusChanged(subFocusItem != 0);
+ bool hasSubFocusItem = subFocusItem != 0;
+ if (((flags & QGraphicsItem::ItemIsFocusScope) || !parent) && hasSubFocusItem != hadSubFocusItem)
+ emit q_func()->activeFocusChanged(hasSubFocusItem);
//see also QDeclarativeItemPrivate::focusChanged
+ hadSubFocusItem = hasSubFocusItem;
}
// Reimplemented from QGraphicsItemPrivate
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 450b6af..845da79 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -402,6 +402,8 @@ public:
void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) {
Q_Q(QDeclarativeListView);
QDeclarativeFlickablePrivate::itemGeometryChanged(item, newGeometry, oldGeometry);
+ if (!q->isComponentComplete())
+ return;
if (item != contentItem && (!highlight || item != highlight->item)) {
if ((orient == QDeclarativeListView::Vertical && newGeometry.height() != oldGeometry.height())
|| (orient == QDeclarativeListView::Horizontal && newGeometry.width() != oldGeometry.width())) {
@@ -1123,8 +1125,6 @@ void QDeclarativeListViewPrivate::updateHeader()
QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item));
itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
header = new FxListItem(item, q);
- if (visibleItems.isEmpty())
- visiblePos = header->size();
}
}
if (header) {
@@ -1137,6 +1137,8 @@ void QDeclarativeListViewPrivate::updateHeader()
header->setPosition(startPos - header->size());
}
} else {
+ if (itemCount == 0)
+ visiblePos = header->size();
header->setPosition(0);
}
}
@@ -1185,10 +1187,14 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
FxListItem *bottomItem = snapItemAt(position()+highlightRangeEnd);
qreal pos;
if (topItem) {
- pos = qMax(qMin(topItem->position() - highlightRangeStart, -maxExtent), -minExtent);
+ if (topItem->index == 0 && header && position()+highlightRangeStart < header->position()+header->size()/2)
+ pos = header->position() - highlightRangeStart;
+ else
+ pos = qMax(qMin(topItem->position() - highlightRangeStart, -maxExtent), -minExtent);
} else if (bottomItem) {
pos = qMax(qMin(bottomItem->position() - highlightRangeStart, -maxExtent), -minExtent);
} else {
+ QDeclarativeFlickablePrivate::fixup(data, minExtent, maxExtent);
fixupDuration = oldDuration;
return;
}
@@ -2211,8 +2217,10 @@ void QDeclarativeListView::setFooter(QDeclarativeComponent *footer)
d->footerComponent = footer;
d->minExtentDirty = true;
d->maxExtentDirty = true;
- d->updateFooter();
- d->updateViewport();
+ if (isComponentComplete()) {
+ d->updateFooter();
+ d->updateViewport();
+ }
emit footerChanged();
}
}
@@ -2243,9 +2251,11 @@ void QDeclarativeListView::setHeader(QDeclarativeComponent *header)
d->headerComponent = header;
d->minExtentDirty = true;
d->maxExtentDirty = true;
- d->updateHeader();
- d->updateFooter();
- d->updateViewport();
+ if (isComponentComplete()) {
+ d->updateHeader();
+ d->updateFooter();
+ d->updateViewport();
+ }
emit headerChanged();
}
}
@@ -2655,6 +2665,8 @@ void QDeclarativeListView::componentComplete()
Q_D(QDeclarativeListView);
QDeclarativeFlickable::componentComplete();
updateSections();
+ d->updateHeader();
+ d->updateFooter();
if (d->isValid()) {
refill();
d->moveReason = QDeclarativeListViewPrivate::SetIndex;
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index dedb3f7..99b36a8 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -470,6 +470,8 @@ void QDeclarativeRectangle::generateBorderedRect()
void QDeclarativeRectangle::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
Q_D(QDeclarativeRectangle);
+ if (width() <= 0 || height() <= 0)
+ return;
if (d->radius > 0 || (d->pen && d->pen->isValid())
|| (d->gradient && d->gradient->gradient()) ) {
drawRect(*p);
@@ -539,6 +541,12 @@ void QDeclarativeRectangle::drawRect(QPainter &p)
Q_ASSERT(d->rectImage.width() == 2*xOffset + 1);
Q_ASSERT(d->rectImage.height() == 2*yOffset + 1);
+ // check whether we've eliminated the center completely
+ if (2*xOffset > width()+pw)
+ xOffset = (width()+pw)/2;
+ if (2*yOffset > height()+pw)
+ yOffset = (height()+pw)/2;
+
QMargins margins(xOffset, yOffset, xOffset, yOffset);
QTileRules rules(Qt::StretchTile, Qt::StretchTile);
//NOTE: even though our item may have qreal-based width and height, qDrawBorderPixmap only supports QRects
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 82c444e..303b21c 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -436,12 +436,13 @@ void QDeclarativeTextPrivate::invalidateImageCache()
{
Q_Q(QDeclarativeText);
- if (imageCacheDirty)
- return;
-
- imageCacheDirty = true;
- imageCache = QPixmap();
+ if(cacheAllTextAsImage || style != QDeclarativeText::Normal){//If actually using the image cache
+ if (imageCacheDirty)
+ return;
+ imageCacheDirty = true;
+ imageCache = QPixmap();
+ }
if (q->isComponentComplete())
q->update();
}
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 0deacf8..f8421a3 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -771,7 +771,7 @@ void QDeclarativeTextInput::setEchoMode(QDeclarativeTextInput::EchoMode echo)
imHints &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
setInputMethodHints(imHints);
d->control->setEchoMode((uint)echo);
- update();
+ q_textChanged();
emit echoModeChanged(echoMode());
}
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
index e8da367..14a1109 100644
--- a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
@@ -361,10 +361,18 @@ void QDeclarativeTextLayout::draw(QPainter *painter, const QPointF &p)
d->position = p;
}
+ QPen oldPen = priv->state->pen;
+ QColor currentColor = oldPen.color();
for (int ii = 0; ii < itemCount; ++ii) {
QStaticTextItem &item = d->items[ii];
+ if (item.color.isValid() && currentColor != item.color) {
+ painter->setPen(item.color);
+ currentColor = item.color;
+ }
priv->extended->drawStaticTextItem(&item);
}
+ if (currentColor != oldPen.color())
+ painter->setPen(oldPen);
}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
index cb6ad8c..a7fbf44 100644
--- a/src/declarative/qml/qdeclarativebinding.cpp
+++ b/src/declarative/qml/qdeclarativebinding.cpp
@@ -55,6 +55,158 @@
QT_BEGIN_NAMESPACE
+QDeclarativeAbstractBinding::QDeclarativeAbstractBinding()
+: m_object(0), m_propertyIndex(-1), m_mePtr(0), m_prevBinding(0), m_nextBinding(0)
+{
+}
+
+QDeclarativeAbstractBinding::~QDeclarativeAbstractBinding()
+{
+ Q_ASSERT(m_prevBinding == 0);
+ Q_ASSERT(m_mePtr == 0);
+}
+
+/*!
+Destroy the binding. Use this instead of calling delete.
+
+Bindings are free to implement their own memory management, so the delete operator is not
+necessarily safe. The default implementation clears the binding, removes it from the object
+and calls delete.
+*/
+void QDeclarativeAbstractBinding::destroy()
+{
+ removeFromObject();
+ clear();
+
+ delete this;
+}
+
+/*!
+Add this binding to \a object.
+
+This transfers ownership of the binding to the object, marks the object's property as
+being bound.
+
+However, it does not enable the binding itself or call update() on it.
+*/
+void QDeclarativeAbstractBinding::addToObject(QObject *object, int index)
+{
+ Q_ASSERT(object);
+
+ if (m_object == object && m_propertyIndex == index)
+ return;
+
+ removeFromObject();
+
+ Q_ASSERT(!m_prevBinding);
+
+ m_object = object;
+ m_propertyIndex = index;
+
+ QDeclarativeData *data = QDeclarativeData::get(object, true);
+
+ if (index & 0xFF000000) {
+ // Value type
+
+ int coreIndex = index & 0xFFFFFF;
+
+ // Find the value type proxy (if there is one)
+ QDeclarativeValueTypeProxyBinding *proxy = 0;
+ if (data->hasBindingBit(coreIndex)) {
+ QDeclarativeAbstractBinding *b = data->bindings;
+ while (b && b->propertyIndex() != coreIndex)
+ b = b->m_nextBinding;
+ Q_ASSERT(b && b->bindingType() == QDeclarativeAbstractBinding::ValueTypeProxy);
+ proxy = static_cast<QDeclarativeValueTypeProxyBinding *>(b);
+ }
+
+ if (!proxy) {
+ proxy = new QDeclarativeValueTypeProxyBinding(object, coreIndex);
+ proxy->addToObject(object, coreIndex);
+ }
+
+ m_nextBinding = proxy->m_bindings;
+ if (m_nextBinding) m_nextBinding->m_prevBinding = &m_nextBinding;
+ m_prevBinding = &proxy->m_bindings;
+ proxy->m_bindings = this;
+
+ } else {
+ m_nextBinding = data->bindings;
+ if (m_nextBinding) m_nextBinding->m_prevBinding = &m_nextBinding;
+ m_prevBinding = &data->bindings;
+ data->bindings = this;
+
+ data->setBindingBit(m_object, index);
+ }
+}
+
+/*!
+Remove the binding from the object.
+*/
+void QDeclarativeAbstractBinding::removeFromObject()
+{
+ if (m_prevBinding) {
+ int index = propertyIndex();
+
+ *m_prevBinding = m_nextBinding;
+ if (m_nextBinding) m_nextBinding->m_prevBinding = m_prevBinding;
+ m_prevBinding = 0;
+ m_nextBinding = 0;
+
+ if (index & 0xFF000000) {
+ // Value type - we don't remove the proxy from the object. It will sit their happily
+ // doing nothing until it is removed by a write, a binding change or it is reused
+ // to hold more sub-bindings.
+ } else if (m_object) {
+ QDeclarativeData *data = QDeclarativeData::get(m_object, false);
+ if (data) data->clearBindingBit(index);
+ }
+
+ m_object = 0;
+ m_propertyIndex = -1;
+ }
+}
+
+static void bindingDummyDeleter(QDeclarativeAbstractBinding *)
+{
+}
+
+QDeclarativeAbstractBinding::Pointer QDeclarativeAbstractBinding::weakPointer()
+{
+ if (m_selfPointer.isNull())
+ m_selfPointer = QSharedPointer<QDeclarativeAbstractBinding>(this, bindingDummyDeleter);
+
+ return m_selfPointer.toWeakRef();
+}
+
+void QDeclarativeAbstractBinding::clear()
+{
+ if (m_mePtr) {
+ *m_mePtr = 0;
+ m_mePtr = 0;
+ }
+}
+
+QString QDeclarativeAbstractBinding::expression() const
+{
+ return QLatin1String("<Unknown>");
+}
+
+QObject *QDeclarativeAbstractBinding::object() const
+{
+ return m_object;
+}
+
+int QDeclarativeAbstractBinding::propertyIndex() const
+{
+ return m_propertyIndex;
+}
+
+void QDeclarativeAbstractBinding::setEnabled(bool enabled, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ if (enabled) update(flags);
+}
+
void QDeclarativeBindingPrivate::refresh()
{
Q_Q(QDeclarativeBinding);
@@ -255,20 +407,8 @@ void QDeclarativeBinding::setEnabled(bool e, QDeclarativePropertyPrivate::WriteF
d->enabled = e;
setNotifyOnValueChanged(e);
- QDeclarativeAbstractBinding::setEnabled(e, flags);
-
- if (e) {
- addToObject(d->property.object());
+ if (e)
update(flags);
- } else {
- removeFromObject();
- }
-}
-
-int QDeclarativeBinding::propertyIndex()
-{
- Q_D(QDeclarativeBinding);
- return QDeclarativePropertyPrivate::bindingIndex(d->property);
}
bool QDeclarativeBinding::enabled() const
@@ -283,127 +423,6 @@ QString QDeclarativeBinding::expression() const
return QDeclarativeExpression::expression();
}
-QDeclarativeAbstractBinding::QDeclarativeAbstractBinding()
-: m_object(0), m_mePtr(0), m_prevBinding(0), m_nextBinding(0)
-{
-}
-
-QDeclarativeAbstractBinding::~QDeclarativeAbstractBinding()
-{
- Q_ASSERT(m_prevBinding == 0);
- Q_ASSERT(m_mePtr == 0);
-}
-
-void QDeclarativeAbstractBinding::destroy()
-{
- removeFromObject();
- clear();
-
- delete this;
-}
-
-void QDeclarativeAbstractBinding::addToObject(QObject *object)
-{
- Q_ASSERT(object);
-
- if (m_object == object)
- return;
-
- int index = propertyIndex();
-
- removeFromObject();
-
- Q_ASSERT(!m_prevBinding);
-
- m_object = object;
- QDeclarativeData *data = QDeclarativeData::get(object, true);
-
- if (index & 0xFF000000) {
- // Value type
-
- int coreIndex = index & 0xFFFFFF;
-
- // Find the value type proxy (if there is one)
- QDeclarativeValueTypeProxyBinding *proxy = 0;
- if (data->hasBindingBit(coreIndex)) {
- QDeclarativeAbstractBinding *b = data->bindings;
- while (b && b->propertyIndex() != coreIndex)
- b = b->m_nextBinding;
- Q_ASSERT(b && b->bindingType() == QDeclarativeAbstractBinding::ValueTypeProxy);
- proxy = static_cast<QDeclarativeValueTypeProxyBinding *>(b);
- }
-
- if (!proxy)
- proxy = new QDeclarativeValueTypeProxyBinding(object, coreIndex);
- proxy->addToObject(object);
-
- m_nextBinding = proxy->m_bindings;
- if (m_nextBinding) m_nextBinding->m_prevBinding = &m_nextBinding;
- m_prevBinding = &proxy->m_bindings;
- proxy->m_bindings = this;
-
- } else {
- m_nextBinding = data->bindings;
- if (m_nextBinding) m_nextBinding->m_prevBinding = &m_nextBinding;
- m_prevBinding = &data->bindings;
- data->bindings = this;
-
- data->setBindingBit(m_object, index);
- }
-}
-
-void QDeclarativeAbstractBinding::removeFromObject()
-{
- if (m_prevBinding) {
- int index = propertyIndex();
-
- *m_prevBinding = m_nextBinding;
- if (m_nextBinding) m_nextBinding->m_prevBinding = m_prevBinding;
- m_prevBinding = 0;
- m_nextBinding = 0;
-
- if (index & 0xFF000000) {
- // Value type - we don't remove the proxy from the object. It will sit their happily
- // doing nothing for ever more.
- } else if (m_object) {
- QDeclarativeData *data = QDeclarativeData::get(m_object, false);
- if (data) data->clearBindingBit(index);
- }
-
- m_object = 0;
- }
-}
-
-static void bindingDummyDeleter(QDeclarativeAbstractBinding *)
-{
-}
-
-QDeclarativeAbstractBinding::Pointer QDeclarativeAbstractBinding::weakPointer()
-{
- if (m_selfPointer.isNull())
- m_selfPointer = QSharedPointer<QDeclarativeAbstractBinding>(this, bindingDummyDeleter);
-
- return m_selfPointer.toWeakRef();
-}
-
-void QDeclarativeAbstractBinding::clear()
-{
- if (m_mePtr) {
- *m_mePtr = 0;
- m_mePtr = 0;
- }
-}
-
-QString QDeclarativeAbstractBinding::expression() const
-{
- return QLatin1String("<Unknown>");
-}
-
-void QDeclarativeAbstractBinding::setEnabled(bool e, QDeclarativePropertyPrivate::WriteFlags)
-{
- if (e) m_mePtr = 0;
-}
-
QDeclarativeValueTypeProxyBinding::QDeclarativeValueTypeProxyBinding(QObject *o, int index)
: m_object(o), m_index(index), m_bindings(0)
{
@@ -421,16 +440,10 @@ QDeclarativeValueTypeProxyBinding::~QDeclarativeValueTypeProxyBinding()
void QDeclarativeValueTypeProxyBinding::setEnabled(bool e, QDeclarativePropertyPrivate::WriteFlags flags)
{
if (e) {
- addToObject(m_object);
-
QDeclarativeAbstractBinding *bindings = m_bindings;
- m_bindings = 0;
recursiveEnable(bindings, flags);
} else {
- removeFromObject();
-
QDeclarativeAbstractBinding *bindings = m_bindings;
- m_bindings = 0;
recursiveDisable(bindings);
}
}
@@ -440,13 +453,7 @@ void QDeclarativeValueTypeProxyBinding::recursiveEnable(QDeclarativeAbstractBind
if (!b)
return;
- QDeclarativeAbstractBinding *next = b->m_nextBinding;
- b->m_prevBinding = 0;
- b->m_nextBinding = 0;
- Q_ASSERT(b->m_mePtr == 0);
- b->m_mePtr = &b;
-
- recursiveEnable(next, flags);
+ recursiveEnable(b->m_nextBinding, flags);
if (b)
b->setEnabled(true, flags);
@@ -459,19 +466,8 @@ void QDeclarativeValueTypeProxyBinding::recursiveDisable(QDeclarativeAbstractBin
recursiveDisable(b->m_nextBinding);
- b->setEnabled(false, 0);
-
- Q_ASSERT(b->m_prevBinding == 0);
- Q_ASSERT(b->m_nextBinding == 0);
- b->m_nextBinding = m_bindings;
- if (b->m_nextBinding) b->m_nextBinding->m_prevBinding = &b->m_nextBinding;
- b->m_prevBinding = &m_bindings;
- m_bindings = b;
-}
-
-int QDeclarativeValueTypeProxyBinding::propertyIndex()
-{
- return m_index;
+ if (b)
+ b->setEnabled(false, 0);
}
void QDeclarativeValueTypeProxyBinding::update(QDeclarativePropertyPrivate::WriteFlags)
@@ -488,4 +484,25 @@ QDeclarativeAbstractBinding *QDeclarativeValueTypeProxyBinding::binding(int prop
return binding;
}
+/*!
+Removes a collection of bindings, corresponding to the set bits in \a mask.
+*/
+void QDeclarativeValueTypeProxyBinding::removeBindings(quint32 mask)
+{
+ QDeclarativeAbstractBinding *binding = m_bindings;
+ while (binding) {
+ if (mask & (1 << (binding->propertyIndex() >> 24))) {
+ QDeclarativeAbstractBinding *remove = binding;
+ binding = remove->m_nextBinding;
+ *remove->m_prevBinding = remove->m_nextBinding;
+ if (remove->m_nextBinding) remove->m_nextBinding->m_prevBinding = remove->m_prevBinding;
+ remove->m_prevBinding = 0;
+ remove->m_nextBinding = 0;
+ remove->destroy();
+ } else {
+ binding = binding->m_nextBinding;
+ }
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h
index 0b9bde6..7823a3d 100644
--- a/src/declarative/qml/qdeclarativebinding_p.h
+++ b/src/declarative/qml/qdeclarativebinding_p.h
@@ -78,14 +78,16 @@ public:
enum Type { PropertyBinding, ValueTypeProxy };
virtual Type bindingType() const { return PropertyBinding; }
+ QObject *object() const;
+ int propertyIndex() const;
+
void setEnabled(bool e) { setEnabled(e, QDeclarativePropertyPrivate::DontRemoveBinding); }
virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags) = 0;
- virtual int propertyIndex() = 0;
void update() { update(QDeclarativePropertyPrivate::DontRemoveBinding); }
virtual void update(QDeclarativePropertyPrivate::WriteFlags) = 0;
- void addToObject(QObject *);
+ void addToObject(QObject *, int);
void removeFromObject();
static Pointer getPointer(QDeclarativeAbstractBinding *p) { return p ? p->weakPointer() : Pointer(); }
@@ -98,12 +100,14 @@ private:
Pointer weakPointer();
friend class QDeclarativeData;
+ friend class QDeclarativeComponentPrivate;
friend class QDeclarativeValueTypeProxyBinding;
friend class QDeclarativePropertyPrivate;
friend class QDeclarativeVME;
friend class QtSharedPointer::ExternalRefCount<QDeclarativeAbstractBinding>;
QObject *m_object;
+ int m_propertyIndex;
QDeclarativeAbstractBinding **m_mePtr;
QDeclarativeAbstractBinding **m_prevBinding;
QDeclarativeAbstractBinding *m_nextBinding;
@@ -118,11 +122,12 @@ public:
virtual Type bindingType() const { return ValueTypeProxy; }
virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags);
- virtual int propertyIndex();
virtual void update(QDeclarativePropertyPrivate::WriteFlags);
QDeclarativeAbstractBinding *binding(int propertyIndex);
+ void removeBindings(quint32 mask);
+
protected:
~QDeclarativeValueTypeProxyBinding();
@@ -154,7 +159,6 @@ public:
// Inherited from QDeclarativeAbstractBinding
virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags flags);
- virtual int propertyIndex();
virtual void update(QDeclarativePropertyPrivate::WriteFlags flags);
virtual QString expression() const;
diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp
index fbe5829..5c295b9 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings.cpp
+++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp
@@ -187,7 +187,6 @@ public:
// Inherited from QDeclarativeAbstractBinding
virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags flags);
- virtual int propertyIndex();
virtual void update(QDeclarativePropertyPrivate::WriteFlags flags);
virtual void destroy();
@@ -294,14 +293,6 @@ QDeclarativeAbstractBinding *QDeclarativeCompiledBindings::configBinding(int ind
void QDeclarativeCompiledBindingsPrivate::Binding::setEnabled(bool e, QDeclarativePropertyPrivate::WriteFlags flags)
{
- if (e) {
- addToObject(target);
- } else {
- removeFromObject();
- }
-
- QDeclarativeAbstractBinding::setEnabled(e, flags);
-
if (enabled != e) {
enabled = e;
@@ -309,11 +300,6 @@ void QDeclarativeCompiledBindingsPrivate::Binding::setEnabled(bool e, QDeclarati
}
}
-int QDeclarativeCompiledBindingsPrivate::Binding::propertyIndex()
-{
- return property & 0xFFFF;
-}
-
void QDeclarativeCompiledBindingsPrivate::Binding::update(QDeclarativePropertyPrivate::WriteFlags flags)
{
parent->run(this, flags);
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 645402e..df428b1 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -946,6 +946,16 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
QDeclarativePropertyCache::Data::IsVMEFunction,
QDeclarativePropertyCache::Data::IsVMESignal);
+ // Add flag for alias properties
+ if (!obj->synthdata.isEmpty()) {
+ const QDeclarativeVMEMetaData *vmeMetaData =
+ reinterpret_cast<const QDeclarativeVMEMetaData *>(obj->synthdata.constData());
+ for (int ii = 0; ii < vmeMetaData->aliasCount; ++ii) {
+ int index = obj->metaObject()->propertyOffset() + vmeMetaData->propertyCount + ii;
+ propertyCache->property(index)->flags |= QDeclarativePropertyCache::Data::IsAlias;
+ }
+ }
+
if (obj == unitRoot) {
propertyCache->addref();
output->rootPropertyCache = propertyCache;
@@ -1003,7 +1013,8 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
seenDefer = true;
continue;
}
- genValueProperty(prop, obj);
+ if (!prop->isAlias)
+ genValueProperty(prop, obj);
}
if (seenDefer) {
QDeclarativeInstruction defer;
@@ -1113,25 +1124,56 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
}
foreach(Property *prop, obj->valueTypeProperties) {
- QDeclarativeInstruction fetch;
- fetch.type = QDeclarativeInstruction::FetchValueType;
- fetch.fetchValue.property = prop->index;
- fetch.fetchValue.type = prop->type;
- fetch.line = prop->location.start.line;
+ if (!prop->isAlias)
+ genValueTypeProperty(obj, prop);
+ }
- output->bytecode << fetch;
+ foreach(Property *prop, obj->valueProperties) {
+ if (prop->isDeferred)
+ continue;
+ if (prop->isAlias)
+ genValueProperty(prop, obj);
+ }
+
+ foreach(Property *prop, obj->valueTypeProperties) {
+ if (prop->isAlias)
+ genValueTypeProperty(obj, prop);
+ }
+}
+void QDeclarativeCompiler::genValueTypeProperty(QDeclarativeParser::Object *obj,QDeclarativeParser::Property *prop)
+{
+ QDeclarativeInstruction fetch;
+ fetch.type = QDeclarativeInstruction::FetchValueType;
+ fetch.fetchValue.property = prop->index;
+ fetch.fetchValue.type = prop->type;
+ fetch.fetchValue.bindingSkipList = 0;
+ fetch.line = prop->location.start.line;
+
+ if (obj->type == -1 || output->types.at(obj->type).component) {
+ // We only have to do this if this is a composite type. If it is a builtin
+ // type it can't possibly already have bindings that need to be cleared.
foreach(Property *vprop, prop->value->valueProperties) {
- genPropertyAssignment(vprop, prop->value, prop);
+ if (!vprop->values.isEmpty()) {
+ Q_ASSERT(vprop->index >= 0 && vprop->index < 32);
+ fetch.fetchValue.bindingSkipList |= (1 << vprop->index);
+ }
}
+ }
- QDeclarativeInstruction pop;
- pop.type = QDeclarativeInstruction::PopValueType;
- pop.fetchValue.property = prop->index;
- pop.fetchValue.type = prop->type;
- pop.line = prop->location.start.line;
- output->bytecode << pop;
+ output->bytecode << fetch;
+
+ foreach(Property *vprop, prop->value->valueProperties) {
+ genPropertyAssignment(vprop, prop->value, prop);
}
+
+ QDeclarativeInstruction pop;
+ pop.type = QDeclarativeInstruction::PopValueType;
+ pop.fetchValue.property = prop->index;
+ pop.fetchValue.type = prop->type;
+ pop.fetchValue.bindingSkipList = 0;
+ pop.line = prop->location.start.line;
+ output->bytecode << pop;
}
void QDeclarativeCompiler::genComponent(QDeclarativeParser::Object *obj)
@@ -1440,10 +1482,22 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop,
if (p.name()) {
prop->type = p.userType();
}
- }
- if (prop->index != -1)
- prop->parent->setBindingBit(prop->index);
+ // Check if this is an alias
+ if (prop->index != -1 &&
+ prop->parent &&
+ prop->parent->type != -1 &&
+ output->types.at(prop->parent->type).component) {
+
+ QDeclarativePropertyCache *cache = output->types.at(prop->parent->type).component->rootPropertyCache;
+ if (cache && cache->property(prop->index) &&
+ cache->property(prop->index)->flags & QDeclarativePropertyCache::Data::IsAlias)
+ prop->isAlias = true;
+ }
+
+ if (prop->index != -1 && !prop->values.isEmpty())
+ prop->parent->setBindingBit(prop->index);
+ }
if (!prop->isDefault && prop->name == "id" && !ctxt.isSubContext()) {
@@ -1778,6 +1832,12 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr
COMPILE_EXCEPTION(prop, tr( "Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name)));
}
+
+ if (prop->isAlias) {
+ foreach (Property *vtProp, prop->value->properties)
+ vtProp->isAlias = true;
+ }
+
COMPILE_CHECK(buildValueTypeProperty(enginePrivate->valueTypes[prop->type],
prop->value, obj, ctxt.incr()));
obj->addValueTypeProperty(prop);
@@ -2423,7 +2483,7 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn
if (p.type == Object::DynamicProperty::Alias) {
if (mode == ResolveAliases) {
((QDeclarativeVMEMetaData *)dynamicData.data())->aliasCount++;
- compileAlias(builder, dynamicData, obj, p);
+ COMPILE_CHECK(compileAlias(builder, dynamicData, obj, p));
} else {
// Need a fake signal so that the metaobject remains consistent across
// the resolve and non-resolve alias runs
@@ -2694,7 +2754,10 @@ void QDeclarativeCompiler::genBindingAssignment(QDeclarativeParser::Value *bindi
}
QDeclarativeInstruction store;
- store.type = QDeclarativeInstruction::StoreBinding;
+ if (!prop->isAlias)
+ store.type = QDeclarativeInstruction::StoreBinding;
+ else
+ store.type = QDeclarativeInstruction::StoreBindingOnAlias;
store.assignBinding.value = output->indexForByteArray(ref.compiledData);
store.assignBinding.context = ref.bindingContext.stack;
store.assignBinding.owner = ref.bindingContext.owner;
@@ -2769,13 +2832,17 @@ bool QDeclarativeCompiler::completeComponentBuild()
expr.expression = binding.expression;
expr.imports = unit->imports();
- int index = bindingCompiler.compile(expr, enginePrivate);
- if (index != -1) {
- binding.dataType = BindingReference::Experimental;
- binding.compiledIndex = index;
- componentStat.optimizedBindings.append(iter.key()->location);
- continue;
- }
+ // ### We don't currently optimize for bindings on alias's - because
+ // of the solution to QTBUG-13719
+ if (!binding.property->isAlias) {
+ int index = bindingCompiler.compile(expr, enginePrivate);
+ if (index != -1) {
+ binding.dataType = BindingReference::Experimental;
+ binding.compiledIndex = index;
+ componentStat.optimizedBindings.append(iter.key()->location);
+ continue;
+ }
+ }
binding.dataType = BindingReference::QtScript;
diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h
index 5cd1fd2..7d76ad9 100644
--- a/src/declarative/qml/qdeclarativecompiler_p.h
+++ b/src/declarative/qml/qdeclarativecompiler_p.h
@@ -252,6 +252,7 @@ private:
void genObject(QDeclarativeParser::Object *obj);
void genObjectBody(QDeclarativeParser::Object *obj);
+ void genValueTypeProperty(QDeclarativeParser::Object *obj,QDeclarativeParser::Property *);
void genComponent(QDeclarativeParser::Object *obj);
void genValueProperty(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj);
void genListProperty(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj);
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 2686ce3..63bde0f 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -876,9 +876,12 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri
QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bv =
state->bindValues.at(ii);
for (int jj = 0; jj < bv.count; ++jj) {
- if(bv.at(jj))
+ if(bv.at(jj)) {
+ // XXX akennedy
+ bv.at(jj)->m_mePtr = 0;
bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor |
QDeclarativePropertyPrivate::DontRemoveBinding);
+ }
}
QDeclarativeEnginePrivate::clear(bv);
}
diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h
index def4188..4767169 100644
--- a/src/declarative/qml/qdeclarativedata_p.h
+++ b/src/declarative/qml/qdeclarativedata_p.h
@@ -65,6 +65,7 @@ class QDeclarativeContext;
class QDeclarativePropertyCache;
class QDeclarativeContextData;
class QDeclarativeNotifier;
+class QDeclarativeDataExtended;
// This class is structured in such a way, that simply zero'ing it is the
// default state for elemental object allocations. This is crucial in the
// workings of the QDeclarativeInstruction::CreateSimpleObject instruction.
@@ -150,17 +151,13 @@ public:
}
}
+ bool hasExtendedData() const { return extendedData != 0; }
QDeclarativeNotifier *objectNameNotifier() const;
QHash<int, QObject *> *attachedProperties() const;
- struct ExtendedData {
- ExtendedData();
- ~ExtendedData();
-
- QHash<int, QObject *> attachedProperties;
- void *objectNameNotifier;
- };
- mutable ExtendedData *extendedData;
+private:
+ // For objectNameNotifier and attachedProperties
+ mutable QDeclarativeDataExtended *extendedData;
};
template<class T>
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 808ba68..a8404f0 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -678,6 +678,9 @@ QNetworkAccessManager *QDeclarativeEngine::networkAccessManager() const
requests. See the QDeclarativeImageProvider documentation for details on
implementing and using image providers.
+ All required image providers should be added to the engine before any
+ QML sources files are loaded.
+
Note that images loaded from a QDeclarativeImageProvider are cached
by QPixmapCache, similar to any image loaded by QML.
@@ -897,9 +900,7 @@ void QDeclarativeEngine::setObjectOwnership(QObject *object, ObjectOwnership own
if (!object)
return;
- // No need to do anything if CppOwnership and there is no QDeclarativeData as
- // the current ownership must be CppOwnership
- QDeclarativeData *ddata = QDeclarativeData::get(object, ownership == JavaScriptOwnership);
+ QDeclarativeData *ddata = QDeclarativeData::get(object, true);
if (!ddata)
return;
@@ -957,7 +958,7 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre
if (!data)
return 0; // Attached properties are only on objects created by QML
- QObject *rv = data->extendedData?data->attachedProperties()->value(id):0;
+ QObject *rv = data->hasExtendedData()?data->attachedProperties()->value(id):0;
if (rv || !create)
return rv;
@@ -985,6 +986,35 @@ QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
return qmlAttachedPropertiesObjectById(*idCache, object, create);
}
+class QDeclarativeDataExtended {
+public:
+ QDeclarativeDataExtended();
+ ~QDeclarativeDataExtended();
+
+ QHash<int, QObject *> attachedProperties;
+ QDeclarativeNotifier objectNameNotifier;
+};
+
+QDeclarativeDataExtended::QDeclarativeDataExtended()
+{
+}
+
+QDeclarativeDataExtended::~QDeclarativeDataExtended()
+{
+}
+
+QDeclarativeNotifier *QDeclarativeData::objectNameNotifier() const
+{
+ if (!extendedData) extendedData = new QDeclarativeDataExtended;
+ return &extendedData->objectNameNotifier;
+}
+
+QHash<int, QObject *> *QDeclarativeData::attachedProperties() const
+{
+ if (!extendedData) extendedData = new QDeclarativeDataExtended;
+ return &extendedData->attachedProperties;
+}
+
void QDeclarativeData::destroyed(QObject *object)
{
if (deferredComponent)
@@ -1075,28 +1105,6 @@ void QDeclarativeData::setBindingBit(QObject *obj, int bit)
bindingBits[bit / 32] |= (1 << (bit % 32));
}
-QDeclarativeData::ExtendedData::ExtendedData()
-: objectNameNotifier(0)
-{
-}
-
-QDeclarativeData::ExtendedData::~ExtendedData()
-{
- ((QDeclarativeNotifier *)&objectNameNotifier)->~QDeclarativeNotifier();
-}
-
-QDeclarativeNotifier *QDeclarativeData::objectNameNotifier() const
-{
- if (!extendedData) extendedData = new ExtendedData;
- return (QDeclarativeNotifier *)&extendedData->objectNameNotifier;
-}
-
-QHash<int, QObject *> *QDeclarativeData::attachedProperties() const
-{
- if (!extendedData) extendedData = new ExtendedData;
- return &extendedData->attachedProperties;
-}
-
/*!
Creates a QScriptValue allowing you to use \a object in QML script.
\a engine is the QDeclarativeEngine it is to be created in.
@@ -2225,8 +2233,9 @@ bool QDeclarative_isFileCaseCorrect(const QString &fileName)
if (a != c)
return false;
}
+#else
+ Q_UNUSED(fileName)
#endif
-
return true;
}
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
index 6f5216a..acc13de 100644
--- a/src/declarative/qml/qdeclarativeimport.cpp
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -51,6 +51,10 @@
#include <private/qdeclarativetypenamecache_p.h>
#include <private/qdeclarativeengine_p.h>
+#ifdef Q_OS_SYMBIAN
+#include "private/qcore_symbian_p.h"
+#endif
+
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(qmlImportTrace, QML_IMPORT_TRACE)
@@ -658,8 +662,32 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e)
// Search order is applicationDirPath(), $QML_IMPORT_PATH, QLibraryInfo::ImportsPath
- addImportPath(QLibraryInfo::location(QLibraryInfo::ImportsPath));
+ QString installImportsPath = QLibraryInfo::location(QLibraryInfo::ImportsPath);
+#if defined(Q_OS_SYMBIAN)
+ // Append imports path for all available drives in Symbian
+ if (installImportsPath.at(1) != QChar(QLatin1Char(':'))) {
+ QString tempPath = installImportsPath;
+ if (tempPath.at(tempPath.length() - 1) != QDir::separator()) {
+ tempPath += QDir::separator();
+ }
+ RFs& fs = qt_s60GetRFs();
+ TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData()));
+ TFindFile finder(fs);
+ TInt err = finder.FindByDir(tempPathPtr, tempPathPtr);
+ while (err == KErrNone) {
+ QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()),
+ finder.File().Length());
+ foundDir = QDir(foundDir).canonicalPath();
+ addImportPath(foundDir);
+ err = finder.Find();
+ }
+ } else {
+ addImportPath(installImportsPath);
+ }
+#else
+ addImportPath(installImportsPath);
+#endif
// env import paths
QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
if (!envImportPath.isEmpty()) {
diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp
index 1767d2f..818c15d 100644
--- a/src/declarative/qml/qdeclarativeinstruction.cpp
+++ b/src/declarative/qml/qdeclarativeinstruction.cpp
@@ -63,7 +63,7 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
qWarning().nospace() << idx << "\t\t" << line << "\t" << "INIT\t\t\t" << instr->init.bindingsSize << "\t" << instr->init.parserStatusSize << "\t" << instr->init.contextCache << "\t" << instr->init.compiledBinding;
break;
case QDeclarativeInstruction::CreateObject:
- qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE\t\t\t" << instr->create.type << "\t\t\t" << types.at(instr->create.type).className;
+ qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE\t\t\t" << instr->create.type << "\t" << instr->create.bindingBits << "\t\t" << types.at(instr->create.type).className;
break;
case QDeclarativeInstruction::CreateSimpleObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE_SIMPLE\t\t" << instr->createSimple.typeSize;
@@ -174,6 +174,9 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
case QDeclarativeInstruction::StoreBinding:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
break;
+ case QDeclarativeInstruction::StoreBindingOnAlias:
+ qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BINDING_ALIAS\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
+ break;
case QDeclarativeInstruction::StoreCompiledBinding:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_COMPILED_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
break;
@@ -203,7 +206,7 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH\t\t\t" << instr->fetch.property;
break;
case QDeclarativeInstruction::FetchValueType:
- qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type;
+ qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type << "\t" << instr->fetchValue.bindingSkipList;
break;
case QDeclarativeInstruction::PopFetchedObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP";
diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h
index f0b032c..94676fc 100644
--- a/src/declarative/qml/qdeclarativeinstruction_p.h
+++ b/src/declarative/qml/qdeclarativeinstruction_p.h
@@ -132,6 +132,7 @@ public:
AssignCustomType, /* assignCustomType */
StoreBinding, /* assignBinding */
+ StoreBindingOnAlias, /* assignBinding */
StoreCompiledBinding, /* assignBinding */
StoreValueSource, /* assignValueSource */
StoreValueInterceptor, /* assignValueInterceptor */
@@ -214,6 +215,7 @@ public:
struct FetchValueInstruction {
int property;
int type;
+ quint32 bindingSkipList;
};
struct FetchQmlListInstruction {
int property;
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index eff59df..b0bc5bb 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -69,7 +69,7 @@ struct ObjectData : public QScriptDeclarativeClass::Object {
virtual ~ObjectData() {
if (object && !object->parent()) {
QDeclarativeData *ddata = QDeclarativeData::get(object, false);
- if (ddata && !ddata->indestructible && 0 == --ddata->objectDataRefCount)
+ if (ddata && !ddata->indestructible && 0 == --ddata->objectDataRefCount)
object->deleteLater();
}
}
@@ -808,7 +808,14 @@ QScriptDeclarativeClass::Value MetaCallArgument::toValue(QDeclarativeEngine *e)
}
return QScriptDeclarativeClass::Value(engine, rv);
} else if (type == -1 || type == qMetaTypeId<QVariant>()) {
- return QScriptDeclarativeClass::Value(engine, QDeclarativeEnginePrivate::get(e)->scriptValueFromVariant(*((QVariant *)&data)));
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(e);
+ QScriptValue rv = ep->scriptValueFromVariant(*((QVariant *)&data));
+ if (rv.isQObject()) {
+ QObject *object = rv.toQObject();
+ if (object)
+ QDeclarativeData::get(object, true)->setImplicitDestructible();
+ }
+ return QScriptDeclarativeClass::Value(engine, rv);
} else {
return QScriptDeclarativeClass::Value();
}
diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp
index 8d00ef8..effecb1 100644
--- a/src/declarative/qml/qdeclarativeparser.cpp
+++ b/src/declarative/qml/qdeclarativeparser.cpp
@@ -205,13 +205,13 @@ QDeclarativeParser::Object::DynamicSlot::DynamicSlot(const DynamicSlot &o)
QDeclarativeParser::Property::Property()
: parent(0), type(0), index(-1), value(0), isDefault(true), isDeferred(false),
- isValueTypeSubProperty(false)
+ isValueTypeSubProperty(false), isAlias(false)
{
}
QDeclarativeParser::Property::Property(const QByteArray &n)
: parent(0), type(0), index(-1), value(0), name(n), isDefault(false),
- isDeferred(false), isValueTypeSubProperty(false)
+ isDeferred(false), isValueTypeSubProperty(false), isAlias(false)
{
}
diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h
index 77184c2..633847d 100644
--- a/src/declarative/qml/qdeclarativeparser_p.h
+++ b/src/declarative/qml/qdeclarativeparser_p.h
@@ -358,6 +358,9 @@ namespace QDeclarativeParser
bool isDeferred;
// True if this property is a value-type pseudo-property
bool isValueTypeSubProperty;
+ // True if this property is a property alias. Set by the
+ // QDeclarativeCompiler
+ bool isAlias;
LocationSpan location;
LocationRange listValueRange;
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
index 1395e97..df0917f 100644
--- a/src/declarative/qml/qdeclarativeproperty.cpp
+++ b/src/declarative/qml/qdeclarativeproperty.cpp
@@ -607,26 +607,7 @@ QDeclarativePropertyPrivate::binding(const QDeclarativeProperty &that)
if (!that.isProperty() || !that.d->object)
return 0;
- QDeclarativeData *data = QDeclarativeData::get(that.d->object);
- if (!data)
- return 0;
-
- if (!data->hasBindingBit(that.d->core.coreIndex))
- return 0;
-
- QDeclarativeAbstractBinding *binding = data->bindings;
- while (binding && binding->propertyIndex() != that.d->core.coreIndex)
- binding = binding->m_nextBinding;
-
- if (binding && that.d->valueType.valueTypeCoreIdx != -1) {
- if (binding->bindingType() == QDeclarativeAbstractBinding::ValueTypeProxy) {
- QDeclarativeValueTypeProxyBinding *proxy = static_cast<QDeclarativeValueTypeProxyBinding *>(binding);
-
- binding = proxy->binding(bindingIndex(that));
- }
- }
-
- return binding;
+ return binding(that.d->object, that.d->core.coreIndex, that.d->valueType.valueTypeCoreIdx);
}
/*!
@@ -658,12 +639,106 @@ QDeclarativePropertyPrivate::setBinding(const QDeclarativeProperty &that,
}
QDeclarativeAbstractBinding *
+QDeclarativePropertyPrivate::binding(QObject *object, int coreIndex, int valueTypeIndex)
+{
+ QDeclarativeData *data = QDeclarativeData::get(object);
+ if (!data)
+ return 0;
+
+ QDeclarativePropertyCache::Data *propertyData =
+ data->propertyCache?data->propertyCache->property(coreIndex):0;
+ if (propertyData && propertyData->flags & QDeclarativePropertyCache::Data::IsAlias) {
+ const QDeclarativeVMEMetaObject *vme =
+ static_cast<const QDeclarativeVMEMetaObject *>(metaObjectForProperty(object->metaObject(), coreIndex));
+
+ QObject *aObject = 0; int aCoreIndex = -1; int aValueTypeIndex = -1;
+ if (!vme->aliasTarget(coreIndex, &aObject, &aCoreIndex, &aValueTypeIndex))
+ return 0;
+
+ // This will either be a value type sub-reference or an alias to a value-type sub-reference not both
+ Q_ASSERT(valueTypeIndex == -1 || aValueTypeIndex == -1);
+ return binding(aObject, aCoreIndex, (valueTypeIndex == -1)?aValueTypeIndex:valueTypeIndex);
+ }
+
+ if (!data->hasBindingBit(coreIndex))
+ return 0;
+
+ QDeclarativeAbstractBinding *binding = data->bindings;
+ while (binding && binding->propertyIndex() != coreIndex)
+ binding = binding->m_nextBinding;
+
+ if (binding && valueTypeIndex != -1) {
+ if (binding->bindingType() == QDeclarativeAbstractBinding::ValueTypeProxy) {
+ int index = coreIndex | (valueTypeIndex << 24);
+ binding = static_cast<QDeclarativeValueTypeProxyBinding *>(binding)->binding(index);
+ }
+ }
+
+ return binding;
+}
+
+void QDeclarativePropertyPrivate::findAliasTarget(QObject *object, int bindingIndex,
+ QObject **targetObject, int *targetBindingIndex)
+{
+ int coreIndex = bindingIndex & 0xFFFFFF;
+ int valueTypeIndex = bindingIndex >> 24;
+ if (valueTypeIndex == 0) valueTypeIndex = -1;
+
+ QDeclarativeData *data = QDeclarativeData::get(object, false);
+ if (data) {
+ QDeclarativePropertyCache::Data *propertyData =
+ data->propertyCache?data->propertyCache->property(coreIndex):0;
+ if (propertyData && propertyData->flags & QDeclarativePropertyCache::Data::IsAlias) {
+ const QDeclarativeVMEMetaObject *vme =
+ static_cast<const QDeclarativeVMEMetaObject *>(metaObjectForProperty(object->metaObject(), coreIndex));
+ QObject *aObject = 0; int aCoreIndex = -1; int aValueTypeIndex = -1;
+ if (vme->aliasTarget(coreIndex, &aObject, &aCoreIndex, &aValueTypeIndex)) {
+ // This will either be a value type sub-reference or an alias to a value-type sub-reference not both
+ Q_ASSERT(valueTypeIndex == -1 || aValueTypeIndex == -1);
+
+ int aBindingIndex = aCoreIndex;
+ if (aValueTypeIndex != -1)
+ aBindingIndex |= aValueTypeIndex << 24;
+ else if (valueTypeIndex != -1)
+ aBindingIndex |= valueTypeIndex << 24;
+
+ findAliasTarget(aObject, aBindingIndex, targetObject, targetBindingIndex);
+ return;
+ }
+ }
+ }
+
+ *targetObject = object;
+ *targetBindingIndex = bindingIndex;
+}
+
+QDeclarativeAbstractBinding *
QDeclarativePropertyPrivate::setBinding(QObject *object, int coreIndex, int valueTypeIndex,
QDeclarativeAbstractBinding *newBinding, WriteFlags flags)
{
QDeclarativeData *data = QDeclarativeData::get(object, 0 != newBinding);
QDeclarativeAbstractBinding *binding = 0;
+ if (data) {
+ QDeclarativePropertyCache::Data *propertyData =
+ data->propertyCache?data->propertyCache->property(coreIndex):0;
+ if (propertyData && propertyData->flags & QDeclarativePropertyCache::Data::IsAlias) {
+ const QDeclarativeVMEMetaObject *vme =
+ static_cast<const QDeclarativeVMEMetaObject *>(metaObjectForProperty(object->metaObject(), coreIndex));
+
+ QObject *aObject = 0; int aCoreIndex = -1; int aValueTypeIndex = -1;
+ if (!vme->aliasTarget(coreIndex, &aObject, &aCoreIndex, &aValueTypeIndex)) {
+ if (newBinding) newBinding->destroy();
+ return 0;
+ }
+
+ // This will either be a value type sub-reference or an alias to a value-type sub-reference not both
+ Q_ASSERT(valueTypeIndex == -1 || aValueTypeIndex == -1);
+ return setBinding(aObject, aCoreIndex, (valueTypeIndex == -1)?aValueTypeIndex:valueTypeIndex,
+ newBinding, flags);
+ }
+ }
+
if (data && data->hasBindingBit(coreIndex)) {
binding = data->bindings;
@@ -671,16 +746,72 @@ QDeclarativePropertyPrivate::setBinding(QObject *object, int coreIndex, int valu
binding = binding->m_nextBinding;
}
- if (binding && valueTypeIndex != -1 && binding->bindingType() == QDeclarativeAbstractBinding::ValueTypeProxy) {
- int index = coreIndex | (valueTypeIndex << 24);
+ int index = coreIndex;
+ if (valueTypeIndex != -1)
+ index |= (valueTypeIndex << 24);
+
+ if (binding && valueTypeIndex != -1 && binding->bindingType() == QDeclarativeAbstractBinding::ValueTypeProxy)
binding = static_cast<QDeclarativeValueTypeProxyBinding *>(binding)->binding(index);
+
+ if (binding) {
+ binding->removeFromObject();
+ binding->setEnabled(false, 0);
}
+ if (newBinding) {
+ newBinding->addToObject(object, index);
+ newBinding->setEnabled(true, flags);
+ }
+
+ return binding;
+}
+
+QDeclarativeAbstractBinding *
+QDeclarativePropertyPrivate::setBindingNoEnable(QObject *object, int coreIndex, int valueTypeIndex,
+ QDeclarativeAbstractBinding *newBinding)
+{
+ QDeclarativeData *data = QDeclarativeData::get(object, 0 != newBinding);
+ QDeclarativeAbstractBinding *binding = 0;
+
+ if (data) {
+ QDeclarativePropertyCache::Data *propertyData =
+ data->propertyCache?data->propertyCache->property(coreIndex):0;
+ if (propertyData && propertyData->flags & QDeclarativePropertyCache::Data::IsAlias) {
+ const QDeclarativeVMEMetaObject *vme =
+ static_cast<const QDeclarativeVMEMetaObject *>(metaObjectForProperty(object->metaObject(), coreIndex));
+
+ QObject *aObject = 0; int aCoreIndex = -1; int aValueTypeIndex = -1;
+ if (!vme->aliasTarget(coreIndex, &aObject, &aCoreIndex, &aValueTypeIndex)) {
+ if (newBinding) newBinding->destroy();
+ return 0;
+ }
+
+ // This will either be a value type sub-reference or an alias to a value-type sub-reference not both
+ Q_ASSERT(valueTypeIndex == -1 || aValueTypeIndex == -1);
+ return setBindingNoEnable(aObject, aCoreIndex, (valueTypeIndex == -1)?aValueTypeIndex:valueTypeIndex,
+ newBinding);
+ }
+ }
+
+ if (data && data->hasBindingBit(coreIndex)) {
+ binding = data->bindings;
+
+ while (binding && binding->propertyIndex() != coreIndex)
+ binding = binding->m_nextBinding;
+ }
+
+ int index = coreIndex;
+ if (valueTypeIndex != -1)
+ index |= (valueTypeIndex << 24);
+
+ if (binding && valueTypeIndex != -1 && binding->bindingType() == QDeclarativeAbstractBinding::ValueTypeProxy)
+ binding = static_cast<QDeclarativeValueTypeProxyBinding *>(binding)->binding(index);
+
if (binding)
- binding->setEnabled(false);
+ binding->removeFromObject();
if (newBinding)
- newBinding->setEnabled(true, flags);
+ newBinding->addToObject(object, index);
return binding;
}
@@ -1392,11 +1523,26 @@ static inline int QMetaObject_methods(const QMetaObject *metaObject)
int className;
int classInfoCount, classInfoData;
int methodCount, methodData;
+ int propertyCount, propertyData;
};
return reinterpret_cast<const Private *>(metaObject->d.data)->methodCount;
}
+static inline int QMetaObject_properties(const QMetaObject *metaObject)
+{
+ struct Private
+ {
+ int revision;
+ int className;
+ int classInfoCount, classInfoData;
+ int methodCount, methodData;
+ int propertyCount, propertyData;
+ };
+
+ return reinterpret_cast<const Private *>(metaObject->d.data)->propertyCount;
+}
+
static inline void flush_vme_signal(const QObject *object, int index)
{
QDeclarativeData *data = static_cast<QDeclarativeData *>(QObjectPrivate::get(const_cast<QObject *>(object))->declarativeData);
@@ -1437,4 +1583,19 @@ bool QDeclarativePropertyPrivate::connect(const QObject *sender, int signal_inde
return QMetaObject::connect(sender, signal_index, receiver, method_index, type, types);
}
+/*!
+Return \a metaObject's [super] meta object that provides data for \a property.
+*/
+const QMetaObject *QDeclarativePropertyPrivate::metaObjectForProperty(const QMetaObject *metaObject, int property)
+{
+ int propertyOffset = metaObject->propertyOffset();
+
+ while (propertyOffset > property) {
+ metaObject = metaObject->d.superdata;
+ propertyOffset -= QMetaObject_properties(metaObject);
+ }
+
+ return metaObject;
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeproperty_p.h b/src/declarative/qml/qdeclarativeproperty_p.h
index a9d6979..6392f88 100644
--- a/src/declarative/qml/qdeclarativeproperty_p.h
+++ b/src/declarative/qml/qdeclarativeproperty_p.h
@@ -68,7 +68,7 @@ class QDeclarativeExpression;
class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativePropertyPrivate
{
public:
- enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02 };
+ enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02, RemoveBindingOnAliasWrite = 0x04 };
Q_DECLARE_FLAGS(WriteFlags, WriteFlag)
QDeclarativePropertyPrivate()
@@ -108,9 +108,13 @@ public:
const QVariant &value, int flags);
static bool write(QObject *, const QDeclarativePropertyCache::Data &, const QVariant &,
QDeclarativeContextData *, WriteFlags flags = 0);
+ static void findAliasTarget(QObject *, int, QObject **, int *);
static QDeclarativeAbstractBinding *setBinding(QObject *, int coreIndex, int valueTypeIndex /* -1 */,
QDeclarativeAbstractBinding *,
WriteFlags flags = DontRemoveBinding);
+ static QDeclarativeAbstractBinding *setBindingNoEnable(QObject *, int coreIndex, int valueTypeIndex /* -1 */,
+ QDeclarativeAbstractBinding *);
+ static QDeclarativeAbstractBinding *binding(QObject *, int coreIndex, int valueTypeIndex /* -1 */);
static QByteArray saveValueType(const QMetaObject *, int,
const QMetaObject *, int);
@@ -120,7 +124,6 @@ public:
static bool equal(const QMetaObject *, const QMetaObject *);
static bool canConvert(const QMetaObject *from, const QMetaObject *to);
-
// "Public" (to QML) methods
static QDeclarativeAbstractBinding *binding(const QDeclarativeProperty &that);
static QDeclarativeAbstractBinding *setBinding(const QDeclarativeProperty &that,
@@ -136,6 +139,7 @@ public:
static bool connect(const QObject *sender, int signal_index,
const QObject *receiver, int method_index,
int type = 0, int *types = 0);
+ static const QMetaObject *metaObjectForProperty(const QMetaObject *, int);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePropertyPrivate::WriteFlags)
diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp
index 0adcdbd..dd9a224 100644
--- a/src/declarative/qml/qdeclarativepropertycache.cpp
+++ b/src/declarative/qml/qdeclarativepropertycache.cpp
@@ -320,7 +320,6 @@ void QDeclarativePropertyCache::update(QDeclarativeEngine *engine, const QMetaOb
{
Q_ASSERT(engine);
Q_ASSERT(metaObject);
- QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
clear();
diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h
index 922010d..f7c5daa 100644
--- a/src/declarative/qml/qdeclarativepropertycache_p.h
+++ b/src/declarative/qml/qdeclarativepropertycache_p.h
@@ -83,6 +83,7 @@ public:
IsConstant = 0x00000001,
IsWritable = 0x00000002,
IsResettable = 0x00000004,
+ IsAlias = 0x00000008,
// These are mutualy exclusive
IsFunction = 0x00000010,
diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp
index b9e9cec..5dc6ffd 100644
--- a/src/declarative/qml/qdeclarativevaluetype.cpp
+++ b/src/declarative/qml/qdeclarativevaluetype.cpp
@@ -109,36 +109,54 @@ void QDeclarativeValueTypeFactory::registerValueTypes()
QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t)
{
+ QDeclarativeValueType *rv = 0;
+
switch (t) {
case QVariant::Point:
- return new QDeclarativePointValueType;
+ rv = new QDeclarativePointValueType;
+ break;
case QVariant::PointF:
- return new QDeclarativePointFValueType;
+ rv = new QDeclarativePointFValueType;
+ break;
case QVariant::Size:
- return new QDeclarativeSizeValueType;
+ rv = new QDeclarativeSizeValueType;
+ break;
case QVariant::SizeF:
- return new QDeclarativeSizeFValueType;
+ rv = new QDeclarativeSizeFValueType;
+ break;
case QVariant::Rect:
- return new QDeclarativeRectValueType;
+ rv = new QDeclarativeRectValueType;
+ break;
case QVariant::RectF:
- return new QDeclarativeRectFValueType;
+ rv = new QDeclarativeRectFValueType;
+ break;
case QVariant::Vector2D:
- return new QDeclarativeVector2DValueType;
+ rv = new QDeclarativeVector2DValueType;
+ break;
case QVariant::Vector3D:
- return new QDeclarativeVector3DValueType;
+ rv = new QDeclarativeVector3DValueType;
+ break;
case QVariant::Vector4D:
- return new QDeclarativeVector4DValueType;
+ rv = new QDeclarativeVector4DValueType;
+ break;
case QVariant::Quaternion:
- return new QDeclarativeQuaternionValueType;
+ rv = new QDeclarativeQuaternionValueType;
+ break;
case QVariant::Matrix4x4:
- return new QDeclarativeMatrix4x4ValueType;
+ rv = new QDeclarativeMatrix4x4ValueType;
+ break;
case QVariant::EasingCurve:
- return new QDeclarativeEasingValueType;
+ rv = new QDeclarativeEasingValueType;
+ break;
case QVariant::Font:
- return new QDeclarativeFontValueType;
+ rv = new QDeclarativeFontValueType;
+ break;
default:
- return 0;
+ break;
}
+
+ Q_ASSERT(!rv || rv->metaObject()->propertyCount() < 32);
+ return rv;
}
QDeclarativeValueType::QDeclarativeValueType(QObject *parent)
diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
index db90aff..c742dec 100644
--- a/src/declarative/qml/qdeclarativevme.cpp
+++ b/src/declarative/qml/qdeclarativevme.cpp
@@ -154,7 +154,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(ctxt->engine);
int status = -1; //for dbus
- QDeclarativePropertyPrivate::WriteFlags flags = QDeclarativePropertyPrivate::BypassInterceptor;
+ QDeclarativePropertyPrivate::WriteFlags flags = QDeclarativePropertyPrivate::BypassInterceptor |
+ QDeclarativePropertyPrivate::RemoveBindingOnAliasWrite;
for (int ii = start; !isError() && ii < (start + count); ++ii) {
const QDeclarativeInstruction &instr = comp->bytecode.at(ii);
@@ -664,6 +665,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
break;
case QDeclarativeInstruction::StoreBinding:
+ case QDeclarativeInstruction::StoreBindingOnAlias:
{
QObject *target =
stack.at(stack.count() - 1 - instr.assignBinding.owner);
@@ -675,14 +677,20 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
int coreIndex = mp.index();
- if (stack.count() == 1 && bindingSkipList.testBit(coreIndex))
+ if ((stack.count() - instr.assignBinding.owner) == 1 && bindingSkipList.testBit(coreIndex))
break;
QDeclarativeBinding *bind = new QDeclarativeBinding((void *)datas.at(instr.assignBinding.value).constData(), comp, context, ctxt, comp->name, instr.line, 0);
bindValues.append(bind);
bind->m_mePtr = &bindValues.values[bindValues.count - 1];
bind->setTarget(mp);
- bind->addToObject(target);
+
+ if (instr.type == QDeclarativeInstruction::StoreBindingOnAlias) {
+ QDeclarativeAbstractBinding *old = QDeclarativePropertyPrivate::setBindingNoEnable(target, coreIndex, QDeclarativePropertyPrivate::valueTypeCoreIndex(mp), bind);
+ if (old) { old->destroy(); }
+ } else {
+ bind->addToObject(target, QDeclarativePropertyPrivate::bindingIndex(mp));
+ }
}
break;
@@ -701,7 +709,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
ctxt->optimizedBindings->configBinding(instr.assignBinding.value, target, scope, property);
bindValues.append(binding);
binding->m_mePtr = &bindValues.values[bindValues.count - 1];
- binding->addToObject(target);
+ binding->addToObject(target, property);
}
break;
@@ -874,8 +882,26 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
case QDeclarativeInstruction::FetchValueType:
{
QObject *target = stack.top();
- QDeclarativeValueType *valueHandler =
- ep->valueTypes[instr.fetchValue.type];
+
+ if (instr.fetchValue.bindingSkipList != 0) {
+ // Possibly need to clear bindings
+ QDeclarativeData *targetData = QDeclarativeData::get(target);
+ if (targetData) {
+ QDeclarativeAbstractBinding *binding =
+ QDeclarativePropertyPrivate::binding(target, instr.fetchValue.property, -1);
+
+ if (binding && binding->bindingType() != QDeclarativeAbstractBinding::ValueTypeProxy) {
+ QDeclarativePropertyPrivate::setBinding(target, instr.fetchValue.property, -1, 0);
+ binding->destroy();
+ } else if (binding) {
+ QDeclarativeValueTypeProxyBinding *proxy =
+ static_cast<QDeclarativeValueTypeProxyBinding *>(binding);
+ proxy->removeBindings(instr.fetchValue.bindingSkipList);
+ }
+ }
+ }
+
+ QDeclarativeValueType *valueHandler = ep->valueTypes[instr.fetchValue.type];
valueHandler->read(target, instr.fetchValue.property);
stack.push(valueHandler);
}
diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp
index e28062b..38c1709 100644
--- a/src/declarative/qml/qdeclarativevmemetaobject.cpp
+++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp
@@ -46,6 +46,7 @@
#include "qdeclarativeexpression.h"
#include "private/qdeclarativeexpression_p.h"
#include "private/qdeclarativecontext_p.h"
+#include "private/qdeclarativebinding_p.h"
Q_DECLARE_METATYPE(QScriptValue);
@@ -589,7 +590,21 @@ int QDeclarativeVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
if (d->isObjectAlias()) {
*reinterpret_cast<QObject **>(a[0]) = target;
return -1;
- } else if (d->isValueTypeAlias()) {
+ }
+
+ // Remove binding (if any) on write
+ if(c == QMetaObject::WriteProperty) {
+ int flags = *reinterpret_cast<int*>(a[3]);
+ if (flags & QDeclarativePropertyPrivate::RemoveBindingOnAliasWrite) {
+ QDeclarativeData *targetData = QDeclarativeData::get(target);
+ if (targetData && targetData->hasBindingBit(d->propertyIndex())) {
+ QDeclarativeAbstractBinding *binding = QDeclarativePropertyPrivate::setBinding(target, d->propertyIndex(), d->isValueTypeAlias()?d->valueTypeIndex():-1, 0);
+ if (binding) binding->destroy();
+ }
+ }
+ }
+
+ if (d->isValueTypeAlias()) {
// Value type property
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(ctxt->engine);
@@ -821,6 +836,36 @@ void QDeclarativeVMEMetaObject::setVMEProperty(int index, const QScriptValue &v)
return writeVarProperty(index - propOffset, v);
}
+bool QDeclarativeVMEMetaObject::aliasTarget(int index, QObject **target, int *coreIndex, int *valueTypeIndex) const
+{
+ Q_ASSERT(index >= propOffset + metaData->propertyCount);
+
+ *target = 0;
+ *coreIndex = -1;
+ *valueTypeIndex = -1;
+
+ if (!ctxt)
+ return false;
+
+ QDeclarativeVMEMetaData::AliasData *d = metaData->aliasData() + (index - propOffset - metaData->propertyCount);
+ QDeclarativeContext *context = ctxt->asQDeclarativeContext();
+ QDeclarativeContextPrivate *ctxtPriv = QDeclarativeContextPrivate::get(context);
+
+ *target = ctxtPriv->data->idValues[d->contextIdx].data();
+ if (!*target)
+ return false;
+
+ if (d->isObjectAlias()) {
+ } else if (d->isValueTypeAlias()) {
+ *coreIndex = d->propertyIndex();
+ *valueTypeIndex = d->valueTypeIndex();
+ } else {
+ *coreIndex = d->propertyIndex();
+ }
+
+ return true;
+}
+
void QDeclarativeVMEMetaObject::connectAlias(int aliasId)
{
if (!aConnected.testBit(aliasId)) {
diff --git a/src/declarative/qml/qdeclarativevmemetaobject_p.h b/src/declarative/qml/qdeclarativevmemetaobject_p.h
index 5134763..7b6b410 100644
--- a/src/declarative/qml/qdeclarativevmemetaobject_p.h
+++ b/src/declarative/qml/qdeclarativevmemetaobject_p.h
@@ -138,6 +138,7 @@ public:
QDeclarativeCompiledData *compiledData);
~QDeclarativeVMEMetaObject();
+ bool aliasTarget(int index, QObject **target, int *coreIndex, int *valueTypeIndex) const;
void registerInterceptor(int index, int valueIndex, QDeclarativePropertyValueInterceptor *interceptor);
QScriptValue vmeMethod(int index);
int vmeMethodLineNumber(int index);
@@ -146,6 +147,7 @@ public:
void setVMEProperty(int index, const QScriptValue &);
void connectAliasSignal(int index);
+
protected:
virtual int metaCall(QMetaObject::Call _c, int _id, void **_a);
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index f2e6217..dd7e5fd 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -1324,7 +1324,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
/*!
\qmlclass RotationAnimation QDeclarativeRotationAnimation
- \ingroup qml-animation-transition
+ \ingroup qml-animation-transition
\since 4.7
\inherits PropertyAnimation
\brief The RotationAnimation element animates changes in rotation values.
@@ -1333,8 +1333,8 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
over the direction of rotation during an animation.
By default, it rotates in the direction
- of the numerical change; a rotation from 0 to 240 will rotate 220 degrees
- clockwise, while a rotation from 240 to 0 will rotate 220 degrees
+ of the numerical change; a rotation from 0 to 240 will rotate 240 degrees
+ clockwise, while a rotation from 240 to 0 will rotate 240 degrees
counterclockwise. The \l direction property can be set to specify the
direction in which the rotation should occur.
@@ -1342,7 +1342,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t)
between states via the shortest path:
\snippet doc/src/snippets/declarative/rotationanimation.qml 0
-
+
Notice the RotationAnimation did not need to set a \l target
value. As a convenience, when used in a transition, RotationAnimation will rotate all
properties named "rotation" or "angle". You can override this by providing
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp
index a07b1bb..380d9bc 100644
--- a/src/declarative/util/qdeclarativepixmapcache.cpp
+++ b/src/declarative/util/qdeclarativepixmapcache.cpp
@@ -684,7 +684,7 @@ void QDeclarativePixmapStore::timerEvent(QTimerEvent *)
}
QDeclarativePixmapReply::QDeclarativePixmapReply(QDeclarativePixmapData *d)
-: data(d), reader(0), loading(false), redirectCount(0), requestSize(d->requestSize)
+: data(d), reader(0), requestSize(d->requestSize), loading(false), redirectCount(0)
{
if (finishedIndex == -1) {
finishedIndex = QDeclarativePixmapReply::staticMetaObject.indexOfSignal("finished()");
diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp
index b7a0026..fbdc522 100644
--- a/src/gui/dialogs/qdialog.cpp
+++ b/src/gui/dialogs/qdialog.cpp
@@ -282,8 +282,8 @@ QDialog::QDialog(QWidget *parent, Qt::WindowFlags f)
QDialog::QDialog(QWidget *parent, const char *name, bool modal, Qt::WindowFlags f)
: QWidget(*new QDialogPrivate, parent,
f
- | QFlag(modal ? Qt::WShowModal : 0)
- | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0)
+ | QFlag(modal ? Qt::WShowModal : Qt::WindowType(0))
+ | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))
)
{
setObjectName(QString::fromAscii(name));
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 15cc109..29415ed 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -165,8 +165,10 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config)
if (chosenVisualInfo) {
// Skip size checks if implementation supports non-matching visual
// and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444).
- if (QEgl::hasExtension("EGL_NV_post_convert_rounding"))
+ if (QEgl::hasExtension("EGL_NV_post_convert_rounding")) {
+ XFree(chosenVisualInfo);
return visualId;
+ }
int visualRedSize = countBits(chosenVisualInfo->red_mask);
int visualGreenSize = countBits(chosenVisualInfo->green_mask);
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 7ab49cb..94e1a72 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -3295,9 +3295,13 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
}
// Update the child focus chain.
- if (scene && scene->focusItem())
- scene->focusItem()->d_ptr->clearSubFocus();
- f->d_ptr->setSubFocus();
+ QGraphicsItem *commonAncestor = 0;
+ if (scene && scene->focusItem()) {
+ commonAncestor = scene->focusItem()->commonAncestorItem(f);
+ scene->focusItem()->d_ptr->clearSubFocus(scene->focusItem(), commonAncestor);
+ }
+
+ f->d_ptr->setSubFocus(f, commonAncestor);
// Update the scene's focus item.
if (scene) {
@@ -5554,7 +5558,7 @@ void QGraphicsItemPrivate::ensureSceneTransformRecursive(QGraphicsItem **topMost
/*!
\internal
*/
-void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem)
+void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem, QGraphicsItem *stopItem)
{
// Update focus child chain. Stop at panels, or if this item
// is hidden, stop at the first item with a visible parent.
@@ -5567,7 +5571,7 @@ void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem)
if (parent != q_ptr && parent->d_ptr->subFocusItem) {
if (parent->d_ptr->subFocusItem == q_ptr)
break;
- parent->d_ptr->subFocusItem->d_ptr->clearSubFocus();
+ parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(0, stopItem);
}
parent->d_ptr->subFocusItem = q_ptr;
parent->d_ptr->subFocusItemChange();
@@ -5580,12 +5584,12 @@ void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem)
/*!
\internal
*/
-void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem)
+void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem *stopItem)
{
// Reset sub focus chain.
QGraphicsItem *parent = rootItem ? rootItem : q_ptr;
do {
- if (parent->d_ptr->subFocusItem != q_ptr)
+ if (parent->d_ptr->subFocusItem != q_ptr || parent == stopItem)
break;
parent->d_ptr->subFocusItem = 0;
parent->d_ptr->subFocusItemChange();
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 1b7aa97..b938759 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -479,8 +479,8 @@ public:
void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide);
void clearFocusHelper(bool giveFocusToParent);
- void setSubFocus(QGraphicsItem *rootItem = 0);
- void clearSubFocus(QGraphicsItem *rootItem = 0);
+ void setSubFocus(QGraphicsItem *rootItem = 0, QGraphicsItem *stopItem = 0);
+ void clearSubFocus(QGraphicsItem *rootItem = 0, QGraphicsItem *stopItem = 0);
void resetFocusProxy();
virtual void subFocusItemChange();
virtual void focusScopeItemChange(bool isSubFocusItem);
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 1157b93..6ba3858 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1121,9 +1121,14 @@ QImage::QImage(const char * const xpm[])
QImage::QImage(const QImage &image)
: QPaintDevice()
{
- d = image.d;
- if (d)
- d->ref.ref();
+ if (image.paintingActive()) {
+ d = 0;
+ operator=(image.copy());
+ } else {
+ d = image.d;
+ if (d)
+ d->ref.ref();
+ }
}
#ifdef QT3_SUPPORT
@@ -1320,11 +1325,15 @@ QImage::~QImage()
QImage &QImage::operator=(const QImage &image)
{
- if (image.d)
- image.d->ref.ref();
- if (d && !d->ref.deref())
- delete d;
- d = image.d;
+ if (image.paintingActive()) {
+ operator=(image.copy());
+ } else {
+ if (image.d)
+ image.d->ref.ref();
+ if (d && !d->ref.deref())
+ delete d;
+ d = image.d;
+ }
return *this;
}
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 53f3559..29bf5f5 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -44,11 +44,13 @@
#include "qpixmap_raster_p.h"
#include "qnativeimage_p.h"
#include "qimage_p.h"
+#include "qpaintengine.h"
#include "qbitmap.h"
#include "qimage.h"
#include <QBuffer>
#include <QImageReader>
+#include <private/qimage_p.h>
#include <private/qsimd_p.h>
#include <private/qwidget_p.h>
#include <private/qdrawhelper_p.h>
@@ -302,6 +304,15 @@ bool QRasterPixmapData::hasAlphaChannel() const
QImage QRasterPixmapData::toImage() const
{
+ if (!image.isNull()) {
+ QImageData *data = const_cast<QImage &>(image).data_ptr();
+ if (data->paintEngine && data->paintEngine->isActive()
+ && data->paintEngine->paintDevice() == &image)
+ {
+ return image.copy();
+ }
+ }
+
return image;
}
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 935aba0..1a78bae 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -82,6 +82,41 @@ QT_BEGIN_NAMESPACE
Never to grayscale.
*/
+class QPngHandlerPrivate
+{
+public:
+ enum State {
+ Ready,
+ ReadHeader,
+ ReadingEnd,
+ Error
+ };
+
+ QPngHandlerPrivate(QPngHandler *qq)
+ : gamma(0.0), quality(2), png_ptr(0), info_ptr(0),
+ end_info(0), row_pointers(0), state(Ready), q(qq)
+ { }
+
+ float gamma;
+ int quality;
+ QString description;
+
+ png_struct *png_ptr;
+ png_info *info_ptr;
+ png_info *end_info;
+ png_byte **row_pointers;
+
+ bool readPngHeader();
+ bool readPngImage(QImage *image);
+
+ QImage::Format readImageFormat();
+
+ State state;
+
+ QPngHandler *q;
+};
+
+
#if defined(Q_C_CALLBACKS)
extern "C" {
#endif
@@ -118,7 +153,16 @@ private:
static
void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
- QIODevice *in = (QIODevice *)png_get_io_ptr(png_ptr);
+ QPngHandlerPrivate *d = (QPngHandlerPrivate *)png_get_io_ptr(png_ptr);
+ QIODevice *in = d->q->device();
+
+ if (d->state == QPngHandlerPrivate::ReadingEnd && !in->isSequential() && (in->size() - in->pos()) < 4 && length == 4) {
+ // Workaround for certain malformed PNGs that lack the final crc bytes
+ uchar endcrc[4] = { 0xae, 0x42, 0x60, 0x82 };
+ qMemCopy(data, endcrc, 4);
+ in->seek(in->size());
+ return;
+ }
while (length) {
int nr = in->read((char*)data, length);
@@ -314,38 +358,6 @@ static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const
}
#endif
-class QPngHandlerPrivate
-{
-public:
- enum State {
- Ready,
- ReadHeader,
- Error
- };
-
- QPngHandlerPrivate(QPngHandler *qq)
- : gamma(0.0), quality(2), png_ptr(0), info_ptr(0),
- end_info(0), row_pointers(0), state(Ready), q(qq)
- { }
-
- float gamma;
- int quality;
- QString description;
-
- png_struct *png_ptr;
- png_info *info_ptr;
- png_info *end_info;
- png_byte **row_pointers;
-
- bool readPngHeader();
- bool readPngImage(QImage *image);
-
- QImage::Format readImageFormat();
-
- State state;
-
- QPngHandler *q;
-};
/*!
\internal
@@ -379,7 +391,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader()
return false;
}
- png_set_read_fn(png_ptr, q->device(), iod_read_fn);
+ png_set_read_fn(png_ptr, this, iod_read_fn);
png_read_info(png_ptr, info_ptr);
#ifndef QT_NO_IMAGE_TEXT
@@ -505,6 +517,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage)
}
#endif
+ state = ReadingEnd;
png_read_end(png_ptr, end_info);
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
delete [] row_pointers;
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 7b81761..acc8deb 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -827,7 +827,7 @@ QVariant QAbstractItemView::inputMethodQuery(Qt::InputMethodQuery query) const
deleted. QAbstractItemView does not take ownership of \a delegate.
\note If a delegate has been assigned to both a row and a column, the row
- delegate (i.e., this delegate) will take presedence and manage the
+ delegate (i.e., this delegate) will take precedence and manage the
intersecting cell index.
\warning You should not share the same instance of a delegate between views.
@@ -885,7 +885,7 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegateForRow(int row) const
deleted. QAbstractItemView does not take ownership of \a delegate.
\note If a delegate has been assigned to both a row and a column, the row
- delegate will take presedence and manage the intersecting cell index.
+ delegate will take precedence and manage the intersecting cell index.
\warning You should not share the same instance of a delegate between views.
Doing so can cause incorrect or unintuitive editing behavior since each
diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp
index 767b5a9..7d20bbb 100644
--- a/src/gui/itemviews/qstandarditemmodel.cpp
+++ b/src/gui/itemviews/qstandarditemmodel.cpp
@@ -1130,7 +1130,7 @@ Qt::ItemFlags QStandardItem::flags() const
meaning that the user can interact with the item; if \a enabled is false, the
user cannot interact with the item.
- This flag takes presedence over the other item flags; e.g. if an item is not
+ This flag takes precedence over the other item flags; e.g. if an item is not
enabled, it cannot be selected by the user, even if the Qt::ItemIsSelectable
flag has been set.
diff --git a/src/gui/kernel/qeventdispatcher_s60_p.h b/src/gui/kernel/qeventdispatcher_s60_p.h
index c14fef0..539a21c 100644
--- a/src/gui/kernel/qeventdispatcher_s60_p.h
+++ b/src/gui/kernel/qeventdispatcher_s60_p.h
@@ -75,6 +75,13 @@ public:
void complete();
private:
+ // Workaround for a BC break from S60 3.2 -> 5.0, where the CEikonEnv override was removed.
+ // To avoid linking to that when we build against 3.2, define an empty body here.
+ // Reserved_*() have been verified to be empty in the S60 code.
+ void Reserved_1() {}
+ void Reserved_2() {}
+
+private:
int m_lastIterationCount;
TInt m_savedStatusCode;
bool m_hasAlreadyRun;
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index a4ab278..024a69d 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -6432,6 +6432,8 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedTiled(int count, const QSpan *sp
int px = int(tx) - (tx < 0);
int py = int(ty) - (ty < 0);
+ px %= image_width;
+ py %= image_height;
if (px < 0)
px += image_width;
if (py < 0)
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index 0510b10..714d5de 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -268,6 +268,15 @@ void QEmulationPaintEngine::setState(QPainterState *s)
real_engine->setState(s);
}
+void QEmulationPaintEngine::beginNativePainting()
+{
+ real_engine->beginNativePainting();
+}
+
+void QEmulationPaintEngine::endNativePainting()
+{
+ real_engine->endNativePainting();
+}
void QEmulationPaintEngine::fillBGRect(const QRectF &r)
{
diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h
index 5835f10..e283645 100644
--- a/src/gui/painting/qemulationpaintengine_p.h
+++ b/src/gui/painting/qemulationpaintengine_p.h
@@ -93,6 +93,9 @@ public:
virtual void setState(QPainterState *s);
+ virtual void beginNativePainting();
+ virtual void endNativePainting();
+
virtual uint flags() const {return QPaintEngineEx::IsEmulationEngine | QPaintEngineEx::DoNotEmulate;}
inline QPainterState *state() { return (QPainterState *)QPaintEngine::state; }
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index ec9ebeb..001345f 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -963,49 +963,53 @@
const QT_FT_Vector* control2,
const QT_FT_Vector* to )
{
+ TPos dx, dy, da, db;
int top, level;
int* levels;
QT_FT_Vector* arc;
- int mid_x = ( DOWNSCALE( ras.x ) + to->x +
- 3 * (control1->x + control2->x ) ) / 8;
- int mid_y = ( DOWNSCALE( ras.y ) + to->y +
- 3 * (control1->y + control2->y ) ) / 8;
- TPos dx = DOWNSCALE( ras.x ) + to->x - ( mid_x << 1 );
- TPos dy = DOWNSCALE( ras.y ) + to->y - ( mid_y << 1 );
+ dx = DOWNSCALE( ras.x ) + to->x - ( control1->x << 1 );
if ( dx < 0 )
dx = -dx;
+ dy = DOWNSCALE( ras.y ) + to->y - ( control1->y << 1 );
if ( dy < 0 )
dy = -dy;
if ( dx < dy )
dx = dy;
+ da = dx;
+
+ dx = DOWNSCALE( ras.x ) + to->x - 3 * ( control1->x + control2->x );
+ if ( dx < 0 )
+ dx = -dx;
+ dy = DOWNSCALE( ras.y ) + to->y - 3 * ( control1->y + control2->y );
+ if ( dy < 0 )
+ dy = -dy;
+ if ( dx < dy )
+ dx = dy;
+ db = dx;
level = 1;
- dx /= ras.cubic_level;
- while ( dx > 0 )
+ da = da / ras.cubic_level;
+ db = db / ras.conic_level;
+ while ( da > 0 || db > 0 )
{
- dx >>= 2;
+ da >>= 2;
+ db >>= 3;
level++;
}
if ( level <= 1 )
{
- TPos to_x, to_y;
+ TPos to_x, to_y, mid_x, mid_y;
to_x = UPSCALE( to->x );
to_y = UPSCALE( to->y );
-
- /* Recalculation of midpoint is needed only if */
- /* UPSCALE and DOWNSCALE have any effect. */
-
-#if ( PIXEL_BITS != 6 )
mid_x = ( ras.x + to_x +
3 * UPSCALE( control1->x + control2->x ) ) / 8;
mid_y = ( ras.y + to_y +
3 * UPSCALE( control1->y + control2->y ) ) / 8;
-#endif
gray_render_line( RAS_VAR_ mid_x, mid_y );
gray_render_line( RAS_VAR_ to_x, to_y );
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index a17b7c1..5060ad6 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -868,9 +868,9 @@ QWingedEdge::QWingedEdge() :
}
QWingedEdge::QWingedEdge(const QPainterPath &subject, const QPainterPath &clip) :
- m_edges(subject.length()),
- m_vertices(subject.length()),
- m_segments(subject.length())
+ m_edges(subject.elementCount()),
+ m_vertices(subject.elementCount()),
+ m_segments(subject.elementCount())
{
m_segments.setPath(subject);
m_segments.addPath(clip);
@@ -1405,9 +1405,9 @@ bool QPathClipper::intersect()
else if (clipIsRect)
return subjectPath.intersects(r2);
- QPathSegments a(subjectPath.length());
+ QPathSegments a(subjectPath.elementCount());
a.setPath(subjectPath);
- QPathSegments b(clipPath.length());
+ QPathSegments b(clipPath.elementCount());
b.setPath(clipPath);
QIntersectionFinder finder;
@@ -1450,9 +1450,9 @@ bool QPathClipper::contains()
if (clipIsRect)
return subjectPath.contains(r2);
- QPathSegments a(subjectPath.length());
+ QPathSegments a(subjectPath.elementCount());
a.setPath(subjectPath);
- QPathSegments b(clipPath.length());
+ QPathSegments b(clipPath.elementCount());
b.setPath(clipPath);
QIntersectionFinder finder;
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index ba5d164..bd68d2a 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1390,7 +1390,7 @@ int QPdfBaseEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
void QPdfBaseEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value)
{
Q_D(QPdfBaseEngine);
- switch (key) {
+ switch (int(key)) {
case PPK_CollateCopies:
d->collate = value.toBool();
break;
@@ -1480,7 +1480,7 @@ QVariant QPdfBaseEngine::property(PrintEnginePropertyKey key) const
Q_D(const QPdfBaseEngine);
QVariant ret;
- switch (key) {
+ switch (int(key)) {
case PPK_CollateCopies:
ret = d->collate;
break;
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 7b75d40..92f53ff 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -698,7 +698,7 @@ void QS60StylePrivate::deleteStoredSettings()
{
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
settings.beginGroup(QLatin1String("QS60Style"));
- settings.remove("");
+ settings.remove(QString());
settings.endGroup();
}
@@ -717,7 +717,6 @@ QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
QT_TRAP_THROWING(
CRepository *themeRepository = CRepository::NewLC(personalisationUID);
if (themeRepository) {
- static const TInt KThemePkgIDDesSize = 23; //size of the stored theme package ID
TBuf<32> value; //themeID is currently max of 8 + 1 + 8 characters, but lets have some extra space
const TUint32 key = 0x00000002; //active theme key in the repository
error = themeRepository->Get(key, value);
@@ -747,7 +746,7 @@ QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
return storedColor;
}
}
- settings.remove(""); //if color was invalid, or theme has been changed, just delete all stored settings
+ settings.remove(QString()); //if color was invalid, or theme has been changed, just delete all stored settings
}
}
#endif
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index 3ebfab2..be8f794 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -2456,6 +2456,8 @@ QDebug operator<<(QDebug debug, QStyle::State state)
qSort(states);
debug << states.join(QLatin1String(" | "));
debug << ')';
+#else
+ Q_UNUSED(state);
#endif
return debug;
}
diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp
index 4780edf..05ca793 100644
--- a/src/gui/styles/qstyleoption.cpp
+++ b/src/gui/styles/qstyleoption.cpp
@@ -5483,6 +5483,8 @@ QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
case QStyleOption::SO_GraphicsItem:
debug << "SO_GraphicsItem"; break;
}
+#else
+ Q_UNUSED(optionType);
#endif
return debug;
}
@@ -5496,6 +5498,8 @@ QDebug operator<<(QDebug debug, const QStyleOption &option)
debug << ',' << option.state;
debug << ',' << option.rect;
debug << ')';
+#else
+ Q_UNUSED(option);
#endif
return debug;
}
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 769ab2f..f73cc4b 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -363,6 +363,9 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
bool adjustX = true;
QTextBlock blockIt = block();
+ if (!blockIt.isValid())
+ return false;
+
if (op >= QTextCursor::Left && op <= QTextCursor::WordRight
&& blockIt.textDirection() == Qt::RightToLeft) {
if (op == QTextCursor::Left)
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index c35069f..77e6aa1 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -596,8 +596,10 @@ void QTextDocument::markContentsDirty(int from, int length)
Q_D(QTextDocument);
d->documentChange(from, length);
if (!d->inContentsChange) {
- d->lout->documentChanged(d->docChangeFrom, d->docChangeOldLength, d->docChangeLength);
- d->docChangeFrom = -1;
+ if (d->lout) {
+ d->lout->documentChanged(d->docChangeFrom, d->docChangeOldLength, d->docChangeLength);
+ d->docChangeFrom = -1;
+ }
}
}
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 46db253..fdbb680 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -265,10 +265,18 @@ private:
friend QDataStream &operator>>(QDataStream &, QTextFormat &);
};
-// this is only safe if sizeof(int) == sizeof(float)
+// this is only safe because sizeof(int) == sizeof(float)
static inline uint hash(float d)
{
+#ifdef Q_CC_GNU
+ // this is a GCC extension and isn't guaranteed to work in other compilers
+ // the reinterpret_cast below generates a strict-aliasing warning with GCC
+ union { float f; uint u; } cvt;
+ cvt.f = d;
+ return cvt.u;
+#else
return reinterpret_cast<uint&>(d);
+#endif
}
static inline uint hash(const QColor &color)
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp
index df9b171..0a6269d 100644
--- a/src/gui/widgets/qdockwidget.cpp
+++ b/src/gui/widgets/qdockwidget.cpp
@@ -1531,8 +1531,11 @@ QAction * QDockWidget::toggleViewAction() const
/*!
\since 4.3
+
Sets an arbitrary \a widget as the dock widget's title bar. If \a widget
- is 0, the title bar widget is removed, but not deleted.
+ is 0, any custom title bar widget previously set on the dock widget is
+ removed, but not deleted, and the default title bar will be used
+ instead.
If a title bar widget is set, QDockWidget will not use native window
decorations when it is floated.
@@ -1540,23 +1543,27 @@ QAction * QDockWidget::toggleViewAction() const
Here are some tips for implementing custom title bars:
\list
- \i Mouse events that are not explicitly handled by the title bar widget
+ \o Mouse events that are not explicitly handled by the title bar widget
must be ignored by calling QMouseEvent::ignore(). These events then
propagate to the QDockWidget parent, which handles them in the usual
manner, moving when the title bar is dragged, docking and undocking
when it is double-clicked, etc.
- \i When DockWidgetVerticalTitleBar is set on QDockWidget, the title
+ \o When DockWidgetVerticalTitleBar is set on QDockWidget, the title
bar widget is repositioned accordingly. In resizeEvent(), the title
bar should check what orientation it should assume:
\snippet doc/src/snippets/code/src_gui_widgets_qdockwidget.cpp 0
- \i The title bar widget must have a valid QWidget::sizeHint() and
+ \o The title bar widget must have a valid QWidget::sizeHint() and
QWidget::minimumSizeHint(). These functions should take into account
the current orientation of the title bar.
+
+ \o It is not possible to remove a title bar from a dock widget. However,
+ a similar effect can be achieved by setting a default constructed
+ QWidget as the title bar widget.
\endlist
- Using qobject_cast as shown above, the title bar widget has full access
+ Using qobject_cast() as shown above, the title bar widget has full access
to its parent QDockWidget. Hence it can perform such operations as docking
and hiding in response to user actions.
diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
index abab33c..9c71004 100644
--- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
@@ -279,7 +279,7 @@ void QDeclarativeFolderListModel::classBegin()
void QDeclarativeFolderListModel::componentComplete()
{
- if (!d->folder.isValid() || !QDir().exists(d->folder.toLocalFile()))
+ if (!d->folder.isValid() || d->folder.toLocalFile().isEmpty() || !QDir().exists(d->folder.toLocalFile()))
setFolder(QUrl(QLatin1String("file://")+QDir::currentPath()));
if (!d->folderIndex.isValid())
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 4d27531..0531595 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -327,8 +327,6 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
Q_ASSERT(socket);
Q_ASSERT(reply);
- Q_Q(QHttpNetworkConnection);
-
resend = false;
//create the response header to be used with QAuthenticatorPrivate.
QList<QPair<QByteArray, QByteArray> > fields = reply->header();
@@ -854,12 +852,17 @@ QHttpNetworkReply* QHttpNetworkConnection::sendRequest(const QHttpNetworkRequest
return d->queueRequest(request);
}
-bool QHttpNetworkConnection::isEncrypted() const
+bool QHttpNetworkConnection::isSsl() const
{
Q_D(const QHttpNetworkConnection);
return d->encrypt;
}
+QHttpNetworkConnectionChannel *QHttpNetworkConnection::channels() const
+{
+ return d_func()->channels;
+}
+
#ifndef QT_NO_NETWORKPROXY
void QHttpNetworkConnection::setCacheProxy(const QNetworkProxy &networkProxy)
{
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index 8461426c..9f23cbf 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -108,7 +108,9 @@ public:
QNetworkProxy transparentProxy() const;
#endif
- bool isEncrypted() const;
+ bool isSsl() const;
+
+ QHttpNetworkConnectionChannel *channels() const;
#ifndef QT_NO_OPENSSL
void setSslConfiguration(const QSslConfiguration &config);
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 02daa50..c8caad4 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -180,7 +180,6 @@ bool QHttpNetworkConnectionChannel::sendRequest()
reply->d_func()->autoDecompress = request.d->autoDecompress;
reply->d_func()->pipeliningUsed = false;
- pendingEncrypt = false;
// if the url contains authentication parameters, use the new ones
// both channels will use the new authentication parameters
if (!request.url().userInfo().isEmpty() && request.withCredentials()) {
@@ -1019,6 +1018,7 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
if (!socket)
return; // ### error
state = QHttpNetworkConnectionChannel::IdleState;
+ pendingEncrypt = false;
sendRequest();
}
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
index 442086a..fd18042 100644
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
@@ -158,6 +158,8 @@ public:
bool isSocketWaiting() const;
bool isSocketReading() const;
+ friend class QNetworkAccessHttpBackend;
+
protected slots:
void _q_receiveReply();
void _q_bytesWritten(qint64 bytes); // proceed sending
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index e4eb7c4..21bc427 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -188,6 +188,12 @@ QByteArray QHttpNetworkReply::readAny()
return d->responseData.read();
}
+QByteArray QHttpNetworkReply::readAll()
+{
+ Q_D(QHttpNetworkReply);
+ return d->responseData.readAll();
+}
+
void QHttpNetworkReply::setDownstreamLimited(bool dsl)
{
Q_D(QHttpNetworkReply);
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index 3f79d81..9cf805c 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -126,6 +126,7 @@ public:
qint64 bytesAvailable() const;
qint64 bytesAvailableNextBlock() const;
QByteArray readAny();
+ QByteArray readAll();
void setDownstreamLimited(bool t);
bool isFinished() const;
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index 05eb6cb..12b6400 100644
--- a/src/network/access/qnetworkaccessbackend.cpp
+++ b/src/network/access/qnetworkaccessbackend.cpp
@@ -142,6 +142,7 @@ void QNetworkAccessBackend::emitReplyUploadProgress(qint64 bytesSent, qint64 byt
QNetworkAccessBackend::QNetworkAccessBackend()
: manager(0)
, reply(0)
+ , synchronous(false)
{
}
diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h
index 7faa5cb..c9ec37e 100644
--- a/src/network/access/qnetworkaccessbackend_p.h
+++ b/src/network/access/qnetworkaccessbackend_p.h
@@ -157,6 +157,9 @@ public:
QVariant attribute(QNetworkRequest::Attribute code) const;
void setAttribute(QNetworkRequest::Attribute code, const QVariant &value);
+ bool isSynchronous() { return synchronous; }
+ void setSynchronous(bool sync) { synchronous = sync; }
+
// return true if the QNonContiguousByteDevice of the upload
// data needs to support reset(). Currently needed for HTTP.
// This will possibly enable buffering of the upload data.
@@ -166,6 +169,8 @@ public:
virtual bool canResume() const { return false; }
virtual void setResumeOffset(quint64 offset) { Q_UNUSED(offset); }
+ virtual bool processRequestSynchronously() { return false; }
+
protected:
// Create the device used for reading the upload data
QNonContiguousByteDevice* createUploadByteDevice();
@@ -200,6 +205,7 @@ private:
friend class QNetworkReplyImplPrivate;
QNetworkAccessManagerPrivate *manager;
QNetworkReplyImplPrivate *reply;
+ bool synchronous;
};
class QNetworkAccessBackendFactory
diff --git a/src/network/access/qnetworkaccessdatabackend.cpp b/src/network/access/qnetworkaccessdatabackend.cpp
index efb6e3e..74aebdb 100644
--- a/src/network/access/qnetworkaccessdatabackend.cpp
+++ b/src/network/access/qnetworkaccessdatabackend.cpp
@@ -122,4 +122,10 @@ bool QNetworkAccessDataBackend::waitForUpstreamBytesWritten(int)
return false;
}
+bool QNetworkAccessDataBackend::processRequestSynchronously()
+{
+ start();
+ return true;
+}
+
QT_END_NAMESPACE
diff --git a/src/network/access/qnetworkaccessdatabackend_p.h b/src/network/access/qnetworkaccessdatabackend_p.h
index a7c63d5..0e5a494 100644
--- a/src/network/access/qnetworkaccessdatabackend_p.h
+++ b/src/network/access/qnetworkaccessdatabackend_p.h
@@ -68,6 +68,8 @@ public:
virtual void closeUpstreamChannel();
virtual bool waitForDownstreamReadyRead(int msecs);
virtual bool waitForUpstreamBytesWritten(int msecs);
+
+ virtual bool processRequestSynchronously();
};
class QNetworkAccessDataBackendFactory: public QNetworkAccessBackendFactory
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index 80b05a4..9df5d7b 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -50,6 +50,7 @@
#include "qnetworkrequest_p.h"
#include "qnetworkcookie_p.h"
#include "QtCore/qdatetime.h"
+#include "QtCore/qelapsedtimer.h"
#include "QtNetwork/qsslconfiguration.h"
#ifndef QT_NO_HTTP
@@ -318,7 +319,10 @@ void QNetworkAccessHttpBackend::disconnectFromHttp()
// Get the object cache that stores our QHttpNetworkConnection objects
QNetworkAccessCache *cache = QNetworkAccessManagerPrivate::getObjectCache(this);
- cache->releaseEntry(cacheKey);
+
+ // synchronous calls are not put into the cache, so for them the key is empty
+ if (!cacheKey.isEmpty())
+ cache->releaseEntry(cacheKey);
}
// This is abut disconnecting signals, not about disconnecting TCP connections
@@ -639,34 +643,49 @@ void QNetworkAccessHttpBackend::open()
if (transparentProxy.type() == QNetworkProxy::DefaultProxy &&
cacheProxy.type() == QNetworkProxy::DefaultProxy) {
// unsuitable proxies
- QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ProxyNotFoundError),
- Q_ARG(QString, tr("No suitable proxy found")));
- QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
- return;
+ if (isSynchronous()) {
+ error(QNetworkReply::ProxyNotFoundError, tr("No suitable proxy found"));
+ finished();
+ } else {
+ QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
+ Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ProxyNotFoundError),
+ Q_ARG(QString, tr("No suitable proxy found")));
+ QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
+ }
+ return;
}
#endif
- // check if we have an open connection to this host
- cacheKey = makeCacheKey(this, theProxy);
- QNetworkAccessCache *cache = QNetworkAccessManagerPrivate::getObjectCache(this);
- // the http object is actually a QHttpNetworkConnection
- http = static_cast<QNetworkAccessCachedHttpConnection *>(cache->requestEntryNow(cacheKey));
- if (http == 0) {
- // no entry in cache; create an object
- // the http object is actually a QHttpNetworkConnection
- http = new QNetworkAccessCachedHttpConnection(url.host(), url.port(), encrypt);
-
+ if (isSynchronous()) {
+ // for synchronous requests, we just create a new connection
+ http = new QHttpNetworkConnection(1, url.host(), url.port(), encrypt, this);
#ifndef QT_NO_NETWORKPROXY
http->setTransparentProxy(transparentProxy);
http->setCacheProxy(cacheProxy);
#endif
+ postRequest();
+ processRequestSynchronously();
+ } else {
+ // check if we have an open connection to this host
+ cacheKey = makeCacheKey(this, theProxy);
+ QNetworkAccessCache *cache = QNetworkAccessManagerPrivate::getObjectCache(this);
+ // the http object is actually a QHttpNetworkConnection
+ http = static_cast<QNetworkAccessCachedHttpConnection *>(cache->requestEntryNow(cacheKey));
+ if (http == 0) {
+ // no entry in cache; create an object
+ // the http object is actually a QHttpNetworkConnection
+ http = new QNetworkAccessCachedHttpConnection(url.host(), url.port(), encrypt);
- // cache the QHttpNetworkConnection corresponding to this cache key
- cache->addEntry(cacheKey, http);
- }
+#ifndef QT_NO_NETWORKPROXY
+ http->setTransparentProxy(transparentProxy);
+ http->setCacheProxy(cacheProxy);
+#endif
- postRequest();
+ // cache the QHttpNetworkConnection corresponding to this cache key
+ cache->addEntry(cacheKey, static_cast<QNetworkAccessCachedHttpConnection *>(http.data()));
+ }
+ postRequest();
+ }
}
void QNetworkAccessHttpBackend::closeDownstreamChannel()
@@ -1125,6 +1144,87 @@ void QNetworkAccessHttpBackend::setResumeOffset(quint64 offset)
resumeOffset = offset;
}
+bool QNetworkAccessHttpBackend::processRequestSynchronously()
+{
+ QHttpNetworkConnectionChannel *channel = &http->channels()[0];
+
+ // Disconnect all socket signals. They will only confuse us when using waitFor*
+ QObject::disconnect(channel->socket, 0, 0, 0);
+
+ qint64 timeout = 20*1000; // 20 sec
+ QElapsedTimer timeoutTimer;
+
+ bool waitResult = channel->socket->waitForConnected(timeout);
+ timeoutTimer.start();
+
+ if (!waitResult || channel->socket->state() != QAbstractSocket::ConnectedState) {
+ error(QNetworkReply::UnknownNetworkError, QLatin1String("could not connect"));
+ return false;
+ }
+ channel->_q_connected(); // this will send the request (via sendRequest())
+
+#ifndef QT_NO_OPENSSL
+ if (http->isSsl()) {
+ qint64 remainingTimeEncrypted = timeout - timeoutTimer.elapsed();
+ if (!static_cast<QSslSocket *>(channel->socket)->waitForEncrypted(remainingTimeEncrypted)) {
+ error(QNetworkReply::SslHandshakeFailedError,
+ QLatin1String("could not encrypt or timeout while encrypting"));
+ return false;
+ }
+ channel->_q_encrypted();
+ }
+#endif
+
+ // if we get a 401 or 407, we might need to send the request twice, see below
+ bool authenticating = false;
+
+ do {
+ channel->sendRequest();
+
+ qint64 remainingTimeBytesWritten;
+ while(channel->socket->bytesToWrite() > 0 ||
+ channel->state == QHttpNetworkConnectionChannel::WritingState) {
+ remainingTimeBytesWritten = timeout - timeoutTimer.elapsed();
+ channel->sendRequest(); // triggers channel->socket->write()
+ if (!channel->socket->waitForBytesWritten(remainingTimeBytesWritten)) {
+ error(QNetworkReply::TimeoutError,
+ QLatin1String("could not write bytes to socket or timeout while writing"));
+ return false;
+ }
+ }
+
+ qint64 remainingTimeBytesRead = timeout - timeoutTimer.elapsed();
+ // Loop for at most remainingTime until either the socket disconnects
+ // or the reply is finished
+ do {
+ waitResult = channel->socket->waitForReadyRead(remainingTimeBytesRead);
+ remainingTimeBytesRead = timeout - timeoutTimer.elapsed();
+ if (!waitResult || remainingTimeBytesRead <= 0
+ || channel->socket->state() != QAbstractSocket::ConnectedState) {
+ error(QNetworkReply::TimeoutError,
+ QLatin1String("could not read from socket or timeout while reading"));
+ return false;
+ }
+
+ if (channel->socket->bytesAvailable())
+ channel->_q_readyRead();
+
+ if (!httpReply)
+ return false; // we got a 401 or 407 and cannot handle it (it might happen that
+ // disconnectFromHttp() was called, in that case the reply is zero)
+ // ### I am quite sure this does not work for NTLM
+ // ### how about uploading to an auth / proxyAuth site?
+
+ authenticating = (httpReply->statusCode() == 401 || httpReply->statusCode() == 407);
+
+ if (httpReply->isFinished())
+ break;
+ } while (remainingTimeBytesRead > 0);
+ } while (authenticating);
+
+ return true;
+}
+
QT_END_NAMESPACE
#endif // QT_NO_HTTP
diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h
index 5de3429..cc2f9ac 100644
--- a/src/network/access/qnetworkaccesshttpbackend_p.h
+++ b/src/network/access/qnetworkaccesshttpbackend_p.h
@@ -99,6 +99,8 @@ public:
bool canResume() const;
void setResumeOffset(quint64 offset);
+ virtual bool processRequestSynchronously();
+
private slots:
void replyReadyRead();
void replyFinished();
@@ -111,7 +113,7 @@ private slots:
private:
QHttpNetworkReply *httpReply;
- QPointer<QNetworkAccessCachedHttpConnection> http;
+ QPointer<QHttpNetworkConnection> http;
QByteArray cacheKey;
QNetworkAccessBackendUploadIODevice *uploadDevice;
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index effd79e..4bc036e 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -1060,12 +1060,14 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
priv->backend->setParent(reply);
priv->backend->reply = priv;
}
- // fourth step: setup the reply
- priv->setup(op, request, outgoingData);
#ifndef QT_NO_OPENSSL
reply->setSslConfiguration(request.sslConfiguration());
#endif
+
+ // fourth step: setup the reply
+ priv->setup(op, request, outgoingData);
+
return reply;
}
@@ -1141,6 +1143,11 @@ void QNetworkAccessManagerPrivate::authenticationRequired(QNetworkAccessBackend
}
}
+ // if we emit a signal here in synchronous mode, the user might spin
+ // an event loop, which might recurse and lead to problems
+ if (backend->isSynchronous())
+ return;
+
backend->reply->urlForLastAuthentication = url;
emit q->authenticationRequired(backend->reply->q_func(), authenticator);
cacheCredentials(url, authenticator);
@@ -1168,6 +1175,11 @@ void QNetworkAccessManagerPrivate::proxyAuthenticationRequired(QNetworkAccessBac
}
}
+ // if we emit a signal here in synchronous mode, the user might spin
+ // an event loop, which might recurse and lead to problems
+ if (backend->isSynchronous())
+ return;
+
backend->reply->lastProxyAuthentication = proxy;
emit q->proxyAuthenticationRequired(proxy, authenticator);
cacheProxyCredentials(proxy, authenticator);
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 5850494..cf6e674 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -85,7 +85,7 @@ void QNetworkReplyImplPrivate::_q_startOperation()
}
#ifndef QT_NO_BEARERMANAGEMENT
- if (!backend->start()) {
+ if (!backend->start()) { // ### we should call that method even if bearer is not used
// backend failed to start because the session state is not Connected.
// QNetworkAccessManager will call reply->backend->start() again for us when the session
// state changes.
@@ -109,11 +109,15 @@ void QNetworkReplyImplPrivate::_q_startOperation()
}
#endif
- if (state != Finished) {
- if (operation == QNetworkAccessManager::GetOperation)
- pendingNotifications.append(NotifyDownstreamReadyWrite);
+ if (backend->isSynchronous()) {
+ state = Finished;
+ } else {
+ if (state != Finished) {
+ if (operation == QNetworkAccessManager::GetOperation)
+ pendingNotifications.append(NotifyDownstreamReadyWrite);
- handleNotifications();
+ handleNotifications();
+ }
}
}
@@ -287,7 +291,25 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const
url = request.url();
operation = op;
- if (outgoingData && backend) {
+ q->QIODevice::open(QIODevice::ReadOnly);
+ // Internal code that does a HTTP reply for the synchronous Ajax
+ // in QtWebKit.
+ QVariant synchronousHttpAttribute = req.attribute(
+ static_cast<QNetworkRequest::Attribute>(QNetworkRequest::DownloadBufferAttribute + 1));
+ if (synchronousHttpAttribute.toBool()) {
+ backend->setSynchronous(true);
+ if (outgoingData && outgoingData->isSequential()) {
+ outgoingDataBuffer = new QRingBuffer();
+ QByteArray data;
+ do {
+ data = outgoingData->readAll();
+ if (data.isEmpty())
+ break;
+ outgoingDataBuffer->append(data);
+ } while (1);
+ }
+ }
+ if (outgoingData && backend && !backend->isSynchronous()) {
// there is data to be uploaded, e.g. HTTP POST.
if (!backend->needsResetableUploadData() || !outgoingData->isSequential()) {
@@ -298,7 +320,7 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const
} else {
bool bufferingDisallowed =
req.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute,
- false).toBool();
+ false).toBool();
if (bufferingDisallowed) {
// if a valid content-length header for the request was supplied, we can disable buffering
@@ -323,17 +345,18 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const
// for HTTP, we want to send out the request as fast as possible to the network, without
// invoking methods in a QueuedConnection
#ifndef QT_NO_HTTP
- if (qobject_cast<QNetworkAccessHttpBackend *>(backend)) {
+ if (qobject_cast<QNetworkAccessHttpBackend *>(backend) || (backend && backend->isSynchronous())) {
_q_startOperation();
} else {
QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
}
#else
- QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
+ if (backend->isSynchronous())
+ _q_startOperation();
+ else
+ QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
#endif // QT_NO_HTTP
- }
-
- q->QIODevice::open(QIODevice::ReadOnly);
+ }
}
void QNetworkReplyImplPrivate::backendNotify(InternalNotifications notification)
diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h
index cdadf0f..9bcc900 100644
--- a/src/network/access/qnetworkrequest.h
+++ b/src/network/access/qnetworkrequest.h
@@ -85,6 +85,9 @@ public:
MaximumDownloadBufferSizeAttribute, // internal
DownloadBufferAttribute, // internal
+ // (DownloadBufferAttribute + 1) is reserved internal for QSynchronousHttpNetworkReply
+ // add the enum in 4.8
+
User = 1000,
UserMax = 32767
};
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 1e0bced..5b42578 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -322,9 +322,9 @@ bool QLocalSocketPrivate::completeAsyncRead()
// buffer. We will read the remaining data in the next call.
break;
case ERROR_PIPE_NOT_CONNECTED:
- setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead"));
- // fall through
+ return false;
default:
+ setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead"));
return false;
}
}
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index a3ea555..275c7be 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -716,7 +716,7 @@ QSslCertificate QSslCertificatePrivate::QSslCertificate_from_X509(X509 *x509)
static bool matchLineFeed(const QByteArray &pem, int *offset)
{
- char ch;
+ char ch = 0;
// ignore extra whitespace at the end of the line
while (*offset < pem.size() && (ch = pem.at(*offset)) == ' ')
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
index 705ad09..66445cd 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
@@ -128,14 +128,17 @@ void QGLTextureGlyphCache::createTextureData(int width, int height)
m_width = width;
m_height = height;
- QVarLengthArray<uchar> data(width * height);
- for (int i = 0; i < data.size(); ++i)
- data[i] = 0;
-
- if (m_type == QFontEngineGlyphCache::Raster_RGBMask)
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]);
- else
+ if (m_type == QFontEngineGlyphCache::Raster_RGBMask) {
+ QVarLengthArray<uchar> data(width * height * 4);
+ for (int i = 0; i < data.size(); ++i)
+ data[i] = 0;
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]);
+ } else {
+ QVarLengthArray<uchar> data(width * height);
+ for (int i = 0; i < data.size(); ++i)
+ data[i] = 0;
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]);
+ }
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@@ -287,7 +290,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph)
if (mask.format() == QImage::Format_RGB32) {
glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits());
} else {
-#ifdef QT_OPENGL_ES2
+#ifdef QT_OPENGL_ES_2
glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits());
#else
// glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index ed9753e..18f1203 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2095,7 +2095,9 @@ void QGLContextPrivate::cleanup()
void QGLContextPrivate::setVertexAttribArrayEnabled(int arrayIndex, bool enabled)
{
Q_ASSERT(arrayIndex < QT_GL_VERTEX_ARRAY_TRACKED_COUNT);
+#ifdef glEnableVertexAttribArray
Q_ASSERT(glEnableVertexAttribArray);
+#endif
if (vertexAttributeArraysEnabledState[arrayIndex] && !enabled)
glDisableVertexAttribArray(arrayIndex);
@@ -2108,7 +2110,9 @@ void QGLContextPrivate::setVertexAttribArrayEnabled(int arrayIndex, bool enabled
void QGLContextPrivate::syncGlState()
{
+#ifdef glEnableVertexAttribArray
Q_ASSERT(glEnableVertexAttribArray);
+#endif
for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) {
if (vertexAttributeArraysEnabledState[i])
glEnableVertexAttribArray(i);
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index d33ea56..75dd1b6 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -97,7 +97,6 @@ QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *)
XVisualInfo visualInfo;
XVisualInfo *vi;
int numVisuals;
- EGLint id = 0;
visualInfo.visualid = QEgl::getCompatibleVisualId(config);
vi = XGetVisualInfo(X11->display, VisualIDMask, &visualInfo, &numVisuals);
@@ -346,7 +345,7 @@ void QGLWidgetPrivate::recreateEglSurface()
// old surface before re-creating a new one. Note: This should not be the case as the
// surface should be deleted before the old window id.
if (glcx->d_func()->eglSurface != EGL_NO_SURFACE && (currentId != eglSurfaceWindowId)) {
- qWarning("EGL surface for deleted window %x was not destroyed", eglSurfaceWindowId);
+ qWarning("EGL surface for deleted window %x was not destroyed", uint(eglSurfaceWindowId));
glcx->d_func()->destroyEglSurfaceForDevice();
}
diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp
index 0b94f5a..2d9f6f1 100644
--- a/src/opengl/qglpixelbuffer_egl.cpp
+++ b/src/opengl/qglpixelbuffer_egl.cpp
@@ -74,7 +74,6 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
// Use the same configuration as the widget we are sharing with.
ctx->setConfig(shareContext->config());
#if QGL_RENDER_TEXTURE
- EGLint value = EGL_FALSE;
if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGBA) == EGL_TRUE)
textureFormat = EGL_TEXTURE_RGBA;
else if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGB) == EGL_TRUE)
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index bbb98d0..f64b93c 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -377,7 +377,18 @@ void QGLWindowSurface::hijackWindow(QWidget *widget)
if (widgetPrivate->extraData()->glContext)
return;
- QGLContext *ctx = new QGLContext(surfaceFormat, widget);
+ QGLContext *ctx = NULL;
+
+ // For translucent top-level widgets we need alpha in the format.
+ if (widget->testAttribute(Qt::WA_TranslucentBackground)) {
+ QGLFormat modFormat(surfaceFormat);
+ modFormat.setSampleBuffers(false);
+ modFormat.setSamples(0);
+ modFormat.setAlpha(true);
+ ctx = new QGLContext(modFormat, widget);
+ } else
+ ctx = new QGLContext(surfaceFormat, widget);
+
ctx->create(qt_gl_share_widget()->context());
#ifndef QT_NO_EGL
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index 184ceb4..7f3501e 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -726,6 +726,7 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath)
if(servicePath.isEmpty()) {
id = QString::number(qHash(networkPath));
+ serv = 0;
} else {
id = QString::number(qHash(servicePath));
serv = new QConnmanServiceInterface(servicePath,this);
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index 952a444..0545422 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -216,7 +216,6 @@ void QConnmanManagerInterface::registerCounter(const QString &path, quint32 inte
{ QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("RegisterCounter"),
QVariant::fromValue(path),
QVariant::fromValue(interval));
- bool ok = true;
if(reply.error().type() == QDBusError::InvalidArgs) {
qWarning() << reply.error().message();
}
@@ -225,7 +224,6 @@ void QConnmanManagerInterface::registerCounter(const QString &path, quint32 inte
void QConnmanManagerInterface::unregisterCounter(const QString &path)
{ QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("UnregisterCounter"),
QVariant::fromValue(path));
- bool ok = true;
if(reply.error().type() == QDBusError::InvalidArgs) {
qWarning() << reply.error().message();
}
diff --git a/src/plugins/bearer/icd/proxyconf.cpp b/src/plugins/bearer/icd/proxyconf.cpp
index e5c8f4e..efe2da7 100644
--- a/src/plugins/bearer/icd/proxyconf.cpp
+++ b/src/plugins/bearer/icd/proxyconf.cpp
@@ -142,16 +142,23 @@ QHash<QString,QVariant> GConfItemFast::getEntries() const
-class NetworkProxyFactory : QNetworkProxyFactory {
+class NetworkProxyFactory : QNetworkProxyFactory
+{
+ ProxyConf proxy_conf;
+ bool proxy_data_read;
+
public:
- NetworkProxyFactory() { }
+ NetworkProxyFactory() : proxy_data_read(false) { }
QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery());
};
QList<QNetworkProxy> NetworkProxyFactory::queryProxy(const QNetworkProxyQuery &query)
{
- ProxyConf proxy_conf;
+ if (proxy_data_read == false) {
+ proxy_data_read = true;
+ proxy_conf.readProxyData();
+ }
QList<QNetworkProxy> result = proxy_conf.flush(query);
if (result.isEmpty())
@@ -299,12 +306,12 @@ QList<QNetworkProxy> ProxyConfPrivate::flush(const QNetworkProxyQuery &query)
if (isHostExcluded(query.peerHostName()))
return result; // no proxy for this host
- if (mode == "auto") {
+ if (mode == QLatin1String("AUTO")) {
// TODO: pac currently not supported, fix me
return result;
}
- if (mode == "manual") {
+ if (mode == QLatin1String("MANUAL")) {
bool isHttps = false;
QString protocol = query.protocolTag().toLower();
@@ -377,10 +384,13 @@ ProxyConf::~ProxyConf()
delete d_ptr;
}
+void ProxyConf::readProxyData()
+{
+ d_ptr->readProxyData();
+}
QList<QNetworkProxy> ProxyConf::flush(const QNetworkProxyQuery &query)
{
- d_ptr->readProxyData();
return d_ptr->flush(query);
}
diff --git a/src/plugins/bearer/icd/proxyconf.h b/src/plugins/bearer/icd/proxyconf.h
index 884cc5c..eedbbf2 100644
--- a/src/plugins/bearer/icd/proxyconf.h
+++ b/src/plugins/bearer/icd/proxyconf.h
@@ -58,6 +58,7 @@ public:
virtual ~ProxyConf();
QList<QNetworkProxy> flush(const QNetworkProxyQuery &query = QNetworkProxyQuery()); // read the proxies from db
+ void readProxyData();
/* Note that for each update() call there should be corresponding
* clear() call because the ProxyConf class implements a reference
diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp
index 1a2e3fa..ca303a8 100644
--- a/src/plugins/graphicssystems/meego/dithering.cpp
+++ b/src/plugins/graphicssystems/meego/dithering.cpp
@@ -154,7 +154,10 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h
// Add the diffusion for this pixel we stored in the accumulator.
// >> 7 because the values in accumulator are stored * 128
- component[c] += accumulator[c][x] >> 7;
+ if (x != 0 && x != (width - 1)) {
+ if (accumulator[c][x] >> 7 != 0)
+ component[c] += rand() % accumulator[c][x] >> 7;
+ }
// Make sure we're not over the boundaries.
CLAMP_256(component[c]);
@@ -172,10 +175,10 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h
// Distribute the difference according to the matrix in the
// accumulation bufffer.
- ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 7);
- ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 3);
+ ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 3);
+ ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 5);
ACCUMULATE(accumulator[c], x, 1, width, diff * 5);
- ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 1);
+ ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 3);
}
// Write the newly produced pixel
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index 507f70b..4a86082 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -124,8 +124,10 @@ QPixmapData* QMeeGoGraphicsSystem::wrapPixmapData(QPixmapData *pmd)
void QMeeGoGraphicsSystem::setSurfaceFixedSize(int /*width*/, int /*height*/)
{
- if (QMeeGoGraphicsSystem::surfaceWasCreated)
+ if (QMeeGoGraphicsSystem::surfaceWasCreated) {
qWarning("Trying to set surface fixed size but surface already created!");
+ return;
+ }
#ifdef QT_WAS_PATCHED
QEglProperties *properties = new QEglProperties();
@@ -143,6 +145,11 @@ void QMeeGoGraphicsSystem::setSurfaceScaling(int x, int y, int width, int height
void QMeeGoGraphicsSystem::setTranslucent(bool translucent)
{
+ if (QMeeGoGraphicsSystem::surfaceWasCreated) {
+ qWarning("Trying to set translucency but surface already created!");
+ return;
+ }
+
QGLWindowSurface::surfaceFormat.setSampleBuffers(false);
QGLWindowSurface::surfaceFormat.setSamples(0);
QGLWindowSurface::surfaceFormat.setAlpha(translucent);
diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def
index 54768a1..632326d 100644
--- a/src/s60installs/eabi/QtGuiu.def
+++ b/src/s60installs/eabi/QtGuiu.def
@@ -4658,11 +4658,11 @@ EXPORTS
_ZN20QGraphicsEllipseItemD1Ev @ 4657 NONAME
_ZN20QGraphicsEllipseItemD2Ev @ 4658 NONAME
_ZN20QGraphicsItemPrivate11removeChildEP13QGraphicsItem @ 4659 NONAME
- _ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItem @ 4660 NONAME
+ _ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItem @ 4660 NONAME ABSENT
_ZN20QGraphicsItemPrivate12remapItemPosEP6QEventP13QGraphicsItem @ 4661 NONAME
_ZN20QGraphicsItemPrivate12resolveDepthEv @ 4662 NONAME
_ZN20QGraphicsItemPrivate12setPosHelperERK7QPointF @ 4663 NONAME
- _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItem @ 4664 NONAME
+ _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItem @ 4664 NONAME ABSENT
_ZN20QGraphicsItemPrivate14setFocusHelperEN2Qt11FocusReasonEb @ 4665 NONAME ABSENT
_ZN20QGraphicsItemPrivate15resetFocusProxyEv @ 4666 NONAME
_ZN20QGraphicsItemPrivate16setEnabledHelperEbbb @ 4667 NONAME
@@ -12105,4 +12105,6 @@ EXPORTS
_ZN15QStaticTextItemD1Ev @ 12104 NONAME
_ZN15QStaticTextItemD2Ev @ 12105 NONAME
_ZN19QEventDispatcherS6031reactivateDeferredActiveObjectsEv @ 12106 NONAME
+ _ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItemS1_ @ 12107 NONAME
+ _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItemS1_ @ 12108 NONAME
diff --git a/src/xmlpatterns/data/qatomicvalue.cpp b/src/xmlpatterns/data/qatomicvalue.cpp
index ecc78bf..fc4cf2e 100644
--- a/src/xmlpatterns/data/qatomicvalue.cpp
+++ b/src/xmlpatterns/data/qatomicvalue.cpp
@@ -202,7 +202,7 @@ ItemType::Ptr AtomicValue::qtToXDMType(const QXmlItem &item)
Q_ASSERT(item.isAtomicValue());
const QVariant v(item.toAtomicValue());
- switch(v.type())
+ switch(int(v.type()))
{
case QVariant::Char:
/* Fallthrough. */