summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-08-05 15:20:28 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-08-05 15:20:28 (GMT)
commit909c084d0c275ec5e747f395b7e0cd39a1d052bc (patch)
treed9e9f9e99dba572471c14ec00b16f4eba07c9dac /src
parentcb086eb5340c4c41efaf45373aa05c37e8aa974a (diff)
parent05bb249c2ad3ee15eb205a806f8546c105683096 (diff)
downloadQt-909c084d0c275ec5e747f395b7e0cd39a1d052bc.zip
Qt-909c084d0c275ec5e747f395b7e0cd39a1d052bc.tar.gz
Qt-909c084d0c275ec5e747f395b7e0cd39a1d052bc.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qeasingcurve.cpp22
-rw-r--r--src/corelib/tools/qsimd_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp2
-rw-r--r--src/declarative/util/qdeclarativespringanimation.cpp228
-rw-r--r--src/declarative/util/qdeclarativespringanimation_p.h17
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm11
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp5
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp14
-rw-r--r--src/gui/painting/qdrawingprimitive_sse2_p.h8
-rw-r--r--src/gui/painting/qgraphicssystem_runtime.cpp9
-rw-r--r--src/gui/styles/qmacstyle_mac.h4
-rw-r--r--src/gui/styles/qmacstyle_mac.mm10
-rw-r--r--src/gui/styles/qmacstyle_mac_p.h2
-rw-r--r--src/gui/text/qtextengine.cpp87
-rw-r--r--src/gui/text/qtextengine_p.h14
-rw-r--r--src/gui/text/qtextlayout.cpp19
-rw-r--r--src/gui/widgets/qpushbutton.cpp8
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp57
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp113
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux_p.h13
-rw-r--r--src/plugins/bearer/icd/qicdengine.cpp38
-rw-r--r--src/plugins/bearer/icd/qicdengine.h8
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp39
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h2
-rw-r--r--src/sql/drivers/tds/qsql_tds.pri4
-rw-r--r--src/xml/dom/qdom.cpp6
26 files changed, 459 insertions, 285 deletions
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index 1734b03..ee791e0 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -91,6 +91,16 @@
animation.setDuration(1000);
animation.setEasingCurve(QEasingCurve::InOutQuad);
\endcode
+
+ The ability to set an amplitude, overshoot, or period depends on the QEasingCurve type. Amplitude access
+ is available to curves that behave as springs such as elastic and bounce curves. Changing the amplitude changes
+ the height of the curve. Period access is only available to elastic curves and setting a higher period slows
+ the rate of bounce. Only curves that have "boomerang" behaviors such as the InBack, OutBack, InOutBack, and OutInBack
+ have overshoot settings. These curves will interpolate beyond the end points and return to the end point,
+ acting similar to a boomerang.
+
+ The \l{Easing Curves Example} contains samples of QEasingCurve types and lets you change the curve settings.
+
*/
/*!
@@ -140,15 +150,15 @@
accelerating from zero velocity.
\value OutQuart \inlineimage qeasingcurve-outquart.png
\br
- Easing curve for a cubic (t^4) function:
+ Easing curve for a quartic (t^4) function:
decelerating to zero velocity.
\value InOutQuart \inlineimage qeasingcurve-inoutquart.png
\br
- Easing curve for a cubic (t^4) function:
+ Easing curve for a quartic (t^4) function:
acceleration until halfway, then deceleration.
\value OutInQuart \inlineimage qeasingcurve-outinquart.png
\br
- Easing curve for a cubic (t^4) function:
+ Easing curve for a quartic (t^4) function:
deceleration until halfway, then acceleration.
\value InQuint \inlineimage qeasingcurve-inquint.png
\br
@@ -156,15 +166,15 @@
in: accelerating from zero velocity.
\value OutQuint \inlineimage qeasingcurve-outquint.png
\br
- Easing curve for a cubic (t^5) function:
+ Easing curve for a quintic (t^5) function:
decelerating to zero velocity.
\value InOutQuint \inlineimage qeasingcurve-inoutquint.png
\br
- Easing curve for a cubic (t^5) function:
+ Easing curve for a quintic (t^5) function:
acceleration until halfway, then deceleration.
\value OutInQuint \inlineimage qeasingcurve-outinquint.png
\br
- Easing curve for a cubic (t^5) function:
+ Easing curve for a quintic (t^5) function:
deceleration until halfway, then acceleration.
\value InSine \inlineimage qeasingcurve-insine.png
\br
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 5ff0f97..a3148fb 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -150,7 +150,9 @@ enum CPUFeatures {
Q_CORE_EXPORT uint qDetectCPUFeatures();
-Q_CORE_EXPORT uint qDetectCPUFeatures();
+
+#define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \
+ for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x3)) & 0x3))); ++i)
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 82b3e1c..e1dd1c0 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -1021,7 +1021,7 @@ void QDeclarativeListViewPrivate::updateCurrent(int modelIndex)
if (oldCurrentItem && (!currentItem || oldCurrentItem->item != currentItem->item))
oldCurrentItem->attached->setIsCurrentItem(false);
if (currentItem) {
- if (modelIndex == visibleIndex - 1) {
+ if (modelIndex == visibleIndex - 1 && visibleItems.count()) {
// We can calculate exact postion in this case
currentItem->setPosition(visibleItems.first()->position() - currentItem->size() - spacing);
} else {
diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp
index 8ce4832..cfc7b8e 100644
--- a/src/declarative/util/qdeclarativespringanimation.cpp
+++ b/src/declarative/util/qdeclarativespringanimation.cpp
@@ -54,36 +54,32 @@
QT_BEGIN_NAMESPACE
-
-class QDeclarativeSpringAnimationPrivate : public QDeclarativeAbstractAnimationPrivate
+class QDeclarativeSpringAnimationPrivate : public QDeclarativePropertyAnimationPrivate
{
Q_DECLARE_PUBLIC(QDeclarativeSpringAnimation)
public:
- QDeclarativeSpringAnimationPrivate()
- : currentValue(0), to(0), from(0), maxVelocity(0), lastTime(0)
- , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01)
- , modulus(0.0), useMass(false), haveModulus(false), enabled(true)
- , fromDefined(false), toDefined(false)
- , mode(Track), clock(this) {}
-
- qreal currentValue;
- qreal to;
- qreal from;
+
+
+ struct SpringAnimation {
+ SpringAnimation()
+ : currentValue(0), to(0), velocity(0){}
+ qreal currentValue;
+ qreal to;
+ qreal velocity;
+ };
+ QHash<QDeclarativeProperty, SpringAnimation> activeAnimations;
+
qreal maxVelocity;
qreal velocityms;
int lastTime;
qreal mass;
qreal spring;
qreal damping;
- qreal velocity;
qreal epsilon;
qreal modulus;
bool useMass : 1;
bool haveModulus : 1;
- bool enabled : 1;
- bool fromDefined : 1;
- bool toDefined : 1;
enum Mode {
Track,
@@ -92,38 +88,68 @@ public:
};
Mode mode;
- void tick(int);
+ QDeclarativeSpringAnimationPrivate()
+ : maxVelocity(0), velocityms(0), lastTime(0)
+ , mass(1.0), spring(0.), damping(0.), epsilon(0.01)
+ , modulus(0.0), useMass(false), haveModulus(false)
+ , mode(Track), clock(0)
+ { }
+
+ void tick(int time);
+ bool animate(const QDeclarativeProperty &property, SpringAnimation &animation, int elapsed);
void updateMode();
- QTickAnimationProxy<QDeclarativeSpringAnimationPrivate, &QDeclarativeSpringAnimationPrivate::tick> clock;
+ typedef QTickAnimationProxy<QDeclarativeSpringAnimationPrivate, &QDeclarativeSpringAnimationPrivate::tick> Clock;
+ Clock *clock;
};
void QDeclarativeSpringAnimationPrivate::tick(int time)
{
if (mode == Track) {
- clock.stop();
+ clock->stop();
return;
}
-
int elapsed = time - lastTime;
if (!elapsed)
return;
- qreal srcVal = to;
+
+ if (mode == Spring) {
+ if (elapsed < 16) // capped at 62fps.
+ return;
+ int count = elapsed / 16;
+ lastTime = time - (elapsed - count * 16);
+ } else {
+ lastTime = time;
+ }
+
+ QMutableHashIterator<QDeclarativeProperty, SpringAnimation> it(activeAnimations);
+ while (it.hasNext()) {
+ it.next();
+ if (animate(it.key(), it.value(), elapsed))
+ it.remove();
+ }
+
+ if (activeAnimations.isEmpty())
+ clock->stop();
+}
+
+bool QDeclarativeSpringAnimationPrivate::animate(const QDeclarativeProperty &property, SpringAnimation &animation, int elapsed)
+{
+
+ qreal srcVal = animation.to;
bool stop = false;
if (haveModulus) {
- currentValue = fmod(currentValue, modulus);
+ animation.currentValue = fmod(animation.currentValue, modulus);
srcVal = fmod(srcVal, modulus);
}
if (mode == Spring) {
- if (elapsed < 16) // capped at 62fps.
- return;
// Real men solve the spring DEs using RK4.
// We'll do something much simpler which gives a result that looks fine.
int count = elapsed / 16;
for (int i = 0; i < count; ++i) {
- qreal diff = srcVal - currentValue;
+ qreal diff = srcVal - animation.currentValue;
if (haveModulus && qAbs(diff) > modulus / 2) {
if (diff < 0)
diff += modulus;
@@ -131,32 +157,31 @@ void QDeclarativeSpringAnimationPrivate::tick(int time)
diff -= modulus;
}
if (useMass)
- velocity = velocity + (spring * diff - damping * velocity) / mass;
+ animation.velocity = animation.velocity + (spring * diff - damping * animation.velocity) / mass;
else
- velocity = velocity + spring * diff - damping * velocity;
+ animation.velocity = animation.velocity + spring * diff - damping * animation.velocity;
if (maxVelocity > 0.) {
// limit velocity
- if (velocity > maxVelocity)
- velocity = maxVelocity;
- else if (velocity < -maxVelocity)
- velocity = -maxVelocity;
+ if (animation.velocity > maxVelocity)
+ animation.velocity = maxVelocity;
+ else if (animation.velocity < -maxVelocity)
+ animation.velocity = -maxVelocity;
}
- currentValue += velocity * 16.0 / 1000.0;
+ animation.currentValue += animation.velocity * 16.0 / 1000.0;
if (haveModulus) {
- currentValue = fmod(currentValue, modulus);
- if (currentValue < 0.0)
- currentValue += modulus;
+ animation.currentValue = fmod(animation.currentValue, modulus);
+ if (animation.currentValue < 0.0)
+ animation.currentValue += modulus;
}
}
- if (qAbs(velocity) < epsilon && qAbs(srcVal - currentValue) < epsilon) {
- velocity = 0.0;
- currentValue = srcVal;
+ if (qAbs(animation.velocity) < epsilon && qAbs(srcVal - animation.currentValue) < epsilon) {
+ animation.velocity = 0.0;
+ animation.currentValue = srcVal;
stop = true;
}
- lastTime = time - (elapsed - count * 16);
} else {
qreal moveBy = elapsed * velocityms;
- qreal diff = srcVal - currentValue;
+ qreal diff = srcVal - animation.currentValue;
if (haveModulus && qAbs(diff) > modulus / 2) {
if (diff < 0)
diff += modulus;
@@ -164,33 +189,31 @@ void QDeclarativeSpringAnimationPrivate::tick(int time)
diff -= modulus;
}
if (diff > 0) {
- currentValue += moveBy;
+ animation.currentValue += moveBy;
if (haveModulus)
- currentValue = fmod(currentValue, modulus);
- if (currentValue > to) {
- currentValue = to;
+ animation.currentValue = fmod(animation.currentValue, modulus);
+ if (animation.currentValue > animation.to) {
+ animation.currentValue = animation.to;
stop = true;
}
} else {
- currentValue -= moveBy;
- if (haveModulus && currentValue < 0.0)
- currentValue = fmod(currentValue, modulus) + modulus;
- if (currentValue < to) {
- currentValue = to;
+ animation.currentValue -= moveBy;
+ if (haveModulus && animation.currentValue < 0.0)
+ animation.currentValue = fmod(animation.currentValue, modulus) + modulus;
+ if (animation.currentValue < animation.to) {
+ animation.currentValue = animation.to;
stop = true;
}
}
- lastTime = time;
}
- qreal old_to = to;
+ qreal old_to = animation.to;
- QDeclarativePropertyPrivate::write(defaultProperty, currentValue,
+ QDeclarativePropertyPrivate::write(property, animation.currentValue,
QDeclarativePropertyPrivate::BypassInterceptor |
QDeclarativePropertyPrivate::DontRemoveBinding);
- if (stop && old_to == to) // do not stop if we got restarted
- clock.stop();
+ return (stop && old_to == animation.to); // do not stop if we got restarted
}
void QDeclarativeSpringAnimationPrivate::updateMode()
@@ -230,79 +253,16 @@ void QDeclarativeSpringAnimationPrivate::updateMode()
*/
QDeclarativeSpringAnimation::QDeclarativeSpringAnimation(QObject *parent)
-: QDeclarativeAbstractAnimation(*(new QDeclarativeSpringAnimationPrivate),parent)
-{
-}
-
-QDeclarativeSpringAnimation::~QDeclarativeSpringAnimation()
-{
-}
-
-void QDeclarativeSpringAnimation::setTarget(const QDeclarativeProperty &property)
+: QDeclarativeNumberAnimation(*(new QDeclarativeSpringAnimationPrivate),parent)
{
Q_D(QDeclarativeSpringAnimation);
- d->defaultProperty = property;
- d->currentValue = property.read().toReal();
- if (!d->avoidPropertyValueSourceStart) {
- setRunning(true);
- }
-}
-
-qreal QDeclarativeSpringAnimation::to() const
-{
- Q_D(const QDeclarativeSpringAnimation);
- return d->toDefined ? d->to : 0;
-}
-
-/*!
- \qmlproperty real SpringAnimation::to
-
- This property holds the value at which the animation will end.
-
- If not set, the animation will continue until it reaches the
- value that is being tracked.
-*/
-
-void QDeclarativeSpringAnimation::setTo(qreal value)
-{
- Q_D(QDeclarativeSpringAnimation);
- if (d->to == value)
- return;
-
- d->to = value;
- d->toDefined = true;
- d->lastTime = 0;
- emit toChanged(value);
+ d->clock = new QDeclarativeSpringAnimationPrivate::Clock(d, this);
}
-qreal QDeclarativeSpringAnimation::from() const
-{
- Q_D(const QDeclarativeSpringAnimation);
- return d->fromDefined ? d->from : 0;
-}
-
-/*!
- \qmlproperty real SpringAnimation::from
-
- This property holds the value from which the animation will begin.
-
- If not set, the animation will start whenever the tracked value has
- changed, regardless of its value.
-*/
-
-void QDeclarativeSpringAnimation::setFrom(qreal value)
+QDeclarativeSpringAnimation::~QDeclarativeSpringAnimation()
{
- Q_D(QDeclarativeSpringAnimation);
- if (d->from == value)
- return;
-
- d->currentValue = d->from = value;
- d->fromDefined = true;
- d->lastTime = 0;
- emit fromChanged(value);
}
-
/*!
\qmlproperty real SpringAnimation::velocity
@@ -452,17 +412,25 @@ void QDeclarativeSpringAnimation::transition(QDeclarativeStateActions &actions,
Q_D(QDeclarativeSpringAnimation);
Q_UNUSED(direction);
- if (d->clock.state() != QAbstractAnimation::Running)
+ if (d->clock->state() != QAbstractAnimation::Running) {
d->lastTime = 0;
+ }
- if (!actions.isEmpty()) {
- for (int i = 0; i < actions.size(); ++i) {
- if (!d->toDefined)
- d->to = actions.at(i).toValue.toReal();
- if (!d->fromDefined)
- d->currentValue = actions.at(i).fromValue.toReal();
- if (d->mode != QDeclarativeSpringAnimationPrivate::Track)
- modified << d->defaultProperty;
+ QDeclarativeNumberAnimation::transition(actions, modified, direction);
+
+ if (!d->actions)
+ return;
+
+ if (!d->actions->isEmpty()) {
+ for (int i = 0; i < d->actions->size(); ++i) {
+ const QDeclarativeProperty &property = d->actions->at(i).property;
+ QDeclarativeSpringAnimationPrivate::SpringAnimation &animation
+ = d->activeAnimations[property];
+ animation.to = d->actions->at(i).toValue.toReal();
+ if (d->fromIsDefined)
+ animation.currentValue = d->actions->at(i).fromValue.toReal();
+ else
+ animation.currentValue = property.read().toReal();
}
}
}
@@ -471,7 +439,7 @@ void QDeclarativeSpringAnimation::transition(QDeclarativeStateActions &actions,
QAbstractAnimation *QDeclarativeSpringAnimation::qtAnimation()
{
Q_D(QDeclarativeSpringAnimation);
- return &d->clock;
+ return d->clock;
}
QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativespringanimation_p.h b/src/declarative/util/qdeclarativespringanimation_p.h
index 6f574ef..ee276ec 100644
--- a/src/declarative/util/qdeclarativespringanimation_p.h
+++ b/src/declarative/util/qdeclarativespringanimation_p.h
@@ -54,14 +54,12 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QDeclarativeSpringAnimationPrivate;
-class Q_AUTOTEST_EXPORT QDeclarativeSpringAnimation : public QDeclarativeAbstractAnimation
+class Q_AUTOTEST_EXPORT QDeclarativeSpringAnimation : public QDeclarativeNumberAnimation
{
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativeSpringAnimation)
Q_INTERFACES(QDeclarativePropertyValueSource)
- Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged)
- Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged)
Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity)
Q_PROPERTY(qreal spring READ spring WRITE setSpring)
Q_PROPERTY(qreal damping READ damping WRITE setDamping)
@@ -73,14 +71,6 @@ public:
QDeclarativeSpringAnimation(QObject *parent=0);
~QDeclarativeSpringAnimation();
- virtual void setTarget(const QDeclarativeProperty &);
-
- qreal to() const;
- void setTo(qreal value);
-
- qreal from() const;
- void setFrom(qreal value);
-
qreal velocity() const;
void setVelocity(qreal velocity);
@@ -99,9 +89,6 @@ public:
qreal modulus() const;
void setModulus(qreal modulus);
- bool enabled() const;
- void setEnabled(bool enabled);
-
virtual void transition(QDeclarativeStateActions &actions,
QDeclarativeProperties &modified,
TransitionDirection direction);
@@ -110,8 +97,6 @@ protected:
virtual QAbstractAnimation *qtAnimation();
Q_SIGNALS:
- void toChanged(qreal);
- void fromChanged(qreal);
void modulusChanged();
void massChanged();
void syncChanged();
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index bb8ef3f..9c63dfa 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -131,6 +131,7 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin
- (QFont)qtFont;
- (void)finishOffWithCode:(NSInteger)result;
- (void)cleanUpAfterMyself;
+- (void)setSubwindowStacking;
@end
static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
@@ -187,6 +188,12 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
[cancelButton setTarget:self];
}
+ mQtFont = new QFont();
+ return self;
+}
+
+- (void)setSubwindowStacking
+{
#ifdef QT_MAC_USE_COCOA
// Stack the native dialog in front of its parent, if any:
QFontDialog *q = mPriv->fontDialog();
@@ -199,9 +206,6 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
}
}
#endif
-
- mQtFont = new QFont();
- return self;
}
- (void)dealloc
@@ -610,6 +614,7 @@ void QFontDialogPrivate::createNSFontPanelDelegate()
[ourPanel setFrame:frameRect display:NO];
[ourPanel center];
}
+ [del setSubwindowStacking];
NSString *title = @"Select font";
[ourPanel setTitle:title];
}
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 48a0093..a98ce6f 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -831,6 +831,11 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
#endif //QT_NO_IM
}
+ // This handles the case that the item has been removed from the
+ // scene in response to the FocusOut event.
+ if (item && item->scene() != q)
+ item = 0;
+
if (item)
focusItem = item;
updateInputMethodSensitivityInViews();
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index 7ab9eda..22c0384 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -112,9 +112,7 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
int x = 0;
// First, align dest to 16 bytes:
- const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;
- const int prologLength = qMin(w, offsetToAlignOn16Bytes);
- for (; x < prologLength; ++x) {
+ ALIGNMENT_PROLOGUE_16BYTES(dst, x, w) {
quint32 s = src[x];
s = BYTE_MUL(s, const_alpha);
dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
@@ -182,12 +180,10 @@ inline int comp_func_Plus_one_pixel(uint d, const uint s)
void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha)
{
int x = 0;
- const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;
- const int prologLength = qMin(length, offsetToAlignOn16Bytes);
if (const_alpha == 255) {
// 1) Prologue: align destination on 16 bytes
- for (; x < prologLength; ++x)
+ ALIGNMENT_PROLOGUE_16BYTES(dst, x, length)
dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]);
// 2) composition with SSE2
@@ -208,7 +204,7 @@ void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uin
const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha);
// 1) Prologue: align destination on 16 bytes
- for (; x < prologLength; ++x)
+ ALIGNMENT_PROLOGUE_16BYTES(dst, x, length)
dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha);
const __m128i half = _mm_set1_epi16(0x80);
@@ -239,9 +235,7 @@ void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, u
int x = 0;
// 1) prologue, align on 16 bytes
- const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;
- const int prologLength = qMin(length, offsetToAlignOn16Bytes);
- for (; x < prologLength; ++x)
+ ALIGNMENT_PROLOGUE_16BYTES(dst, x, length)
dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
// 2) interpolate pixels with SSE2
diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h
index 18355c2..d8f6bf5 100644
--- a/src/gui/painting/qdrawingprimitive_sse2_p.h
+++ b/src/gui/painting/qdrawingprimitive_sse2_p.h
@@ -143,9 +143,7 @@ QT_BEGIN_NAMESPACE
int x = 0; \
\
/* First, get dst aligned. */ \
- const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;\
- const int prologLength = qMin(length, offsetToAlignOn16Bytes);\
- for (; x < prologLength; ++x) { \
+ ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \
uint s = src[x]; \
if (s >= 0xff000000) \
dst[x] = s; \
@@ -202,9 +200,7 @@ QT_BEGIN_NAMESPACE
{ \
int x = 0; \
\
- const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;\
- const int prologLength = qMin(length, offsetToAlignOn16Bytes);\
- for (; x < prologLength; ++x) { \
+ ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \
quint32 s = src[x]; \
if (s != 0) { \
s = BYTE_MUL(s, const_alpha); \
diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp
index 3438137..568f4d7 100644
--- a/src/gui/painting/qgraphicssystem_runtime.cpp
+++ b/src/gui/painting/qgraphicssystem_runtime.cpp
@@ -346,11 +346,14 @@ QRuntimeGraphicsSystem::QRuntimeGraphicsSystem()
QApplicationPrivate::graphics_system_name = QLatin1String("runtime");
QApplicationPrivate::runtime_graphics_system = true;
+#ifdef QT_DEFAULT_RUNTIME_SYSTEM
+ m_graphicsSystemName = QLatin1String(QT_DEFAULT_RUNTIME_SYSTEM);
+ if (m_graphicsSystemName.isNull())
+#endif
+ m_graphicsSystemName = QLatin1String("raster");
+
#ifdef Q_OS_SYMBIAN
- m_graphicsSystemName = QLatin1String("openvg");
m_windowSurfaceDestroyPolicy = DestroyAfterFirstFlush;
-#else
- m_graphicsSystemName = QLatin1String("raster");
#endif
m_graphicsSystem = QGraphicsSystemFactory::create(m_graphicsSystemName);
diff --git a/src/gui/styles/qmacstyle_mac.h b/src/gui/styles/qmacstyle_mac.h
index bcebb1d..d5fcdae 100644
--- a/src/gui/styles/qmacstyle_mac.h
+++ b/src/gui/styles/qmacstyle_mac.h
@@ -60,6 +60,8 @@ class QPalette;
#define Q_GUI_EXPORT_STYLE_MAC Q_GUI_EXPORT
#endif
+class QPushButton;
+class QStyleOptionButton;
class QMacStylePrivate;
class Q_GUI_EXPORT_STYLE_MAC QMacStyle : public QWindowsStyle
{
@@ -133,6 +135,8 @@ private:
Q_DISABLE_COPY(QMacStyle)
QMacStylePrivate *d;
+
+ friend bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
};
#endif // Q_WS_MAC
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index d18383c..ae90d26 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -1059,6 +1059,16 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn,
}
}
+bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option)
+{
+ QMacStyle *macStyle = qobject_cast<QMacStyle *>(pushButton->style());
+ if (!macStyle)
+ return false;
+ HIThemeButtonDrawInfo bdi;
+ macStyle->d->initHIThemePushButton(option, pushButton, kThemeStateActive, &bdi);
+ return bdi.kind == kThemeBevelButton;
+}
+
/**
Creates a HIThemeButtonDrawInfo structure that specifies the correct button
kind and other details to use for drawing the given combobox. Which button
diff --git a/src/gui/styles/qmacstyle_mac_p.h b/src/gui/styles/qmacstyle_mac_p.h
index 5a0ba4c..f9b9d30 100644
--- a/src/gui/styles/qmacstyle_mac_p.h
+++ b/src/gui/styles/qmacstyle_mac_p.h
@@ -150,6 +150,8 @@ enum QAquaWidgetSize { QAquaSizeLarge = 0, QAquaSizeSmall = 1, QAquaSizeMini = 2
return sizes[controlSize]; \
} while (0)
+bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
+
class QMacStylePrivate : public QObject
{
Q_OBJECT
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 439f2a4..5670e29 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -923,6 +923,13 @@ void QTextEngine::shapeText(int item) const
si.width += glyphs.advances_x[i];
}
+static inline bool hasCaseChange(const QScriptItem &si)
+{
+ return si.analysis.flags == QScriptAnalysis::SmallCaps ||
+ si.analysis.flags == QScriptAnalysis::Uppercase ||
+ si.analysis.flags == QScriptAnalysis::Lowercase;
+}
+
#if defined(Q_WS_WINCE) //TODO
// set the glyph attributes heuristically. Assumes a 1 to 1 relationship between chars and glyphs
// and no reordering.
@@ -1050,14 +1057,15 @@ void QTextEngine::shapeTextWithCE(int item) const
if (option.useDesignMetrics())
flags |= DesignMetrics;
- attributes(); // pre-initialize char attributes
+ // pre-initialize char attributes
+ if (! attributes())
+ return;
const int len = length(item);
int num_glyphs = length(item);
const QChar *str = layoutData->string.unicode() + si.position;
ushort upperCased[256];
- if (si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase
- || si.analysis.flags == QScriptAnalysis::Lowercase) {
+ if (hasCaseChange(si)) {
ushort *uc = upperCased;
if (len > 256)
uc = new ushort[len];
@@ -1071,7 +1079,14 @@ void QTextEngine::shapeTextWithCE(int item) const
}
while (true) {
- ensureSpace(num_glyphs);
+ if (! ensureSpace(num_glyphs)) {
+ // If str is converted to uppercase/lowercase form with a new buffer,
+ // we need to delete that buffer before return for error
+ const ushort *uc = reinterpret_cast<const ushort *>(str);
+ if (hasCaseChange(si) && uc != upperCased)
+ delete [] uc;
+ return;
+ }
num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used;
QGlyphLayout g = availableGlyphs(&si);
@@ -1092,9 +1107,7 @@ void QTextEngine::shapeTextWithCE(int item) const
layoutData->used += si.num_glyphs;
const ushort *uc = reinterpret_cast<const ushort *>(str);
- if ((si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase
- || si.analysis.flags == QScriptAnalysis::Lowercase)
- && uc != upperCased)
+ if (hasCaseChange(si) && uc != upperCased)
delete [] uc;
}
#endif
@@ -1133,8 +1146,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
entire_shaper_item.item.bidiLevel = si.analysis.bidiLevel;
HB_UChar16 upperCased[256]; // XXX what about making this 4096, so we don't have to extend it ever.
- if (si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase
- || si.analysis.flags == QScriptAnalysis::Lowercase) {
+ if (hasCaseChange(si)) {
HB_UChar16 *uc = upperCased;
if (entire_shaper_item.item.length > 256)
uc = new HB_UChar16[entire_shaper_item.item.length];
@@ -1156,17 +1168,24 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
entire_shaper_item.shaperFlags |= HB_ShaperFlag_UseDesignMetrics;
entire_shaper_item.num_glyphs = qMax(layoutData->glyphLayout.numGlyphs - layoutData->used, int(entire_shaper_item.item.length));
- ensureSpace(entire_shaper_item.num_glyphs);
+ if (! ensureSpace(entire_shaper_item.num_glyphs)) {
+ if (hasCaseChange(si))
+ delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string);
+ return;
+ }
QGlyphLayout initialGlyphs = availableGlyphs(&si).mid(0, entire_shaper_item.num_glyphs);
if (!stringToGlyphs(&entire_shaper_item, &initialGlyphs, font)) {
- ensureSpace(entire_shaper_item.num_glyphs);
+ if (! ensureSpace(entire_shaper_item.num_glyphs)) {
+ if (hasCaseChange(si))
+ delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string);
+ return;
+ }
initialGlyphs = availableGlyphs(&si).mid(0, entire_shaper_item.num_glyphs);
if (!stringToGlyphs(&entire_shaper_item, &initialGlyphs, font)) {
// ############ if this happens there's a bug in the fontengine
- if ((si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase
- || si.analysis.flags == QScriptAnalysis::Lowercase) && entire_shaper_item.string != upperCased)
+ if (hasCaseChange(si) && entire_shaper_item.string != upperCased)
delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string);
return;
}
@@ -1231,7 +1250,11 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
remaining_glyphs -= shaper_item.initialGlyphCount;
do {
- ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs);
+ if (! ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs)) {
+ if (hasCaseChange(si))
+ delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string);
+ return;
+ }
const QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos);
moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs);
@@ -1271,8 +1294,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
layoutData->used += si.num_glyphs;
- if ((si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase)
- && entire_shaper_item.string != upperCased)
+ if (hasCaseChange(si) && entire_shaper_item.string != upperCased)
delete [] const_cast<HB_UChar16 *>(entire_shaper_item.string);
}
@@ -1317,7 +1339,8 @@ const HB_CharAttributes *QTextEngine::attributes() const
return (HB_CharAttributes *) layoutData->memory;
itemize();
- ensureSpace(layoutData->string.length());
+ if (! ensureSpace(layoutData->string.length()))
+ return NULL;
QVarLengthArray<HB_ScriptItem> hbScriptItems(layoutData->items.size());
@@ -1864,7 +1887,10 @@ void QTextEngine::justify(const QScriptLine &line)
// don't include trailing white spaces when doing justification
int line_length = line.length;
- const HB_CharAttributes *a = attributes()+line.from;
+ const HB_CharAttributes *a = attributes();
+ if (! a)
+ return;
+ a += line.from;
while (line_length && a[line_length-1].whiteSpace)
--line_length;
// subtract one char more, as we can't justfy after the last character
@@ -2045,7 +2071,7 @@ QTextEngine::LayoutData::LayoutData()
memory_on_stack = false;
used = 0;
hasBidi = false;
- inLayout = false;
+ layoutState = LayoutEmpty;
haveCharAttributes = false;
logClustersPtr = 0;
available_glyphs = 0;
@@ -2079,7 +2105,7 @@ QTextEngine::LayoutData::LayoutData(const QString &str, void **stack_memory, int
}
used = 0;
hasBidi = false;
- inLayout = false;
+ layoutState = LayoutEmpty;
haveCharAttributes = false;
}
@@ -2090,12 +2116,12 @@ QTextEngine::LayoutData::~LayoutData()
memory = 0;
}
-void QTextEngine::LayoutData::reallocate(int totalGlyphs)
+bool QTextEngine::LayoutData::reallocate(int totalGlyphs)
{
Q_ASSERT(totalGlyphs >= glyphLayout.numGlyphs);
if (memory_on_stack && available_glyphs >= totalGlyphs) {
glyphLayout.grow(glyphLayout.data(), totalGlyphs);
- return;
+ return true;
}
int space_charAttributes = sizeof(HB_CharAttributes)*string.length()/sizeof(void*) + 1;
@@ -2103,7 +2129,14 @@ void QTextEngine::LayoutData::reallocate(int totalGlyphs)
int space_glyphs = QGlyphLayout::spaceNeededForGlyphLayout(totalGlyphs)/sizeof(void*) + 2;
int newAllocated = space_charAttributes + space_glyphs + space_logClusters;
- Q_ASSERT(newAllocated >= allocated);
+ // These values can be negative if the length of string/glyphs causes overflow,
+ // we can't layout such a long string all at once, so return false here to
+ // indicate there is a failure
+ if (space_charAttributes < 0 || space_logClusters < 0 || space_glyphs < 0 || newAllocated < allocated) {
+ layoutState = LayoutFailed;
+ return false;
+ }
+
void **newMem = memory;
newMem = (void **)::realloc(memory_on_stack ? 0 : memory, newAllocated*sizeof(void *));
Q_CHECK_PTR(newMem);
@@ -2124,6 +2157,7 @@ void QTextEngine::LayoutData::reallocate(int totalGlyphs)
glyphLayout.grow(reinterpret_cast<char *>(m), totalGlyphs);
allocated = newAllocated;
+ return true;
}
// grow to the new size, copying the existing data to the new layout
@@ -2155,7 +2189,7 @@ void QTextEngine::freeMemory()
} else {
layoutData->used = 0;
layoutData->hasBidi = false;
- layoutData->inLayout = false;
+ layoutData->layoutState = LayoutEmpty;
layoutData->haveCharAttributes = false;
}
for (int i = 0; i < lines.size(); ++i) {
@@ -2314,6 +2348,9 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
shape(i);
HB_CharAttributes *attributes = const_cast<HB_CharAttributes *>(this->attributes());
+ if (!attributes)
+ return QString();
+
unsigned short *logClusters = this->logClusters(&si);
QGlyphLayout glyphs = shapedGlyphs(&si);
@@ -2385,6 +2422,8 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
return QString();
const HB_CharAttributes *attributes = this->attributes();
+ if (!attributes)
+ return QString();
if (mode == Qt::ElideRight) {
QFixed currentWidth;
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index e623fa5..4cbe81f 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -416,6 +416,11 @@ class QTextFormatCollection;
class Q_GUI_EXPORT QTextEngine {
public:
+ enum LayoutState {
+ LayoutEmpty,
+ InLayout,
+ LayoutFailed,
+ };
struct LayoutData {
LayoutData(const QString &str, void **stack_memory, int mem_size);
LayoutData();
@@ -428,11 +433,11 @@ public:
QGlyphLayout glyphLayout;
mutable int used;
uint hasBidi : 1;
- uint inLayout : 1;
+ uint layoutState : 2;
uint memory_on_stack : 1;
bool haveCharAttributes;
QString string;
- void reallocate(int totalGlyphs);
+ bool reallocate(int totalGlyphs);
};
QTextEngine(LayoutData *data);
@@ -520,9 +525,10 @@ public:
return layoutData->glyphLayout.mid(si->glyph_data_offset, si->num_glyphs);
}
- inline void ensureSpace(int nGlyphs) const {
+ inline bool ensureSpace(int nGlyphs) const {
if (layoutData->glyphLayout.numGlyphs - layoutData->used < nGlyphs)
- layoutData->reallocate((((layoutData->used + nGlyphs)*3/2 + 15) >> 4) << 4);
+ return layoutData->reallocate((((layoutData->used + nGlyphs)*3/2 + 15) >> 4) << 4);
+ return true;
}
void freeMemory();
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 674064e..5a11c87 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -74,6 +74,8 @@ static inline QFixed leadingSpaceWidth(QTextEngine *eng, const QScriptLine &line
int pos = line.length;
const HB_CharAttributes *attributes = eng->attributes();
+ if (!attributes)
+ return QFixed();
while (pos > 0 && attributes[line.from + pos - 1].whiteSpace)
--pos;
return eng->width(line.from + pos, line.length - pos);
@@ -601,7 +603,7 @@ bool QTextLayout::cacheEnabled() const
void QTextLayout::beginLayout()
{
#ifndef QT_NO_DEBUG
- if (d->layoutData && d->layoutData->inLayout) {
+ if (d->layoutData && d->layoutData->layoutState == QTextEngine::InLayout) {
qWarning("QTextLayout::beginLayout: Called while already doing layout");
return;
}
@@ -609,7 +611,7 @@ void QTextLayout::beginLayout()
d->invalidate();
d->clearLineData();
d->itemize();
- d->layoutData->inLayout = true;
+ d->layoutData->layoutState = QTextEngine::InLayout;
}
/*!
@@ -618,7 +620,7 @@ void QTextLayout::beginLayout()
void QTextLayout::endLayout()
{
#ifndef QT_NO_DEBUG
- if (!d->layoutData || !d->layoutData->inLayout) {
+ if (!d->layoutData || d->layoutData->layoutState == QTextEngine::LayoutEmpty) {
qWarning("QTextLayout::endLayout: Called without beginLayout()");
return;
}
@@ -627,7 +629,7 @@ void QTextLayout::endLayout()
if (l && d->lines.at(l-1).length < 0) {
QTextLine(l-1, d).setNumColumns(INT_MAX);
}
- d->layoutData->inLayout = false;
+ d->layoutData->layoutState = QTextEngine::LayoutEmpty;
if (!d->cacheGlyphs)
d->freeMemory();
}
@@ -757,11 +759,14 @@ bool QTextLayout::isValidCursorPosition(int pos) const
QTextLine QTextLayout::createLine()
{
#ifndef QT_NO_DEBUG
- if (!d->layoutData || !d->layoutData->inLayout) {
+ if (!d->layoutData || d->layoutData->layoutState == QTextEngine::LayoutEmpty) {
qWarning("QTextLayout::createLine: Called without layouting");
return QTextLine();
}
#endif
+ if (d->layoutData->layoutState == QTextEngine::LayoutFailed)
+ return QTextLine();
+
int l = d->lines.size();
if (l && d->lines.at(l-1).length < 0) {
QTextLine(l-1, d).setNumColumns(INT_MAX);
@@ -1801,6 +1806,8 @@ void QTextLine::layout_helper(int maxGlyphs)
Qt::Alignment alignment = eng->option.alignment();
const HB_CharAttributes *attributes = eng->attributes();
+ if (!attributes)
+ return;
lbh.currentPosition = line.from;
int end = 0;
lbh.logClusters = eng->layoutData->logClustersPtr;
@@ -1814,6 +1821,8 @@ void QTextLine::layout_helper(int maxGlyphs)
if (!current.num_glyphs) {
eng->shape(item);
attributes = eng->attributes();
+ if (!attributes)
+ return;
lbh.logClusters = eng->layoutData->logClustersPtr;
}
lbh.currentPosition = qMax(line.from, current.position);
diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp
index 8a18ed0..237c266 100644
--- a/src/gui/widgets/qpushbutton.cpp
+++ b/src/gui/widgets/qpushbutton.cpp
@@ -687,11 +687,11 @@ bool QPushButton::event(QEvent *e)
/*! \reimp */
bool QPushButton::hitButton(const QPoint &pos) const
{
- // This is only required if we are using the native style, so check that first.
- QMacStyle *macStyle = qobject_cast<QMacStyle *>(style());
- // If this is a flat button we just bail out.
- if(isFlat() || (0 == macStyle))
+ QStyleOptionButton opt;
+ initStyleOption(&opt);
+ if (qt_mac_buttonIsRenderedFlat(this, &opt))
return QAbstractButton::hitButton(pos);
+
// Now that we know we are using the native style, let's proceed.
Q_D(const QPushButton);
QPushButtonPrivate *nonConst = const_cast<QPushButtonPrivate *>(d);
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index b51596c..a1e7d37 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -149,7 +149,6 @@ void QConnmanEngine::getNetworkListing()
}
-
void QConnmanEngine::doRequestUpdate()
{
connmanManager->requestScan("");
@@ -312,6 +311,9 @@ QString QConnmanEngine::getServiceForNetwork(const QString &netPath)
QMutexLocker locker(&mutex);
QConnmanNetworkInterface network(netPath, this);
foreach(QString service,connmanManager->getServices()) {
+
+ QString devicePath = netPath.section("/",5,5);
+
QConnmanServiceInterface serv(service,this);
if(serv.getName() == network.getName()
&& network.getSignalStrength() == serv.getSignalStrength()) {
@@ -354,17 +356,6 @@ void QConnmanEngine::propertyChangedContext(const QString &path,const QString &i
technologies.insert(listPath, tech);
}
}
-
- foreach(const QString old, oldtech.keys()) {
- if(!newlist.contains(old)) {
- QConnmanTechnologyInterface *tech = oldtech.value(old);
- disconnect(tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
- this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant)));
-
- technologies.remove(old);
- getNetworkListing();
- }
- }
}
}
if(item == "State") {
@@ -385,15 +376,21 @@ void QConnmanEngine::servicePropertyChangedContext(const QString &path,const QSt
}
}
-void QConnmanEngine::networkPropertyChangedContext(const QString &/*path*/,const QString &/*item*/, const QDBusVariant &/*value*/)
+void QConnmanEngine::networkPropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value)
{
QMutexLocker locker(&mutex);
+// qDebug() << __FUNCTION__ << path << item << value.variant();
}
void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const QString &item,const QDBusVariant &value)
{
+// qDebug() << __FUNCTION__ << devpath << item << value.variant();
QMutexLocker locker(&mutex);
if(item == "Networks") {
+
+ QConnmanNetworkInterface network(devpath, this);
+
+
QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant());
QStringList remainingNetworks = qdbus_cast<QStringList>(arg);
QString devicetype;
@@ -431,6 +428,7 @@ void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const Q
void QConnmanEngine::technologyPropertyChangedContext(const QString & path, const QString &item, const QDBusVariant &value)
{
+// qDebug() << __FUNCTION__ << path << item << value.variant();
if(item == "Devices") {
QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant());
QStringList list = qdbus_cast<QStringList>(arg);
@@ -452,6 +450,12 @@ void QConnmanEngine::technologyPropertyChangedContext(const QString & path, cons
}
if(value.variant().toString() == "offline") {
deviceMap.remove(path);
+ QConnmanTechnologyInterface tech(path);
+ disconnect(&tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
+ this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant)));
+
+ technologies.remove(path);
+ getNetworkListing();
}
}
}
@@ -523,7 +527,7 @@ QNetworkConfiguration::BearerType QConnmanEngine::typeToBearer(const QString &ty
if (type == "bluetooth")
return QNetworkConfiguration::BearerBluetooth;
if (type == "cellular") {
- return QNetworkConfiguration::BearerUnknown;
+ return QNetworkConfiguration::Bearer2G;
// not handled: CDMA2000 HSPA
}
if (type == "wimax")
@@ -588,8 +592,11 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath)
QString networkName = serv->getName();
- if(serv->getType() == "Cellular") {
+ if(serv->getType() == "cellular") {
networkName = serv->getAPN();
+ if(networkName.isEmpty()) {
+ networkName = serv->getName();
+ }
}
cpPriv->name = networkName;
@@ -643,6 +650,9 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath)
{
QMutexLocker locker(&mutex);
+ if(networkPath.isNull())
+ return;
+
QConnmanNetworkInterface *network;
network = new QConnmanNetworkInterface(networkPath, this);
QString servicePath = getServiceForNetwork(networkPath);
@@ -658,9 +668,10 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath)
serv = new QConnmanServiceInterface(servicePath,this);
connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant)));
+
}
- if (!accessPointConfigurations.contains(id)) {
+ if (!id.isEmpty() && !accessPointConfigurations.contains(id)) {
knownNetworks[device.getType()].append(networkPath);
@@ -681,20 +692,26 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath)
if(servicePath.isEmpty()) {
QString devicePath = networkPath.section("/",0,5);
+
QConnmanDeviceInterface device(devicePath,this);
bearerType = typeToBearer(device.getType());
} else {
bearerType = typeToBearer(serv->getType());
}
- if (bearerType == QNetworkConfiguration::BearerUnknown) {
+ if (bearerType == QNetworkConfiguration::Bearer2G) {
QString mode = serv->getMode();
if (mode == "gprs" || mode == "edge") {
bearerType = QNetworkConfiguration::Bearer2G;
} else if (mode == "umts") {
bearerType = QNetworkConfiguration::BearerWCDMA;
}
- networkName = serv->getAPN();
+ if(servicePath.isEmpty()) {
+ networkName = serv->getAPN();
+ if(networkName.isEmpty()) {
+ networkName = serv->getName();
+ }
+ }
}
cpPriv->name = networkName;
@@ -723,7 +740,9 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath)
emit configurationAdded(ptr);
locker.relock();
emit updateCompleted();
- }
+ } /*else {
+ qDebug() << "Not added~~~~~~~~~~~";
+ }*/
}
bool QConnmanEngine::requiresPolling() const
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index b20e7c1..eb88317 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -53,6 +53,8 @@
#include "qconnmanservice_linux_p.h"
+#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE
static QDBusConnection dbusConnection = QDBusConnection::systemBus();
@@ -129,8 +131,10 @@ QVariant QConnmanManagerInterface::getProperty(const QString &property)
QVariantMap QConnmanManagerInterface::getProperties()
{
- QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
- return reply.value();
+ if(this->isValid()) {
+ QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+ } else return QVariantMap();
}
QString QConnmanManagerInterface::getState()
@@ -551,8 +555,12 @@ void QConnmanServiceInterface::disconnectNotify(const char *signal)
QVariantMap QConnmanServiceInterface::getProperties()
{
- QDBusReply<QVariantMap> reply = this->call(QLatin1String("GetProperties"));
- return reply.value();
+ if(this->isValid()) {
+ QDBusReply<QVariantMap> reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+ }
+ else
+ return QVariantMap();
}
QVariant QConnmanServiceInterface::getProperty(const QString &property)
@@ -725,6 +733,99 @@ QVariantMap QConnmanServiceInterface::getEthernet()
return qdbus_cast<QVariantMap >(var);
}
+QString QConnmanServiceInterface::getMethod()
+{
+ QVariant var;
+ QVariantMap map = getEthernet();
+ QMapIterator<QString,QVariant> it(map);
+ while(it.hasNext()) {
+ it.next();
+ if(it.key() == "Method") {
+ return it.value().toString();
+ }
+ }
+ return QString();
+}
+
+QString QConnmanServiceInterface::getInterface()
+{
+ QVariant var;
+ QVariantMap map = getEthernet();
+
+ QMapIterator<QString,QVariant> it(map);
+ while(it.hasNext()) {
+ it.next();
+ if(it.key() == "Interface") {
+ return it.value().toString();
+ }
+ }
+
+ return QString();
+}
+
+QString QConnmanServiceInterface::getMacAddress()
+{
+ QVariant var;
+ QVariantMap map = getEthernet();
+
+ QMapIterator<QString,QVariant> it(map);
+ while(it.hasNext()) {
+ it.next();
+ if(it.key() == "Address") {
+ return it.value().toString();
+ }
+ }
+ return QString();
+}
+
+quint16 QConnmanServiceInterface::getMtu()
+{
+ quint16 mtu=0;
+ QVariant var;
+ QVariantMap map = getEthernet();
+
+ QMapIterator<QString,QVariant> it(map);
+ while(it.hasNext()) {
+ it.next();
+ if(it.key() == "MTU") {
+ return it.value().toUInt();
+ }
+ }
+ return mtu;
+}
+
+quint16 QConnmanServiceInterface::getSpeed()
+{
+ quint16 speed=0;
+ QVariant var;
+ QVariantMap map = getEthernet();
+
+ QMapIterator<QString,QVariant> it(map);
+ while(it.hasNext()) {
+ it.next();
+ if(it.key() == "Speed") {
+ return it.value().toUInt();
+ }
+ }
+ return speed;
+}
+
+QString QConnmanServiceInterface::getDuplex()
+{
+ QVariant var;
+ QVariantMap map = getEthernet();
+
+ QMapIterator<QString,QVariant> it(map);
+ while(it.hasNext()) {
+ it.next();
+ if(it.key() == "Duplex") {
+ return it.value().toString();
+ }
+ }
+ return QString();
+}
+
+
bool QConnmanServiceInterface::isOfflineMode()
{
QVariant var = getProperty("OfflineMode");
@@ -1070,3 +1171,7 @@ void QConnmanDBusHelper::propertyChanged(const QString &item, const QDBusVariant
/////////////////
QT_END_NAMESPACE
+
+#endif // QT_NO_DBUS
+#endif // QT_NO_BEARERMANAGEMENT
+
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
index 35e3f3d..a2b1e73 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h
+++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
@@ -65,6 +65,9 @@
#include <QtDBus/QDBusContext>
#include <QMap>
+#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_DBUS
+
#ifndef __CONNMAN_DBUS_H
#define CONNMAN_SERVICE "org.moblin.connman"
@@ -249,6 +252,13 @@ public:
QVariantMap getProxy();
QVariantMap getEthernet();
+ QString getMethod();
+ QString getInterface();
+ QString getMacAddress();
+ quint16 getMtu();
+ quint16 getSpeed();
+ QString getDuplex();
+
bool isOfflineMode();
QStringList getServices();
@@ -378,4 +388,7 @@ Q_SIGNALS:
QT_END_NAMESPACE
+#endif // QT_NO_DBUS
+#endif // QT_NO_BEARERMANAGEMENT
+
#endif //QCONNMANSERVICE_H
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp
index 6060a09..0900329 100644
--- a/src/plugins/bearer/icd/qicdengine.cpp
+++ b/src/plugins/bearer/icd/qicdengine.cpp
@@ -217,7 +217,7 @@ void IapMonitor::iapRemoved(const QString &iap_id)
}
QIcdEngine::QIcdEngine(QObject *parent)
-: QBearerEngine(parent), iapMonitor(new IapMonitor), m_dbusInterface(0),
+: QBearerEngine(parent), iapMonitor(0), m_dbusInterface(0),
firstUpdate(true), m_scanGoingOn(false)
{
}
@@ -258,6 +258,7 @@ void QIcdEngine::initialize()
startListeningStateSignalsForAllConnections();
/* Turn on IAP add/remove monitoring */
+ iapMonitor = new IapMonitor;
iapMonitor->setup(this);
/* We create a default configuration which is a pseudo config */
@@ -520,8 +521,6 @@ void QIcdEngine::addConfiguration(QString& iap_id)
void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned)
{
- QMutexLocker locker(&mutex);
-
/* Contains all known iap_ids from storage */
QList<QString> knownConfigs = accessPointConfigurations.keys();
@@ -587,9 +586,9 @@ void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned)
QNetworkConfigurationPrivatePointer ptr(cpPriv);
accessPointConfigurations.insert(iap_id, ptr);
- locker.unlock();
+ mutex.unlock();
emit configurationAdded(ptr);
- locker.relock();
+ mutex.lock();
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug("IAP: %s, name: %s, ssid: %s, added to known list",
@@ -642,9 +641,9 @@ void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned)
ptr->mutex.unlock();
if (changed) {
- locker.unlock();
+ mutex.unlock();
emit configurationChanged(ptr);
- locker.relock();
+ mutex.lock();
}
if (!ap.scan.network_type.startsWith(QLatin1String("WLAN")))
@@ -703,9 +702,9 @@ rescan_list:
QNetworkConfigurationPrivatePointer ptr(cpPriv);
accessPointConfigurations.insert(ptr->id, ptr);
- locker.unlock();
+ mutex.unlock();
emit configurationAdded(ptr);
- locker.relock();
+ mutex.lock();
} else {
knownConfigs.removeOne(scanned_ssid);
}
@@ -733,9 +732,9 @@ rescan_list:
ptr->state = QNetworkConfiguration::Defined;
configLocker.unlock();
- locker.unlock();
+ mutex.unlock();
emit configurationChanged(ptr);
- locker.relock();
+ mutex.lock();
}
}
}
@@ -744,9 +743,9 @@ rescan_list:
foreach (const QString &oldIface, knownConfigs) {
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(oldIface);
if (ptr) {
- locker.unlock();
+ mutex.unlock();
emit configurationRemoved(ptr);
- locker.relock();
+ mutex.lock();
//if we would have SNAP support we would have to remove the references
//from existing ServiceNetworks to the removed access point configuration
}
@@ -762,9 +761,9 @@ rescan_list:
}
if (!firstUpdate) {
- locker.unlock();
+ mutex.unlock();
emit updateCompleted();
- locker.relock();
+ mutex.lock();
}
if (firstUpdate)
@@ -781,8 +780,6 @@ QNetworkConfigurationPrivatePointer QIcdEngine::defaultConfiguration()
void QIcdEngine::startListeningStateSignalsForAllConnections()
{
- QMutexLocker locker(&mutex);
-
// Start listening ICD_DBUS_API_STATE_SIG signals
m_dbusInterface->connection().connect(ICD_DBUS_API_INTERFACE,
ICD_DBUS_API_PATH,
@@ -906,8 +903,6 @@ void QIcdEngine::requestUpdate()
void QIcdEngine::cancelAsyncConfigurationUpdate()
{
- QMutexLocker locker(&mutex);
-
if (!m_scanGoingOn) {
return;
}
@@ -947,7 +942,9 @@ void QIcdEngine::asyncUpdateConfigurationsSlot(QDBusMessage msg)
if (icd_scan_status == ICD_SCAN_COMPLETE) {
m_typesToBeScanned.removeOne(arguments[6].toString());
if (!m_typesToBeScanned.count()) {
+ locker.unlock();
finishAsyncConfigurationUpdate();
+ locker.relock();
}
} else {
Maemo::IcdScanResult scanResult;
@@ -977,7 +974,8 @@ void QIcdEngine::cleanup()
m_scanTimer.stop();
m_dbusInterface->call(ICD_DBUS_API_SCAN_CANCEL);
}
- iapMonitor->cleanup();
+ if (iapMonitor)
+ iapMonitor->cleanup();
}
bool QIcdEngine::hasIdentifier(const QString &id)
diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h
index 16dc979..a768d84 100644
--- a/src/plugins/bearer/icd/qicdengine.h
+++ b/src/plugins/bearer/icd/qicdengine.h
@@ -126,13 +126,13 @@ public:
QMutexLocker locker(&mutex);
accessPointConfigurations.insert(ptr->id, ptr);
+
+ locker.unlock();
emit configurationAdded(ptr);
}
inline void changedSessionConfiguration(QNetworkConfigurationPrivatePointer ptr)
{
- QMutexLocker locker(&mutex);
-
emit configurationChanged(ptr);
}
@@ -144,14 +144,14 @@ Q_SIGNALS:
void iapStateChanged(const QString& iapid, uint icd_connection_state);
private Q_SLOTS:
- void doRequestUpdate(QList<Maemo::IcdScanResult> scanned = QList<Maemo::IcdScanResult>());
- void cancelAsyncConfigurationUpdate();
void finishAsyncConfigurationUpdate();
void asyncUpdateConfigurationsSlot(QDBusMessage msg);
void connectionStateSignalsSlot(QDBusMessage msg);
private:
void startListeningStateSignalsForAllConnections();
+ void doRequestUpdate(QList<Maemo::IcdScanResult> scanned = QList<Maemo::IcdScanResult>());
+ void cancelAsyncConfigurationUpdate();
private:
IapMonitor *iapMonitor;
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index f3f693b..29445ce 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -104,14 +104,23 @@ void QNetworkManagerEngine::initialize()
QMutexLocker locker(&mutex);
// Get current list of access points.
- foreach (const QDBusObjectPath &devicePath, interface->getDevices())
+ foreach (const QDBusObjectPath &devicePath, interface->getDevices()) {
+ locker.unlock();
deviceAdded(devicePath);
+ locker.relock();
+ }
// Get connections.
- foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections())
+ foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) {
+ locker.unlock();
newConnection(settingsPath, systemSettings);
- foreach (const QDBusObjectPath &settingsPath, userSettings->listConnections())
+ locker.relock();
+ }
+ foreach (const QDBusObjectPath &settingsPath, userSettings->listConnections()) {
+ locker.unlock();
newConnection(settingsPath, userSettings);
+ locker.relock();
+ }
// Get active connections.
foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
@@ -132,11 +141,6 @@ bool QNetworkManagerEngine::networkManagerAvailable() const
return interface->isValid();
}
-void QNetworkManagerEngine::doRequestUpdate()
-{
- emit updateCompleted();
-}
-
QString QNetworkManagerEngine::getInterfaceFromId(const QString &id)
{
QMutexLocker locker(&mutex);
@@ -233,9 +237,7 @@ void QNetworkManagerEngine::disconnectFromId(const QString &id)
void QNetworkManagerEngine::requestUpdate()
{
- QMutexLocker locker(&mutex);
-
- QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
+ QMetaObject::invokeMethod(this, "updateCompleted", Qt::QueuedConnection);
}
void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path,
@@ -361,13 +363,10 @@ void QNetworkManagerEngine::devicePropertiesChanged(const QString &path,
void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path)
{
- QMutexLocker locker(&mutex);
-
QNetworkManagerInterfaceDevice device(path.path());
if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS) {
QNetworkManagerInterfaceDeviceWireless *wirelessDevice =
new QNetworkManagerInterfaceDeviceWireless(device.connectionInterface()->path());
- wirelessDevices.insert(path.path(), wirelessDevice);
wirelessDevice->setConnections();
connect(wirelessDevice, SIGNAL(accessPointAdded(QString,QDBusObjectPath)),
@@ -379,6 +378,10 @@ void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path)
foreach (const QDBusObjectPath &apPath, wirelessDevice->getAccessPoints())
newAccessPoint(QString(), apPath);
+
+ mutex.lock();
+ wirelessDevices.insert(path.path(), wirelessDevice);
+ mutex.unlock();
}
}
@@ -685,8 +688,6 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
const QString &settingsPath,
const QNmSettingsMap &map)
{
- QMutexLocker locker(&mutex);
-
QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate;
cpPriv->name = map.value("connection").value("id").toString();
cpPriv->isValid = true;
@@ -735,9 +736,9 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.take(accessPointId);
- locker.unlock();
+ mutex.unlock();
emit configurationRemoved(ptr);
- locker.relock();
+ mutex.lock();
}
break;
}
@@ -753,8 +754,6 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const QString &id) const
{
- QMutexLocker locker(&mutex);
-
for (int i = 0; i < connections.count(); ++i) {
QNetworkManagerSettingsConnection *connection = connections.at(i);
const QString service = connection->connectionInterface()->service();
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
index ffb8395..78ebb0a 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
@@ -116,8 +116,6 @@ private Q_SLOTS:
void removeAccessPoint(const QString &path, const QDBusObjectPath &objectPath);
void updateAccessPoint(const QMap<QString, QVariant> &map);
- void doRequestUpdate();
-
private:
QNetworkConfigurationPrivate *parseConnection(const QString &service,
const QString &settingsPath,
diff --git a/src/sql/drivers/tds/qsql_tds.pri b/src/sql/drivers/tds/qsql_tds.pri
index c552ead..037f793 100644
--- a/src/sql/drivers/tds/qsql_tds.pri
+++ b/src/sql/drivers/tds/qsql_tds.pri
@@ -1,8 +1,10 @@
HEADERS += $$PWD/qsql_tds.h
SOURCES += $$PWD/qsql_tds.cpp
-unix {
+unix|win32-g++: {
+ !isEmpty(QT_LFLAGS_TDS):!static:LIBS *= $$QT_LFLAGS_TDS
!contains(LIBS, .*sybdb.*):LIBS += -lsybdb
+ QMAKE_CXXFLAGS *= $$QT_CFLAGS_TDS
} else:win32-borland {
LIBS *= $(BCB)/lib/PSDK/NTWDBLIB.LIB
} else {
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 1267e7e..662c796 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -7418,8 +7418,10 @@ bool QDomHandler::startElement(const QString& nsURI, const QString&, const QStri
n = doc->createElement(qName);
}
- if (n)
- n->setLocation(locator->lineNumber(), locator->columnNumber());
+ if (!n)
+ return false;
+
+ n->setLocation(locator->lineNumber(), locator->columnNumber());
node->appendChild(n);
node = n;