aboutsummaryrefslogtreecommitdiff
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/animation/scene/mbasicorientationanimation.cpp18
-rw-r--r--src/corelib/animation/scene/mbasicorientationanimation.h14
-rw-r--r--src/corelib/animation/scene/mbasicorientationanimation_p.h6
-rw-r--r--src/corelib/animation/scene/mcrossfadedorientationanimation.cpp330
-rw-r--r--src/corelib/animation/scene/mcrossfadedorientationanimation.h46
-rw-r--r--src/corelib/animation/scene/mcrossfadedorientationanimation_p.h55
-rw-r--r--src/corelib/animation/scene/mfliporientationanimation.cpp147
-rw-r--r--src/corelib/animation/scene/mfliporientationanimation.h70
-rw-r--r--src/corelib/animation/scene/mfliporientationanimation_p.h46
-rw-r--r--src/corelib/animation/scene/mnavigationbaranimation.cpp93
-rw-r--r--src/corelib/animation/scene/mnavigationbaranimation.h65
-rw-r--r--src/corelib/animation/scene/mnotificationanimation.cpp99
-rw-r--r--src/corelib/animation/scene/mnotificationanimation.h64
-rw-r--r--src/corelib/animation/scene/mnotificationanimation_p.h34
-rw-r--r--src/corelib/animation/scene/morientationanimation.cpp13
-rw-r--r--src/corelib/animation/scene/morientationanimation.h19
-rw-r--r--src/corelib/animation/scene/morientationanimation_p.h4
-rw-r--r--src/corelib/animation/scene/mscenefadeanimation.cpp86
-rw-r--r--src/corelib/animation/scene/mscenefadeanimation.h66
-rw-r--r--src/corelib/animation/scene/mscenefadeanimation_p.h34
-rw-r--r--src/corelib/animation/scene/mscenewindowanimation.cpp67
-rw-r--r--src/corelib/animation/scene/mscenewindowanimation.h90
-rw-r--r--src/corelib/animation/scene/msnapshotitem.cpp47
-rw-r--r--src/corelib/animation/scene/msnapshotitem.h29
-rw-r--r--src/corelib/animation/scene/scene.pri26
-rw-r--r--src/corelib/animation/widget/core/mabstractwidgetanimation_p.h8
-rw-r--r--src/corelib/animation/widget/mwidgetfadeanimation.cpp120
-rw-r--r--src/corelib/animation/widget/mwidgetfadeanimation.h (renamed from src/corelib/animation/widget/mwidgetfadeinanimation.h)28
-rw-r--r--src/corelib/animation/widget/mwidgetfadeanimation_p.h (renamed from src/corelib/animation/widget/mwidgetfadeinanimation_p.h)15
-rw-r--r--src/corelib/animation/widget/mwidgetfadeinanimation.cpp80
-rw-r--r--src/corelib/animation/widget/mwidgetfadeoutanimation.cpp78
-rw-r--r--src/corelib/animation/widget/mwidgetfadeoutanimation.h67
-rw-r--r--src/corelib/animation/widget/mwidgetfadeoutanimation_p.h38
-rw-r--r--src/corelib/animation/widget/mwidgetslideanimation.cpp140
-rw-r--r--src/corelib/animation/widget/mwidgetslideanimation.h (renamed from src/corelib/animation/widget/mwidgetslideoutanimation.h)30
-rw-r--r--src/corelib/animation/widget/mwidgetslideanimation_p.h (renamed from src/corelib/animation/widget/mwidgetslideinanimation_p.h)17
-rw-r--r--src/corelib/animation/widget/mwidgetslideinanimation.cpp91
-rw-r--r--src/corelib/animation/widget/mwidgetslideoutanimation.cpp90
-rw-r--r--src/corelib/animation/widget/mwidgetslideoutanimation_p.h39
-rw-r--r--src/corelib/animation/widget/mwidgetzoomanimation.cpp169
-rw-r--r--src/corelib/animation/widget/mwidgetzoomanimation.h (renamed from src/corelib/animation/widget/mwidgetslideinanimation.h)56
-rw-r--r--src/corelib/animation/widget/mwidgetzoomanimation_p.h (renamed from src/corelib/animation/scene/mnavigationbaranimation_p.h)27
-rw-r--r--src/corelib/animation/widget/mwidgetzoominanimation.cpp62
-rw-r--r--src/corelib/animation/widget/mwidgetzoominanimation.h69
-rw-r--r--src/corelib/animation/widget/mwidgetzoominanimation_p.h34
-rw-r--r--src/corelib/animation/widget/mwidgetzoomoutanimation.cpp57
-rw-r--r--src/corelib/animation/widget/mwidgetzoomoutanimation.h63
-rw-r--r--src/corelib/animation/widget/mwidgetzoomoutanimation_p.h34
-rw-r--r--src/corelib/animation/widget/widget.pri27
-rw-r--r--src/corelib/core/maction.cpp2
-rw-r--r--src/corelib/core/mcomponentcache.cpp4
-rw-r--r--src/corelib/core/mcomponentdata.cpp37
-rw-r--r--src/corelib/core/mnamespace.h36
-rw-r--r--src/corelib/corelib.pro6
-rw-r--r--src/corelib/events/morientationtracker.cpp2
-rw-r--r--src/corelib/events/mpanrecognizer.cpp2
-rw-r--r--src/corelib/events/mtapandholdrecognizer.cpp7
-rw-r--r--src/corelib/i18n/mcalendar.cpp33
-rw-r--r--src/corelib/i18n/mcollator.cpp2
-rw-r--r--src/corelib/i18n/mcollator_p.h2
-rw-r--r--src/corelib/i18n/mlocale.cpp83
-rw-r--r--src/corelib/i18n/mlocale.h147
-rw-r--r--src/corelib/i18n/mlocale_p.h2
-rw-r--r--src/corelib/icu-extradata/extradata.pri5
-rw-r--r--src/corelib/layout/mabstractlayoutpolicy.cpp2
-rw-r--r--src/corelib/layout/mabstractlayoutpolicy_p.cpp20
-rw-r--r--src/corelib/layout/mabstractlayoutpolicy_p.h2
-rw-r--r--src/corelib/layout/mbasiclayoutanimation.cpp24
-rw-r--r--src/corelib/layout/mbasiclayoutanimation_p.cpp85
-rw-r--r--src/corelib/layout/mitemstate_p.cpp60
-rw-r--r--src/corelib/layout/mitemstate_p.h52
-rw-r--r--src/corelib/layout/mlayout.cpp20
-rw-r--r--src/corelib/layout/mlayout_p.cpp10
-rw-r--r--src/corelib/layout/mlayout_p.h6
-rw-r--r--src/corelib/layout/mlinearlayoutpolicy.cpp11
-rw-r--r--src/corelib/painting/mbackgroundtiles.cpp3
-rw-r--r--src/corelib/scene/mscene.cpp2
-rw-r--r--src/corelib/scene/mscene.h12
-rw-r--r--src/corelib/scene/mscenelayereffect.cpp24
-rw-r--r--src/corelib/scene/mscenelayereffect.h4
-rw-r--r--src/corelib/scene/mscenemanager.cpp141
-rw-r--r--src/corelib/scene/mscenemanager_p.h6
-rw-r--r--src/corelib/style/manimationstyle.h2
-rw-r--r--src/corelib/style/mbasiclayoutanimationstyle.h7
-rw-r--r--src/corelib/style/mcrossfadedorientationanimationstyle.h (renamed from src/corelib/style/mwidgetslideinanimationstyle.h)24
-rw-r--r--src/corelib/style/mstylesheetparser.cpp26
-rw-r--r--src/corelib/style/mwidgetfadeanimationstyle.h (renamed from src/corelib/style/mwidgetfadeinanimationstyle.h)13
-rw-r--r--src/corelib/style/mwidgetslideanimationstyle.h (renamed from src/corelib/style/mwidgetfadeoutanimationstyle.h)15
-rw-r--r--src/corelib/style/mwidgetslideoutanimationstyle.h42
-rw-r--r--src/corelib/style/mwidgetstyle.h2
-rw-r--r--src/corelib/style/mwidgetzoomanimationstyle.h52
-rw-r--r--src/corelib/style/mwidgetzoominanimationstyle.h42
-rw-r--r--src/corelib/style/mwidgetzoomoutanimationstyle.h41
-rw-r--r--src/corelib/style/style.pri10
-rw-r--r--src/corelib/theme/mcommonpixmaps.cpp5
-rw-r--r--src/corelib/theme/mtheme.cpp79
-rw-r--r--src/corelib/theme/mtheme.h14
-rw-r--r--src/corelib/theme/mtheme_p.h8
-rw-r--r--src/corelib/widgets/RichTextEditorToolbar1.xml34
-rw-r--r--src/corelib/widgets/core/mwidget.cpp30
-rw-r--r--src/corelib/widgets/core/mwidget.h30
-rw-r--r--src/corelib/widgets/core/mwidgetcontroller.h2
-rw-r--r--src/corelib/widgets/core/mwidgetview.cpp2
-rw-r--r--src/corelib/widgets/mabstractcellcreator.cpp10
-rw-r--r--src/corelib/widgets/mapplicationpage.h36
-rw-r--r--src/corelib/widgets/mapplicationwindow.cpp74
-rw-r--r--src/corelib/widgets/mapplicationwindow.h4
-rw-r--r--src/corelib/widgets/mapplicationwindow_p.h13
-rw-r--r--src/corelib/widgets/mbutton.cpp11
-rw-r--r--src/corelib/widgets/mbutton.h20
-rw-r--r--src/corelib/widgets/mbuttongroup.cpp3
-rw-r--r--src/corelib/widgets/mbuttonmodel.cpp (renamed from src/corelib/animation/scene/mscenewindowanimation_p.h)21
-rw-r--r--src/corelib/widgets/mbuttonmodel.h11
-rw-r--r--src/corelib/widgets/mcontentitem.cpp34
-rw-r--r--src/corelib/widgets/mcontentitem.h20
-rw-r--r--src/corelib/widgets/mcontentitem_p.h4
-rw-r--r--src/corelib/widgets/mcontentitemmodel.h8
-rw-r--r--src/corelib/widgets/mdialog.cpp8
-rw-r--r--src/corelib/widgets/mdialog.h14
-rw-r--r--src/corelib/widgets/mimagewidget.cpp17
-rw-r--r--src/corelib/widgets/mlabel.cpp4
-rw-r--r--src/corelib/widgets/mlabel.h2
-rw-r--r--src/corelib/widgets/mlabelmodel.cpp4
-rw-r--r--src/corelib/widgets/mlabelmodel.h8
-rw-r--r--src/corelib/widgets/mlist.cpp10
-rw-r--r--src/corelib/widgets/mlist.h10
-rw-r--r--src/corelib/widgets/mlistmodel.h1
-rw-r--r--src/corelib/widgets/mobjectmenu.cpp10
-rw-r--r--src/corelib/widgets/mobjectmenu.h5
-rw-r--r--src/corelib/widgets/mobjectmenumodel.h8
-rw-r--r--src/corelib/widgets/mpannablewidget.cpp15
-rw-r--r--src/corelib/widgets/mpannablewidget.h12
-rw-r--r--src/corelib/widgets/mrichtextedit.cpp256
-rw-r--r--src/corelib/widgets/mrichtextedit.h98
-rw-r--r--src/corelib/widgets/mrichtextedit_p.h61
-rw-r--r--src/corelib/widgets/mscenewindow.cpp48
-rw-r--r--src/corelib/widgets/mscenewindow.h6
-rw-r--r--src/corelib/widgets/mscenewindow_p.h9
-rw-r--r--src/corelib/widgets/mscenewindowmodel.h5
-rw-r--r--src/corelib/widgets/mtextedit.cpp372
-rw-r--r--src/corelib/widgets/mtextedit.h13
-rw-r--r--src/corelib/widgets/mtextedit_p.h29
-rw-r--r--src/corelib/widgets/mtexteditmodel.h1
-rw-r--r--src/corelib/widgets/mtoolbar.cpp3
-rw-r--r--src/corelib/widgets/mwindow.cpp46
-rw-r--r--src/corelib/widgets/mwindow_p.h1
-rw-r--r--src/corelib/widgets/widgets.pri3
-rw-r--r--src/corelib/workspace/devices.conf7
-rw-r--r--src/corelib/workspace/mdeviceprofile.cpp24
-rw-r--r--src/corelib/workspace/mdeviceprofile.h3
-rw-r--r--src/corelib/workspace/mdeviceprofile_p.h1
151 files changed, 3078 insertions, 2646 deletions
diff --git a/src/corelib/animation/scene/mbasicorientationanimation.cpp b/src/corelib/animation/scene/mbasicorientationanimation.cpp
index 449beebe..e806e6e3 100644
--- a/src/corelib/animation/scene/mbasicorientationanimation.cpp
+++ b/src/corelib/animation/scene/mbasicorientationanimation.cpp
@@ -265,11 +265,10 @@ MSceneWindow *MBasicOrientationAnimationPrivate::fetchLayerEffect(MSceneWindow *
}
MBasicOrientationAnimation::MBasicOrientationAnimation(const QSize &landscapeScreenSize, QObject *parent) :
- MParallelAnimationGroup(new MBasicOrientationAnimationPrivate, parent)
+ MOrientationAnimation(new MBasicOrientationAnimationPrivate, parent)
{
Q_D(MBasicOrientationAnimation);
- d->rootElement = NULL;
d->sequentialPhasesAnimation = new QSequentialAnimationGroup;
addAnimation(d->sequentialPhasesAnimation);
@@ -467,21 +466,6 @@ void MBasicOrientationAnimation::rootElementChanged()
d->originAnimation->setTargetObject(rootElement());
}
-void MBasicOrientationAnimation::setRootElement(QGraphicsWidget *rootElement)
-{
- Q_D(MBasicOrientationAnimation);
- if (d->rootElement != rootElement) {
- d->rootElement = rootElement;
- rootElementChanged();
- }
-}
-
-QGraphicsWidget *MBasicOrientationAnimation::rootElement()
-{
- Q_D(MBasicOrientationAnimation);
- return d->rootElement;
-}
-
void MBasicOrientationAnimation::updateState(QAbstractAnimation::State newState,
QAbstractAnimation::State oldState)
{
diff --git a/src/corelib/animation/scene/mbasicorientationanimation.h b/src/corelib/animation/scene/mbasicorientationanimation.h
index 8b8c8afa..8e478d31 100644
--- a/src/corelib/animation/scene/mbasicorientationanimation.h
+++ b/src/corelib/animation/scene/mbasicorientationanimation.h
@@ -22,7 +22,7 @@
#ifndef MBASICORIENTATIONANIMATION_H
#define MBASICORIENTATIONANIMATION_H
-#include <mparallelanimationgroup.h>
+#include <morientationanimation.h>
#include <mbasicorientationanimationstyle.h>
#include <QSize>
#include <mnamespace.h>
@@ -40,7 +40,7 @@ class QAnimationGroup;
Phase 1: Screen is rotated
Phase 2: Navigation bar & dock widget slide in, scene window fade in
*/
-class MBasicOrientationAnimation : public MParallelAnimationGroup
+class MBasicOrientationAnimation : public MOrientationAnimation
{
Q_OBJECT
Q_DECLARE_PRIVATE(MBasicOrientationAnimation)
@@ -65,22 +65,12 @@ public:
virtual void setTargetRotationAngle(M::OrientationAngle start, M::OrientationAngle end);
//! \reimp_end
- void setRootElement(QGraphicsWidget *rootElement);
-
-Q_SIGNALS:
- /*!
- \brief Signals that orientation has changed
- */
- void orientationChanged();
-
protected:
//! \reimp
// from MOrientationAnimation
virtual void rootElementChanged();
//! \reimp_end
- QGraphicsWidget *rootElement();
-
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
private:
diff --git a/src/corelib/animation/scene/mbasicorientationanimation_p.h b/src/corelib/animation/scene/mbasicorientationanimation_p.h
index d8abdd91..77780702 100644
--- a/src/corelib/animation/scene/mbasicorientationanimation_p.h
+++ b/src/corelib/animation/scene/mbasicorientationanimation_p.h
@@ -20,17 +20,16 @@
#ifndef MBASICORIENTATIONANIMATION_P_H
#define MBASICORIENTATIONANIMATION_P_H
-#include "mparallelanimationgroup_p.h"
+#include "morientationanimation_p.h"
#include <QHash>
class QParallelAnimationGroup;
class QPropertyAnimation;
class MBasicOrientationAnimation;
-class MSceneWindowAnimation;
class MSceneWindow;
-class MBasicOrientationAnimationPrivate : public MParallelAnimationGroupPrivate
+class MBasicOrientationAnimationPrivate : public MOrientationAnimationPrivate
{
Q_DECLARE_PUBLIC(MBasicOrientationAnimation)
@@ -98,7 +97,6 @@ public:
QHash<MSceneWindow *, SceneWindowAnimationPair> genericAnimationsHash;
class QAnimationGroup *sequentialPhasesAnimation;
- QGraphicsWidget *rootElement;
};
#endif
diff --git a/src/corelib/animation/scene/mcrossfadedorientationanimation.cpp b/src/corelib/animation/scene/mcrossfadedorientationanimation.cpp
new file mode 100644
index 00000000..3ef83853
--- /dev/null
+++ b/src/corelib/animation/scene/mcrossfadedorientationanimation.cpp
@@ -0,0 +1,330 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#include "mcrossfadedorientationanimation.h"
+#include "mcrossfadedorientationanimation_p.h"
+
+#include <QGraphicsScene>
+#include <QGraphicsWidget>
+#include <QPropertyAnimation>
+
+#include <QDebug>
+
+void MCrossFadedOrientationAnimationPrivate::init(const QRectF &visibleSceneRect)
+{
+ Q_Q(MCrossFadedOrientationAnimation);
+
+ snapshot = 0;
+ this->visibleSceneRect = visibleSceneRect;
+
+ rootElementRotationAnimation = new QPropertyAnimation(0, "rotation", q);
+ rootElementRotationAnimation->setDuration(q->style()->duration());
+ rootElementRotationAnimation->setEasingCurve(q->style()->rotationEasingCurve());
+
+ rootElementFadeInAnimation = new QPropertyAnimation(0, "opacity", q);
+ rootElementFadeInAnimation->setStartValue(0.0);
+ rootElementFadeInAnimation->setEndValue(1.0);
+ rootElementFadeInAnimation->setDuration(q->style()->duration());
+ rootElementFadeInAnimation->setEasingCurve(q->style()->fadingEasingCurve());
+
+ rootElementPositionAnimation = new QPropertyAnimation(0, "pos", q);
+ rootElementPositionAnimation->setDuration(q->style()->duration());
+ rootElementPositionAnimation->setEasingCurve(q->style()->translationEasingCurve());
+
+ snapshotRotationAnimation = new QPropertyAnimation(0, "rotation", q);
+ snapshotRotationAnimation->setDuration(q->style()->duration());
+ snapshotRotationAnimation->setEasingCurve(q->style()->rotationEasingCurve());
+
+ snapshotFadeOutAnimation = new QPropertyAnimation(0, "opacity", q);
+ snapshotFadeOutAnimation->setStartValue(1.0);
+ snapshotFadeOutAnimation->setEndValue(0.0);
+ snapshotFadeOutAnimation->setDuration(q->style()->duration());
+ snapshotFadeOutAnimation->setEasingCurve(q->style()->fadingEasingCurve());
+
+ snapshotPositionAnimation = new QPropertyAnimation(0, "pos", q);
+ snapshotPositionAnimation->setDuration(q->style()->duration());
+ snapshotPositionAnimation->setEasingCurve(q->style()->translationEasingCurve());
+
+}
+
+void MCrossFadedOrientationAnimationPrivate::createRootElementSnapshot()
+{
+ Q_Q(MCrossFadedOrientationAnimation);
+ QGraphicsScene *scene = q->rootElement()->scene();
+
+ Q_ASSERT(snapshot == 0);
+
+ // Since we want a snapshot only from the root element, we have to
+ // temporarily hide the scene background.
+
+ // hide scene background
+ snapshot = new MSnapshotItem(scene, visibleSceneRect);
+ // show scene background
+
+ scene->addItem(snapshot);
+ snapshot->setPos(0.0, 0.0);
+ snapshot->setTransformOriginPoint(snapshotRotationPoint);
+
+ snapshotRotationAnimation->setTargetObject(snapshot);
+ snapshotFadeOutAnimation->setTargetObject(snapshot);
+ snapshotPositionAnimation->setTargetObject(snapshot);
+}
+
+void MCrossFadedOrientationAnimationPrivate::destroyRootElementSnapshot()
+{
+ snapshotRotationAnimation->setTargetObject(0);
+ snapshotFadeOutAnimation->setTargetObject(0);
+ snapshotPositionAnimation->setTargetObject(0);
+
+ if (snapshot) {
+ delete snapshot;
+ snapshot = 0;
+ }
+}
+
+void MCrossFadedOrientationAnimationPrivate::setSnapshotRotationAnimationValues(
+ M::OrientationAngle startAngle, M::OrientationAngle endAngle)
+{
+ // Unlike the root element, the snapshot always begin from 0.0.
+ // Therefore we have to translate the root element rotation angles to snapshot
+ // rotation angles.
+
+ snapshotRotationAnimation->setStartValue(0.0);
+
+ qreal snapshotEndAngle;
+ if (startAngle == M::Angle0) {
+ if (endAngle == M::Angle270)
+ snapshotEndAngle = -90.0;
+ else
+ snapshotEndAngle = endAngle;
+
+ } else if (startAngle == M::Angle90) {
+ snapshotEndAngle = endAngle - startAngle;
+
+ } else if (startAngle == M::Angle180) {
+ if (endAngle == M::Angle0)
+ snapshotEndAngle = 180.0;
+ else
+ snapshotEndAngle = endAngle - startAngle;
+ } else {
+ // startAngle == M::Angle270
+
+ if (endAngle == M::Angle0) {
+ snapshotEndAngle = 90.0;
+ } else if (endAngle == M::Angle90) {
+ snapshotEndAngle = 180.0;
+ } else if (endAngle == M::Angle180) {
+ snapshotEndAngle = -90.0;
+ } else {
+ // M::Angle270
+ snapshotEndAngle = 0.0;
+ }
+ }
+ snapshotRotationAnimation->setEndValue(snapshotEndAngle);
+}
+
+void MCrossFadedOrientationAnimationPrivate::calculateSnapshotRotationPoint(
+ M::OrientationAngle startAngle)
+{
+ // The snapshot item always begin its rotation from 0 degrees, unlike the root
+ // element, which begins from startAngle.
+ // Since both snapshot and root element must be rotated from the same point
+ // in the scene, their rotation points (transform origin points) in their respective local
+ // coordinates must map to the same point in scene coordinates.
+ //
+ // The style option "rotation point" is in local root element coordinates.
+ // Here we translate it into snapshot local coordinates.
+
+ Q_Q(MCrossFadedOrientationAnimation);
+
+ // rotation point of the root element in its local coordinate system.
+ QPointF rootElementRotationPoint = q->style()->rotationPoint();
+
+ switch (startAngle) {
+ case M::Angle0:
+ snapshotRotationPoint = rootElementRotationPoint;
+ break;
+ case M::Angle90:
+ snapshotRotationPoint.rx() = visibleSceneRect.width() - rootElementRotationPoint.y();
+ snapshotRotationPoint.ry() = rootElementRotationPoint.x();
+ break;
+ case M::Angle180:
+ snapshotRotationPoint.rx() = visibleSceneRect.width() - rootElementRotationPoint.x();
+ snapshotRotationPoint.ry() = visibleSceneRect.height() - rootElementRotationPoint.y();
+ break;
+ default: // M::Angle270:
+ snapshotRotationPoint.rx() = rootElementRotationPoint.x();
+ snapshotRotationPoint.ry() = visibleSceneRect.height() - rootElementRotationPoint.y();
+ break;
+ }
+}
+
+void MCrossFadedOrientationAnimationPrivate::setSnapshotPositionAnimationValues(
+ M::OrientationAngle startAngle, M::OrientationAngle endAngle)
+{
+ snapshotPositionAnimation->setStartValue(
+ calculateRotationPointSceneCoords(startAngle) - snapshotRotationPoint);
+
+ snapshotPositionAnimation->setEndValue(
+ calculateRotationPointSceneCoords(endAngle) - snapshotRotationPoint);
+}
+
+void MCrossFadedOrientationAnimationPrivate::setRootElementPositionAnimationValues(
+ M::OrientationAngle startAngle, M::OrientationAngle endAngle)
+{
+ Q_Q(MCrossFadedOrientationAnimation);
+
+ // rotation point in local item coordinates.
+ QPointF rotationPointLocal = q->style()->rotationPoint();
+
+ rootElementPositionAnimation->setStartValue(
+ calculateRotationPointSceneCoords(startAngle) - rotationPointLocal);
+
+ rootElementPositionAnimation->setEndValue(
+ calculateRotationPointSceneCoords(endAngle) - rotationPointLocal);
+}
+
+void MCrossFadedOrientationAnimationPrivate::setRootElementRotationAnimationValues(
+ M::OrientationAngle startAngle, M::OrientationAngle endAngle)
+{
+ if (startAngle == M::Angle270 && endAngle == M::Angle90) {
+ // 180 degrees rotation. Do it clockwise like the snapshot item.
+ rootElementRotationAnimation->setStartValue(-90);
+ rootElementRotationAnimation->setEndValue(endAngle);
+
+ } else if (startAngle == M::Angle180 && endAngle == M::Angle0) {
+ // 180 degrees rotation. Do it clockwise like the snapshot item.
+ rootElementRotationAnimation->setStartValue(-180);
+ rootElementRotationAnimation->setEndValue(endAngle);
+ } else if (startAngle == M::Angle270 && endAngle == M::Angle0) {
+ // Do it clockwise, which is the shortest rotation.
+ rootElementRotationAnimation->setStartValue(-90);
+ rootElementRotationAnimation->setEndValue(endAngle);
+ } else if (startAngle == M::Angle0 && endAngle == M::Angle270) {
+ // Do it counterclockwise, which is the shortest rotation.
+ rootElementRotationAnimation->setStartValue(startAngle);
+ rootElementRotationAnimation->setEndValue(-90);
+ } else {
+ // Easy cases. No tweaks needed.
+ rootElementRotationAnimation->setStartValue(startAngle);
+ rootElementRotationAnimation->setEndValue(endAngle);
+ }
+}
+
+QPointF MCrossFadedOrientationAnimationPrivate::calculateRotationPointSceneCoords(M::OrientationAngle angle)
+{
+ Q_Q(MCrossFadedOrientationAnimation);
+
+ // rotation point in local item coordinates
+ QPointF rotationPointLocal = q->style()->rotationPoint();
+
+ // rotation point in scene coordinates
+ QPointF rotationPointScene;
+
+ rotationPointScene.rx() = visibleSceneRect.x();
+ rotationPointScene.ry() = visibleSceneRect.y();
+
+ switch (angle) {
+ case M::Angle0:
+ rotationPointScene.rx() += rotationPointLocal.x();
+ rotationPointScene.ry() += rotationPointLocal.y();
+ break;
+ case M::Angle90:
+ rotationPointScene.rx() += visibleSceneRect.width() - rotationPointLocal.x();
+ rotationPointScene.ry() += rotationPointLocal.y();
+ break;
+ case M::Angle180:
+ rotationPointScene.rx() += visibleSceneRect.width() - rotationPointLocal.x();
+ rotationPointScene.ry() += visibleSceneRect.height() - rotationPointLocal.y();
+ break;
+ default: // M::Angle270:
+ rotationPointScene.rx() += rotationPointLocal.x();
+ rotationPointScene.ry() += visibleSceneRect.height() - rotationPointLocal.y();
+ break;
+ }
+
+ return rotationPointScene;
+}
+
+MCrossFadedOrientationAnimation::MCrossFadedOrientationAnimation(
+ const QRectF &visibleSceneRect, QObject *parent) :
+ MOrientationAnimation(new MCrossFadedOrientationAnimationPrivate, parent)
+{
+ Q_D(MCrossFadedOrientationAnimation);
+ d->init(visibleSceneRect);
+}
+
+MCrossFadedOrientationAnimation::~MCrossFadedOrientationAnimation()
+{
+ Q_D(MCrossFadedOrientationAnimation);
+
+ d->destroyRootElementSnapshot();
+}
+
+void MCrossFadedOrientationAnimation::addSceneWindow(MSceneWindow *sceneWindow)
+{
+ Q_UNUSED(sceneWindow);
+}
+
+void MCrossFadedOrientationAnimation::removeSceneWindow(MSceneWindow *sceneWindow)
+{
+ Q_UNUSED(sceneWindow);
+}
+
+void MCrossFadedOrientationAnimation::setTargetRotationAngle(
+ M::OrientationAngle startAngle, M::OrientationAngle endAngle)
+{
+ Q_D(MCrossFadedOrientationAnimation);
+
+ d->setRootElementRotationAnimationValues(startAngle, endAngle);
+ d->setRootElementPositionAnimationValues(startAngle, endAngle);
+ d->setSnapshotRotationAnimationValues(startAngle, endAngle);
+
+ d->calculateSnapshotRotationPoint(startAngle);
+ d->setSnapshotPositionAnimationValues(startAngle, endAngle);
+}
+
+void MCrossFadedOrientationAnimation::rootElementChanged()
+{
+ Q_D(MCrossFadedOrientationAnimation);
+ d->rootElementRotationAnimation->setTargetObject(rootElement());
+ d->rootElementFadeInAnimation->setTargetObject(rootElement());
+ d->rootElementPositionAnimation->setTargetObject(rootElement());
+}
+
+void MCrossFadedOrientationAnimation::updateState(
+ QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
+{
+ Q_D(MCrossFadedOrientationAnimation);
+
+ if (newState == QAbstractAnimation::Running) {
+ d->createRootElementSnapshot();
+
+ // Let the scene windows and widgets have their final sizes and positions
+ // within the root element.
+ emit orientationChanged();
+
+ rootElement()->setTransformOriginPoint(style()->rotationPoint());
+
+ } else if (newState == QAbstractAnimation::Stopped) {
+ d->destroyRootElementSnapshot();
+ }
+
+ MParallelAnimationGroup::updateState(newState, oldState);
+}
diff --git a/src/corelib/animation/scene/mcrossfadedorientationanimation.h b/src/corelib/animation/scene/mcrossfadedorientationanimation.h
new file mode 100644
index 00000000..515ec180
--- /dev/null
+++ b/src/corelib/animation/scene/mcrossfadedorientationanimation.h
@@ -0,0 +1,46 @@
+// Make doxygen skip this internal class
+//! \internal
+#ifndef MCROSSFADEDORIENTATIONANIMATION_H
+#define MCROSSFADEDORIENTATIONANIMATION_H
+
+#include "morientationanimation.h"
+#include <mcrossfadedorientationanimationstyle.h>
+
+class MCrossFadedOrientationAnimationPrivate;
+
+class MCrossFadedOrientationAnimation : public MOrientationAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(MCrossFadedOrientationAnimation)
+ M_ANIMATION_GROUP(MCrossFadedOrientationAnimationStyle)
+
+public:
+ /*!
+ * \brief Constructor
+ *
+ * \param visibleSceneRect The rectangle of the scene that is rendered by MWindow.
+ * Equals to the bounding rectangle of the root element in
+ * scene coordinates.
+ */
+ MCrossFadedOrientationAnimation(const QRectF &visibleSceneRect, QObject *parent = 0);
+
+ /*!
+ * \brief Destructor
+ */
+ virtual ~MCrossFadedOrientationAnimation();
+
+ virtual void addSceneWindow(MSceneWindow *window);
+ virtual void removeSceneWindow(MSceneWindow *window);
+ virtual void setTargetRotationAngle(M::OrientationAngle start, M::OrientationAngle end);
+
+protected:
+ //! \reimp
+ // from MOrientationAnimation
+ virtual void rootElementChanged();
+ //! \reimp_end
+
+ void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
+};
+
+#endif
+//! \internal_end
diff --git a/src/corelib/animation/scene/mcrossfadedorientationanimation_p.h b/src/corelib/animation/scene/mcrossfadedorientationanimation_p.h
new file mode 100644
index 00000000..b62b636d
--- /dev/null
+++ b/src/corelib/animation/scene/mcrossfadedorientationanimation_p.h
@@ -0,0 +1,55 @@
+#ifndef MCROSSFADEDORIENTATIONANIMATION_P_H
+#define MCROSSFADEDORIENTATIONANIMATION_P_H
+
+#include "morientationanimation_p.h"
+
+#include "msnapshotitem.h"
+
+class QPropertyAnimation;
+
+class MCrossFadedOrientationAnimationPrivate : public MOrientationAnimationPrivate
+{
+ Q_DECLARE_PUBLIC(MCrossFadedOrientationAnimation)
+
+public:
+ void init(const QRectF &visibleSceneRect);
+ void createRootElementSnapshot();
+ void destroyRootElementSnapshot();
+
+ void setSnapshotRotationAnimationValues(
+ M::OrientationAngle startAngle, M::OrientationAngle endAngle);
+
+ void setSnapshotPositionAnimationValues(
+ M::OrientationAngle startAngle, M::OrientationAngle endAngle);
+
+ void setRootElementRotationAnimationValues(
+ M::OrientationAngle startAngle, M::OrientationAngle endAngle);
+
+ void setRootElementPositionAnimationValues(
+ M::OrientationAngle startAngle, M::OrientationAngle endAngle);
+
+ void calculateSnapshotRotationPoint(M::OrientationAngle startAngle);
+
+ // Calculates the rotation point in scene coordinates.
+ QPointF calculateRotationPointSceneCoords(M::OrientationAngle angle);
+
+ MSnapshotItem *snapshot;
+
+ // visible scene rect, in scene coordinates.
+ // This is the rectangle of the scene that is rendered by MWindow.
+ // Equals to the bounding rectangle of the root element in scene coordinates.
+ QRectF visibleSceneRect;
+
+ QPropertyAnimation *rootElementRotationAnimation;
+ QPropertyAnimation *rootElementFadeInAnimation;
+ QPropertyAnimation *rootElementPositionAnimation;
+
+ QPropertyAnimation *snapshotRotationAnimation;
+ QPropertyAnimation *snapshotFadeOutAnimation;
+ QPropertyAnimation *snapshotPositionAnimation;
+
+ // The rotation point of the snapshot item, in its local coordinates.
+ QPointF snapshotRotationPoint;
+};
+
+#endif
diff --git a/src/corelib/animation/scene/mfliporientationanimation.cpp b/src/corelib/animation/scene/mfliporientationanimation.cpp
deleted file mode 100644
index 20a5d1bb..00000000
--- a/src/corelib/animation/scene/mfliporientationanimation.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mfliporientationanimation.h"
-
-#if QT_VERSION >= 0x040600
-
-#include "mfliporientationanimation_p.h"
-
-#include <QParallelAnimationGroup>
-#include <QPropertyAnimation>
-#include <QGraphicsWidget>
-#include "mwidgetanimation.h"
-#include "mscenemanager.h"
-#include "mscenewindow.h"
-#include "mnavigationbaranimation.h"
-
-///////////////////
-// Private class //
-///////////////////
-MFlipOrientationAnimationPrivate::MFlipOrientationAnimationPrivate() : angle(M::Angle0)
-{
-}
-
-MFlipOrientationAnimationPrivate::~MFlipOrientationAnimationPrivate()
-{
-}
-
-void MFlipOrientationAnimationPrivate::finishedPhase0()
-{
- Q_Q(MFlipOrientationAnimation);
-
- //TODO: create own class for rootElement to be able to
- // rotate around other axes as well.
-
- if (angle == M::Angle0 || angle == M::Angle180) {
- q->rootElement()->setPos(0, 0);
- q->rootElement()->setTransformOriginPoint(QPointF(432, 240));
- //q->rootElement()->setXRotation(0);
- //q->rootElement()->setYRotation(0);
- //q->rootElement()->setZRotation(angle);
- } else {
- q->rootElement()->setPos(192, -192);
- q->rootElement()->setTransformOriginPoint(QPointF(240, 432));
- //q->rootElement()->setXRotation(0);
- //q->rootElement()->setYRotation(0);
- //q->rootElement()->setZRotation(angle);
- }
-}
-
-//////////////////
-// Public class //
-//////////////////
-
-MFlipOrientationAnimation::MFlipOrientationAnimation(QObject *parent) :
- MOrientationAnimation(new MFlipOrientationAnimationPrivate(), parent, MGroupAnimation::Sequential)
-{
- Q_D(MFlipOrientationAnimation);
-
- d->phase0 = new QPropertyAnimation(NULL, "xRotation", group());
- d->phase0->setDuration(500);
-
-
- d->phase1 = new QPropertyAnimation(NULL, "yRotation", group());
- d->phase1->setDuration(500);
-
- connect(d->phase0, SIGNAL(finished()), SIGNAL(orientationChanged()));
- connect(d->phase0, SIGNAL(finished()), SLOT(finishedPhase0()));
-}
-
-MFlipOrientationAnimation::~MFlipOrientationAnimation()
-{
-}
-
-void MFlipOrientationAnimation::addSceneWindow(MSceneWindow *window)
-{
- Q_UNUSED(window);
-}
-
-void MFlipOrientationAnimation::removeSceneWindow(MSceneWindow *window)
-{
- Q_UNUSED(window);
-}
-
-void MFlipOrientationAnimation::setTargetRotationAngle(M::OrientationAngle start,
- M::OrientationAngle end)
-{
- Q_D(MFlipOrientationAnimation);
-
- //TODO: create own class for rootElement to be able to
- // rotate around other axes as well.
-
-
- //d->phase0->setStartValue(0);
- //d->phase0->setStartValue(rootElement()->xRotation());
- //d->phase1->setEndValue(0);
-
- int startDir = -1;
- //if(start == M::Angle180/* || start == M::Angle270*/)
- // startDir = 1;
-
- int endDir = -1;
- //if(/*end == M::Angle180 || */end == M::Angle270)
- // endDir = 1;
-
- d->phase0->setEndValue(90 * startDir);
- d->phase1->setStartValue(-90 * endDir);
-
-
- if (start == M::Angle0 || start == M::Angle180) {
- // Landscape to portrait
- d->phase0->setPropertyName("xRotation");
- d->phase1->setPropertyName("xRotation");
- } else {
- // Portrait to landscape
- d->phase0->setPropertyName("xRotation");
- d->phase1->setPropertyName("xRotation");
- }
-
- d->angle = end;
-}
-
-void MFlipOrientationAnimation::rootElementChanged()
-{
- Q_D(MFlipOrientationAnimation);
- d->phase0->setTargetObject(rootElement());
- d->phase1->setTargetObject(rootElement());
-}
-
-#include "moc_mfliporientationanimation.cpp"
-#endif
diff --git a/src/corelib/animation/scene/mfliporientationanimation.h b/src/corelib/animation/scene/mfliporientationanimation.h
deleted file mode 100644
index 36109c85..00000000
--- a/src/corelib/animation/scene/mfliporientationanimation.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MFLIPORIENTATIONANIMATION_H
-#define MFLIPORIENTATIONANIMATION_H
-
-#include <QtGlobal>
-#if QT_VERSION >= 0x040600
-
-#include <morientationanimation.h>
-#include <manimationstyle.h>
-
-class MFlipOrientationAnimationPrivate;
-class MWindow;
-
-/*!
- \class MFlipOrientationAnimation
- */
-class MFlipOrientationAnimation : public MOrientationAnimation
-{
- Q_OBJECT
- M_ANIMATION(MAnimationStyle)
- Q_DECLARE_PRIVATE(MFlipOrientationAnimation)
-
- Q_PRIVATE_SLOT(d_func(), void finishedPhase0())
-public:
-
- /*!
- \brief Constructs the orientation animation.
- */
- MFlipOrientationAnimation(QObject *parent = NULL);
-
- /*!
- \brief Destroys the orientation animation.
- */
- virtual ~MFlipOrientationAnimation();
-
- //! \reimp
- // from MOrientationAnimation
- virtual void addSceneWindow(MSceneWindow *window);
- virtual void removeSceneWindow(MSceneWindow *window);
- virtual void setTargetRotationAngle(M::OrientationAngle start, M::OrientationAngle end);
- //! \reimp_end
-
-protected:
- //! \reimp
- // from MOrientationAnimation
- virtual void rootElementChanged();
- //! \reimp_end
-};
-
-#endif
-#endif
-
diff --git a/src/corelib/animation/scene/mfliporientationanimation_p.h b/src/corelib/animation/scene/mfliporientationanimation_p.h
deleted file mode 100644
index b407c66b..00000000
--- a/src/corelib/animation/scene/mfliporientationanimation_p.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MFLIPORIENTATIONANIMATION_P_H
-#define MFLIPORIENTATIONANIMATION_P_H
-
-#include "morientationanimation_p.h"
-#include "mnamespace.h"
-
-class QParallelAnimationGroup;
-class QPropertyAnimation;
-class MBasicOrientationAnimation;
-class MSceneWindowAnimation;
-
-class MFlipOrientationAnimationPrivate : public MOrientationAnimationPrivate
-{
- Q_DECLARE_PUBLIC(MFlipOrientationAnimation)
-public:
- MFlipOrientationAnimationPrivate();
- virtual ~MFlipOrientationAnimationPrivate();
-private:
- void finishedPhase0();
-
- QPropertyAnimation *phase0;
- QPropertyAnimation *phase1;
-
- M::OrientationAngle angle;
-};
-
-#endif
diff --git a/src/corelib/animation/scene/mnavigationbaranimation.cpp b/src/corelib/animation/scene/mnavigationbaranimation.cpp
deleted file mode 100644
index 8802b187..00000000
--- a/src/corelib/animation/scene/mnavigationbaranimation.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mnavigationbaranimation.h"
-
-#if QT_VERSION >= 0x040600
-
-
-#include "mnavigationbaranimation_p.h"
-#include "mscenewindow.h"
-#include <QPropertyAnimation>
-#include <QAnimationGroup>
-
-MNavigationbarAnimation::MNavigationbarAnimation(MSceneWindow *window, QObject *parent) :
- MSceneWindowAnimation(new MNavigationbarAnimationPrivate, window, parent)
-{
- Q_D(MNavigationbarAnimation);
-
- d->positionAnimation = new QPropertyAnimation(window, "pos", group());
- d->opacityAnimation = new QPropertyAnimation(window, "opacity", group());
-}
-
-MNavigationbarAnimation::MNavigationbarAnimation(MNavigationbarAnimationPrivate *dd, MSceneWindow *window, QObject *parent) :
- MSceneWindowAnimation(dd, window, parent)
-{
- Q_D(MNavigationbarAnimation);
-
- d->positionAnimation = new QPropertyAnimation(window, "pos", group());
- d->opacityAnimation = new QPropertyAnimation(window, "opacity", group());
-}
-
-void MNavigationbarAnimation::setType(MSceneWindowAnimation::Type type, bool useCurrentAsStartValue)
-{
- Q_D(MNavigationbarAnimation);
-
- if (useCurrentAsStartValue) {
- d->positionAnimation->setStartValue(d->sceneWindow->pos());
- d->opacityAnimation->setStartValue(d->sceneWindow->opacity());
- }
-
- switch (type) {
- case MSceneWindowAnimation::Show:
- if (!useCurrentAsStartValue) {
- d->positionAnimation->setStartValue(QPointF(0, -d->sceneWindow->geometry().height()));
- d->opacityAnimation->setStartValue(0);
- }
- d->positionAnimation->setEndValue(QPointF(0, 0));
- d->opacityAnimation->setEndValue(1);
- d->positionAnimation->setDuration(250);
- d->opacityAnimation->setDuration(250);
- break;
-
- case MSceneWindowAnimation::Hide:
- if (!useCurrentAsStartValue) {
- d->positionAnimation->setStartValue(QPointF(0, 0));
- d->opacityAnimation->setStartValue(1);
- }
- d->positionAnimation->setEndValue(QPointF(0, -d->sceneWindow->geometry().height()));
- d->opacityAnimation->setEndValue(0);
- d->positionAnimation->setDuration(250);
- d->opacityAnimation->setDuration(250);
- break;
-
- case MSceneWindowAnimation::Move:
- if (!useCurrentAsStartValue) {
- d->positionAnimation->setStartValue(QPointF(0, 0));
- d->opacityAnimation->setStartValue(1);
- }
-
- d->positionAnimation->setEndValue(QPointF(0, 0));
- d->opacityAnimation->setEndValue(1);
- d->positionAnimation->setDuration(500);
- d->opacityAnimation->setDuration(500);
- break;
- }
-}
-#endif
diff --git a/src/corelib/animation/scene/mnavigationbaranimation.h b/src/corelib/animation/scene/mnavigationbaranimation.h
deleted file mode 100644
index cf86f0cd..00000000
--- a/src/corelib/animation/scene/mnavigationbaranimation.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MNAVIGATIONBARANIMATION_H
-#define MNAVIGATIONBARANIMATION_H
-
-#include <QtGlobal>
-#if QT_VERSION >= 0x040600
-
-#include <mscenewindowanimation.h>
-#include <manimationstyle.h>
-
-class MNavigationbarAnimationPrivate;
-
-/*!
- \class MNavigationbarAnimation
- \brief
- */
-class MNavigationbarAnimation : public MSceneWindowAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(MNavigationbarAnimation)
- M_ANIMATION(MSceneWindowAnimationStyle)
-
-protected:
-
- /*!
- \brief Constructs the navigation bar animation.
-
- This constructor is meant to be used inside the libmeegotouch to share the
- private data class pointer.
- */
- MNavigationbarAnimation(MNavigationbarAnimationPrivate *dd, MSceneWindow *window, QObject *parent = NULL);
-
-public:
-
- /*!
- \brief Constructs the scene window animation.
- */
- MNavigationbarAnimation(MSceneWindow *window, QObject *parent = NULL);
-
- /*!
- \brief Sets animation type.
- */
- virtual void setType(MSceneWindowAnimation::Type type, bool useCurrentAsStartValue);
-};
-
-#endif
-#endif
diff --git a/src/corelib/animation/scene/mnotificationanimation.cpp b/src/corelib/animation/scene/mnotificationanimation.cpp
deleted file mode 100644
index ea2fbab4..00000000
--- a/src/corelib/animation/scene/mnotificationanimation.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mnotificationanimation.h"
-
-#if QT_VERSION >= 0x040600
-
-#include "mnotificationanimation_p.h"
-#include "mscenewindow.h"
-#include "mscenemanager.h"
-#include "mapplication.h"
-#include "mwindow.h"
-#include <QPropertyAnimation>
-#include <QAnimationGroup>
-
-MNotificationAnimation::MNotificationAnimation(MSceneWindow *window, QObject *parent) :
- MSceneWindowAnimation(new MNotificationAnimationPrivate, window, parent)
-{
- Q_D(MNotificationAnimation);
-
- d->positionAnimation = new QPropertyAnimation(window, "pos", group());
-}
-
-MNotificationAnimation::MNotificationAnimation(MNotificationAnimationPrivate *dd, MSceneWindow *window, QObject *parent) :
- MSceneWindowAnimation(dd, window, parent)
-{
- Q_D(MNotificationAnimation);
-
- d->positionAnimation = new QPropertyAnimation(window, "pos", group());
-}
-
-void MNotificationAnimation::setType(MSceneWindowAnimation::Type type, bool useCurrentAsStartValue)
-{
- Q_D(MNotificationAnimation);
-
- if (useCurrentAsStartValue) {
- d->positionAnimation->setStartValue(d->sceneWindow->pos());
- }
-
- QSize screenSize = MApplication::activeWindow()->visibleSceneSize();
-
- //TODO: Get the start, end and duration parameters from theme or somewhere.
-
- switch (type) {
- case MSceneWindowAnimation::Show:
- if (!useCurrentAsStartValue) {
- if (d->sceneWindow->windowType() == MSceneWindow::NotificationEvent)
- d->positionAnimation->setStartValue(QPointF(-d->sceneWindow->geometry().width(), screenSize.height() * .2));
- else
- d->positionAnimation->setStartValue(QPointF(screenSize.width() + d->sceneWindow->geometry().width(), screenSize.height() * .2));
- }
- if (d->sceneWindow->windowType() == MSceneWindow::NotificationEvent)
- d->positionAnimation->setEndValue(QPointF(0, screenSize.height() * .2));
- else
- d->positionAnimation->setEndValue(QPointF(screenSize.width() - d->sceneWindow->geometry().width(), screenSize.height() * .2));
- d->positionAnimation->setDuration(750);
- break;
-
- case MSceneWindowAnimation::Hide:
- if (!useCurrentAsStartValue) {
- if (d->sceneWindow->windowType() == MSceneWindow::NotificationEvent)
- d->positionAnimation->setStartValue(QPointF(0, screenSize.height() * .2));
- else
- d->positionAnimation->setStartValue(QPointF(screenSize.width() - d->sceneWindow->geometry().width(), screenSize.height() * .2));
- }
- if (d->sceneWindow->windowType() == MSceneWindow::NotificationEvent)
- d->positionAnimation->setEndValue(QPointF(-d->sceneWindow->geometry().width(), screenSize.height() * .2));
- else
- d->positionAnimation->setEndValue(QPointF(screenSize.width() + d->sceneWindow->geometry().width(), screenSize.height() * .2));
- d->positionAnimation->setDuration(750);
- break;
-
- case MSceneWindowAnimation::Move:
- if (!useCurrentAsStartValue) {
- d->positionAnimation->setStartValue(QPointF(0, screenSize.height() * .2));
- }
-
- d->positionAnimation->setEndValue(QPointF(0, screenSize.height() * .2));
- d->positionAnimation->setDuration(500);
- break;
- }
-}
-#endif
diff --git a/src/corelib/animation/scene/mnotificationanimation.h b/src/corelib/animation/scene/mnotificationanimation.h
deleted file mode 100644
index 135d09a7..00000000
--- a/src/corelib/animation/scene/mnotificationanimation.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MNOTIFICATIONANIMATION_H
-#define MNOTIFICATIONANIMATION_H
-#include <QtGlobal>
-#if QT_VERSION >= 0x040600
-
-#include <mscenewindowanimation.h>
-#include <manimationstyle.h>
-
-class MNotificationAnimationPrivate;
-
-/*!
- \class MNavigationbarAnimation
- \brief
- */
-class MNotificationAnimation : public MSceneWindowAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(MNotificationAnimation)
- M_ANIMATION(MSceneWindowAnimationStyle)
-
-protected:
-
- /*!
- \brief Constructs the navigation bar animation.
-
- This constructor is meant to be used inside the libmeegotouch to share the
- private data class pointer.
- */
- MNotificationAnimation(MNotificationAnimationPrivate *dd, MSceneWindow *window, QObject *parent = NULL);
-
-public:
-
- /*!
- \brief Constructs the scene window animation.
- */
- MNotificationAnimation(MSceneWindow *window, QObject *parent = NULL);
-
- /*!
- \brief Sets animation type.
- */
- virtual void setType(MSceneWindowAnimation::Type type, bool useCurrentAsStartValue);
-};
-
-#endif
-#endif
diff --git a/src/corelib/animation/scene/mnotificationanimation_p.h b/src/corelib/animation/scene/mnotificationanimation_p.h
deleted file mode 100644
index 586fef44..00000000
--- a/src/corelib/animation/scene/mnotificationanimation_p.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MNOTIFICATIONANIMATION_P_H
-#define MNOTIFICATIONANIMATION_P_H
-
-#include "mscenewindowanimation_p.h"
-class QPropertyAnimation;
-
-class MNotificationAnimationPrivate : public MSceneWindowAnimationPrivate
-{
- Q_DECLARE_PUBLIC(MNotificationAnimation)
-
-public:
- QPropertyAnimation *positionAnimation;
-};
-
-#endif
diff --git a/src/corelib/animation/scene/morientationanimation.cpp b/src/corelib/animation/scene/morientationanimation.cpp
index cfd03632..2eeb7bef 100644
--- a/src/corelib/animation/scene/morientationanimation.cpp
+++ b/src/corelib/animation/scene/morientationanimation.cpp
@@ -19,9 +19,6 @@
#include "morientationanimation.h"
-#if QT_VERSION >= 0x040600
-
-
#include "morientationanimation_p.h"
///////////////////
@@ -42,13 +39,8 @@ MOrientationAnimationPrivate::~MOrientationAnimationPrivate()
//////////////////
MOrientationAnimation::MOrientationAnimation(MOrientationAnimationPrivate *d,
- QObject *parent, MGroupAnimation::Type type) :
- MGroupAnimation(d, type, parent)
-{
-}
-
-MOrientationAnimation::MOrientationAnimation(QObject *parent, MGroupAnimation::Type type) :
- MGroupAnimation(new MOrientationAnimationPrivate(), type, parent)
+ QObject *parent) :
+ MParallelAnimationGroup(d, parent)
{
}
@@ -70,4 +62,3 @@ QGraphicsWidget *MOrientationAnimation::rootElement()
void MOrientationAnimation::rootElementChanged()
{
}
-#endif
diff --git a/src/corelib/animation/scene/morientationanimation.h b/src/corelib/animation/scene/morientationanimation.h
index 2a3ce35b..c7a3868e 100644
--- a/src/corelib/animation/scene/morientationanimation.h
+++ b/src/corelib/animation/scene/morientationanimation.h
@@ -21,14 +21,11 @@
#define MORIENTATIONANIMATION_H
#include <QtGlobal>
-#if QT_VERSION >= 0x040600
-#include <mgroupanimation.h>
-#include <mgroupanimationstyle.h>
+#include <mparallelanimationgroup.h>
#include <mnamespace.h>
class QGraphicsWidget;
-class MWindow;
class MSceneWindow;
class MOrientationAnimationPrivate;
@@ -36,21 +33,18 @@ class MOrientationAnimationPrivate;
\class MOrientationAnimation
\brief MOrientationAnimation class provides abstract interface for orientation animations.
*/
-class MOrientationAnimation : public MGroupAnimation
+class MOrientationAnimation : public MParallelAnimationGroup
{
Q_OBJECT
Q_DECLARE_PRIVATE(MOrientationAnimation)
-
- M_ANIMATION(MGroupAnimationStyle)
+ M_ANIMATION_GROUP(MAnimationStyle)
protected:
/*!
\brief Constructs the orientation animation.
*/
- MOrientationAnimation(MOrientationAnimationPrivate *d,
- QObject *parent,
- MGroupAnimation::Type type = MGroupAnimation::Parallel);
+ MOrientationAnimation(MOrientationAnimationPrivate *d, QObject *parent);
Q_SIGNALS:
/*!
@@ -61,10 +55,6 @@ Q_SIGNALS:
public:
/*!
- \brief Constructs the orientation animation.
- */
- MOrientationAnimation(QObject *parent, MGroupAnimation::Type type = MGroupAnimation::Parallel);
- /*!
\brief Destroys the orientation animation.
*/
virtual ~MOrientationAnimation() {};
@@ -102,4 +92,3 @@ protected:
};
#endif
-#endif
diff --git a/src/corelib/animation/scene/morientationanimation_p.h b/src/corelib/animation/scene/morientationanimation_p.h
index 2c29064e..bc46e189 100644
--- a/src/corelib/animation/scene/morientationanimation_p.h
+++ b/src/corelib/animation/scene/morientationanimation_p.h
@@ -20,9 +20,9 @@
#ifndef MORIENTATIONANIMATION_P_H
#define MORIENTATIONANIMATION_P_H
-#include "mgroupanimation_p.h"
+#include "mparallelanimationgroup_p.h"
-class MOrientationAnimationPrivate : public MGroupAnimationPrivate
+class MOrientationAnimationPrivate : public MParallelAnimationGroupPrivate
{
Q_DECLARE_PUBLIC(MOrientationAnimation)
public:
diff --git a/src/corelib/animation/scene/mscenefadeanimation.cpp b/src/corelib/animation/scene/mscenefadeanimation.cpp
deleted file mode 100644
index 91a16180..00000000
--- a/src/corelib/animation/scene/mscenefadeanimation.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mscenefadeanimation.h"
-
-#if QT_VERSION >= 0x040600
-
-
-#include "mscenefadeanimation_p.h"
-#include "mscenewindow.h"
-#include "mscenemanager.h"
-#include "mwidgetanimation.h"
-
-//#include <QPropertyAnimation>
-#include <QAnimationGroup>
-#include <QEasingCurve>
-
-MSceneFadeAnimation::MSceneFadeAnimation(MSceneWindow *window, QObject *parent) :
- MSceneWindowAnimation(new MSceneFadeAnimationPrivate, window, parent)
-{
- Q_D(MSceneFadeAnimation);
-
- //d->positionAnimation = new QPropertyAnimation(window, "pos", group());
- d->animation = new MWidgetAnimation(group());
- //d->animation->addWidget(window);
-}
-
-MSceneFadeAnimation::MSceneFadeAnimation(MSceneFadeAnimationPrivate *dd, MSceneWindow *window, QObject *parent) :
- MSceneWindowAnimation(dd, window, parent)
-{
- Q_D(MSceneFadeAnimation);
-
- //d->positionAnimation = new QPropertyAnimation(window, "pos", group());
- d->animation = new MWidgetAnimation(group());
- d->animation->addWidget(window);
-}
-
-void MSceneFadeAnimation::setType(MSceneWindowAnimation::Type type, bool useCurrentAsStartValue)
-{
- Q_D(MSceneFadeAnimation);
-
- switch (type) {
- case MSceneWindowAnimation::Show: {
-
- if (!useCurrentAsStartValue)
- d->sceneWindow->setOpacity(0.0);
-
- /*d->sceneWindow->setTransformOrigin(QPointF(432, 240));
- d->sceneWindow->setXScale(0.0);
- d->sceneWindow->setYScale(0.0);
- d->animation->setTargetValue(d->sceneWindow, "xScale",1.0);
- d->animation->setTargetValue(d->sceneWindow, "yScale",1.0);
- d->animation->setDuration(500);*/
- //d->animation->setEasingCurve(QEasingCurve::OutBounce);
-
- d->animation->setTargetOpacity(d->sceneWindow, 1.0);
- d->animation->setDuration(style()->showDuration(), "opacity");
- } break;
-
- case MSceneWindowAnimation::Hide:
-
- d->animation->setTargetOpacity(d->sceneWindow, 0.0);
- d->animation->setDuration(style()->hideDuration());
- break;
-
- case MSceneWindowAnimation::Move:
- break;
- }
-}
-#endif
diff --git a/src/corelib/animation/scene/mscenefadeanimation.h b/src/corelib/animation/scene/mscenefadeanimation.h
deleted file mode 100644
index 19240074..00000000
--- a/src/corelib/animation/scene/mscenefadeanimation.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MSCENEFADEANIMATION_H
-#define MSCENEFADEANIMATION_H
-
-#include <QtGlobal>
-#if QT_VERSION >= 0x040600
-
-#include <mscenewindowanimation.h>
-#include <manimationstyle.h>
-
-class MSceneFadeAnimationPrivate;
-
-/*!
- \class MNavigationbarAnimation
- \brief
- */
-class MSceneFadeAnimation : public MSceneWindowAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(MSceneFadeAnimation)
- M_ANIMATION(MSceneWindowAnimationStyle)
-
-protected:
-
- /*!
- \brief Constructs the navigation bar animation.
-
- This constructor is meant to be used inside the libmeegotouch to share the
- private data class pointer.
- */
- MSceneFadeAnimation(MSceneFadeAnimationPrivate *dd, MSceneWindow *window, QObject *parent = NULL);
-
-public:
-
- /*!
- \brief Constructs the scene window animation.
- */
- MSceneFadeAnimation(MSceneWindow *window, QObject *parent = NULL);
-
- /*!
- \brief Sets animation type.
- */
- virtual void setType(MSceneWindowAnimation::Type type, bool useCurrentAsStartValue);
-};
-
-#endif
-#endif
-
diff --git a/src/corelib/animation/scene/mscenefadeanimation_p.h b/src/corelib/animation/scene/mscenefadeanimation_p.h
deleted file mode 100644
index d6f9d96c..00000000
--- a/src/corelib/animation/scene/mscenefadeanimation_p.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MSCENEFADEANIMATION_P_H
-#define MSCENEFADEANIMATION_P_H
-
-#include "mscenewindowanimation_p.h"
-class MWidgetAnimation;
-
-class MSceneFadeAnimationPrivate : public MSceneWindowAnimationPrivate
-{
- Q_DECLARE_PUBLIC(MSceneFadeAnimation)
-
-public:
- MWidgetAnimation *animation;
-};
-
-#endif
diff --git a/src/corelib/animation/scene/mscenewindowanimation.cpp b/src/corelib/animation/scene/mscenewindowanimation.cpp
deleted file mode 100644
index 8bb0e8dc..00000000
--- a/src/corelib/animation/scene/mscenewindowanimation.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mscenewindowanimation.h"
-
-#if QT_VERSION >= 0x040600
-
-#include "mscenewindowanimation_p.h"
-
-#include <QPropertyAnimation>
-#include <QAnimationGroup>
-#include <QGraphicsWidget>
-
-
-MSceneWindowAnimation::MSceneWindowAnimation(MSceneWindowAnimationPrivate *dd,
- MSceneWindow *window,
- QObject *parent,
- MGroupAnimation::Type type) :
- MGroupAnimation(dd, type, parent)
-{
- Q_D(MSceneWindowAnimation);
-
- d->sceneWindow = window;
-}
-
-MSceneWindowAnimation::MSceneWindowAnimation(MSceneWindow *window,
- QObject *parent,
- MGroupAnimation::Type type) :
- MGroupAnimation(new MSceneWindowAnimationPrivate, type, parent)
-{
- Q_D(MSceneWindowAnimation);
-
- d->sceneWindow = window;
-}
-
-MSceneWindowAnimation::~MSceneWindowAnimation()
-{
-}
-
-void MSceneWindowAnimation::updateState(QAbstractAnimation::State oldState,
- QAbstractAnimation::State newState)
-{
- MGroupAnimation::updateState(oldState, newState);
-
- if (newState == QAbstractAnimation::Stopped) {
- Q_D(MSceneWindowAnimation);
- emit animationDone(d->sceneWindow);
- }
-}
-#endif
-
diff --git a/src/corelib/animation/scene/mscenewindowanimation.h b/src/corelib/animation/scene/mscenewindowanimation.h
deleted file mode 100644
index c450f169..00000000
--- a/src/corelib/animation/scene/mscenewindowanimation.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MSCENEWINDOWANIMATION_H
-#define MSCENEWINDOWANIMATION_H
-
-#include <QtGlobal>
-#if QT_VERSION >= 0x040600
-
-#include <MGroupAnimation>
-#include <QPair>
-#include <QVector>
-#include <mscenewindowanimationstyle.h>
-
-class MSceneWindow;
-class MSceneWindowAnimationPrivate;
-
-/*!
- \class MSceneWindowAnimation
- \brief
- */
-class MSceneWindowAnimation : public MGroupAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(MSceneWindowAnimation)
- M_ANIMATION(MSceneWindowAnimationStyle)
-
-protected:
-
- /*!
- \brief Constructs the scene window animation.
-
- This constructor is meant to be used inside the libmeegotouch to share the
- private data class pointer.
- */
- MSceneWindowAnimation(MSceneWindowAnimationPrivate *dd,
- MSceneWindow *window,
- QObject *parent = NULL,
- MGroupAnimation::Type type = Parallel);
-
-public:
-
- enum Type {
- Show,
- Hide,
- Move
- };
-
- /*!
- \brief Constructs the scene window animation.
- */
- MSceneWindowAnimation(MSceneWindow *window,
- QObject *parent = NULL,
- MGroupAnimation::Type type = Parallel);
-
- /*!
- \brief Destructs the scene window animation.
- */
- virtual ~MSceneWindowAnimation();
-
- /*!
- \brief Sets animation type.
- */
- virtual void setType(Type type, bool useCurrentAsStartValue = true) = 0;
-
-Q_SIGNALS:
- void animationDone(MSceneWindow *window);
-
-protected:
- virtual void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
-};
-
-#endif
-#endif
diff --git a/src/corelib/animation/scene/msnapshotitem.cpp b/src/corelib/animation/scene/msnapshotitem.cpp
new file mode 100644
index 00000000..86ee395a
--- /dev/null
+++ b/src/corelib/animation/scene/msnapshotitem.cpp
@@ -0,0 +1,47 @@
+#include "msnapshotitem.h"
+
+#include <QGraphicsScene>
+#include <QImage>
+#include <QPainter>
+
+MSnapshotItem::MSnapshotItem(QGraphicsScene *scene, const QRectF &sceneTargetRect, QGraphicsItem *parent)
+ : QGraphicsObject(parent), m_boundingRect(sceneTargetRect)
+{
+ // Assumes that the resolution is one scene unit per pixel
+ image = new QImage(sceneTargetRect.width(), sceneTargetRect.height(),
+ QImage::Format_ARGB32_Premultiplied);
+
+ QRectF targetRect;
+ targetRect.setX(0.0f);
+ targetRect.setY(0.0f);
+ targetRect.setWidth(sceneTargetRect.width());
+ targetRect.setHeight(sceneTargetRect.height());
+
+ QRectF sourceRect;
+ sourceRect = sceneTargetRect;
+
+ QPainter painter(image);
+ scene->render(&painter, targetRect, sourceRect);
+}
+
+MSnapshotItem::~MSnapshotItem()
+{
+ delete image;
+ image = 0;
+}
+
+QRectF MSnapshotItem::boundingRect() const
+{
+ return m_boundingRect;
+}
+
+void MSnapshotItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget)
+{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+
+ painter->setRenderHint(QPainter::Antialiasing, true);
+ painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
+ painter->drawImage(0, 0, *image);
+}
diff --git a/src/corelib/animation/scene/msnapshotitem.h b/src/corelib/animation/scene/msnapshotitem.h
new file mode 100644
index 00000000..1a92ff10
--- /dev/null
+++ b/src/corelib/animation/scene/msnapshotitem.h
@@ -0,0 +1,29 @@
+#ifndef MSNAPSHOTITEM_H
+#define MSNAPSHOTITEM_H
+
+#include <QGraphicsObject>
+
+class QGraphicsScene;
+class QRectF;
+class QImage;
+
+class MSnapshotItem : public QGraphicsObject
+{
+ Q_OBJECT
+public:
+ MSnapshotItem(QGraphicsScene *scene, const QRectF &targetRect,
+ QGraphicsItem *parent = 0);
+
+ virtual ~MSnapshotItem();
+
+ //! \reimp
+ virtual QRectF boundingRect() const;
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ //! \reimp_end
+
+private:
+ QRectF m_boundingRect;
+ QImage *image;
+};
+
+#endif
diff --git a/src/corelib/animation/scene/scene.pri b/src/corelib/animation/scene/scene.pri
index 3d4d7366..627cd541 100644
--- a/src/corelib/animation/scene/scene.pri
+++ b/src/corelib/animation/scene/scene.pri
@@ -6,31 +6,21 @@
ANIMATIONS_SCENE_SRC_DIR=./animation/scene
PUBLIC_HEADERS += \
- $$ANIMATIONS_SCENE_SRC_DIR/morientationanimation.h \
$$ANIMATIONS_SCENE_SRC_DIR/mbasicorientationanimation.h \
- $$ANIMATIONS_SCENE_SRC_DIR/mfliporientationanimation.h \
- $$ANIMATIONS_SCENE_SRC_DIR/mscenewindowanimation.h \
- $$ANIMATIONS_SCENE_SRC_DIR/mnavigationbaranimation.h \
- $$ANIMATIONS_SCENE_SRC_DIR/mnotificationanimation.h \
- $$ANIMATIONS_SCENE_SRC_DIR/mscenefadeanimation.h \
$$ANIMATIONS_SCENE_SRC_DIR/mpageswitchanimation.h \
PRIVATE_HEADERS += \
- $$ANIMATIONS_SCENE_SRC_DIR/morientationanimation_p.h \
$$ANIMATIONS_SCENE_SRC_DIR/mbasicorientationanimation_p.h \
- $$ANIMATIONS_SCENE_SRC_DIR/mfliporientationanimation_p.h \
- $$ANIMATIONS_SCENE_SRC_DIR/mscenewindowanimation_p.h \
- $$ANIMATIONS_SCENE_SRC_DIR/mnavigationbaranimation_p.h \
- $$ANIMATIONS_SCENE_SRC_DIR/mnotificationanimation_p.h \
- $$ANIMATIONS_SCENE_SRC_DIR/mscenefadeanimation_p.h \
+ $$ANIMATIONS_SCENE_SRC_DIR/morientationanimation.h \
+ $$ANIMATIONS_SCENE_SRC_DIR/morientationanimation_p.h \
+ $$ANIMATIONS_SCENE_SRC_DIR/mcrossfadedorientationanimation.h \
+ $$ANIMATIONS_SCENE_SRC_DIR/mcrossfadedorientationanimation_p.h \
+ $$ANIMATIONS_SCENE_SRC_DIR/msnapshotitem.h \
$$ANIMATIONS_SCENE_SRC_DIR/mpageswitchanimation_p.h \
SOURCES += \
- $$ANIMATIONS_SCENE_SRC_DIR/morientationanimation.cpp \
$$ANIMATIONS_SCENE_SRC_DIR/mbasicorientationanimation.cpp \
- $$ANIMATIONS_SCENE_SRC_DIR/mfliporientationanimation.cpp \
- $$ANIMATIONS_SCENE_SRC_DIR/mscenewindowanimation.cpp \
- $$ANIMATIONS_SCENE_SRC_DIR/mnavigationbaranimation.cpp \
- $$ANIMATIONS_SCENE_SRC_DIR/mnotificationanimation.cpp \
- $$ANIMATIONS_SCENE_SRC_DIR/mscenefadeanimation.cpp \
+ $$ANIMATIONS_SCENE_SRC_DIR/morientationanimation.cpp \
+ $$ANIMATIONS_SCENE_SRC_DIR/mcrossfadedorientationanimation.cpp \
+ $$ANIMATIONS_SCENE_SRC_DIR/msnapshotitem.cpp \
$$ANIMATIONS_SCENE_SRC_DIR/mpageswitchanimation.cpp \
diff --git a/src/corelib/animation/widget/core/mabstractwidgetanimation_p.h b/src/corelib/animation/widget/core/mabstractwidgetanimation_p.h
index efe8090f..65059cab 100644
--- a/src/corelib/animation/widget/core/mabstractwidgetanimation_p.h
+++ b/src/corelib/animation/widget/core/mabstractwidgetanimation_p.h
@@ -21,8 +21,8 @@
#define MABSTRACTWIDGETANIMATION_P_H
#include "mparallelanimationgroup_p.h"
-
-class MWidgetController;
+#include <mwidgetcontroller.h>
+#include <QPointer>
class MAbstractWidgetAnimationPrivate : public MParallelAnimationGroupPrivate
{
@@ -30,8 +30,8 @@ class MAbstractWidgetAnimationPrivate : public MParallelAnimationGroupPrivate
public:
MAbstractWidgetAnimationPrivate();
virtual ~MAbstractWidgetAnimationPrivate() {}
-private:
- MWidgetController *targetWidget;
+protected:
+ QPointer<MWidgetController> targetWidget;
};
#endif
diff --git a/src/corelib/animation/widget/mwidgetfadeanimation.cpp b/src/corelib/animation/widget/mwidgetfadeanimation.cpp
new file mode 100644
index 00000000..e3633b02
--- /dev/null
+++ b/src/corelib/animation/widget/mwidgetfadeanimation.cpp
@@ -0,0 +1,120 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#include "mwidgetfadeanimation.h"
+#include "mwidgetfadeanimation_p.h"
+#include "manimationcreator.h"
+
+#include <QPauseAnimation>
+#include <QPropertyAnimation>
+#include <QSequentialAnimationGroup>
+#include <mwidgetcontroller.h>
+
+void MWidgetFadeAnimationPrivate::init()
+{
+ Q_Q(MWidgetFadeAnimation);
+
+ direction = MWidgetFadeAnimation::In;
+ QSequentialAnimationGroup *delayedAnimation = new QSequentialAnimationGroup;
+ delay = new QPauseAnimation;
+ opacityAnimation = new QPropertyAnimation;
+ opacityAnimation->setPropertyName("opacity");
+ delayedAnimation->addAnimation(delay);
+ delayedAnimation->addAnimation(opacityAnimation);
+ q->addAnimation(delayedAnimation);
+}
+
+MWidgetFadeAnimation::MWidgetFadeAnimation(MWidgetFadeAnimationPrivate *dd, QObject *parent) :
+ MAbstractWidgetAnimation(dd, parent)
+{
+ Q_D(MWidgetFadeAnimation);
+
+ d->init();
+}
+
+MWidgetFadeAnimation::MWidgetFadeAnimation(QObject *parent) :
+ MAbstractWidgetAnimation(new MWidgetFadeAnimationPrivate, parent)
+{
+ Q_D(MWidgetFadeAnimation);
+
+ d->init();
+}
+
+MWidgetFadeAnimation::~MWidgetFadeAnimation()
+{
+}
+
+void MWidgetFadeAnimation::setTargetWidget(MWidgetController *widget)
+{
+ Q_D(MWidgetFadeAnimation);
+ MAbstractWidgetAnimation::setTargetWidget(widget);
+
+ d->played = false;
+ d->opacityAnimation->setTargetObject(targetWidget());
+}
+
+void MWidgetFadeAnimation::restoreTargetWidgetState()
+{
+ Q_D(MWidgetFadeAnimation);
+ if (d->played)
+ targetWidget()->setOpacity(d->originalOpacity);
+}
+
+void MWidgetFadeAnimation::setTransitionDirection(TransitionDirection direction)
+{
+ Q_D(MWidgetFadeAnimation);
+
+ d->direction = direction;
+
+ if (d->direction == In)
+ style().setObjectName("In");
+ else
+ style().setObjectName("Out");
+}
+
+void MWidgetFadeAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
+{
+ Q_D(MWidgetFadeAnimation);
+
+ if (!d->targetWidget)
+ return;
+
+ if (oldState == QAbstractAnimation::Stopped &&
+ newState == QAbstractAnimation::Running)
+ {
+ if (style().objectName().isNull())
+ style().setObjectName("In");
+
+ d->originalOpacity = d->targetWidget->opacity();
+
+ if (d->direction == In) {
+ targetWidget()->setOpacity(0);
+ d->opacityAnimation->setStartValue(0);
+ d->opacityAnimation->setEndValue(style()->opacity());
+ } else {
+ d->opacityAnimation->setStartValue(style()->opacity());
+ d->opacityAnimation->setEndValue(0);
+ }
+
+ d->played = true;
+
+ d->delay->setDuration(style()->delay());
+ d->opacityAnimation->setDuration(style()->duration());
+ }
+}
diff --git a/src/corelib/animation/widget/mwidgetfadeinanimation.h b/src/corelib/animation/widget/mwidgetfadeanimation.h
index e3f91956..dcff20a2 100644
--- a/src/corelib/animation/widget/mwidgetfadeinanimation.h
+++ b/src/corelib/animation/widget/mwidgetfadeanimation.h
@@ -17,20 +17,20 @@
**
****************************************************************************/
-#ifndef MWIDGETFADEINANIMATION_H
-#define MWIDGETFADEINANIMATION_H
+#ifndef MWIDGETFADEANIMATION_H
+#define MWIDGETFADEANIMATION_H
#include <mabstractwidgetanimation.h>
-#include <mwidgetfadeinanimationstyle.h>
+#include <mwidgetfadeanimationstyle.h>
-class MWidgetFadeInAnimationPrivate;
+class MWidgetFadeAnimationPrivate;
//! \internal
-class MWidgetFadeInAnimation : public MAbstractWidgetAnimation
+class MWidgetFadeAnimation : public MAbstractWidgetAnimation
{
Q_OBJECT
- Q_DECLARE_PRIVATE(MWidgetFadeInAnimation)
- M_ANIMATION_GROUP(MWidgetFadeInAnimationStyle)
+ Q_DECLARE_PRIVATE(MWidgetFadeAnimation)
+ M_ANIMATION_GROUP(MWidgetFadeAnimationStyle)
/*!
\brief Constructs the widget animation.
@@ -38,19 +38,25 @@ class MWidgetFadeInAnimation : public MAbstractWidgetAnimation
This constructor is meant to be used inside the libmeegotouch to share the
private data class pointer.
*/
- MWidgetFadeInAnimation(MWidgetFadeInAnimationPrivate *dd, QObject *parent);
+ MWidgetFadeAnimation(MWidgetFadeAnimationPrivate *dd, QObject *parent);
public:
-
/*!
\brief Constructs the widget animation.
*/
- MWidgetFadeInAnimation(QObject *parent = NULL);
+ MWidgetFadeAnimation(QObject *parent = NULL);
/*!
\brief Destructs the widget animation.
*/
- virtual ~MWidgetFadeInAnimation();
+ virtual ~MWidgetFadeAnimation();
+
+ enum TransitionDirection {
+ In,
+ Out
+ };
+
+ void setTransitionDirection(TransitionDirection direction);
//! \reimp
virtual void restoreTargetWidgetState();
diff --git a/src/corelib/animation/widget/mwidgetfadeinanimation_p.h b/src/corelib/animation/widget/mwidgetfadeanimation_p.h
index 7513c497..e372805e 100644
--- a/src/corelib/animation/widget/mwidgetfadeinanimation_p.h
+++ b/src/corelib/animation/widget/mwidgetfadeanimation_p.h
@@ -17,21 +17,26 @@
**
****************************************************************************/
-#ifndef MWIDGETFADEINANIMATION_P_H
-#define MWIDGETFADEINANIMATION_P_H
+#ifndef MWIDGETFADEANIMATION_P_H
+#define MWIDGETFADEANIMATION_P_H
#include "mabstractwidgetanimation_p.h"
+#include "mwidgetfadeanimation.h"
+class QPauseAnimation;
class QPropertyAnimation;
-class MWidgetFadeInAnimationPrivate : public MAbstractWidgetAnimationPrivate
+class MWidgetFadeAnimationPrivate : public MAbstractWidgetAnimationPrivate
{
- Q_DECLARE_PUBLIC(MWidgetFadeInAnimation)
+ Q_DECLARE_PUBLIC(MWidgetFadeAnimation)
public:
- virtual ~MWidgetFadeInAnimationPrivate() {}
+ void init();
+ virtual ~MWidgetFadeAnimationPrivate() {}
private:
qreal originalOpacity;
bool played;
+ MWidgetFadeAnimation::TransitionDirection direction;
+ QPauseAnimation *delay;
QPropertyAnimation *opacityAnimation;
};
diff --git a/src/corelib/animation/widget/mwidgetfadeinanimation.cpp b/src/corelib/animation/widget/mwidgetfadeinanimation.cpp
deleted file mode 100644
index 6832df91..00000000
--- a/src/corelib/animation/widget/mwidgetfadeinanimation.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mwidgetfadeinanimation.h"
-#include "mwidgetfadeinanimation_p.h"
-#include "manimationcreator.h"
-
-#include <QPropertyAnimation>
-#include <mwidgetcontroller.h>
-
-MWidgetFadeInAnimation::MWidgetFadeInAnimation(MWidgetFadeInAnimationPrivate *dd, QObject *parent) :
- MAbstractWidgetAnimation(dd, parent)
-{
- Q_D(MWidgetFadeInAnimation);
-
- d->opacityAnimation = new QPropertyAnimation;
- d->opacityAnimation->setPropertyName("opacity");
- addAnimation(d->opacityAnimation);
-}
-
-MWidgetFadeInAnimation::MWidgetFadeInAnimation(QObject *parent) :
- MAbstractWidgetAnimation(new MWidgetFadeInAnimationPrivate, parent)
-{
- Q_D(MWidgetFadeInAnimation);
-
- d->opacityAnimation = new QPropertyAnimation;
- d->opacityAnimation->setPropertyName("opacity");
- addAnimation(d->opacityAnimation);
-}
-
-MWidgetFadeInAnimation::~MWidgetFadeInAnimation()
-{
-}
-
-void MWidgetFadeInAnimation::setTargetWidget(MWidgetController *widget)
-{
- Q_D(MWidgetFadeInAnimation);
- MAbstractWidgetAnimation::setTargetWidget(widget);
-
- d->played = false;
- d->opacityAnimation->setTargetObject(targetWidget());
-}
-
-void MWidgetFadeInAnimation::restoreTargetWidgetState()
-{
- Q_D(MWidgetFadeInAnimation);
- if (d->played)
- targetWidget()->setOpacity(d->originalOpacity);
-}
-
-void MWidgetFadeInAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
-{
- Q_D(MWidgetFadeInAnimation);
- if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
- targetWidget()->show();
-
- d->originalOpacity = targetWidget()->opacity();
- d->played = true;
-
- d->opacityAnimation->setStartValue(0.0);
- d->opacityAnimation->setEndValue(style()->opacity());
- d->opacityAnimation->setDuration(style()->duration());
- }
-}
diff --git a/src/corelib/animation/widget/mwidgetfadeoutanimation.cpp b/src/corelib/animation/widget/mwidgetfadeoutanimation.cpp
deleted file mode 100644
index 8f162d2c..00000000
--- a/src/corelib/animation/widget/mwidgetfadeoutanimation.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mwidgetfadeoutanimation.h"
-#include "mwidgetfadeoutanimation_p.h"
-#include "manimationcreator.h"
-
-#include <QPropertyAnimation>
-#include <mwidgetcontroller.h>
-
-MWidgetFadeOutAnimation::MWidgetFadeOutAnimation(MWidgetFadeOutAnimationPrivate *dd, QObject *parent) :
- MAbstractWidgetAnimation(dd, parent)
-{
- Q_D(MWidgetFadeOutAnimation);
-
- d->opacityAnimation = new QPropertyAnimation;
- d->opacityAnimation->setPropertyName("opacity");
- addAnimation(d->opacityAnimation);
-}
-
-MWidgetFadeOutAnimation::MWidgetFadeOutAnimation(QObject *parent) :
- MAbstractWidgetAnimation(new MWidgetFadeOutAnimationPrivate, parent)
-{
- Q_D(MWidgetFadeOutAnimation);
-
- d->opacityAnimation = new QPropertyAnimation;
- d->opacityAnimation->setPropertyName("opacity");
- addAnimation(d->opacityAnimation);
-}
-
-MWidgetFadeOutAnimation::~MWidgetFadeOutAnimation()
-{
-}
-
-void MWidgetFadeOutAnimation::setTargetWidget(MWidgetController *widget)
-{
- Q_D(MWidgetFadeOutAnimation);
- MAbstractWidgetAnimation::setTargetWidget(widget);
-
- d->played = false;
- d->opacityAnimation->setTargetObject(targetWidget());
-}
-
-void MWidgetFadeOutAnimation::restoreTargetWidgetState()
-{
- Q_D(MWidgetFadeOutAnimation);
- if (d->played)
- targetWidget()->setOpacity(d->originalOpacity);
-}
-
-void MWidgetFadeOutAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
-{
- Q_D(MWidgetFadeOutAnimation);
- if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
- d->originalOpacity = targetWidget()->opacity();
- d->played = true;
-
- d->opacityAnimation->setStartValue(d->originalOpacity);
- d->opacityAnimation->setEndValue(style()->opacity());
- d->opacityAnimation->setDuration(style()->duration());
- }
-}
diff --git a/src/corelib/animation/widget/mwidgetfadeoutanimation.h b/src/corelib/animation/widget/mwidgetfadeoutanimation.h
deleted file mode 100644
index 5b4790dd..00000000
--- a/src/corelib/animation/widget/mwidgetfadeoutanimation.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MWIDGETFADEOUTANIMATION_H
-#define MWIDGETFADEOUTANIMATION_H
-
-#include <mabstractwidgetanimation.h>
-#include <mwidgetfadeoutanimationstyle.h>
-
-class MWidgetFadeOutAnimationPrivate;
-
-//! \internal
-class MWidgetFadeOutAnimation : public MAbstractWidgetAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(MWidgetFadeOutAnimation)
- M_ANIMATION_GROUP(MWidgetFadeOutAnimationStyle)
-
- /*!
- \brief Constructs the widget animation.
-
- This constructor is meant to be used inside the libmeegotouch to share the
- private data class pointer.
- */
- MWidgetFadeOutAnimation(MWidgetFadeOutAnimationPrivate *dd, QObject *parent);
-
-public:
-
- /*!
- \brief Constructs the widget animation.
- */
- MWidgetFadeOutAnimation(QObject *parent = NULL);
-
- /*!
- \brief Destructs the widget animation.
- */
- virtual ~MWidgetFadeOutAnimation();
-
- //! \reimp
- virtual void restoreTargetWidgetState();
- virtual void setTargetWidget(MWidgetController *widget);
- //! \reimp_end
-
-protected:
- //! \reimp
- virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
- //! \reimp_end
-};
-//! \internal_end
-
-#endif
diff --git a/src/corelib/animation/widget/mwidgetfadeoutanimation_p.h b/src/corelib/animation/widget/mwidgetfadeoutanimation_p.h
deleted file mode 100644
index a7f464ad..00000000
--- a/src/corelib/animation/widget/mwidgetfadeoutanimation_p.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MWIDGETFADEOUTANIMATION_P_H
-#define MWIDGETFADEOUTANIMATION_P_H
-
-#include "mabstractwidgetanimation_p.h"
-
-class QPropertyAnimation;
-
-class MWidgetFadeOutAnimationPrivate : public MAbstractWidgetAnimationPrivate
-{
- Q_DECLARE_PUBLIC(MWidgetFadeOutAnimation)
-public:
- virtual ~MWidgetFadeOutAnimationPrivate() {}
-private:
- qreal originalOpacity;
- bool played;
- QPropertyAnimation *opacityAnimation;
-};
-
-#endif
diff --git a/src/corelib/animation/widget/mwidgetslideanimation.cpp b/src/corelib/animation/widget/mwidgetslideanimation.cpp
new file mode 100644
index 00000000..fe81e741
--- /dev/null
+++ b/src/corelib/animation/widget/mwidgetslideanimation.cpp
@@ -0,0 +1,140 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#include "mwidgetslideanimation.h"
+#include "mwidgetslideanimation_p.h"
+#include "manimationcreator.h"
+
+#include <QPauseAnimation>
+#include <QPropertyAnimation>
+#include <QSequentialAnimationGroup>
+#include <mwidgetcontroller.h>
+
+void MWidgetSlideAnimationPrivate::init()
+{
+ Q_Q(MWidgetSlideAnimation);
+
+ direction = MWidgetSlideAnimation::In;
+
+ QSequentialAnimationGroup *delayedAnimation = new QSequentialAnimationGroup;
+ delay = new QPauseAnimation;
+ positionAnimation = new QPropertyAnimation;
+ positionAnimation->setPropertyName("pos");
+ delayedAnimation->addAnimation(delay);
+ delayedAnimation->addAnimation(positionAnimation);
+ q->addAnimation(delayedAnimation);
+ q->connect(delay, SIGNAL(finished()), SLOT(_q_onDelayFinished()));
+}
+
+void MWidgetSlideAnimationPrivate::_q_onDelayFinished()
+{
+ targetWidget->show();
+}
+
+MWidgetSlideAnimation::MWidgetSlideAnimation(MWidgetSlideAnimationPrivate *dd, QObject *parent) :
+ MAbstractWidgetAnimation(dd, parent)
+{
+ Q_D(MWidgetSlideAnimation);
+
+ d->init();
+}
+
+MWidgetSlideAnimation::MWidgetSlideAnimation(QObject *parent) :
+ MAbstractWidgetAnimation(new MWidgetSlideAnimationPrivate, parent)
+{
+ Q_D(MWidgetSlideAnimation);
+
+ d->init();
+}
+
+MWidgetSlideAnimation::~MWidgetSlideAnimation()
+{
+}
+
+void MWidgetSlideAnimation::setTargetWidget(MWidgetController *widget)
+{
+ Q_D(MWidgetSlideAnimation);
+ MAbstractWidgetAnimation::setTargetWidget(widget);
+
+ d->played = false;
+ d->positionAnimation->setTargetObject(targetWidget());
+}
+
+void MWidgetSlideAnimation::setTransitionDirection(TransitionDirection direction)
+{
+ Q_D(MWidgetSlideAnimation);
+
+ d->direction = direction;
+
+ if (d->direction == In)
+ style().setObjectName("In");
+ else
+ style().setObjectName("Out");
+}
+
+void MWidgetSlideAnimation::restoreTargetWidgetState()
+{
+ Q_D(MWidgetSlideAnimation);
+ if (d->played)
+ targetWidget()->setPos(d->originalPos);
+}
+
+void MWidgetSlideAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
+{
+ Q_D(MWidgetSlideAnimation);
+
+ if (!d->targetWidget)
+ return;
+
+ if (oldState == QAbstractAnimation::Stopped &&
+ newState == QAbstractAnimation::Running)
+ {
+ d->originalPos = targetWidget()->pos();
+
+ QPointF offscreenPos;
+
+ if (style().objectName().isNull())
+ style().setObjectName("In");
+
+ if (style()->origin() == "top") {
+ offscreenPos = QPointF(0, -targetWidget()->boundingRect().height());
+ } else if (style()->origin() == "right") {
+ offscreenPos = QPointF(targetWidget()->boundingRect().width(), 0);
+ } else if (style()->origin() == "bottom") {
+ offscreenPos = QPointF(0, targetWidget()->boundingRect().height());
+ } else if (style()->origin() == "left") {
+ offscreenPos = QPointF(-targetWidget()->boundingRect().width(), 0);
+ }
+
+ if (d->direction == In) {
+ targetWidget()->hide();
+ d->positionAnimation->setStartValue(offscreenPos);
+ d->positionAnimation->setEndValue(d->originalPos);
+ } else {
+ d->positionAnimation->setStartValue(d->originalPos);
+ d->positionAnimation->setEndValue(offscreenPos);
+ }
+
+ d->delay->setDuration(style()->delay());
+ d->positionAnimation->setDuration(style()->duration());
+ d->played = true;
+ }
+}
+
+#include "moc_mwidgetslideanimation.cpp"
diff --git a/src/corelib/animation/widget/mwidgetslideoutanimation.h b/src/corelib/animation/widget/mwidgetslideanimation.h
index 18711783..3ecdbb3f 100644
--- a/src/corelib/animation/widget/mwidgetslideoutanimation.h
+++ b/src/corelib/animation/widget/mwidgetslideanimation.h
@@ -17,20 +17,20 @@
**
****************************************************************************/
-#ifndef MWIDGETSLIDEOUTANIMATION_H
-#define MWIDGETSLIDEOUTANIMATION_H
+#ifndef MWIDGETSLIDEANIMATION_H
+#define MWIDGETSLIDEANIMATION_H
#include <mabstractwidgetanimation.h>
-#include <mwidgetslideoutanimationstyle.h>
+#include <mwidgetslideanimationstyle.h>
-class MWidgetSlideOutAnimationPrivate;
+class MWidgetSlideAnimationPrivate;
//! \internal
-class MWidgetSlideOutAnimation : public MAbstractWidgetAnimation
+class MWidgetSlideAnimation : public MAbstractWidgetAnimation
{
Q_OBJECT
- Q_DECLARE_PRIVATE(MWidgetSlideOutAnimation)
- M_ANIMATION_GROUP(MWidgetSlideOutAnimationStyle)
+ Q_DECLARE_PRIVATE(MWidgetSlideAnimation)
+ M_ANIMATION_GROUP(MWidgetSlideAnimationStyle)
/*!
\brief Constructs the widget animation.
@@ -38,19 +38,26 @@ class MWidgetSlideOutAnimation : public MAbstractWidgetAnimation
This constructor is meant to be used inside the libmeegotouch to share the
private data class pointer.
*/
- MWidgetSlideOutAnimation(MWidgetSlideOutAnimationPrivate *dd, QObject *parent);
+ MWidgetSlideAnimation(MWidgetSlideAnimationPrivate *dd, QObject *parent);
public:
/*!
\brief Constructs the widget animation.
*/
- MWidgetSlideOutAnimation(QObject *parent = NULL);
+ MWidgetSlideAnimation(QObject *parent = NULL);
/*!
\brief Destructs the widget animation.
*/
- virtual ~MWidgetSlideOutAnimation();
+ virtual ~MWidgetSlideAnimation();
+
+ enum TransitionDirection {
+ In,
+ Out
+ };
+
+ void setTransitionDirection(TransitionDirection direction);
//! \reimp
virtual void restoreTargetWidgetState();
@@ -61,6 +68,9 @@ protected:
//! \reimp
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
//! \reimp_end
+
+private:
+ Q_PRIVATE_SLOT(d_func(), void _q_onDelayFinished())
};
//! \internal_end
diff --git a/src/corelib/animation/widget/mwidgetslideinanimation_p.h b/src/corelib/animation/widget/mwidgetslideanimation_p.h
index 0b96bea1..1aeae0c3 100644
--- a/src/corelib/animation/widget/mwidgetslideinanimation_p.h
+++ b/src/corelib/animation/widget/mwidgetslideanimation_p.h
@@ -17,22 +17,29 @@
**
****************************************************************************/
-#ifndef MWIDGETSLIDEINANIMATION_P_H
-#define MWIDGETSLIDEINANIMATION_P_H
+#ifndef MWIDGETSLIDEANIMATION_P_H
+#define MWIDGETSLIDEANIMATION_P_H
#include "mabstractwidgetanimation_p.h"
+#include "mwidgetslideanimation.h"
#include <QPointF>
+class QPauseAnimation;
class QPropertyAnimation;
-class MWidgetSlideInAnimationPrivate : public MAbstractWidgetAnimationPrivate
+class MWidgetSlideAnimationPrivate : public MAbstractWidgetAnimationPrivate
{
- Q_DECLARE_PUBLIC(MWidgetSlideInAnimation)
+ Q_DECLARE_PUBLIC(MWidgetSlideAnimation)
public:
- virtual ~MWidgetSlideInAnimationPrivate() {}
+ void init();
+ virtual ~MWidgetSlideAnimationPrivate() {}
+
+ void _q_onDelayFinished();
private:
QPointF originalPos;
bool played;
+ MWidgetSlideAnimation::TransitionDirection direction;
+ QPauseAnimation *delay;
QPropertyAnimation *positionAnimation;
};
diff --git a/src/corelib/animation/widget/mwidgetslideinanimation.cpp b/src/corelib/animation/widget/mwidgetslideinanimation.cpp
deleted file mode 100644
index edcf5c29..00000000
--- a/src/corelib/animation/widget/mwidgetslideinanimation.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mwidgetslideinanimation.h"
-#include "mwidgetslideinanimation_p.h"
-#include "manimationcreator.h"
-
-#include <QPropertyAnimation>
-#include <mwidgetcontroller.h>
-
-MWidgetSlideInAnimation::MWidgetSlideInAnimation(MWidgetSlideInAnimationPrivate *dd, QObject *parent) :
- MAbstractWidgetAnimation(dd, parent)
-{
- Q_D(MWidgetSlideInAnimation);
-
- d->positionAnimation = new QPropertyAnimation;
- d->positionAnimation->setPropertyName("pos");
- addAnimation(d->positionAnimation);
-}
-
-MWidgetSlideInAnimation::MWidgetSlideInAnimation(QObject *parent) :
- MAbstractWidgetAnimation(new MWidgetSlideInAnimationPrivate, parent)
-{
- Q_D(MWidgetSlideInAnimation);
-
- d->positionAnimation = new QPropertyAnimation;
- d->positionAnimation->setPropertyName("pos");
- addAnimation(d->positionAnimation);
-}
-
-MWidgetSlideInAnimation::~MWidgetSlideInAnimation()
-{
-}
-
-void MWidgetSlideInAnimation::setTargetWidget(MWidgetController *widget)
-{
- Q_D(MWidgetSlideInAnimation);
- MAbstractWidgetAnimation::setTargetWidget(widget);
-
- d->played = false;
- d->positionAnimation->setTargetObject(targetWidget());
-}
-
-void MWidgetSlideInAnimation::restoreTargetWidgetState()
-{
- Q_D(MWidgetSlideInAnimation);
- if (d->played)
- targetWidget()->setPos(d->originalPos);
-}
-
-void MWidgetSlideInAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
-{
- Q_D(MWidgetSlideInAnimation);
- if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
- targetWidget()->show();
- d->originalPos = targetWidget()->pos();
- d->played = true;
-
- QPointF startPos;
-
- if (style()->from() == "top") {
- startPos = QPointF(0, -targetWidget()->boundingRect().height());
- } else if (style()->from() == "right") {
- startPos = QPointF(targetWidget()->boundingRect().width(), 0);
- } else if (style()->from() == "bottom") {
- startPos = QPointF(0, targetWidget()->boundingRect().height());
- } else if (style()->from() == "left") {
- startPos = QPointF(-targetWidget()->boundingRect().width(), 0);
- }
-
- d->positionAnimation->setStartValue(startPos);
- d->positionAnimation->setEndValue(d->originalPos);
- d->positionAnimation->setDuration(style()->duration());
- }
-}
diff --git a/src/corelib/animation/widget/mwidgetslideoutanimation.cpp b/src/corelib/animation/widget/mwidgetslideoutanimation.cpp
deleted file mode 100644
index 449b90ed..00000000
--- a/src/corelib/animation/widget/mwidgetslideoutanimation.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mwidgetslideoutanimation.h"
-#include "mwidgetslideoutanimation_p.h"
-#include "manimationcreator.h"
-
-#include <QPropertyAnimation>
-#include <mwidgetcontroller.h>
-
-MWidgetSlideOutAnimation::MWidgetSlideOutAnimation(MWidgetSlideOutAnimationPrivate *dd, QObject *parent) :
- MAbstractWidgetAnimation(dd, parent)
-{
- Q_D(MWidgetSlideOutAnimation);
-
- d->positionAnimation = new QPropertyAnimation;
- d->positionAnimation->setPropertyName("pos");
- addAnimation(d->positionAnimation);
-}
-
-MWidgetSlideOutAnimation::MWidgetSlideOutAnimation(QObject *parent) :
- MAbstractWidgetAnimation(new MWidgetSlideOutAnimationPrivate, parent)
-{
- Q_D(MWidgetSlideOutAnimation);
-
- d->positionAnimation = new QPropertyAnimation;
- d->positionAnimation->setPropertyName("pos");
- addAnimation(d->positionAnimation);
-}
-
-MWidgetSlideOutAnimation::~MWidgetSlideOutAnimation()
-{
-}
-
-void MWidgetSlideOutAnimation::setTargetWidget(MWidgetController *widget)
-{
- Q_D(MWidgetSlideOutAnimation);
- MAbstractWidgetAnimation::setTargetWidget(widget);
-
- d->played = false;
- d->positionAnimation->setTargetObject(targetWidget());
-}
-
-void MWidgetSlideOutAnimation::restoreTargetWidgetState()
-{
- Q_D(MWidgetSlideOutAnimation);
- if (d->played)
- targetWidget()->setPos(d->originalPos);
-}
-
-void MWidgetSlideOutAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
-{
- Q_D(MWidgetSlideOutAnimation);
- if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
- d->originalPos = targetWidget()->pos();
- d->played = true;
-
- QPointF endPos;
-
- if (style()->to() == "top") {
- endPos = QPointF(0, -targetWidget()->boundingRect().height());
- } else if (style()->to() == "right") {
- endPos = QPointF(targetWidget()->boundingRect().width(), 0);
- } else if (style()->to() == "bottom") {
- endPos = QPointF(0, targetWidget()->boundingRect().height());
- } else if (style()->to() == "left") {
- endPos = QPointF(-targetWidget()->boundingRect().width(), 0);
- }
-
- d->positionAnimation->setStartValue(d->originalPos);
- d->positionAnimation->setEndValue(endPos);
- d->positionAnimation->setDuration(style()->duration());
- }
-}
diff --git a/src/corelib/animation/widget/mwidgetslideoutanimation_p.h b/src/corelib/animation/widget/mwidgetslideoutanimation_p.h
deleted file mode 100644
index edd7ae18..00000000
--- a/src/corelib/animation/widget/mwidgetslideoutanimation_p.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MWIDGETSLIDEOUTANIMATION_P_H
-#define MWIDGETSLIDEOUTANIMATION_P_H
-
-#include "mabstractwidgetanimation_p.h"
-#include <QPointF>
-
-class QPropertyAnimation;
-
-class MWidgetSlideOutAnimationPrivate : public MAbstractWidgetAnimationPrivate
-{
- Q_DECLARE_PUBLIC(MWidgetSlideOutAnimation)
-public:
- virtual ~MWidgetSlideOutAnimationPrivate() {}
-private:
- QPointF originalPos;
- bool played;
- QPropertyAnimation *positionAnimation;
-};
-
-#endif
diff --git a/src/corelib/animation/widget/mwidgetzoomanimation.cpp b/src/corelib/animation/widget/mwidgetzoomanimation.cpp
new file mode 100644
index 00000000..22b5dc4f
--- /dev/null
+++ b/src/corelib/animation/widget/mwidgetzoomanimation.cpp
@@ -0,0 +1,169 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#include "mwidgetzoomanimation.h"
+#include "mwidgetzoomanimation_p.h"
+#include <mobjectmenu.h>
+
+#include <QPropertyAnimation>
+#include <QPauseAnimation>
+#include <QSequentialAnimationGroup>
+
+void MWidgetZoomAnimationPrivate::init()
+{
+ Q_Q(MWidgetZoomAnimation);
+
+ direction = MWidgetZoomAnimation::In;
+ startDelay = new QPauseAnimation;
+
+ opacityAnimationDelay = new QPauseAnimation;
+ opacityAnimation = new QPropertyAnimation;
+ opacityAnimation->setPropertyName("opacity");
+
+ QSequentialAnimationGroup *delayedOpacityAnimation = new QSequentialAnimationGroup;
+ delayedOpacityAnimation->addAnimation(opacityAnimationDelay);
+ delayedOpacityAnimation->addAnimation(opacityAnimation);
+
+ scaleAnimation = new QPropertyAnimation;
+ scaleAnimation->setPropertyName("scale");
+
+ positionAnimation = new QPropertyAnimation;
+ positionAnimation->setPropertyName("pos");
+
+ QParallelAnimationGroup *parallelGroup = new QParallelAnimationGroup;
+ parallelGroup->addAnimation(delayedOpacityAnimation);
+ parallelGroup->addAnimation(scaleAnimation);
+ parallelGroup->addAnimation(positionAnimation);
+
+ QSequentialAnimationGroup *sequentialGroup = new QSequentialAnimationGroup;
+ sequentialGroup->addAnimation(startDelay);
+ sequentialGroup->addAnimation(parallelGroup);
+
+ q->addAnimation(sequentialGroup);
+}
+
+QPointF MWidgetZoomAnimationPrivate::setupPositionAnimation(const QPointF &widgetPos)
+{
+ Q_Q(MWidgetZoomAnimation);
+
+ QPointF distance = origin - widgetPos;
+ return widgetPos + distance * (1 - q->style()->positionAnimationDistanceFactor());
+}
+
+MWidgetZoomAnimation::MWidgetZoomAnimation(QObject *parent) :
+ MAbstractWidgetAnimation(new MWidgetZoomAnimationPrivate, parent)
+{
+ Q_D(MWidgetZoomAnimation);
+
+ d->init();
+}
+
+MWidgetZoomAnimation::MWidgetZoomAnimation(MWidgetZoomAnimationPrivate *dd, QObject *parent) :
+ MAbstractWidgetAnimation(dd, parent)
+{
+ Q_D(MWidgetZoomAnimation);
+
+ d->init();
+}
+
+void MWidgetZoomAnimation::setTargetWidget(MWidgetController *widget)
+{
+ Q_D(MWidgetZoomAnimation);
+
+ MAbstractWidgetAnimation::setTargetWidget(widget);
+
+ d->opacityAnimation->setTargetObject(widget);
+ d->scaleAnimation->setTargetObject(widget);
+ d->positionAnimation->setTargetObject(widget);
+}
+
+void MWidgetZoomAnimation::restoreTargetWidgetState()
+{
+}
+
+void MWidgetZoomAnimation::setTransitionDirection(TransitionDirection direction)
+{
+ Q_D(MWidgetZoomAnimation);
+
+ d->direction = direction;
+
+ if (d->direction == In)
+ style().setObjectName("In");
+ else
+ style().setObjectName("Out");
+}
+
+void MWidgetZoomAnimation::setOrigin(const QPointF &pos)
+{
+ Q_D(MWidgetZoomAnimation);
+
+ d->origin = pos;
+}
+
+void MWidgetZoomAnimation::updateState(QAbstractAnimation::State newState,
+ QAbstractAnimation::State oldState)
+{
+ Q_D(MWidgetZoomAnimation);
+
+ QAbstractAnimation::updateState(newState, oldState);
+
+ if (!d->targetWidget)
+ return;
+
+ if (oldState == QAbstractAnimation::Stopped &&
+ newState == QAbstractAnimation::Running)
+ {
+ if (style().objectName().isNull())
+ style().setObjectName("In");
+
+ if (d->direction == In) {
+ d->targetWidget->setOpacity(0);
+
+ d->positionAnimation->setStartValue(d->setupPositionAnimation(d->targetWidget->pos()));
+ d->positionAnimation->setEndValue(d->targetWidget->pos());
+
+ d->scaleAnimation->setStartValue(style()->scale());
+ d->scaleAnimation->setEndValue(1);
+
+ d->opacityAnimation->setStartValue(0);
+ d->opacityAnimation->setEndValue(style()->opacity());
+ } else {
+ d->positionAnimation->setStartValue(d->targetWidget->pos());
+ d->positionAnimation->setEndValue(d->setupPositionAnimation(d->targetWidget->pos()));
+
+ d->opacityAnimation->setStartValue(style()->opacity());
+ d->opacityAnimation->setEndValue(0);
+ d->scaleAnimation->setStartValue(1);
+ d->scaleAnimation->setEndValue(style()->scale());
+ }
+
+ d->startDelay->setDuration(style()->delay());
+ d->opacityAnimationDelay->setDuration(style()->opacityAnimationDelay());
+ d->opacityAnimation->setEasingCurve(style()->opacityAnimationEasingCurve());
+ d->opacityAnimation->setDuration(style()->opacityAnimationDuration());
+
+ d->scaleAnimation->setEasingCurve(style()->scaleAnimationEasingCurve());
+ d->scaleAnimation->setDuration(style()->scaleAnimationDuration());
+
+ d->positionAnimation->setEasingCurve(style()->scaleAnimationEasingCurve());
+ d->positionAnimation->setDuration(style()->scaleAnimationDuration());
+ }
+}
+
+#include "moc_mwidgetzoomanimation.cpp"
diff --git a/src/corelib/animation/widget/mwidgetslideinanimation.h b/src/corelib/animation/widget/mwidgetzoomanimation.h
index ea147694..07466a7c 100644
--- a/src/corelib/animation/widget/mwidgetslideinanimation.h
+++ b/src/corelib/animation/widget/mwidgetzoomanimation.h
@@ -17,51 +17,41 @@
**
****************************************************************************/
-#ifndef MWIDGETSLIDEINANIMATION_H
-#define MWIDGETSLIDEINANIMATION_H
+#ifndef MWIDGETZOOMANIMATION_H
+#define MWIDGETZOOMANIMATION_H
-#include <mabstractwidgetanimation.h>
-#include <mwidgetslideinanimationstyle.h>
+#include "mabstractwidgetanimation.h"
+#include <mwidgetzoomanimationstyle.h>
-class MWidgetSlideInAnimationPrivate;
+#include <QPointF>
-//! \internal
-class MWidgetSlideInAnimation : public MAbstractWidgetAnimation
+class MWidgetZoomAnimationPrivate;
+
+class MWidgetZoomAnimation : public MAbstractWidgetAnimation
{
Q_OBJECT
- Q_DECLARE_PRIVATE(MWidgetSlideInAnimation)
- M_ANIMATION_GROUP(MWidgetSlideInAnimationStyle)
-
- /*!
- \brief Constructs the widget animation.
-
- This constructor is meant to be used inside the libmeegotouch to share the
- private data class pointer.
- */
- MWidgetSlideInAnimation(MWidgetSlideInAnimationPrivate *dd, QObject *parent);
+ M_ANIMATION_GROUP(MWidgetZoomAnimationStyle)
public:
+ MWidgetZoomAnimation(QObject *parent = NULL);
- /*!
- \brief Constructs the widget animation.
- */
- MWidgetSlideInAnimation(QObject *parent = NULL);
-
- /*!
- \brief Destructs the widget animation.
- */
- virtual ~MWidgetSlideInAnimation();
+ enum TransitionDirection {
+ In,
+ Out
+ };
- //! \reimp
- virtual void restoreTargetWidgetState();
virtual void setTargetWidget(MWidgetController *widget);
- //! \reimp_end
+ virtual void restoreTargetWidgetState();
+
+ void setTransitionDirection(TransitionDirection direction);
+ void setOrigin(const QPointF &pos);
protected:
- //! \reimp
+ MWidgetZoomAnimation(MWidgetZoomAnimationPrivate *dd, QObject *parent = NULL);
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
- //! \reimp_end
+
+private:
+ Q_DECLARE_PRIVATE(MWidgetZoomAnimation)
};
-//! \internal_end
-#endif
+#endif // MWIDGETZOOMANIMATION_H
diff --git a/src/corelib/animation/scene/mnavigationbaranimation_p.h b/src/corelib/animation/widget/mwidgetzoomanimation_p.h
index 598e0e69..5bf37b27 100644
--- a/src/corelib/animation/scene/mnavigationbaranimation_p.h
+++ b/src/corelib/animation/widget/mwidgetzoomanimation_p.h
@@ -17,19 +17,30 @@
**
****************************************************************************/
-#ifndef MNAVIGATIONBARANIMATION_P_H
-#define MNAVIGATIONBARANIMATION_P_H
+#ifndef MWIDGETZOOMANIMATION_P_H
+#define MWIDGETZOOMANIMATION_P_H
+
+#include "mabstractwidgetanimation_p.h"
+#include "mwidgetzoomanimation.h"
-#include "mscenewindowanimation_p.h"
class QPropertyAnimation;
+class QPauseAnimation;
-class MNavigationbarAnimationPrivate : public MSceneWindowAnimationPrivate
+class MWidgetZoomAnimationPrivate : MAbstractWidgetAnimationPrivate
{
- Q_DECLARE_PUBLIC(MNavigationbarAnimation)
-
+ Q_DECLARE_PUBLIC(MWidgetZoomAnimation)
public:
- QPropertyAnimation *positionAnimation;
+ void init();
+ QPointF setupPositionAnimation(const QPointF &widgetPos);
+
+ QPauseAnimation *startDelay;
+ QPauseAnimation *opacityAnimationDelay;
+
+ MWidgetZoomAnimation::TransitionDirection direction;
+ QPointF origin;
QPropertyAnimation *opacityAnimation;
+ QPropertyAnimation *positionAnimation;
+ QPropertyAnimation *scaleAnimation;
};
-#endif
+#endif // MWIDGETZOOMANIMATION_P_H
diff --git a/src/corelib/animation/widget/mwidgetzoominanimation.cpp b/src/corelib/animation/widget/mwidgetzoominanimation.cpp
deleted file mode 100644
index bf50a8a3..00000000
--- a/src/corelib/animation/widget/mwidgetzoominanimation.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mwidgetzoominanimation.h"
-#include "mwidgetzoominanimation_p.h"
-#include "mwidgetview.h"
-#include "manimationcreator.h"
-
-M_REGISTER_ANIMATION(MWidgetZoomInAnimation)
-
-MWidgetZoomInAnimation::MWidgetZoomInAnimation(MWidgetZoomInAnimationPrivate *dd, QObject *parent) :
- MAbstractWidgetAnimation(dd, parent)
-{
-}
-
-MWidgetZoomInAnimation::MWidgetZoomInAnimation(QObject *parent) :
- MAbstractWidgetAnimation(new MWidgetZoomInAnimationPrivate, parent)
-{
-}
-
-MWidgetZoomInAnimation::~MWidgetZoomInAnimation()
-{
-}
-
-void MWidgetZoomInAnimation::resetToInitialState()
-{
- view()->setScale(0.0);
-}
-
-void MWidgetZoomInAnimation::updateCurrentTime(int currentTime)
-{
- Q_D(MWidgetZoomInAnimation);
-
- qreal progress = ((qreal)currentTime) / ((qreal)style()->duration());
- qreal value = style()->easingCurve().valueForProgress(progress);
- view()->setScale(d->startScale + (1 - d->startScale) * value);
-}
-
-void MWidgetZoomInAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
-{
- Q_D(MWidgetZoomInAnimation);
- if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
- view()->show();
- d->startScale = view()->scale();
- }
-}
diff --git a/src/corelib/animation/widget/mwidgetzoominanimation.h b/src/corelib/animation/widget/mwidgetzoominanimation.h
deleted file mode 100644
index c896615a..00000000
--- a/src/corelib/animation/widget/mwidgetzoominanimation.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MWIDGETZOOMINANIMATION_H
-#define MWIDGETZOOMINANIMATION_H
-
-#include <mabstractwidgetanimation.h>
-#include <mwidgetzoominanimationstyle.h>
-
-class MWidgetZoomInAnimationPrivate;
-
-
-//! \internal
-class MWidgetZoomInAnimation : public MAbstractWidgetAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(MWidgetZoomInAnimation)
- M_WIDGET_ANIMATION(MWidgetZoomInAnimationStyle, MWidgetView)
-
- /*!
- \brief Constructs the widget animation.
-
- This constructor is meant to be used inside the libmeegotouch to share the
- private data class pointer.
- */
- MWidgetZoomInAnimation(MWidgetZoomInAnimationPrivate *dd, QObject *parent);
-
-public:
-
- /*!
- \brief Constructs the widget animation.
- */
- MWidgetZoomInAnimation(QObject *parent = NULL);
-
- /*!
- \brief Destructs the widget animation.
- */
- virtual ~MWidgetZoomInAnimation();
-
- //! \reimp
- virtual void resetToInitialState();
- //! \reimp_end
-
-protected:
- //! \reimp
- virtual void updateCurrentTime(int currentTime);
- virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
- //! \reimp_end
-};
-
-//! \internal_end
-
-#endif
diff --git a/src/corelib/animation/widget/mwidgetzoominanimation_p.h b/src/corelib/animation/widget/mwidgetzoominanimation_p.h
deleted file mode 100644
index 03c690e8..00000000
--- a/src/corelib/animation/widget/mwidgetzoominanimation_p.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MWIDGETZOOMINANIMATION_P_H
-#define MWIDGETZOOMINANIMATION_P_H
-
-#include "core/mabstractwidgetanimation_p.h"
-
-class MWidgetZoomInAnimationPrivate : public MAbstractWidgetAnimationPrivate
-{
- Q_DECLARE_PUBLIC(MWidgetZoomInAnimation)
-public:
- virtual ~MWidgetZoomInAnimationPrivate() {}
-private:
- qreal startScale;
-};
-
-#endif
diff --git a/src/corelib/animation/widget/mwidgetzoomoutanimation.cpp b/src/corelib/animation/widget/mwidgetzoomoutanimation.cpp
deleted file mode 100644
index 82342532..00000000
--- a/src/corelib/animation/widget/mwidgetzoomoutanimation.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "mwidgetzoomoutanimation.h"
-#include "mwidgetzoomoutanimation_p.h"
-#include "mwidgetview.h"
-#include "manimationcreator.h"
-
-M_REGISTER_ANIMATION(MWidgetZoomOutAnimation)
-
-MWidgetZoomOutAnimation::MWidgetZoomOutAnimation(MWidgetZoomOutAnimationPrivate *dd, QObject *parent) :
- MAbstractWidgetAnimation(dd, parent)
-{
-}
-
-MWidgetZoomOutAnimation::MWidgetZoomOutAnimation(QObject *parent) :
- MAbstractWidgetAnimation(new MWidgetZoomOutAnimationPrivate, parent)
-{
-}
-
-MWidgetZoomOutAnimation::~MWidgetZoomOutAnimation()
-{
-}
-
-void MWidgetZoomOutAnimation::updateCurrentTime(int currentTime)
-{
- Q_D(MWidgetZoomOutAnimation);
- qreal progress = ((qreal)currentTime) / ((qreal)style()->duration());
- qreal value = style()->easingCurve().valueForProgress(progress);
- view()->setScale(d->startScale - (d->startScale) * value);
-}
-
-void MWidgetZoomOutAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
-{
- Q_D(MWidgetZoomOutAnimation);
- if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
- d->startScale = view()->scale();
- } else if (oldState == QAbstractAnimation::Running && newState == QAbstractAnimation::Stopped) {
- view()->hide();
- }
-}
diff --git a/src/corelib/animation/widget/mwidgetzoomoutanimation.h b/src/corelib/animation/widget/mwidgetzoomoutanimation.h
deleted file mode 100644
index a9a5d723..00000000
--- a/src/corelib/animation/widget/mwidgetzoomoutanimation.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MWIDGETZOOMOUTANIMATION_H
-#define MWIDGETZOOMOUTANIMATION_H
-
-#include <mabstractwidgetanimation.h>
-#include <mwidgetzoomoutanimationstyle.h>
-
-class MWidgetZoomOutAnimationPrivate;
-
-//! \internal
-class MWidgetZoomOutAnimation : public MAbstractWidgetAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(MWidgetZoomOutAnimation)
- M_WIDGET_ANIMATION(MWidgetZoomOutAnimationStyle, MWidgetView)
-
- /*!
- \brief Constructs the widget animation.
-
- This constructor is meant to be used inside the libmeegotouch to share the
- private data class pointer.
- */
- MWidgetZoomOutAnimation(MWidgetZoomOutAnimationPrivate *dd, QObject *parent);
-
-public:
-
- /*!
- \brief Constructs the widget animation.
- */
- MWidgetZoomOutAnimation(QObject *parent = NULL);
-
- /*!
- \brief Destructs the widget animation.
- */
- virtual ~MWidgetZoomOutAnimation();
-
-protected:
- //! \reimp
- virtual void updateCurrentTime(int currentTime);
- virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
- //! \reimp_end
-};
-//! \internal_end
-
-#endif
diff --git a/src/corelib/animation/widget/mwidgetzoomoutanimation_p.h b/src/corelib/animation/widget/mwidgetzoomoutanimation_p.h
deleted file mode 100644
index 328e028f..00000000
--- a/src/corelib/animation/widget/mwidgetzoomoutanimation_p.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MWIDGETZOOMOUTANIMATION_P_H
-#define MWIDGETZOOMOUTANIMATION_P_H
-
-#include "core/mabstractwidgetanimation_p.h"
-
-class MWidgetZoomOutAnimationPrivate : public MAbstractWidgetAnimationPrivate
-{
- Q_DECLARE_PUBLIC(MWidgetZoomOutAnimation)
-public:
- virtual ~MWidgetZoomOutAnimationPrivate() {}
-private:
- qreal startScale;
-};
-
-#endif
diff --git a/src/corelib/animation/widget/widget.pri b/src/corelib/animation/widget/widget.pri
index 0a6cc0b5..faa98d24 100644
--- a/src/corelib/animation/widget/widget.pri
+++ b/src/corelib/animation/widget/widget.pri
@@ -8,26 +8,17 @@ include(core/core.pri)
ANIMATIONS_WIDGET_SRC_DIR=./animation/widget
PUBLIC_HEADERS += \
- $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetfadeinanimation.h \
- $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetfadeoutanimation.h \
- $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetslideinanimation.h \
- $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetslideoutanimation.h \
- #$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetzoominanimation.h \
- #$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetzoomoutanimation.h \
+ $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetfadeanimation.h \
+ $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetslideanimation.h \
+ $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetzoomanimation.h \
PRIVATE_HEADERS += \
- $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetfadeinanimation_p.h \
- $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetfadeoutanimation_p.h \
- $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetslideinanimation_p.h \
- $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetslideoutanimation_p.h \
- #$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetzoominanimation_p.h \
- #$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetzoomoutanimation_p.h \
+ $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetfadeanimation_p.h \
+ $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetslideanimation_p.h \
+ $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetzoomanimation_p.h \
SOURCES += \
- $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetfadeinanimation.cpp \
- $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetfadeoutanimation.cpp \
- $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetslideinanimation.cpp \
- $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetslideoutanimation.cpp \
- #$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetzoominanimation.cpp \
- #$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetzoomoutanimation.cpp \
+ $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetfadeanimation.cpp \
+ $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetslideanimation.cpp \
+ $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetzoomanimation.cpp \
diff --git a/src/corelib/core/maction.cpp b/src/corelib/core/maction.cpp
index a1afd74a..4774b3c0 100644
--- a/src/corelib/core/maction.cpp
+++ b/src/corelib/core/maction.cpp
@@ -26,7 +26,7 @@
#include <QGraphicsWidget>
MActionPrivate::MActionPrivate()
- : location(MAction::EveryLocation), styleAction(false)
+ : location(MAction::EveryLocation), styleAction(false), q_ptr(0)
{
}
diff --git a/src/corelib/core/mcomponentcache.cpp b/src/corelib/core/mcomponentcache.cpp
index 16a1ae88..b890ff26 100644
--- a/src/corelib/core/mcomponentcache.cpp
+++ b/src/corelib/core/mcomponentcache.cpp
@@ -62,12 +62,12 @@ bool MComponentCachePrivate::populating()
void MComponentCachePrivate::populateForMApplication()
{
static int argc = 1;
- static char *argv0 = (char *)"generic";
+ static char *argv[] = {(char*)"generic"};
cacheBeingPopulated = true;
if (mApplicationInstance == 0) {
- mApplicationInstance = new MApplication(argc, &argv0, 0);
+ mApplicationInstance = new MApplication(argc, argv, 0);
} else {
cacheBeingPopulated = false;
qFatal("MComponentCache::populateForMApplication() - Cache is already populated.");
diff --git a/src/corelib/core/mcomponentdata.cpp b/src/corelib/core/mcomponentdata.cpp
index 89ffda35..fc2ff54f 100644
--- a/src/corelib/core/mcomponentdata.cpp
+++ b/src/corelib/core/mcomponentdata.cpp
@@ -27,6 +27,7 @@
#include "minputmethodstate.h"
#include "mtheme.h"
+#include "mtheme_p.h"
#include "mthemedaemon.h"
#include "mcomponentdata.h"
#include "mscenemanager.h"
@@ -54,6 +55,10 @@
// end testability
#endif
+#ifdef Q_WS_X11
+#include <QX11Info>
+#include <X11/extensions/Xfixes.h>
+#endif
namespace
{
@@ -281,9 +286,9 @@ MComponentData::MComponentData(MApplicationService *service) :
MComponentData::self = this;
int argc = 0;
- char *argv = 0;
+ char *argv[] = {0};
- d->init(argc, &argv, QString(), service);
+ d->init(argc, argv, QString(), service);
}
void MComponentDataPrivate::init(int &argc, char **argv, const QString &appIdentifier, MApplicationService *newService)
@@ -637,23 +642,9 @@ void MComponentData::reinit(int &argc, char **argv, const QString &appIdentifier
systemLocale.installTrCatalog(d->appName);
MLocale::setDefault(systemLocale);
- QString baseCSS(MThemeDaemon::systemThemeDirectory() +
- QDir::separator() + QString("base") +
- QDir::separator() + QString("meegotouch") +
- QDir::separator() + d->appName +
- QDir::separator() + QString("style") +
- QDir::separator() + d->appName + QString(".css"));
-
- MTheme::loadCSS(baseCSS);
-
- QString themeCSS(MThemeDaemon::systemThemeDirectory() +
- QDir::separator() + MTheme::currentTheme() +
- QDir::separator() + QString("meegotouch") +
- QDir::separator() + d->appName +
- QDir::separator() + QString("style") +
- QDir::separator() + d->appName + QString(".css"));
-
- MTheme::loadCSS(themeCSS);
+ if (MTheme::instance()) {
+ MTheme::instance()->d_func()->reinit(d->appName, d->imglistFilename, MTheme::AnyTheme);
+ }
if (newService) {
d->registerNewService(newService);
@@ -878,11 +869,19 @@ void MComponentData::setShowCursor(bool show)
}
if (show) {
+#ifdef Q_WS_X11
+ XFixesShowCursor(QX11Info::display(), QX11Info::appRootWindow());
+#else
qApp->restoreOverrideCursor();
+#endif
} else {
+#ifdef Q_WS_X11
+ XFixesHideCursor(QX11Info::display(), QX11Info::appRootWindow());
+#else
QPixmap cursor(QSize(1, 1));
cursor.fill(Qt::transparent);
qApp->setOverrideCursor(cursor);
+#endif
}
gMComponentDataPrivate->showCursor = show;
diff --git a/src/corelib/core/mnamespace.h b/src/corelib/core/mnamespace.h
index f20acc3d..8e024372 100644
--- a/src/corelib/core/mnamespace.h
+++ b/src/corelib/core/mnamespace.h
@@ -20,6 +20,7 @@
#ifndef MNAMESPACE_H
#define MNAMESPACE_H
+#include <QMetaType>
#include <QMessageBox>
namespace M
@@ -30,7 +31,7 @@ namespace M
};
/*!
- * setting a dynamic porperty to any QWidget or QApplication will cause the the object
+ * setting a dynamic porperty to any QWidget or QApplication will cause the object
* not to be styled like M does.
*/
#ifdef __GNUC__
@@ -40,6 +41,26 @@ namespace M
#endif
/*!
+ * setting a dynamic property to QApplication named NoMNavigationBar will hide the
+ * navigationbar from qt maemo 6 style
+ */
+#ifdef __GNUC__
+ static const char* NoMNavigationBar __attribute__((__unused__)) = "NoMNavigationBar";
+#else
+ static const char* NoMNavigationBar = "NoMNavigationBar";
+#endif
+
+ /*!
+ * setting a dynamic property to QApplication named NoMStatusBar will hide the
+ * statusbar from qt maemo 6 style
+ */
+#ifdef __GNUC__
+ static const char* NoMStatusBar __attribute__((__unused__)) = "NoMStatusBar";
+#else
+ static const char* NoMStatusBar = "NoMStatusBar";
+#endif
+
+ /*!
* This enum contains values of the orientation angle of windows in the application.
*
* \sa Orientation
@@ -244,4 +265,17 @@ namespace M
Q_DECLARE_OPERATORS_FOR_FLAGS(M::StandardButtons)
+Q_ENUMS(M::AssemblyType)
+
+Q_DECLARE_METATYPE(M::OrientationAngle)
+Q_DECLARE_METATYPE(M::Orientation)
+Q_DECLARE_METATYPE(M::Position)
+Q_DECLARE_METATYPE(M::RecursionMode)
+Q_DECLARE_METATYPE(M::InputMethodQueryExtensions)
+Q_DECLARE_METATYPE(M::PreeditFace)
+Q_DECLARE_METATYPE(M::TextContentType)
+Q_DECLARE_METATYPE(M::InputMethodMode)
+Q_DECLARE_METATYPE(M::PrestartMode)
+Q_DECLARE_METATYPE(M::StandardButton)
+
#endif
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index db2ae35f..f73b5f82 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -45,11 +45,15 @@ install_prf.files = $${M_SOURCE_TREE}/mkspecs/features/meegotouch.prf \
INSTALLS += install_prf
}
+#install Rich Text Editor xml file
+install_xmltoolbar.files = ./widgets/RichTextEditorToolbar1.xml
+install_xmltoolbar.path = /usr/share/meegotouch/imtoolbars
#install libmeegotouch .pc file
install_pkgconfig.path = $$M_INSTALL_LIBS/pkgconfig
install_pkgconfig.files = ../meegotouch.pc
-INSTALLS += install_pkgconfig
+INSTALLS += install_pkgconfig \
+ install_xmltoolbar
# install forwarding headers
diff --git a/src/corelib/events/morientationtracker.cpp b/src/corelib/events/morientationtracker.cpp
index d3c19b84..ff32f890 100644
--- a/src/corelib/events/morientationtracker.cpp
+++ b/src/corelib/events/morientationtracker.cpp
@@ -82,7 +82,7 @@ void MOrientationTrackerPrivate::topEdgeChanged()
} else if (edge == "bottom") {
angle = M::Angle180;
} else {
- angle = currentAngle;
+ angle = M::Angle0;
}
// if hardware keyboard is opened, don't allow orientation angle to be changed.
diff --git a/src/corelib/events/mpanrecognizer.cpp b/src/corelib/events/mpanrecognizer.cpp
index 3ad00332..60c3e132 100644
--- a/src/corelib/events/mpanrecognizer.cpp
+++ b/src/corelib/events/mpanrecognizer.cpp
@@ -28,6 +28,8 @@
static const int defaultPanThreshold = 10;
MPanRecognizerPrivate::MPanRecognizerPrivate()
+ : movementThreshold( 0 ),
+ q_ptr( 0 )
{
}
diff --git a/src/corelib/events/mtapandholdrecognizer.cpp b/src/corelib/events/mtapandholdrecognizer.cpp
index de44e8bc..6e9ca2be 100644
--- a/src/corelib/events/mtapandholdrecognizer.cpp
+++ b/src/corelib/events/mtapandholdrecognizer.cpp
@@ -31,6 +31,9 @@ static const int MTapAndHoldTimeout = 500; /* miliseconds */
static const int MTapAndHoldMovementThreshold = 20; /* pixels */
MTapAndHoldRecognizerPrivate::MTapAndHoldRecognizerPrivate()
+ : timeoutValue( 0 ),
+ movementThreshold( 0 ),
+ q_ptr( 0 )
{
}
@@ -77,7 +80,7 @@ QGestureRecognizer::Result MTapAndHoldRecognizer::recognize(QGesture *state, QOb
switch (event->type()) {
case QEvent::GraphicsSceneMousePress:
- tapAndHoldState->setPosition(ev->pos());
+ tapAndHoldState->setPosition(ev->scenePos());
tapAndHoldState->setHotSpot(ev->scenePos());
if (tapAndHoldState->timerId)
@@ -98,7 +101,7 @@ QGestureRecognizer::Result MTapAndHoldRecognizer::recognize(QGesture *state, QOb
break;
case QEvent::GraphicsSceneMouseMove:
if (tapAndHoldState->state() != Qt::NoGesture) {
- QPoint delta = ev->pos().toPoint() - tapAndHoldState->position().toPoint();
+ QPoint delta = ev->scenePos().toPoint() - tapAndHoldState->position().toPoint();
if (delta.manhattanLength() <= d->movementThreshold)
result = QGestureRecognizer::TriggerGesture;
}
diff --git a/src/corelib/i18n/mcalendar.cpp b/src/corelib/i18n/mcalendar.cpp
index 46b72360..a52b26e1 100644
--- a/src/corelib/i18n/mcalendar.cpp
+++ b/src/corelib/i18n/mcalendar.cpp
@@ -22,6 +22,7 @@
#include <QString>
#include <QDateTime>
+#include <QDebug>
#include "mlocale_p.h"
#include "micuconversions.h"
@@ -233,6 +234,7 @@ void MCalendar::setDate(const QDate &date)
setDateTime(datetime);
}
+#define MSECS_PER_DAY 86400000
//! Sets the calendar according to given QDate
void MCalendar::setDateTime(QDateTime date)
@@ -244,7 +246,17 @@ void MCalendar::setDateTime(QDateTime date)
// we avoid time conversions made by qt
Qt::TimeSpec originalTimeSpec = date.timeSpec();
date.setTimeSpec(Qt::UTC);
- UDate icuDate = date.toTime_t() * 1000.0;
+
+ // We cannot use QDateTime::toTime_t because this
+ // works only for dates after 1970-01-01T00:00:00.000.
+#if QT_VERSION >= 0x040700
+ UDate icuDate = date.toMSecsSinceEpoch();
+#else
+ // Qt < 4.7 lacks QDateTime::toMSecsSinceEpoch(), we need to emulate it:
+ int days = QDate(1970, 1, 1).daysTo(date.date());
+ qint64 msecs = qint64(QTime().secsTo(date.time())) * 1000;
+ UDate icuDate = (qint64(days) * MSECS_PER_DAY) + msecs;
+#endif
if (originalTimeSpec == Qt::LocalTime) {
// convert from local time to UTC
@@ -278,8 +290,23 @@ QDateTime MCalendar::qDateTime(Qt::TimeSpec spec) const
tz.getOffset(icuDate, true /*local */, rawOffset, dstOffset, status);
icuDate = icuDate + rawOffset + dstOffset;
}
-
- time.setTime_t(icuDate / 1000.0); // takes time in seconds since epoch
+ // We cannot use QDateTime::setTime_t because this
+ // works only for dates after 1970-01-01T00:00:00.000.
+#if QT_VERSION >= 0x040700
+ time.setMSecsSinceEpoch(qint64(icuDate));
+#else
+ // Qt < 4.7 lacks QDateTime::setMSecsSinceEpoch(), we need to emulate it.
+ qint64 msecs = qint64(icuDate);
+ int ddays = msecs / MSECS_PER_DAY;
+ msecs %= MSECS_PER_DAY;
+ if (msecs < 0) {
+ // negative
+ --ddays;
+ msecs += MSECS_PER_DAY;
+ }
+ time.setDate(QDate(1970, 1, 1).addDays(ddays));
+ time.setTime(QTime().addMSecs(msecs));
+#endif
// note: we set time spec after time value so Qt will not any conversions
// of its own to UTC. We might let Qt handle it but this might be more robust
time.setTimeSpec(spec);
diff --git a/src/corelib/i18n/mcollator.cpp b/src/corelib/i18n/mcollator.cpp
index 7672d0b0..abf035e8 100644
--- a/src/corelib/i18n/mcollator.cpp
+++ b/src/corelib/i18n/mcollator.cpp
@@ -45,7 +45,7 @@ MCollatorPrivate::~MCollatorPrivate()
// allocates an icu collator based on locale
-void MCollatorPrivate::initCollator(icu::Locale locale)
+void MCollatorPrivate::initCollator(const icu::Locale &locale)
{
UErrorCode status = U_ZERO_ERROR;
_coll = icu::Collator::createInstance(locale, status);
diff --git a/src/corelib/i18n/mcollator_p.h b/src/corelib/i18n/mcollator_p.h
index d756da29..8c8d915c 100644
--- a/src/corelib/i18n/mcollator_p.h
+++ b/src/corelib/i18n/mcollator_p.h
@@ -28,7 +28,7 @@ public:
MCollatorPrivate();
virtual ~MCollatorPrivate();
- void initCollator(icu::Locale locale);
+ void initCollator(const icu::Locale &locale);
icu::Collator *_coll;
diff --git a/src/corelib/i18n/mlocale.cpp b/src/corelib/i18n/mlocale.cpp
index 7b296ef3..af8d4afd 100644
--- a/src/corelib/i18n/mlocale.cpp
+++ b/src/corelib/i18n/mlocale.cpp
@@ -114,7 +114,7 @@ public:
* As an example lets assume that
*
* - MLocale::translationPaths()
- * is the list ("/usr/share/l10n/m", "/usr/share/l10n")
+ * is the list ("/usr/share/l10n/meegotouch", "/usr/share/l10n")
* - the category is MLocale::MLcMessages
* - the name of the locale (returned by mlocale->categoryName(category))
* is "en_US"
@@ -122,18 +122,14 @@ public:
*
* then the function will try to load translation catalogs in the following order:
*
- * /usr/share/l10n/m/foo_en_US.qm
- * /usr/share/l10n/m/foo_en_US
- * /usr/share/l10n/m/foo_en.qm
- * /usr/share/l10n/m/foo_en
- * /usr/share/l10n/m/foo.qm
- * /usr/share/l10n/m/foo
+ * /usr/share/l10n/meegotouch/foo_en_US.qm
+ * /usr/share/l10n/meegotouch/foo_en_US
+ * /usr/share/l10n/meegotouch/foo_en.qm
+ * /usr/share/l10n/meegotouch/foo_en
* /usr/share/l10n/foo_en_US.qm
* /usr/share/l10n/foo_en_US
* /usr/share/l10n/foo_en.qm
* /usr/share/l10n/foo_en
- * /usr/share/l10n/foo.qm
- * /usr/share/l10n/foo
*
* and return when the first translation catalog was found.
* If no translation can be found this function returns false.
@@ -286,7 +282,7 @@ QString MLocalePrivate::createLocaleString(const QString &language,
}
#ifdef HAVE_ICU
-icu::DateFormatSymbols *MLocalePrivate::createDateFormatSymbols(icu::Locale locale)
+icu::DateFormatSymbols *MLocalePrivate::createDateFormatSymbols(const icu::Locale &locale)
{
// This is a bit dirty but the only way to currently get the symbols
// is like this. Only the internal API supports directly creating DateFormatSymbols
@@ -349,6 +345,7 @@ MLocalePrivate::MLocalePrivate()
currentLcNumericItem(SettingsLcNumeric),
currentLcMonetaryItem(SettingsLcMonetary)
#endif
+ , q_ptr(0)
{
}
@@ -377,6 +374,7 @@ MLocalePrivate::MLocalePrivate(const MLocalePrivate &other)
currentLcNumericItem(SettingsLcNumeric),
currentLcMonetaryItem(SettingsLcMonetary)
#endif
+ , q_ptr(0)
{
#ifdef HAVE_ICU
if (other._numberFormat != 0) {
@@ -1395,13 +1393,13 @@ QString MLocale::formatDateTime(const MCalendar &mCalendar,
break;
case 'H':
- // 24 hour clock
- icuFormat.append("kk");
+ // Hour (24-hour clock), as a decimal number (00-23).
+ icuFormat.append("HH");
break;
case 'I':
- // 12 hour clock
- icuFormat.append("KK");
+ // Hour (12-hour clock), as a decimal number (01-12).
+ icuFormat.append("hh");
break;
case 'j':
@@ -1429,14 +1427,29 @@ QString MLocale::formatDateTime(const MCalendar &mCalendar,
icuFormat.append("aaa");
break;
- case 'r':
+ case 'r': {
// 12 hour clock with am/pm
- icuFormat.append("KK aaa"); // correct?
+ QString timeShortFormat
+ = icuFormatString(MLocale::DateNone, MLocale::TimeShort,
+ MLocale::GregorianCalendar);
+ timeShortFormat.replace(QChar('k'), QChar('K'), Qt::CaseSensitive);
+ timeShortFormat.replace(QChar('H'), QChar('h'), Qt::CaseSensitive);
+ if (!timeShortFormat.contains('a', Qt::CaseSensitive))
+ timeShortFormat.append(QLatin1String(" a"));
+ icuFormat.append(timeShortFormat);
+ }
break;
- case 'R':
+ case 'R': {
// 24-hour clock time, in the format "%H:%M"
- icuFormat.append("kk:mm");
+ QString timeShortFormat
+ = icuFormatString(MLocale::DateNone, MLocale::TimeShort,
+ MLocale::GregorianCalendar);
+ timeShortFormat.replace(QRegExp(" *a"), QLatin1String(""));
+ timeShortFormat.replace(QChar('K'), QChar('k'), Qt::CaseSensitive);
+ timeShortFormat.replace(QChar('h'), QChar('H'), Qt::CaseSensitive);
+ icuFormat.append(timeShortFormat);
+ }
break;
case 'S':
@@ -1449,7 +1462,7 @@ QString MLocale::formatDateTime(const MCalendar &mCalendar,
icuFormat.append('\t');
break;
- case 'T':
+ case 'T': // FIXME!
// 24 hour clock HH:MM:SS
icuFormat.append("kk:mm:ss");
break;
@@ -1618,18 +1631,18 @@ QString MLocale::icuFormatString( DateType dateType,
calendarType);
DateFormatSymbols *dfs = MLocalePrivate::createDateFormatSymbols(symbolLocale);
- // This is not nice but seems to be the only way to set the
- // symbols with the public API
- static_cast<SimpleDateFormat *>(df)->adoptDateFormatSymbols(dfs);
-
- icu::UnicodeString icuFormatString;
- static_cast<SimpleDateFormat *>(df)->toPattern(icuFormatString);
-
- QString icuFormatQString = MIcuConversions::unicodeStringToQString(icuFormatString);
+ QString icuFormatQString;
- if( df )
+ if (df)
+ {
+ icu::UnicodeString icuFormatString;
+ // This is not nice but seems to be the only way to set the
+ // symbols with the public API
+ static_cast<SimpleDateFormat *>(df)->adoptDateFormatSymbols(dfs);
+ static_cast<SimpleDateFormat *>(df)->toPattern(icuFormatString);
+ icuFormatQString = MIcuConversions::unicodeStringToQString(icuFormatString);
delete df;
-
+ }
return icuFormatQString;
}
#endif
@@ -1833,7 +1846,13 @@ QString MLocale::languageEndonym() const
Q_D(const MLocale);
UErrorCode status = U_ZERO_ERROR;
+ // TODO: implement a workaround for
+ // http://site.icu-project.org/design/resbund/issues
+#if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >=4)
+ UResourceBundle *res = ures_open("ICUDATA-lang", qPrintable(d->_defaultLocale), &status);
+#else
UResourceBundle *res = ures_open(NULL, qPrintable(d->_defaultLocale), &status);
+#endif
if (U_FAILURE(status)) {
mDebug("MLocale") << "Error ures_open" << u_errorName(status);
}
@@ -1865,7 +1884,13 @@ QString MLocale::countryEndonym() const
Q_D(const MLocale);
UErrorCode status = U_ZERO_ERROR;
+ // TODO: implement a workaround for
+ // http://site.icu-project.org/design/resbund/issues
+#if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >=4)
+ UResourceBundle *res = ures_open("ICUDATA-region", qPrintable(d->_defaultLocale), &status);
+#else
UResourceBundle *res = ures_open(NULL, qPrintable(d->_defaultLocale), &status);
+#endif
if (U_FAILURE(status)) {
mDebug("MLocale") << "Error ures_open" << u_errorName(status);
}
diff --git a/src/corelib/i18n/mlocale.h b/src/corelib/i18n/mlocale.h
index 1eea9d20..2c1dd115 100644
--- a/src/corelib/i18n/mlocale.h
+++ b/src/corelib/i18n/mlocale.h
@@ -550,11 +550,11 @@ public:
</a>
or
<a href="http://linux.die.net/man/1/date">
- the man page of <verbatim>date<verbatim>
+ the man page of “date”
</a>
or
<a href="http://www.gnu.org/s/libc/manual/html_node/Formatting-Calendar-Time.html">
- the documentation of the glibc function <verbatim>strftime</verbatim>
+ the documentation of the glibc function “strftime”
</a>.
The pattern may contain the following symbols to be replaced with
@@ -579,8 +579,19 @@ public:
- \%M Minute, as a decimal number (00-59).
- \%n A &lt;newline&gt; character.
- \%p FDCC-set's equivalent of either AM or PM.
- - \%r 12-hour clock time (01-12), using the AM/PM notation.
- - \%R 24-hour clock time, in the format "%H:%M".
+ - \%r locale specific 12-hour clock time using the AM/PM notation
+ Similar to “%I:%M %p” but the exact format does depend more on
+ the locale. E.g. for “en_GB” locale the result may look like
+ “12:15 PM” with a colon between the hours and he minutes whereas
+ for “fi_FI” locale a dot may be used as the separator, like
+ “12.15 ip.”. The exact result depends on how the TimeShort format
+ for the locale is implemented in ICU.
+ - \%R locale specific 24-hour clock time.
+ Similar to “%H:%M” but the exact format depends on the locale.
+ E.g. for “en_GB” locale the result may look like “14:15” and
+ for “fi_FI” locale the result may look like “14.15”.
+ The exact result depends on how the TimeShort format
+ for the locale is implemented in ICU.
- \%S Seconds, as a decimal number (00-61).
- \%t A &lt;tab&gt; character.
- \%T 24-hour clock time, in the format HH:MM:SS.
@@ -677,17 +688,34 @@ public:
/*!
* \brief installs a translation catalog
+ * \param name of the translation catalog to install
*
* Adds this translation catalog to the list of translation catalogs
* used by this MLocale.
*
- * The list of catalogs used by the default locale is the list of
- * catalogs which will be used when translating strings with qtTrId() or tr().
+ * The list of catalogs used by the system default locale is the
+ * list of catalogs which will be used when translating strings
+ * with qtTrId() or tr().
*
- * Examples:
+ * Usually the catalog name should be specified <b>without</b> the
+ * “.qm” file extension and <b>without</b> the locale specific
+ * part of the file name. I.e. one should usually call
+ * installTrCatalog("foo") and <b>not</b>
+ * installTrCatalog("foo_en_US.qm").
+ *
+ * If only the basename of the catalog (e.g. "foo") is specified,
+ * installTrCatalog() installs both the engineering
+ * English file for this catalog <b>and</b> the real translations
+ * for this catalog for the locale. The engineering English
+ * gets lowest priority by prepending it to the list of
+ * already installed catalogs and the real translations get
+ * highest priority by appending it to the list of already
+ * installed catalog names.
+ *
+ * Example:
*
- * Add another translation catalog to the catalogs used
- * by the system default locale, and translate a message:
+ * Add translation catalogs “foo” and “bar” to the catalogs used
+ * by the system default locale:
*
* \code
* // get current system default locale
@@ -695,11 +723,89 @@ public:
* // install a translation catalog
* // (this catalog is added to the list of catalogs already used
* // by the system default locale):
- * locale.installTrCatalog("catalogname");
+ * locale.installTrCatalog("foo");
+ * locale.installTrCatalog("bar");
* // make the locale with the added translation catalog the new system
* // default:
* MLocale::setDefault(locale);
+ * \endcode
+ *
+ * In this example, after calling locale.installTrCatalog("foo") the
+ * internal list of installed catalog names of the locale looks like:
+ *
+ * \code
+ * "foo.qm" "bar.qm" ... previous catalog list ... "foo" "bar"
+ * \endcode
+ *
+ * Priority in this list increases from left to right.
+ *
+ * Eventually, this list of catalog names is evaluated and
+ * translation files are loaded from the file system.
+ * The translation files are searched in the directories
+ * in the translation path list, see translationPaths().
+ *
+ * For entries in the list of catalog names which end with “.qm”
+ * the names are used “as is”, i.e. in the example above the files
+ * “foo.qm” and “bar.qm” are loaded for these entries. For entries
+ * in the list of catalog names which do <b>not</b> end with
+ * “.qm”, a locale specific file name part and a “.qm” extension
+ * is added and Qt-like fallbacks for the file name to load are
+ * used. As an example, let’s assume that the name of the locale
+ * is “en_US”, then the following file names are tried to get
+ * the real translations for the catalog name “foo”:
+ *
+ * \code
+ * foo_en_US.qm
+ * foo_en_US
+ * foo_en.qm
+ * foo_en
+ * \endcode
+ *
+ * and the first one which exists is loaded.
+ *
+ * Note that the search for fallbacks for the real translation
+ * stops at “foo_en”. This is slightly different from the
+ * behaviour of <a
+ * href="http://qt.nokia.com/doc/4.6/qtranslator.html#load">QTranslator::load()</a>
+ * because proceeding to the fallback “foo.qm” would load
+ * engineering English if “foo.qm” exists which is not what we
+ * want when trying to load real translations because this might
+ * add engineering English with the wrong priority (highest
+ * priority) to the list of translation catalogs if the real
+ * translation happens to be missing.
+ *
+ * If the settings of the locale change, the list of translation
+ * catalog names is reevaluated and translations may switch to
+ * a different language (see connectSettings(), disconnectSettings(),
+ * settingsChanged(), localeSettingsChanged()).
+ *
+ * If a full file name including a “.qm” extension is specified
+ * as the argument of installTrCatalog(), this catalog name is
+ * always appended to the list of catalog names, i.e. used with
+ * highest priority. This means that after calling
+ * locale.installTrCatalog("foo_en_US.qm") the internal list
+ * of installed catalog names looks like:
+ *
+ * \code
+ * ... previous catalog list ... "foo_en_US.qm"
+ * \endcode
*
+ * This is mainly intended for testing to force loading of a fully
+ * specified translation file with highest priority. Except
+ * for testing this should not be used because in the above example
+ * with “foo_en_US.qm”, the locale specific part does not change
+ * according to the locale settings but always stays like this.
+ * And loading an engineering English file by specifying
+ * the full file name, i.e. installTrCatalog("foo.qm") should
+ * also be used only for testing because this adds the engineering
+ * English with highest priority which is usually wrong.
+ *
+ * After a locale has been made the system default with setDefault(),
+ * the translation catalogs which have been installed into that locale
+ * are available for use with qtTrId(), i.e. one can use code
+ * like this to translate a string:
+ *
+ * \code
* // translate a string:
*
* //% "Hello"
@@ -707,11 +813,16 @@ public:
* \endcode
*
* \sa setDefault(const MLocale &locale)
+ * \sa translationPaths()
+ * \sa setTranslationPaths(const QStringList &paths)
+ * \sa addTranslationPath(const QString &path)
+ * \sa removeTranslationPath(const QString &path)
*/
void installTrCatalog(const QString &name);
/*!
* \brief removes a translation catalog
+ * \param name of the translation catalog to remove
*
* Removes the catalog from the list of translation catalogs used by this
* MLocale.
@@ -744,21 +855,37 @@ public:
/*!
* \brief Sets the paths that are used as base directories for using translations
* The translation path modification methods are not thread-safe.
+ *
+ * \sa translationPaths()
+ * \sa addTranslationPath(const QString &path)
+ * \sa removeTranslationPath(const QString &path)
*/
static void setTranslationPaths(const QStringList &paths);
/*!
* \brief Append a path to the translation file lookup directories.
+ *
+ * \sa translationPaths()
+ * \sa setTranslationPaths(const QStringList &paths)
+ * \sa removeTranslationPath(const QString &path)
*/
static void addTranslationPath(const QString &path);
/*!
* \brief Removes a path
+ *
+ * \sa translationPaths()
+ * \sa setTranslationPaths(const QStringList &paths)
+ * \sa addTranslationPath(const QString &path)
*/
static void removeTranslationPath(const QString &path);
/*!
* \brief Returns the list of current translation file base paths
+ *
+ * \sa setTranslationPaths(const QStringList &paths)
+ * \sa addTranslationPath(const QString &path)
+ * \sa removeTranslationPath(const QString &path)
*/
static QStringList translationPaths();
diff --git a/src/corelib/i18n/mlocale_p.h b/src/corelib/i18n/mlocale_p.h
index 39f28f22..e19249bb 100644
--- a/src/corelib/i18n/mlocale_p.h
+++ b/src/corelib/i18n/mlocale_p.h
@@ -90,7 +90,7 @@ public:
// creates an icu::Locale for specific category
icu::Locale getCategoryLocale(MLocale::Category category) const;
- static icu::DateFormatSymbols *createDateFormatSymbols(icu::Locale locale);
+ static icu::DateFormatSymbols *createDateFormatSymbols(const icu::Locale &locale);
// creates a dateformat object for datetime formatting/parsing
// the caller is responsible for deleting the dateformat object
diff --git a/src/corelib/icu-extradata/extradata.pri b/src/corelib/icu-extradata/extradata.pri
index 6b091956..866a9eef 100644
--- a/src/corelib/icu-extradata/extradata.pri
+++ b/src/corelib/icu-extradata/extradata.pri
@@ -1,8 +1,9 @@
+ICUBINDIR = $$system(icu-config --bindir)
extradata.name = libextradata builder
extradata.input = EXTRADATA_SOURCE
extradata.output = $$DESTDIR/lib${QMAKE_FILE_BASE}.a
-extradata.commands += genrb -d $$OBJECTS_DIR -s $$IN_PWD -e UTF-8 ${QMAKE_FILE_BASE}.txt;
-extradata.commands += pkgdata --name ${QMAKE_FILE_BASE} --mode static -v -d $$DESTDIR -T $$OBJECTS_DIR -s $$OBJECTS_DIR $$IN_PWD/packagelist.txt
+extradata.commands += $$ICUBINDIR/genrb -d $$OBJECTS_DIR -s $$IN_PWD -e UTF-8 ${QMAKE_FILE_BASE}.txt;
+extradata.commands += $$ICUBINDIR/pkgdata --name ${QMAKE_FILE_BASE} --mode static -v -d $$DESTDIR -T $$OBJECTS_DIR -s $$OBJECTS_DIR $$IN_PWD/packagelist.txt
extradata.clean += $$OBJECTS_DIR/*.mak $$OBJECTS_DIR/*.lst $$OBJECTS_DIR/*.ao $$OBJECTS_DIR/*.o $$OBJECTS_DIR/*.res $$OBJECTS_DIR/*.c $$DESTDIR/lib${QMAKE_FILE_BASE}.a $$DESTDIR/README_${QMAKE_FILE_BASE}.txt
diff --git a/src/corelib/layout/mabstractlayoutpolicy.cpp b/src/corelib/layout/mabstractlayoutpolicy.cpp
index 82e3cbce..8b1c0bdd 100644
--- a/src/corelib/layout/mabstractlayoutpolicy.cpp
+++ b/src/corelib/layout/mabstractlayoutpolicy.cpp
@@ -350,6 +350,6 @@ void MAbstractLayoutPolicy::activated()
void MAbstractLayoutPolicy::aboutToBeRemovedFromLayout(const QGraphicsLayoutItem *item)
{
Q_D(MAbstractLayoutPolicy);
- d->aboutToBeRemovedFromLayout(item);
+ d->aboutToBeRemovedFromLayout(layout()->indexOf(item));
}
diff --git a/src/corelib/layout/mabstractlayoutpolicy_p.cpp b/src/corelib/layout/mabstractlayoutpolicy_p.cpp
index 79dd2b11..95f25cf9 100644
--- a/src/corelib/layout/mabstractlayoutpolicy_p.cpp
+++ b/src/corelib/layout/mabstractlayoutpolicy_p.cpp
@@ -41,27 +41,17 @@ MAbstractLayoutPolicyPrivate::MAbstractLayoutPolicyPrivate(MLayout *l) :
MAbstractLayoutPolicyPrivate::~MAbstractLayoutPolicyPrivate()
{ }
-void MAbstractLayoutPolicyPrivate::aboutToBeRemovedFromLayout(const QGraphicsLayoutItem *item)
+void MAbstractLayoutPolicyPrivate::aboutToBeRemovedFromLayout(int layoutIndex)
{
- //The item is about to be removed from the layout, so we need to remove it from this policy too
- //This gets called even if the item is not in this policy, so that we can update the items mapping
- Q_Q(MAbstractLayoutPolicy);
-
- // First remove the item from this policy, if it is in this policy
- int policyIndex = q->indexOf(item);
- if (policyIndex > -1) {
- removingFromLayout = true;
- q->removeItem(item);
- removingFromLayout = false;
- }
-
- //Now update all of the indexes
- int layoutIndex = layout->indexOf(item); //This should always succeed
+ //The item is about to be removed from the layout. It has already been removed from the policy
+ //so this gets called so that we can update the items mappings.
Q_ASSERT(layoutIndex >= 0);
+ //Now update all of the indexes
const int count = items.count();
for (int i = 0; i < count; ++i) {
int currentLayoutIndex = items.at(i);
+ Q_ASSERT(currentLayoutIndex != layoutIndex);
if (currentLayoutIndex > layoutIndex)
items[i] = currentLayoutIndex - 1;
}
diff --git a/src/corelib/layout/mabstractlayoutpolicy_p.h b/src/corelib/layout/mabstractlayoutpolicy_p.h
index eeeeff3b..f3006e0c 100644
--- a/src/corelib/layout/mabstractlayoutpolicy_p.h
+++ b/src/corelib/layout/mabstractlayoutpolicy_p.h
@@ -37,7 +37,7 @@ public:
/** Destructor */
virtual ~MAbstractLayoutPolicyPrivate();
- void aboutToBeRemovedFromLayout(const QGraphicsLayoutItem *item);
+ void aboutToBeRemovedFromLayout(int index);
/** The layout we are associated with. */
MLayout *const layout;
diff --git a/src/corelib/layout/mbasiclayoutanimation.cpp b/src/corelib/layout/mbasiclayoutanimation.cpp
index 0e3de45d..860d6e88 100644
--- a/src/corelib/layout/mbasiclayoutanimation.cpp
+++ b/src/corelib/layout/mbasiclayoutanimation.cpp
@@ -58,16 +58,23 @@ void MBasicLayoutAnimation::setItemGeometry(int index, const QRectF &geometry) {
Q_ASSERT(index >= 0 && index < d->states.count());
MItemState &state = d->states[index];
Q_ASSERT(state.item());
- state.setTargetGeometry(geometry);
- if (state.isSet(MItemState::STATE_FLAG_TO_BE_SHOWN)) {
+ if(state.isSet(MItemState::STATE_FLAG_SHOWING) && !state.isSet(MItemState::STATE_FLAG_TO_BE_HIDDEN)) {
+ QPointF originalPositionCenter = state.item()->pos() + QPointF(state.item()->transform().dx(), state.item()->transform().dy());
+ state.item()->setGeometry(geometry); //Note that the item's geometry doesn't have to be equal to geometry, since there are various constraints
+ QPointF offset = originalPositionCenter - state.item()->pos();
+ state.item()->setTransform( QTransform::fromTranslate(offset.x(), offset.y()) );
+ state.setSourceTranslatePoint(offset);
+ } else {
+ state.item()->setTransform( QTransform() );
+ state.item()->setGeometry(geometry); //Note that the item's geometry doesn't have to be equal to geometry, since there are various constraints
d->doItemShownAnimation(&state);
- //we only want to call the item shown animation once, so clear the shown flags
- state.removeFlags(MItemState::STATE_FLAG_TO_BE_SHOWN);
state.addFlags(MItemState::STATE_FLAG_SHOWING);
+ state.removeFlags(MItemState::STATE_FLAG_TO_BE_HIDDEN);
}
+
if (state.isAnimationDone()) {//Set the geometry anyway, so that it can refresh
- state.item()->setOpacity(1); //Restore the opacity to 1, since we are hiding it now anyway
- state.item()->setGeometry(state.targetGeometry());
+ state.item()->setOpacity(1);
+ state.item()->setTransform( QTransform() );
} else
start();
}
@@ -76,10 +83,9 @@ void MBasicLayoutAnimation::hideItem(int index) {
Q_ASSERT(index >= 0 && index < d->states.count());
MItemState &state = d->states[index];
Q_ASSERT(state.item());
- //Check if its being hidden or if it is hiding (i.e. not shown and not to-be-shown
+ //Check if its being hidden or if it is hiding (i.e. not shown)
if (state.isSet(MItemState::STATE_FLAG_TO_BE_HIDDEN) ||
- (!state.isSet(MItemState::STATE_FLAG_TO_BE_SHOWN) &&
- !state.isSet(MItemState::STATE_FLAG_SHOWING))) {
+ (!state.isSet(MItemState::STATE_FLAG_SHOWING))) {
return; //It's already hiding/hidden. Nothing to do
}
state.hide();
diff --git a/src/corelib/layout/mbasiclayoutanimation_p.cpp b/src/corelib/layout/mbasiclayoutanimation_p.cpp
index 355630ce..303a9ad5 100644
--- a/src/corelib/layout/mbasiclayoutanimation_p.cpp
+++ b/src/corelib/layout/mbasiclayoutanimation_p.cpp
@@ -55,25 +55,22 @@ void MBasicLayoutAnimationPrivate::animate(MItemState &item)
{
Q_Q(MBasicLayoutAnimation);
- QRectF target(item.targetGeometry());
- QRectF start(item.sourceGeometry());
qreal delta_progress = recordedTimeSinceLastUpdate / q->style()->duration(); //Both times are in milliseconds
//First animate the geometry if needed
- if (item.geometryProgress() != 1) {
+ if (item.translateProgress() != 1) {
//animate the geometry
- qreal new_geometry_progress = qMin(item.geometryProgress() + delta_progress, (qreal)1.0); //between 0 and 1
- item.setGeometryProgress(new_geometry_progress);
- qreal geometry_animation_value = q->style()->geometryEasingCurve().valueForProgress(new_geometry_progress);
- if (item.geometryProgress() == 1) {
- item.item()->setGeometry(target);
+ qreal new_geometry_progress = item.translateProgress() + delta_progress;
+ if (new_geometry_progress >= 1.0) {
+ item.setTransformProgress(1.0);
+ item.item()->setTransform( QTransform() );
} else {
- QSizeF new_size = start.size() + (target.size() - start.size()) * geometry_animation_value;
- new_size = new_size.boundedTo(item.item()->maximumSize()).expandedTo(item.item()->minimumSize());
- QPointF new_position = start.center() - QPointF(new_size.width() / 2, new_size.height() / 2) + (target.center() - start.center()) * geometry_animation_value;
- QRectF new_geometry(new_position, new_size);
- if (item.item()->geometry() != new_geometry)
- item.item()->setGeometry(new_geometry);
+ item.setTransformProgress(new_geometry_progress);
+ qreal x_translation_animation_value = q->style()->xTranslationEasingCurve().valueForProgress(new_geometry_progress);
+ qreal y_translation_animation_value = q->style()->yTranslationEasingCurve().valueForProgress(new_geometry_progress);
+ qreal x_offset = item.sourceTranslate().x() * (1 - x_translation_animation_value);
+ qreal y_offset = item.sourceTranslate().y() * (1 - y_translation_animation_value);
+ item.item()->setTransform( QTransform::fromTranslate(x_offset, y_offset) );
}
}
@@ -95,7 +92,7 @@ void MBasicLayoutAnimationPrivate::animate(MItemState &item)
}
//Have we finished with this item now?
- if (item.opacityProgress() == 1 && item.geometryProgress() == 1) {
+ if (item.opacityProgress() == 1 && item.translateProgress() == 1) {
if (item.isSet(MItemState::STATE_FLAG_TO_BE_HIDDEN)) {
if (item.targetOpacity() != -1)
item.item()->setOpacity(1); //Restore the opacity to 1, since we are hiding it now anyway
@@ -109,23 +106,6 @@ void MBasicLayoutAnimationPrivate::doItemHiddenAnimation(MItemState *itemstate)
{
Q_Q(MBasicLayoutAnimation);
Q_ASSERT(itemstate->item());
- // for item hiding it should deflate from its current size to final-hiding-scale-factor
- qreal finalScaleFactor = q->style()->finalHidingScaleFactor();
- QRectF finalGeometry;
- if (finalScaleFactor == 1.0) {
- finalGeometry = itemstate->item()->geometry();
- } else {
- QSizeF size = itemstate->item()->effectiveSizeHint(Qt::MinimumSize);
- if (finalScaleFactor > 0) {
- size = size.expandedTo(itemstate->item()->geometry().size() * finalScaleFactor)
- .boundedTo(itemstate->item()->effectiveSizeHint(Qt::MaximumSize));
- }
- finalGeometry = QRectF(QPointF(0, 0), size);
- finalGeometry.moveCenter(itemstate->item()->geometry().center());
- }
-
- if (itemstate->targetGeometry().size() != finalGeometry.size())
- itemstate->setTargetGeometry(finalGeometry);
QGraphicsItem *graphicsItem = itemstate->item()->graphicsItem();
if (graphicsItem) {
@@ -138,43 +118,22 @@ void MBasicLayoutAnimationPrivate::doItemShownAnimation(MItemState *itemstate)
{
Q_Q(MBasicLayoutAnimation);
Q_ASSERT(itemstate->item());
+ q->showItemNow(itemstate->item());
+ QGraphicsItem *graphicsItem = itemstate->item()->graphicsItem();
+ if(!graphicsItem)
+ return;
if (itemstate->isSet(MItemState::STATE_FLAG_SHOWING)) {
//If the item is already visible, this can be called because we were currently doing a hide animation.
//So just make sure that we make everything visible
- q->showItemNow(itemstate->item());
- QGraphicsItem *graphicsItem = itemstate->item()->graphicsItem();
- if (graphicsItem) {
- itemstate->setTargetOpacity(1);
- graphicsItem->setOpacity(1);
- }
+ itemstate->setTargetOpacity(1);
+ graphicsItem->setOpacity(1);
return;
}
- //If the item that started this animation is to be added/shown, set the initial geometry
- qreal initialScaleFactor = q->style()->initialShowingScaleFactor();
- QRectF initialGeometry;
- if (initialScaleFactor == 1.0) {
- initialGeometry = itemstate->targetGeometry();
- } else {
- QSizeF size = itemstate->item()->effectiveSizeHint(Qt::MinimumSize);
- if (initialScaleFactor != 0.0) {
- size = size.expandedTo(itemstate->targetGeometry().size() * initialScaleFactor)
- .boundedTo(itemstate->item()->effectiveSizeHint(Qt::MaximumSize));
- }
- initialGeometry = QRectF(QPointF(0, 0), size);
- initialGeometry.moveCenter(itemstate->targetGeometry().center());
- }
-
- itemstate->setGeometry(initialGeometry);
-
- q->showItemNow(itemstate->item());
- QGraphicsItem *graphicsItem = itemstate->item()->graphicsItem();
- if (graphicsItem) {
- qreal initialOpacity = q->style()->initialShowingOpacity();
- if (initialOpacity != 1.0) {
- graphicsItem->setOpacity(initialOpacity);
- itemstate->setTargetOpacity(1);
- }
+ qreal initialOpacity = q->style()->initialShowingOpacity();
+ if (initialOpacity != 1.0) {
+ graphicsItem->setOpacity(initialOpacity);
+ itemstate->setTargetOpacity(1);
}
}
diff --git a/src/corelib/layout/mitemstate_p.cpp b/src/corelib/layout/mitemstate_p.cpp
index a289a483..47bb662c 100644
--- a/src/corelib/layout/mitemstate_p.cpp
+++ b/src/corelib/layout/mitemstate_p.cpp
@@ -25,7 +25,7 @@ MItemState::MItemState(QGraphicsWidget *i) :
m_sourceOpacity(-1),
m_targetOpacity(-1),
m_flags(MItemState::STATE_FLAG_NONE),
- m_geometryProgress(1),
+ m_translateProgress(1),
m_opacityProgress(1),
m_isAnimationDone(true)
{
@@ -40,14 +40,9 @@ QGraphicsWidget *MItemState::item() const
return m_item;
}
-QRectF MItemState::sourceGeometry() const
+QPointF MItemState::sourceTranslate() const
{
- return m_sourceGeometry;
-}
-
-QRectF MItemState::targetGeometry() const
-{
- return m_targetGeometry;
+ return m_sourceTranslate;
}
MItemState::Flags MItemState::flags() const
@@ -55,35 +50,15 @@ MItemState::Flags MItemState::flags() const
return m_flags;
}
-void MItemState::setGeometry(const QRectF &p)
-{
- m_item->setGeometry(p);
- m_sourceGeometry = p;
- m_isAnimationDone = false;
- if (m_sourceGeometry != m_targetGeometry)
- m_geometryProgress = 0;
- else
- m_geometryProgress = 1;
-}
-void MItemState::setTargetGeometry(const QRectF &p)
+void MItemState::setSourceTranslatePoint(const QPointF &sourceTranslate)
{
Q_ASSERT(m_item);
- QSizeF maximum = m_item->effectiveSizeHint(Qt::MaximumSize, p.size());
- QSizeF minimum = m_item->effectiveSizeHint(Qt::MinimumSize, p.size());
- QRectF target = p;
- target.setSize(target.size().boundedTo(maximum).expandedTo(minimum));
- if (target == m_targetGeometry && (isSet(STATE_FLAG_SHOWING) || isSet(STATE_FLAG_TO_BE_SHOWN)) && !isSet(STATE_FLAG_TO_BE_HIDDEN))
- return; //Nothing has changed and item is already being shown or is already showing. If the item is hiding, then we need to reset the source and show the item anyway
- m_targetGeometry = target;
- m_sourceGeometry = m_item->geometry();
-
- if (!isSet(STATE_FLAG_SHOWING) || isSet(STATE_FLAG_TO_BE_HIDDEN)) //If it's not being shown or we are in the middle of a showing animation
- addFlags(STATE_FLAG_TO_BE_SHOWN);
- removeFlags(STATE_FLAG_TO_BE_HIDDEN);
-
+ if(m_sourceTranslate == sourceTranslate)
+ return;
+ m_sourceTranslate = sourceTranslate;
m_isAnimationDone = false;
- if (m_sourceGeometry != m_targetGeometry)
- m_geometryProgress = 0;
+ if (!m_sourceTranslate.isNull())
+ m_translateProgress = 0;
}
void MItemState::setFlags(Flags new_flags)
@@ -115,23 +90,19 @@ void MItemState::animationDone()
{
m_isAnimationDone = true;
m_opacityProgress = 1;
- m_geometryProgress = 1;
- m_sourceGeometry = m_targetGeometry;
+ m_translateProgress = 1;
+ m_sourceTranslate = QPointF(0,0);
m_sourceOpacity = m_targetOpacity = -1;
//Keep the deleted flag so that it can be deleted
- if (m_flags & STATE_FLAG_TO_BE_SHOWN) {
- m_flags &= ~STATE_FLAG_TO_BE_SHOWN;
- m_flags |= STATE_FLAG_SHOWING;
- }
if (m_flags & STATE_FLAG_TO_BE_HIDDEN) {
m_flags &= ~STATE_FLAG_TO_BE_HIDDEN;
m_flags &= ~STATE_FLAG_SHOWING;
}
}
-void MItemState::setGeometryProgress(qreal progress)
+void MItemState::setTransformProgress(qreal progress)
{
- m_geometryProgress = progress;
+ m_translateProgress = progress;
if (progress != 1)
m_isAnimationDone = false;
}
@@ -141,9 +112,9 @@ void MItemState::setOpacityProgress(qreal progress)
if (progress != 1)
m_isAnimationDone = false;
}
-qreal MItemState::geometryProgress() const
+qreal MItemState::translateProgress() const
{
- return m_geometryProgress;
+ return m_translateProgress;
}
qreal MItemState::opacityProgress() const
{
@@ -173,7 +144,6 @@ qreal MItemState::sourceOpacity() const
}
void MItemState::hide()
{
- removeFlags(STATE_FLAG_TO_BE_SHOWN);
m_isAnimationDone = false;
if (isSet(STATE_FLAG_SHOWING)) //if it's not already hiding
addFlags(STATE_FLAG_TO_BE_HIDDEN);
diff --git a/src/corelib/layout/mitemstate_p.h b/src/corelib/layout/mitemstate_p.h
index 6e902db1..88f4687f 100644
--- a/src/corelib/layout/mitemstate_p.h
+++ b/src/corelib/layout/mitemstate_p.h
@@ -43,9 +43,8 @@ public:
STATE_FLAG_NONE = 0, //!< If none of the other flags are set, this indicates that the item is not being shown
/* The item is still doing its remove-animation. */
STATE_FLAG_TO_BE_DELETED = 1, //!< Indicates that the item will be deleted as soon as its hidden/
- STATE_FLAG_TO_BE_SHOWN = 2, //!< Indicates that setTargetGeometry has been called for an item that wasn't SHOWING. The animator will move the item into its starting position and clear this flag. This is not set during any showing animation.
- STATE_FLAG_TO_BE_HIDDEN = 4, //!< Indicates that hide() has been called for an item was SHOWING. The animator will set the hiding animation. Both this flag and the SHOWING flag will be left set during any hiding animation. One the animation is finished, the item will be hidden and both this flag and SHOWING will be cleared. If TO_BE_DELETED is set, the item is deleted.
- STATE_FLAG_SHOWING = 8 //!< Whether the item is currently visible by the user
+ STATE_FLAG_TO_BE_HIDDEN = 2, //!< Indicates that hide() has been called for an item was SHOWING. The animator will set the hiding animation. Both this flag and the SHOWING flag will be left set during any hiding animation. One the animation is finished, the item will be hidden and both this flag and SHOWING will be cleared. If TO_BE_DELETED is set, the item is deleted.
+ STATE_FLAG_SHOWING = 4 //!< Whether the item is currently visible by the user
};
Q_DECLARE_FLAGS(Flags, Flag)
@@ -70,14 +69,9 @@ public:
QGraphicsWidget *item() const;
/*!
- * \brief Getter for the source position.
+ * \brief Getter for the starting offset to draw the item
*/
- QRectF sourceGeometry() const;
-
- /*!
- * \brief Getter for the target position.
- */
- QRectF targetGeometry() const;
+ QPointF sourceTranslate() const;
/*!
* \brief Getter for the state flags.
@@ -85,20 +79,11 @@ public:
Flags flags() const;
/*!
- * \brief Set a new target position.
+ * \brief Set a new starting offset to draw the item.
*
- * This will set the target geometry to the given rectangle, and set
- * source geometry to be the current item geometry
+ * This will set the starting offset for where to draw the item.
*/
- void setTargetGeometry(const QRectF &rect);
-
- /*!
- * \brief Set the current position, restarting the animation
- *
- * This will set the item's geometry to the rectangle and set the source
- * geometry, restarting the animation.
- */
- void setGeometry(const QRectF &rect);
+ void setSourceTranslatePoint(const QPointF &translatePoint);
/*!
* \brief set a new target opacity.
@@ -166,7 +151,7 @@ public:
* far into the geometry animation we are
* If this is set to -1, the geometry will not be changed.
*/
- qreal geometryProgress() const;
+ qreal translateProgress() const;
/*!
* \brief Current opacity progress for this item
@@ -186,7 +171,7 @@ public:
*
* The animator will use this value to set the geometry
*/
- void setGeometryProgress(qreal progress);
+ void setTransformProgress(qreal progress);
/*!
* \brief Set the current opacity progress for this item
@@ -200,7 +185,7 @@ public:
/** \brief Whether the animation is completed
*
- * Equivalent to geometryProgress() == 1 && opacityProgress == 1
+ * Equivalent to translateProgress() == 1 && opacityProgress == 1
*/
bool isAnimationDone() const;
void animationDone();
@@ -212,20 +197,11 @@ private:
QGraphicsWidget *m_item;
/*!
- * \brief The position of the item in the layout.
- *
- * This position is the one the item had before the currently
- * active change was issued.
- */
- QRectF m_sourceGeometry;
-
- /*!
- * \brief The position of the item in the layout.
+ * \brief The original offset to paint the item
*
- * This is the position the item should have once all in-flight
- * operations are finished.
+ * The item's translatePoint value is animated from this value to the (0,0).
*/
- QRectF m_targetGeometry;
+ QPointF m_sourceTranslate;
qreal m_sourceOpacity;
qreal m_targetOpacity;
@@ -239,7 +215,7 @@ private:
* \brief Current progress of animation of the geometry
* Between 0 and 1. 1 indicating finished.
*/
- qreal m_geometryProgress;
+ qreal m_translateProgress;
/*!
* \brief Current progress of animation of the opacity
* Between 0 and 1. 1 indicating finished.
diff --git a/src/corelib/layout/mlayout.cpp b/src/corelib/layout/mlayout.cpp
index dd26e65b..08d7900c 100644
--- a/src/corelib/layout/mlayout.cpp
+++ b/src/corelib/layout/mlayout.cpp
@@ -39,9 +39,8 @@ MLayout::MLayout(QGraphicsLayoutItem *parent) :
QSizePolicy newSizePolicy(sizePolicy());
newSizePolicy.setHeightForWidth(true);
setSizePolicy(newSizePolicy);
- // Disabling layout animations by default. Unfortunately they are not working
- // nicely.
- //new MBasicLayoutAnimation(this);
+ // Disabling layout animations by default
+ // new MBasicLayoutAnimation(this);
}
MLayout::~MLayout()
@@ -122,9 +121,19 @@ QGraphicsLayoutItem *MLayout::takeAt(int index)
bool toBeDeleted = d->items.at(index).toBeDeleted;
QGraphicsLayoutItem *item = d->items.at(index).item;
Q_ASSERT(item);
+ //First remove the item from all the policies, then update the indexes using aboutToBeRemovedFromLayout
+ //We cannot do this in once pass since removeAt() is virtual and can do pretty much anything
foreach(MAbstractLayoutPolicy * policy, d->policies) {
Q_ASSERT(policy);
- policy->d_ptr->aboutToBeRemovedFromLayout(item);
+ int policyIndex = policy->indexOf(item);
+ if (policyIndex >= 0 ) {
+ policy->d_ptr->removingFromLayout = true; //Indicate to the policy to remove the item but not to hide it
+ policy->removeAt(policyIndex);
+ policy->d_ptr->removingFromLayout = false;
+ }
+ }
+ foreach(MAbstractLayoutPolicy * policy, d->policies) {
+ policy->d_ptr->aboutToBeRemovedFromLayout(index);
}
if (d->animation)
d->animation->itemRemovedFromLayout(index);
@@ -136,7 +145,8 @@ QGraphicsLayoutItem *MLayout::takeAt(int index)
delete item;
return NULL;
}
- d->removeHiddenFlag(item);
+ /* We cannot actually show the item as it might be in the process of being deleted */
+ d->removeHiddenFlag(item->graphicsItem());
return item;
}
diff --git a/src/corelib/layout/mlayout_p.cpp b/src/corelib/layout/mlayout_p.cpp
index 488a4153..957018b5 100644
--- a/src/corelib/layout/mlayout_p.cpp
+++ b/src/corelib/layout/mlayout_p.cpp
@@ -191,8 +191,10 @@ void MLayoutPrivate::recheckOrientation() {
}
}
}
-void MLayoutPrivate::showItemNow(QGraphicsItem *graphicsItem)
+void MLayoutPrivate::showItemNow(QGraphicsItem *graphicsItem) const
{
+ if(!graphicsItem)
+ return;
MWidget *widget = dynamic_cast<MWidget *>(graphicsItem);
if (widget) {
widget->d_ptr->layoutHidden = false;
@@ -201,13 +203,13 @@ void MLayoutPrivate::showItemNow(QGraphicsItem *graphicsItem)
} else
graphicsItem->show(); //Show always for non-mwidgets
}
-void MLayoutPrivate::removeHiddenFlag(QGraphicsLayoutItem *layoutItem)
+void MLayoutPrivate::removeHiddenFlag(QGraphicsItem *graphicsItem) const
{
- MWidget *widget = dynamic_cast<MWidget *>(layoutItem->graphicsItem());
+ MWidget *widget = dynamic_cast<MWidget *>(graphicsItem);
if (widget)
widget->d_ptr->layoutHidden = false;
}
-void MLayoutPrivate::hideItemNow(QGraphicsItem *graphicsItem)
+void MLayoutPrivate::hideItemNow(QGraphicsItem *graphicsItem) const
{
graphicsItem->hide();
MWidget *widget = dynamic_cast<MWidget *>(graphicsItem);
diff --git a/src/corelib/layout/mlayout_p.h b/src/corelib/layout/mlayout_p.h
index a2aec4fc..ea191389 100644
--- a/src/corelib/layout/mlayout_p.h
+++ b/src/corelib/layout/mlayout_p.h
@@ -94,11 +94,11 @@ public:
QGraphicsItem *parentItem() const;
/** Hide the given item, setting a flag in MWidget to indicate that the layout hid it */
- void hideItemNow(QGraphicsItem *layoutItem);
+ void hideItemNow(QGraphicsItem *layoutItem) const;
/** Show the given item if it was hidden by the layout, clearing the flag in MWidget to indicate that the layout unhid it */
- void showItemNow(QGraphicsItem *layoutItem);
+ void showItemNow(QGraphicsItem *layoutItem) const;
/** Only clear the flag in MWidget */
- void removeHiddenFlag(QGraphicsLayoutItem *layoutItem);
+ void removeHiddenFlag(QGraphicsItem *layoutItem) const;
/** This is called when the widget's orientation has changed (probably because the device has been rotated) */
void setOrientation(M::Orientation orientation);
/** Check the closest parent widget's scene to find out what orientation we are in */
diff --git a/src/corelib/layout/mlinearlayoutpolicy.cpp b/src/corelib/layout/mlinearlayoutpolicy.cpp
index 72f77a99..5a34bad1 100644
--- a/src/corelib/layout/mlinearlayoutpolicy.cpp
+++ b/src/corelib/layout/mlinearlayoutpolicy.cpp
@@ -106,9 +106,13 @@ void MLinearLayoutPolicy::setStretchFactor(QGraphicsLayoutItem *item, int stretc
mWarning("MLinearLayoutPolicy") << Q_FUNC_INFO << "cannot assign a stretch factor to a null item";
return;
}
- if (stretchFactor(item) == stretch)
+
+ QGraphicsLayoutItem *proxyItem = d->engine->itemAt(indexOf(item));
+
+ if (d->engine->stretchFactor(proxyItem) == stretch)
return;
- d->engine->setStretchFactor(item, stretch);
+
+ d->engine->setStretchFactor(proxyItem, stretch);
invalidatePolicyAndLayout();
}
int MLinearLayoutPolicy::stretchFactor(QGraphicsLayoutItem *item) const
@@ -118,7 +122,8 @@ int MLinearLayoutPolicy::stretchFactor(QGraphicsLayoutItem *item) const
mWarning("MLinearLayoutPolicy") << Q_FUNC_INFO << "cannot return a stretch factor for a null item";
return 0;
}
- return d->engine->stretchFactor(item);
+ QGraphicsLayoutItem *proxyItem = d->engine->itemAt(indexOf(item));
+ return d->engine->stretchFactor(proxyItem);
}
void MLinearLayoutPolicy::setOrientation(Qt::Orientation orientation)
diff --git a/src/corelib/painting/mbackgroundtiles.cpp b/src/corelib/painting/mbackgroundtiles.cpp
index 53883ec9..5a70804c 100644
--- a/src/corelib/painting/mbackgroundtiles.cpp
+++ b/src/corelib/painting/mbackgroundtiles.cpp
@@ -38,6 +38,9 @@ const QString TILE_POSTFIX[16] = {
MBackgroundTilesPrivate::MBackgroundTilesPrivate() :
refCount(1)
{
+ for(int i=0; i<16; ++i) {
+ tiles[i] = 0;
+ }
}
MBackgroundTilesPrivate::~MBackgroundTilesPrivate()
diff --git a/src/corelib/scene/mscene.cpp b/src/corelib/scene/mscene.cpp
index 4b20d939..dc9e1f9d 100644
--- a/src/corelib/scene/mscene.cpp
+++ b/src/corelib/scene/mscene.cpp
@@ -52,6 +52,8 @@ const int GesturePointSize = 4;
MScenePrivate::MScenePrivate() :
+ q_ptr(0),
+ manager(0),
emuPoint1(1),
emuPoint2(2),
panEmulationEnabled(false),
diff --git a/src/corelib/scene/mscene.h b/src/corelib/scene/mscene.h
index d0f42359..ffff914f 100644
--- a/src/corelib/scene/mscene.h
+++ b/src/corelib/scene/mscene.h
@@ -45,12 +45,12 @@ class MWindowPrivate;
- Emulation of multitouch events for single-touch enviroments, as in a development environment.
- Calcuation of the widget on-display property, see MWidget::isOnDisplay()
- Development mode visual overlays, providing information to help debug applications:
- - Bounding rectangles, toggled by <Ctrl>-B
- - Margins, toggled by <Ctrl>-M
- - Positions, toggled by <Ctrl>-P
- - Sizes, toggled by <Ctrl>-S
- - Object names, toggled by <Ctrl>-N
- - Frames per second, toggled by <Ctrl>-F
+ - Bounding rectangles, toggled by <Ctrl>-<Shift>-B
+ - Margins, toggled by <Ctrl>-<Shift>-M
+ - Positions, toggled by <Ctrl>-<Shift>-P
+ - Sizes, toggled by <Ctrl>-<Shift>-S
+ - Object names, toggled by <Ctrl>-<Shift>-N
+ - Frames per second, toggled by <Ctrl>-<Shift>-F
\sa MWindow, MApplicationWindow
*/
diff --git a/src/corelib/scene/mscenelayereffect.cpp b/src/corelib/scene/mscenelayereffect.cpp
index 18f4ac89..9f45f9f2 100644
--- a/src/corelib/scene/mscenelayereffect.cpp
+++ b/src/corelib/scene/mscenelayereffect.cpp
@@ -22,6 +22,7 @@
#include "mscenelayereffect.h"
#include "mscenelayereffect_p.h"
#include "mscenelayereffectmodel.h"
+#include "mwidgetfadeanimation.h"
#include "mwidgetcreator.h"
M_REGISTER_WIDGET_NO_CREATE(MSceneLayerEffect)
@@ -29,6 +30,15 @@ M_REGISTER_WIDGET_NO_CREATE(MSceneLayerEffect)
MSceneLayerEffectPrivate::MSceneLayerEffectPrivate()
{
layerPressedDirectly = false;
+
+ MWidgetFadeAnimation *fadeInAnimation = new MWidgetFadeAnimation;
+ fadeInAnimation->setTransitionDirection(MWidgetFadeAnimation::In);
+
+ MWidgetFadeAnimation *fadeOutAnimation = new MWidgetFadeAnimation;
+ fadeOutAnimation->setTransitionDirection(MWidgetFadeAnimation::Out);
+
+ appearanceAnimation = fadeInAnimation;
+ disappearanceAnimation = fadeOutAnimation;
}
MSceneLayerEffectPrivate::~MSceneLayerEffectPrivate()
@@ -40,6 +50,10 @@ MSceneLayerEffect::MSceneLayerEffect(const QString &effectType)
new MSceneLayerEffectModel(), MSceneWindow::LayerEffect,
effectType)
{
+ Q_D(MSceneLayerEffect);
+
+ d->appearanceAnimation->setTargetWidget(this);
+ d->disappearanceAnimation->setTargetWidget(this);
}
MSceneLayerEffect::~MSceneLayerEffect()
@@ -97,13 +111,3 @@ void MSceneLayerEffect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
event->accept();
}
-
-void MSceneLayerEffect::enableEffect()
-{
- model()->setEnabled(true);
-}
-
-void MSceneLayerEffect::disableEffect()
-{
- model()->setEnabled(false);
-}
diff --git a/src/corelib/scene/mscenelayereffect.h b/src/corelib/scene/mscenelayereffect.h
index 8f2c12ef..5e064c3e 100644
--- a/src/corelib/scene/mscenelayereffect.h
+++ b/src/corelib/scene/mscenelayereffect.h
@@ -36,10 +36,6 @@ public:
MSceneLayerEffect(const QString &effectType);
virtual ~MSceneLayerEffect();
-public Q_SLOTS:
- void enableEffect();
- void disableEffect();
-
protected:
//! \reimp
diff --git a/src/corelib/scene/mscenemanager.cpp b/src/corelib/scene/mscenemanager.cpp
index b5a0fe4c..ab574658 100644
--- a/src/corelib/scene/mscenemanager.cpp
+++ b/src/corelib/scene/mscenemanager.cpp
@@ -42,6 +42,7 @@
#include "mdockwidget.h"
#include "mescapebuttonpanel.h"
#include "mescapebuttonpanelmodel.h"
+#include "mobjectmenu.h"
#include "mapplication.h"
#include "mwindow.h"
#include "mapplicationwindow.h"
@@ -55,15 +56,13 @@
#include "morientationtracker.h"
#include "mbasicorientationanimation.h"
-#include "mnotificationanimation.h"
-#include "mscenefadeanimation.h"
+#include "mcrossfadedorientationanimation.h"
#include "mabstractwidgetanimation.h"
#include "mpageswitchanimation.h"
-#include <mwidgetslideinanimation.h>
-#include <mwidgetfadeinanimation.h>
-#include <mwidgetslideoutanimation.h>
-#include <mwidgetfadeoutanimation.h>
+#include <mwidgetslideanimation.h>
+#include <mwidgetfadeanimation.h>
+#include <mwidgetzoomanimation.h>
namespace
{
@@ -115,13 +114,7 @@ void MSceneManagerPrivate::init(MScene *scene)
rootElement->setTransformOriginPoint(QPointF(q->visibleSceneSize().width() / 2.0, q->visibleSceneSize().height() / 2.0));
scene->addItem(rootElement);
- //TODO: get this from theme
- orientationAnimation = new MBasicOrientationAnimation(q->visibleSceneSize(M::Landscape));
- orientationAnimation->setRootElement(rootElement);
- q->connect(orientationAnimation, SIGNAL(orientationChanged()), SLOT(_q_changeGlobalOrientationAngle()));
- q->connect(orientationAnimation, SIGNAL(finished()), SLOT(_q_emitOrientationChangeFinished()));
- q->connect(orientationAnimation, SIGNAL(finished()), SLOT(_q_applyQueuedSceneWindowTransitions()));
- q->connect(orientationAnimation, SIGNAL(finished()), SLOT(_q_triggerAsyncPendingOrientationChange()));
+ createOrientationAnimation();
// The scene manager should only listen to region updates from one instance, to prevent
// conflicting window relocation requests. Since MIMS is a singleton, enforcing
@@ -132,11 +125,33 @@ void MSceneManagerPrivate::init(MScene *scene)
q, SLOT(_q_relocateWindowByInputPanel(QRect)),
Qt::UniqueConnection);
+ q->connect(q, SIGNAL(orientationChangeFinished(M::Orientation)),
+ q, SLOT(ensureCursorVisible()),
+ Qt::UniqueConnection);
+
pageSwitchAnimation = new MPageSwitchAnimation;
setOrientationAngleWithoutAnimation(newAngle);
}
+void MSceneManagerPrivate::createOrientationAnimation()
+{
+ Q_Q(MSceneManager);
+
+ QRectF visibleSceneRect = QRectF(QPointF(0.0, 0.0), q->visibleSceneSize(M::Landscape));
+
+ //TODO: get this from theme
+ orientationAnimation = new MCrossFadedOrientationAnimation(visibleSceneRect);
+ //orientationAnimation = new MBasicOrientationAnimation(q->visibleSceneSize(M::Landscape));
+
+ orientationAnimation->setRootElement(rootElement);
+
+ q->connect(orientationAnimation, SIGNAL(orientationChanged()), SLOT(_q_changeGlobalOrientationAngle()));
+ q->connect(orientationAnimation, SIGNAL(finished()), SLOT(_q_emitOrientationChangeFinished()));
+ q->connect(orientationAnimation, SIGNAL(finished()), SLOT(_q_applyQueuedSceneWindowTransitions()));
+ q->connect(orientationAnimation, SIGNAL(finished()), SLOT(_q_triggerAsyncPendingOrientationChange()));
+}
+
MSceneManagerPrivate::~MSceneManagerPrivate()
{
delete windows;
@@ -386,6 +401,12 @@ void MSceneManagerPrivate::_q_relocateWindowByInputPanel(const QRect &inputPanel
{
Q_Q(MSceneManager);
+ const QRectF microFocusRect = q->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
+ // If the microfocus is invalid then the focused widget does not want to be relocated.
+ if (!microFocusRect.isValid()) {
+ return;
+ }
+
// This method is not responsible for restoring visibility when the input panel is closed -
// _q_inputPanelClosed() does that. Therefore, it is OK to also ignore empty rectangles here.
if (!focusedInputWidget || inputPanelRect.isEmpty()) {
@@ -404,7 +425,6 @@ void MSceneManagerPrivate::_q_relocateWindowByInputPanel(const QRect &inputPanel
visibleRect.setHeight(visibleRect.height() - obstructedHeight);
// Always try to center the input focus into the remaining visible rectangle.
- const QRectF microFocusRect = q->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
int adjustment = (rootElement->mapRectFromScene(microFocusRect).toRect().center() -
visibleRect.center()).y();
@@ -418,7 +438,7 @@ void MSceneManagerPrivate::_q_relocateWindowByInputPanel(const QRect &inputPanel
void MSceneManagerPrivate::_q_restoreSceneWindow()
{
- if (alteredSceneWindow && !focusedInputWidget) {
+ if (alteredSceneWindow) {
sceneWindowTranslation *= -1;
alteredSceneWindow->moveBy(sceneWindowTranslation.x(), sceneWindowTranslation.y());
sceneWindowTranslation = QPoint();
@@ -863,9 +883,7 @@ void MSceneManagerPrivate::prepareWindowShow(MSceneWindow *window)
setSceneWindowGeometry(window);
MSceneLayerEffect *effect = createLayerEffectForWindow(window);
- if (effect) {
- effect->enableEffect();
- } else {
+ if (!effect) {
// window could have been added to another scene manually beforehand
// remove it in that case, to avoid Qt's assert
if (window->scene() && window->scene() != scene)
@@ -1022,7 +1040,7 @@ void MSceneManagerPrivate::appearSceneWindow(MSceneWindow *window,
if (animatedTransition) {
if (!window->d_func()->appearanceAnimation)
createAppearanceAnimationForSceneWindow(window);
- window->d_func()->appearanceAnimation->start();
+ window->d_func()->appearanceAnimation->start(QAbstractAnimation::DeleteWhenStopped);
} else {
emit window->appeared();
}
@@ -1039,10 +1057,6 @@ void MSceneManagerPrivate::prepareWindowHide(MSceneWindow *window)
orientationAnimation->removeSceneWindow(window);
window->d_func()->shown = false;
- if (window->d_func()->effect) {
- window->d_func()->effect->disableEffect();
- }
-
// Check whether we are trying to hide a window while it is in the middle of
// a show animation. If that's the case, we stop it.
if (window->d_func()->appearanceAnimation) {
@@ -1092,7 +1106,7 @@ void MSceneManagerPrivate::disappearSceneWindow(MSceneWindow *window,
if (animatedTransition) {
if (!window->d_func()->disappearanceAnimation)
createDisappearanceAnimationForSceneWindow(window);
- window->d_func()->disappearanceAnimation->start();
+ window->d_func()->disappearanceAnimation->start(QAbstractAnimation::DeleteWhenStopped);
} else {
emit window->disappeared();
}
@@ -1161,15 +1175,46 @@ void MSceneManagerPrivate::createAppearanceAnimationForSceneWindow(MSceneWindow
case MSceneWindow::NotificationEvent:
case MSceneWindow::ApplicationMenu:
case MSceneWindow::NavigationBar:
- case MSceneWindow::PopupList:
- animation = new MWidgetSlideInAnimation(sceneWindow);
+ case MSceneWindow::PopupList: {
+ MWidgetSlideAnimation *slideInAnimation = new MWidgetSlideAnimation(sceneWindow);
+ slideInAnimation->setTransitionDirection(MWidgetSlideAnimation::In);
+ animation = slideInAnimation;
+ break;
+ }
+ case MSceneWindow::MessageBox: {
+ MWidgetZoomAnimation *objectMenuAnimation =
+ new MWidgetZoomAnimation(sceneWindow);
+
+ objectMenuAnimation->setOrigin(sceneWindow->boundingRect().center());
+ objectMenuAnimation->setTransitionDirection(MWidgetZoomAnimation::In);
+
+ animation = objectMenuAnimation;
break;
- default:
- animation = new MWidgetFadeInAnimation(sceneWindow);
+ }
+ case MSceneWindow::ObjectMenu: {
+ MWidgetZoomAnimation *objectMenuAnimation =
+ new MWidgetZoomAnimation(sceneWindow);
+
+ MObjectMenu *objectMenu = static_cast<MObjectMenu*>(sceneWindow);
+ objectMenuAnimation->setOrigin(rootElement->mapFromScene(objectMenu->cursorPosition()));
+ objectMenuAnimation->setTransitionDirection(MWidgetZoomAnimation::In);
+ animation = objectMenuAnimation;
break;
+ }
+ default: {
+ MWidgetFadeAnimation *fadeInAnimation = new MWidgetFadeAnimation(sceneWindow);
+ fadeInAnimation->setTransitionDirection(MWidgetFadeAnimation::In);
+ animation = fadeInAnimation;
+ break;
+ }
}
animation->setTargetWidget(sceneWindow);
+
+ MSceneWindow *effect = sceneWindow->d_func()->effect;
+ if (effect)
+ animation->addAnimation(effect->d_func()->appearanceAnimation);
+
sceneWindow->connect(animation, SIGNAL(finished()), SIGNAL(appeared()));
sceneWindow->d_func()->appearanceAnimation = animation;
}
@@ -1186,15 +1231,47 @@ void MSceneManagerPrivate::createDisappearanceAnimationForSceneWindow(MSceneWind
case MSceneWindow::NotificationEvent:
case MSceneWindow::ApplicationMenu:
case MSceneWindow::NavigationBar:
- case MSceneWindow::PopupList:
- animation = new MWidgetSlideOutAnimation(sceneWindow);
+ case MSceneWindow::PopupList: {
+ MWidgetSlideAnimation *slideOutAnimation = new MWidgetSlideAnimation(sceneWindow);
+ slideOutAnimation->setTransitionDirection(MWidgetSlideAnimation::Out);
+ animation = slideOutAnimation;
break;
- default:
- animation = new MWidgetFadeOutAnimation(sceneWindow);
+ }
+ case MSceneWindow::MessageBox: {
+ MWidgetZoomAnimation *zoomAnimation =
+ new MWidgetZoomAnimation(sceneWindow);
+
+ zoomAnimation->setOrigin(sceneWindow->boundingRect().center());
+ zoomAnimation->setTransitionDirection(MWidgetZoomAnimation::Out);
+
+ animation = zoomAnimation;
break;
+ }
+ case MSceneWindow::ObjectMenu: {
+ MWidgetZoomAnimation *zoomAnimation =
+ new MWidgetZoomAnimation(sceneWindow);
+
+ MObjectMenu *objectMenu = static_cast<MObjectMenu*>(sceneWindow);
+ zoomAnimation->setOrigin(rootElement->mapFromScene(objectMenu->cursorPosition()));
+ zoomAnimation->setTransitionDirection(MWidgetZoomAnimation::Out);
+
+ animation = zoomAnimation;
+ break;
+ }
+ default: {
+ MWidgetFadeAnimation *fadeOutAnimation = new MWidgetFadeAnimation(sceneWindow);
+ fadeOutAnimation->setTransitionDirection(MWidgetFadeAnimation::Out);
+ animation = fadeOutAnimation;
+ break;
+ }
}
animation->setTargetWidget(sceneWindow);
+
+ MSceneWindow *effect = sceneWindow->d_func()->effect;
+ if (effect)
+ animation->addAnimation(effect->d_func()->disappearanceAnimation);
+
sceneWindow->connect(animation, SIGNAL(finished()), SIGNAL(disappeared()));
sceneWindow->d_func()->disappearanceAnimation = animation;
}
diff --git a/src/corelib/scene/mscenemanager_p.h b/src/corelib/scene/mscenemanager_p.h
index af4533ed..4421b52e 100644
--- a/src/corelib/scene/mscenemanager_p.h
+++ b/src/corelib/scene/mscenemanager_p.h
@@ -34,7 +34,7 @@ class MSceneWindow;
class MSceneLayerEffect;
class MSceneManager;
class MNavigationBar;
-class MBasicOrientationAnimation;
+class MOrientationAnimation;
class MPageSwitchAnimation;
class MWindow;
@@ -125,6 +125,8 @@ public:
QRectF calculateAvailableSceneRect(MSceneWindow *window);
+ void createOrientationAnimation();
+
void createAppearanceAnimationForSceneWindow(MSceneWindow *sceneWindow);
void createDisappearanceAnimationForSceneWindow(MSceneWindow *sceneWindow);
@@ -156,7 +158,7 @@ public:
MScene *scene;
QGraphicsWidget *rootElement;
- MBasicOrientationAnimation *orientationAnimation;
+ MOrientationAnimation *orientationAnimation;
MPageSwitchAnimation *pageSwitchAnimation;
QList<MSceneWindow *> *windows;
diff --git a/src/corelib/style/manimationstyle.h b/src/corelib/style/manimationstyle.h
index e01816c6..a488c291 100644
--- a/src/corelib/style/manimationstyle.h
+++ b/src/corelib/style/manimationstyle.h
@@ -28,7 +28,7 @@ class M_EXPORT MAnimationStyle : public MStyle
M_STYLE_INTERNAL(MAnimationStyle)
};
-class MAnimationStyleContainer : public MStyleContainer
+class M_EXPORT MAnimationStyleContainer : public MStyleContainer
{
M_STYLE_CONTAINER_INTERNAL(MAnimationStyle)
};
diff --git a/src/corelib/style/mbasiclayoutanimationstyle.h b/src/corelib/style/mbasiclayoutanimationstyle.h
index 4debcc9c..12bb2ec1 100644
--- a/src/corelib/style/mbasiclayoutanimationstyle.h
+++ b/src/corelib/style/mbasiclayoutanimationstyle.h
@@ -25,18 +25,17 @@
#include <QtGlobal>
#include <QEasingCurve>
-class M_EXPORT MBasicLayoutAnimationStyle : public MLayoutAnimationStyle
+class MBasicLayoutAnimationStyle : public MLayoutAnimationStyle
{
Q_OBJECT
M_STYLE_INTERNAL(MBasicLayoutAnimationStyle)
M_STYLE_ATTRIBUTE(int, duration, Duration)
- M_STYLE_ATTRIBUTE(QEasingCurve, geometryEasingCurve, GeometryEasingCurve)
+ M_STYLE_ATTRIBUTE(QEasingCurve, xTranslationEasingCurve, XTranslationEasingCurve)
+ M_STYLE_ATTRIBUTE(QEasingCurve, yTranslationEasingCurve, YTranslationEasingCurve)
M_STYLE_ATTRIBUTE(QEasingCurve, opacityEasingCurve, OpacityEasingCurve)
M_STYLE_ATTRIBUTE(qreal, initialShowingOpacity, InitialShowingOpacity)
- M_STYLE_ATTRIBUTE(qreal, initialShowingScaleFactor, InitialShowingScaleFactor)
M_STYLE_ATTRIBUTE(qreal, finalHidingOpacity, FinalHidingOpacity)
- M_STYLE_ATTRIBUTE(qreal, finalHidingScaleFactor, FinalHidingScaleFactor)
};
// TODO: get rid of this container
diff --git a/src/corelib/style/mwidgetslideinanimationstyle.h b/src/corelib/style/mcrossfadedorientationanimationstyle.h
index 19e264d2..ab0e0964 100644
--- a/src/corelib/style/mwidgetslideinanimationstyle.h
+++ b/src/corelib/style/mcrossfadedorientationanimationstyle.h
@@ -17,27 +17,31 @@
**
****************************************************************************/
-#ifndef MWIDGETSLIDEINANIMATIONSTYLE_H
-#define MWIDGETSLIDEINANIMATIONSTYLE_H
+#ifndef MCROSSFADEDORIENTATIONANIMATIONSTYLE_H
+#define MCROSSFADEDORIENTATIONANIMATIONSTYLE_H
-#include <mabstractwidgetanimationstyle.h>
+#include <manimationstyle.h>
+
+#include <QPointF>
#include <QEasingCurve>
//! \internal
-class MWidgetSlideInAnimationStyle : public MAbstractWidgetAnimationStyle
+class MCrossFadedOrientationAnimationStyle: public MAnimationStyle
{
Q_OBJECT
- M_STYLE_INTERNAL(MWidgetSlideInAnimationStyle)
+ M_STYLE_INTERNAL(MCrossFadedOrientationAnimationStyle)
- M_STYLE_ATTRIBUTE(QString, from, From)
- M_STYLE_ATTRIBUTE(QEasingCurve, easingCurve, EasingCurve)
+ M_STYLE_ATTRIBUTE(int, duration, Duration)
+ M_STYLE_ATTRIBUTE(QPointF, rotationPoint, RotationPoint)
+ M_STYLE_ATTRIBUTE(QEasingCurve, rotationEasingCurve, RotationEasingCurve)
+ M_STYLE_ATTRIBUTE(QEasingCurve, translationEasingCurve, TranslationEasingCurve)
+ M_STYLE_ATTRIBUTE(QEasingCurve, fadingEasingCurve, FadingEasingCurve)
};
-class MWidgetSlideInAnimationStyleContainer : public MAbstractWidgetAnimationStyleContainer
+class MCrossFadedOrientationAnimationStyleContainer : public MAnimationStyleContainer
{
- M_STYLE_CONTAINER_INTERNAL(MWidgetSlideInAnimationStyle)
+ M_STYLE_CONTAINER_INTERNAL(MCrossFadedOrientationAnimationStyle)
};
//! \internal_end
#endif
-
diff --git a/src/corelib/style/mstylesheetparser.cpp b/src/corelib/style/mstylesheetparser.cpp
index 887ea32b..9282a1ff 100644
--- a/src/corelib/style/mstylesheetparser.cpp
+++ b/src/corelib/style/mstylesheetparser.cpp
@@ -264,20 +264,25 @@ QChar MStyleSheetParserPrivate::read(QFile &stream, const QString &delimeters, Q
continue;
} else if (in[0] == '/' && in[1] == '*') {
stream.read(in, 2);
+ in[1] = 0;
// multi-line comment
- int count = 0;
QString comment;
// Read until we get "*/"
while (stream.atEnd() == false) {
stream.read(in, 1);
- if (count == 0 && in[0] == '*')
- count++;
- else if (count == 1 && in[0] == '/')
+ if (in[0] == '/' && in[1] == '*') {
break;
- else {
- comment += in[0];
- count = 0;
+ } else {
+ if(in[1] == '*') {
+ comment += in[1];
+ }
+ if(in[0] == '*') {
+ in[1] = '*';
+ } else {
+ in[1] = 0;
+ comment += in[0];
+ }
}
}
//mDebug("MStyleSheetParserPrivate") << "Skipping comment:" << comment;
@@ -1202,8 +1207,11 @@ int MStyleSheetParser::getLineNum(QFile &stream, const qint64 &streamPos)
int MStyleSheetParser::getLineNum(const QString &filename, const qint64 &streamPos)
{
QFile file(filename);
- file.open(QFile::ReadOnly);
- return getLineNum(file, streamPos);
+ if ( file.open(QFile::ReadOnly) ) {
+ return getLineNum(file, streamPos);
+ } else {
+ return 0;
+ }
}
diff --git a/src/corelib/style/mwidgetfadeinanimationstyle.h b/src/corelib/style/mwidgetfadeanimationstyle.h
index e3d98b65..27fac88c 100644
--- a/src/corelib/style/mwidgetfadeinanimationstyle.h
+++ b/src/corelib/style/mwidgetfadeanimationstyle.h
@@ -17,25 +17,26 @@
**
****************************************************************************/
-#ifndef MWIDGETFADEINANIMATIONSTYLE_H
-#define MWIDGETFADEINANIMATIONSTYLE_H
+#ifndef MWIDGETFADEANIMATIONSTYLE_H
+#define MWIDGETFADEANIMATIONSTYLE_H
#include <mabstractwidgetanimationstyle.h>
#include <QEasingCurve>
//! \internal
-class M_EXPORT MWidgetFadeInAnimationStyle : public MAbstractWidgetAnimationStyle
+class MWidgetFadeAnimationStyle : public MAbstractWidgetAnimationStyle
{
Q_OBJECT
- M_STYLE_INTERNAL(MWidgetFadeInAnimationStyle)
+ M_STYLE_INTERNAL(MWidgetFadeAnimationStyle)
+ M_STYLE_ATTRIBUTE(int, delay, Delay)
M_STYLE_ATTRIBUTE(qreal, opacity, Opacity)
M_STYLE_ATTRIBUTE(QEasingCurve, easingCurve, EasingCurve)
};
-class MWidgetFadeInAnimationStyleContainer : public MAbstractWidgetAnimationStyleContainer
+class MWidgetFadeAnimationStyleContainer : public MAbstractWidgetAnimationStyleContainer
{
- M_STYLE_CONTAINER_INTERNAL(MWidgetFadeInAnimationStyle)
+ M_STYLE_CONTAINER_INTERNAL(MWidgetFadeAnimationStyle)
};
//! \internal_end
diff --git a/src/corelib/style/mwidgetfadeoutanimationstyle.h b/src/corelib/style/mwidgetslideanimationstyle.h
index 8843a589..ef419d90 100644
--- a/src/corelib/style/mwidgetfadeoutanimationstyle.h
+++ b/src/corelib/style/mwidgetslideanimationstyle.h
@@ -17,25 +17,26 @@
**
****************************************************************************/
-#ifndef MWIDGETFADEOUTANIMATIONSTYLE_H
-#define MWIDGETFADEOUTANIMATIONSTYLE_H
+#ifndef MWIDGETSLIDEANIMATIONSTYLE_H
+#define MWIDGETSLIDEANIMATIONSTYLE_H
#include <mabstractwidgetanimationstyle.h>
#include <QEasingCurve>
//! \internal
-class M_EXPORT MWidgetFadeOutAnimationStyle : public MAbstractWidgetAnimationStyle
+class MWidgetSlideAnimationStyle : public MAbstractWidgetAnimationStyle
{
Q_OBJECT
- M_STYLE_INTERNAL(MWidgetFadeOutAnimationStyle)
+ M_STYLE_INTERNAL(MWidgetSlideAnimationStyle)
- M_STYLE_ATTRIBUTE(qreal, opacity, Opacity)
+ M_STYLE_ATTRIBUTE(int, delay, Delay)
+ M_STYLE_ATTRIBUTE(QString, origin, Origin)
M_STYLE_ATTRIBUTE(QEasingCurve, easingCurve, EasingCurve)
};
-class MWidgetFadeOutAnimationStyleContainer : public MAbstractWidgetAnimationStyleContainer
+class MWidgetSlideAnimationStyleContainer : public MAbstractWidgetAnimationStyleContainer
{
- M_STYLE_CONTAINER_INTERNAL(MWidgetFadeOutAnimationStyle)
+ M_STYLE_CONTAINER_INTERNAL(MWidgetSlideAnimationStyle)
};
//! \internal_end
diff --git a/src/corelib/style/mwidgetslideoutanimationstyle.h b/src/corelib/style/mwidgetslideoutanimationstyle.h
deleted file mode 100644
index 9eaf18c1..00000000
--- a/src/corelib/style/mwidgetslideoutanimationstyle.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MWIDGETSLIDEOUTANIMATIONSTYLE_H
-#define MWIDGETSLIDEOUTANIMATIONSTYLE_H
-
-#include <mabstractwidgetanimationstyle.h>
-#include <QEasingCurve>
-
-//! \internal
-class MWidgetSlideOutAnimationStyle : public MAbstractWidgetAnimationStyle
-{
- Q_OBJECT
- M_STYLE_INTERNAL(MWidgetSlideOutAnimationStyle)
-
- M_STYLE_ATTRIBUTE(QString, to, To)
- M_STYLE_ATTRIBUTE(QEasingCurve, easingCurve, EasingCurve)
-};
-
-class MWidgetSlideOutAnimationStyleContainer : public MAbstractWidgetAnimationStyleContainer
-{
- M_STYLE_CONTAINER_INTERNAL(MWidgetSlideOutAnimationStyle)
-};
-//! \internal_end
-
-#endif
diff --git a/src/corelib/style/mwidgetstyle.h b/src/corelib/style/mwidgetstyle.h
index 8da0c637..06d20a8c 100644
--- a/src/corelib/style/mwidgetstyle.h
+++ b/src/corelib/style/mwidgetstyle.h
@@ -67,7 +67,7 @@ class M_EXPORT MWidgetStyle : public MStyle
M_STYLE_ATTRIBUTE(MFeedback, pressFeedback, PressFeedback)
M_STYLE_ATTRIBUTE(MFeedback, releaseFeedback, ReleaseFeedback)
-
+ M_STYLE_ATTRIBUTE(MFeedback, cancelFeedback, CancelFeedback)
};
class M_EXPORT MWidgetStyleContainer : public MStyleContainer
diff --git a/src/corelib/style/mwidgetzoomanimationstyle.h b/src/corelib/style/mwidgetzoomanimationstyle.h
new file mode 100644
index 00000000..0e3152a8
--- /dev/null
+++ b/src/corelib/style/mwidgetzoomanimationstyle.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef MWIDGETZOOMANIMATIONSTYLE_H
+#define MWIDGETZOOMANIMATIONSTYLE_H
+
+#include <manimationstyle.h>
+#include <QEasingCurve>
+
+//! \internal
+class MWidgetZoomAnimationStyle: public MAnimationStyle
+{
+ Q_OBJECT
+ M_STYLE_INTERNAL(MWidgetZoomAnimationStyle)
+
+ M_STYLE_ATTRIBUTE(int, opacityAnimationDelay, opacityAnimationDelay)
+ M_STYLE_ATTRIBUTE(int, opacityAnimationDuration, opacityAnimationDuration)
+ M_STYLE_ATTRIBUTE(QEasingCurve, opacityAnimationEasingCurve, OpacityAnimationEasingCurve)
+
+ M_STYLE_ATTRIBUTE(int, scaleAnimationDuration, scaleAnimationDuration)
+ M_STYLE_ATTRIBUTE(QEasingCurve, scaleAnimationEasingCurve, ScaleAnimationEasingCurve)
+
+ M_STYLE_ATTRIBUTE(int, delay, Delay)
+ M_STYLE_ATTRIBUTE(qreal, scale, Scale)
+ M_STYLE_ATTRIBUTE(qreal, opacity, Opacity)
+ M_STYLE_ATTRIBUTE(qreal, positionAnimationDistanceFactor, PositionAnimationDistanceFactor)
+};
+
+class MWidgetZoomAnimationStyleContainer : public MAnimationStyleContainer
+{
+ M_STYLE_CONTAINER_INTERNAL(MWidgetZoomAnimationStyle)
+};
+//! \internal_end
+
+#endif
+
diff --git a/src/corelib/style/mwidgetzoominanimationstyle.h b/src/corelib/style/mwidgetzoominanimationstyle.h
deleted file mode 100644
index f06e4647..00000000
--- a/src/corelib/style/mwidgetzoominanimationstyle.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MWIDGETZOOMINANIMATIONSTYLE_H
-#define MWIDGETZOOMINANIMATIONSTYLE_H
-
-#include <mabstractwidgetanimationstyle.h>
-#include <QEasingCurve>
-
-//! \internal
-class MWidgetZoomInAnimationStyle : public MAbstractWidgetAnimationStyle
-{
- Q_OBJECT
- M_STYLE_INTERNAL(MWidgetZoomInAnimationStyle)
-
- M_STYLE_ATTRIBUTE(QEasingCurve, easingCurve, EasingCurve)
-};
-
-class MWidgetZoomInAnimationStyleContainer : public MAbstractWidgetAnimationStyleContainer
-{
- M_STYLE_CONTAINER_INTERNAL(MWidgetZoomInAnimationStyle)
-};
-//! \internal_end
-
-#endif
-
diff --git a/src/corelib/style/mwidgetzoomoutanimationstyle.h b/src/corelib/style/mwidgetzoomoutanimationstyle.h
deleted file mode 100644
index e241306d..00000000
--- a/src/corelib/style/mwidgetzoomoutanimationstyle.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui@nokia.com)
-**
-** This file is part of libmeegotouch.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui@nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef MWIDGETZOOMOUTANIMATIONSTYLE_H
-#define MWIDGETZOOMOUTANIMATIONSTYLE_H
-
-#include <mabstractwidgetanimationstyle.h>
-#include <QEasingCurve>
-
-//! \internal
-class MWidgetZoomOutAnimationStyle : public MAbstractWidgetAnimationStyle
-{
- Q_OBJECT
- M_STYLE_INTERNAL(MWidgetZoomOutAnimationStyle)
-
- M_STYLE_ATTRIBUTE(QEasingCurve, easingCurve, EasingCurve)
-};
-
-class MWidgetZoomOutAnimationStyleContainer : public MAbstractWidgetAnimationStyleContainer
-{
- M_STYLE_CONTAINER_INTERNAL(MWidgetZoomOutAnimationStyle)
-};
-//! \internal_end
-
-#endif
diff --git a/src/corelib/style/style.pri b/src/corelib/style/style.pri
index 5404daa9..1ec272cd 100644
--- a/src/corelib/style/style.pri
+++ b/src/corelib/style/style.pri
@@ -25,14 +25,12 @@ MGEN_STYLE_HEADERS += \
$$STYLE_SRC_DIR/manimationstyle.h \
$$STYLE_SRC_DIR/mscenewindowanimationstyle.h \
$$STYLE_SRC_DIR/mbasiclayoutanimationstyle.h \
+ $$STYLE_SRC_DIR/mcrossfadedorientationanimationstyle.h \
$$STYLE_SRC_DIR/mgroupanimationstyle.h \
$$STYLE_SRC_DIR/mlayoutanimationstyle.h \
- $$STYLE_SRC_DIR/mwidgetfadeinanimationstyle.h \
- $$STYLE_SRC_DIR/mwidgetfadeoutanimationstyle.h \
- $$STYLE_SRC_DIR/mwidgetslideinanimationstyle.h \
- $$STYLE_SRC_DIR/mwidgetslideoutanimationstyle.h \
- $$STYLE_SRC_DIR/mwidgetzoominanimationstyle.h \
- $$STYLE_SRC_DIR/mwidgetzoomoutanimationstyle.h \
+ $$STYLE_SRC_DIR/mwidgetfadeanimationstyle.h \
+ $$STYLE_SRC_DIR/mwidgetslideanimationstyle.h \
+ $$STYLE_SRC_DIR/mwidgetzoomanimationstyle.h \
$$STYLE_SRC_DIR/mpageswitchanimationstyle.h \
$$STYLE_SRC_DIR/mbasicorientationanimationstyle.h \
diff --git a/src/corelib/theme/mcommonpixmaps.cpp b/src/corelib/theme/mcommonpixmaps.cpp
index c91aeaef..b2e9aa17 100644
--- a/src/corelib/theme/mcommonpixmaps.cpp
+++ b/src/corelib/theme/mcommonpixmaps.cpp
@@ -169,9 +169,10 @@ void MCommonPixmaps::loadOne()
}
ImageResource *resource = daemon->findImageResource(id.imageId);
- if(!resource)
+ if (resource)
+ resource->fetchPixmap(id.size);
+ else
qFatal("MCommonPixmaps - Theme daemon could not find resource %s while loading most used pixmaps! Please re-install current theme or clear the preload.list file", qPrintable(id.imageId));
- resource->fetchPixmap(id.size);
} else {
// the cpu usage was too high, so start start the timer with longer delay
diff --git a/src/corelib/theme/mtheme.cpp b/src/corelib/theme/mtheme.cpp
index 354b86b3..c01962b4 100644
--- a/src/corelib/theme/mtheme.cpp
+++ b/src/corelib/theme/mtheme.cpp
@@ -70,25 +70,23 @@ MThemePrivate::RegisteredStyleContainers MThemePrivate::styleContainers;
namespace
{
+ // "default_pixmap_MyPixmap_47_47"
+ static QString defaultPixmapCacheId(const QString &name, int width, int height)
+ {
+ return QString::fromLatin1("default_pixmap_") + name
+ + QChar::fromLatin1('_') + QString::number(width)
+ + QChar::fromLatin1('_') + QString::number(height);
+ }
-// "default_pixmap_MyPixmap_47_47"
-static QString defaultPixmapCacheId(const QString &name, int width, int height)
-{
- return QString::fromLatin1("default_pixmap_") + name
- + QChar::fromLatin1('_') + QString::number(width)
- + QChar::fromLatin1('_') + QString::number(height);
-}
-
-// "scalable_image_myscalable_5_5_5_5
-static QString scalableImageCacheId(const QString &name, int left, int top, int right, int bottom)
-{
- return QString::fromLatin1("scalable_image_") + name
- + QChar::fromLatin1('_') + QString::number(left)
- + QChar::fromLatin1('_') + QString::number(top)
- + QChar::fromLatin1('_') + QString::number(right)
- + QChar::fromLatin1('_') + QString::number(bottom);
-}
-
+ // "scalable_image_myscalable_5_5_5_5
+ static QString scalableImageCacheId(const QString &name, int left, int top, int right, int bottom)
+ {
+ return QString::fromLatin1("scalable_image_") + name
+ + QChar::fromLatin1('_') + QString::number(left)
+ + QChar::fromLatin1('_') + QString::number(top)
+ + QChar::fromLatin1('_') + QString::number(right)
+ + QChar::fromLatin1('_') + QString::number(bottom);
+ }
} // anonymous namespace
MTheme::MTheme(const QString &applicationName, const QString &, ThemeService themeService) :
@@ -369,22 +367,23 @@ const MStyle *MTheme::style(const char *styleClassName,
// find proper library
MLibrary *library = d->libraries->value(assemblyName, NULL);
- if (!library) {
+ if (library) {
+ // use stylesheet from this library if there is one
+ if (library->stylesheet()) {
+ if (!sheets.contains(library->stylesheet())) {
+ sheets.insert(0, library->stylesheet());
+ }
+ }
+ } else {
mWarning("MTheme") << "Cannot find library. You must register your library to theming using M_LIBRARY macro." << '(' << assemblyName << ')';
Q_ASSERT_X(library, "MTheme", "Failed to find library");
}
- // use stylesheet from this library if there is one
- if (library->stylesheet()) {
- if (!sheets.contains(library->stylesheet())) {
- sheets.insert(0, library->stylesheet());
- }
- }
mobj = mobj->superClass();
} while (mobj->className() != QObject::staticMetaObject.className());
// add application css
- if (d->application.stylesheet())
- sheets.append(d->application.stylesheet());
+ if (d->application->stylesheet())
+ sheets.append(d->application->stylesheet());
// add custom stylesheet
if (d->customStylesheet)
@@ -490,10 +489,18 @@ bool MTheme::hasPendingRequests()
return instance()->d_ptr->themeDaemon->hasPendingRequests();
}
+void MThemePrivate::reinit(const QString &newApplicationName, const QString &, MTheme::ThemeService)
+{
+ delete application;
+ applicationName = newApplicationName;
+ application = new MAssembly(applicationName);
+ application->themeChanged(themeDaemon->themeInheritanceChain(), logicalValues);
+}
+
MThemePrivate::MThemePrivate(const QString &applicationName, MTheme::ThemeService themeService) :
applicationName(applicationName),
customStylesheet(NULL),
- application(applicationName),
+ application(new MAssembly(applicationName)),
palette(logicalValues),
fonts(logicalValues)
#ifdef HAVE_GCONF
@@ -530,6 +537,7 @@ MThemePrivate::MThemePrivate(const QString &applicationName, MTheme::ThemeServic
MThemePrivate::~MThemePrivate()
{
+ delete application;
delete themeDaemon;
delete invalidPixmap;
delete customStylesheet;
@@ -542,7 +550,7 @@ QString MThemePrivate::determineViewClassForController(const MWidgetController *
bool exactMatch = false;
// first search from application view configuration
- QString bestMatch = application.viewType(controller, exactMatch);
+ QString bestMatch = application->viewType(controller, exactMatch);
if (exactMatch)
return bestMatch;
@@ -619,7 +627,7 @@ void MThemePrivate::refreshLocalThemeConfiguration(const QStringList &themeInher
}
// refresh application theme data
- application.themeChanged(themeInheritance, logicalValues);
+ application->themeChanged(themeInheritance, logicalValues);
// cached data is no more valid
MStyleSheet::cleanup(false);
@@ -627,13 +635,22 @@ void MThemePrivate::refreshLocalThemeConfiguration(const QStringList &themeInher
void MThemePrivate::reloadThemeLibraries(const QStringList& libraryNames)
{
+ QString libsuffix;
+
+#ifdef Q_OS_WIN
+ // under windows the libraries are suffixed with a "0",
+ // e.g. meegotouchviews0.dll, so the 0 here is needed,
+ // so that the library can be loaded under windows.
+ libsuffix = "0";
+#endif
+
// store list of libraries that needs to be unloaded
QSet<QLibrary*> toUnload = openedThemeLibraries;
// load all new libraries (if the library is already loaded, it will ref the loaded one)
openedThemeLibraries.clear();
foreach(const QString& libname, libraryNames) {
- QLibrary* library = new QLibrary(libname);
+ QLibrary* library = new QLibrary(libname + libsuffix);
if(library->load()) {
openedThemeLibraries.insert(library);
} else {
diff --git a/src/corelib/theme/mtheme.h b/src/corelib/theme/mtheme.h
index 5e881130..a17de25a 100644
--- a/src/corelib/theme/mtheme.h
+++ b/src/corelib/theme/mtheme.h
@@ -40,6 +40,7 @@ class MStyleContainer;
class MLibrary;
class MPalette;
class MDefaultFonts;
+class MComponentData;
/*!
\class MTheme
@@ -133,11 +134,11 @@ public:
\sa releaseStyle
*/
static const MStyle *style(const char *styleClassName,
- const QString &objectName,
- const QString &mode,
- const QString &type,
- M::Orientation orientation,
- const MWidgetController *parent = NULL);
+ const QString &objectName,
+ const QString &mode,
+ const QString &type,
+ M::Orientation orientation,
+ const MWidgetController *parent = NULL);
/*!
This is an overloaded function.
@@ -145,7 +146,7 @@ public:
Returns the style object with the given \a styleClassName and \a objectName
*/
static const MStyle *style(const char *styleClassName,
- const QString &objectName = "");
+ const QString &objectName = "");
/*!
This method should be called on style objects when they are no longer needed.
@@ -319,6 +320,7 @@ private:
#endif
friend class MApplicationPrivate;
+ friend class MComponentData;
friend class MWidgetController;
friend class MStyle;
diff --git a/src/corelib/theme/mtheme_p.h b/src/corelib/theme/mtheme_p.h
index bd5fe503..32bf13c3 100644
--- a/src/corelib/theme/mtheme_p.h
+++ b/src/corelib/theme/mtheme_p.h
@@ -37,6 +37,7 @@ class MLibrary;
#include "mlogicalvalues.h"
#include "mpalette.h"
#include "mdefaultfonts.h"
+#include "mtheme.h"
// TODO: remove this with style profiling
#ifndef Q_OS_WIN
@@ -105,7 +106,7 @@ public:
static QHash<QString, MLibrary *>* libraries;
- MAssembly application;
+ MAssembly *application;
MLogicalValues logicalValues;
@@ -159,6 +160,11 @@ public:
void refreshLocalThemeConfiguration(const QStringList &themeInheritance);
void reloadThemeLibraries(const QStringList& libraryNames);
+ /*!
+ * Reinitializes the theme to correspond to the new application name
+ */
+ void reinit(const QString &applicationName, const QString &imglistFilename = QString(), MTheme::ThemeService themeService = MTheme::AnyTheme);
+
static void registerStyleContainer(MStyleContainer *container);
static void unregisterStyleContainer(MStyleContainer *container);
diff --git a/src/corelib/widgets/RichTextEditorToolbar1.xml b/src/corelib/widgets/RichTextEditorToolbar1.xml
new file mode 100644
index 00000000..f86843bc
--- /dev/null
+++ b/src/corelib/widgets/RichTextEditorToolbar1.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE MEEGO_IM_TOOLBAR_WIDGET SYSTEM 'VirtualKeyboardToolbarDTD.dtd'>
+<toolbar>
+ <button name="Underline" group="Styles" priority="0" showon="always" alignment="left" icon="" text="&lt;U&gt;U&lt;&#x002F;U&gt;" text_id="">
+ <actions>
+ <sendkeysequence keysequence="Ctrl+U"> </sendkeysequence>
+ </actions>
+ </button>
+ <button name="Italic" group="Styles" priority="0" showon="always" alignment="left" icon="" text="&lt;I&gt;I&lt;&#x002F;I&gt;" text_id="">
+ <actions>
+ <sendkeysequence keysequence="Ctrl+I"> </sendkeysequence>
+ </actions>
+ </button>
+ <button name="Bold" group="Styles" priority="0" showon="always" alignment="left" icon="" text="&lt;B&gt;B&lt;&#x002F;B&gt;" text_id="">
+ <actions>
+ <sendkeysequence keysequence="Ctrl+B"> </sendkeysequence>
+ </actions>
+ </button>
+ <button name="Paste" group="ClipboardOptions" priority="0" showon="always" alignment="right" icon="" text="Paste" text_id="">
+ <actions>
+ <sendkeysequence keysequence="Ctrl+V"> </sendkeysequence>
+ </actions>
+ </button>
+ <button name="Copy" group="ClipboardOptions" priority="0" showon="always" alignment="right" icon="" text="Copy" text_id="">
+ <actions>
+ <sendkeysequence keysequence="Ctrl+C"> </sendkeysequence>
+ </actions>
+ </button>
+ <button name="Cut" group="ClipboardOptions" priority="0" showon="always" alignment="right" icon="" text="Cut" text_id="">
+ <actions>
+ <sendkeysequence keysequence="Ctrl+X"> </sendkeysequence>
+ </actions>
+ </button>
+</toolbar>
diff --git a/src/corelib/widgets/core/mwidget.cpp b/src/corelib/widgets/core/mwidget.cpp
index b050c386..ae56f7c4 100644
--- a/src/corelib/widgets/core/mwidget.cpp
+++ b/src/corelib/widgets/core/mwidget.cpp
@@ -122,18 +122,20 @@ void MWidgetPrivate::sendOnDisplayChangeEvent(MWidget *widget, const QRectF *vis
QRectF widgetSceneRect = widget->sceneBoundingRect();
- if (visibleSceneRect && visibleSceneRect->intersects(widgetSceneRect)) {
- if (visibleSceneRect->contains(widgetSceneRect)) {
- event = new MOnDisplayChangeEvent(MOnDisplayChangeEvent::FullyOnDisplay, *visibleSceneRect);
+ if (visibleSceneRect) {
+ if (visibleSceneRect->intersects(widgetSceneRect)) {
+ if (visibleSceneRect->contains(widgetSceneRect)) {
+ event = new MOnDisplayChangeEvent(MOnDisplayChangeEvent::FullyOnDisplay, *visibleSceneRect);
+ } else {
+ event = new MOnDisplayChangeEvent(MOnDisplayChangeEvent::PartiallyOnDisplay, *visibleSceneRect);
+ }
} else {
- event = new MOnDisplayChangeEvent(MOnDisplayChangeEvent::PartiallyOnDisplay, *visibleSceneRect);
+ event = new MOnDisplayChangeEvent(MOnDisplayChangeEvent::FullyOffDisplay, *visibleSceneRect);
}
- } else {
- event = new MOnDisplayChangeEvent(MOnDisplayChangeEvent::FullyOffDisplay, *visibleSceneRect);
- }
- q->scene()->sendEvent(widget, event);
- delete event;
+ q->scene()->sendEvent(widget, event);
+ delete event;
+ }
}
void MWidgetPrivate::resolveIsOnDisplay(QGraphicsItem *item, const QRectF *visibleSceneRect)
@@ -319,6 +321,7 @@ void MWidget::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
if (hasObjectMenuActions) {
MObjectMenu *menu = new MObjectMenu(this);
+ menu->setCursorPosition(event->scenePos());
sceneManager()->appearSceneWindow(menu, MSceneWindow::DestroyWhenDone);
} else {
event->ignore();
@@ -455,3 +458,12 @@ void MWidget::setVisible(bool visible)
QGraphicsWidget::setVisible(visible);
}
+QPointF MWidget::paintOffset() const
+{
+ return QPointF(transform().dx(), transform().dy());
+}
+
+void MWidget::setPaintOffset(const QPointF &newOffset)
+{
+ setTransform(QTransform::fromTranslate(newOffset.x(), newOffset.y()));
+}
diff --git a/src/corelib/widgets/core/mwidget.h b/src/corelib/widgets/core/mwidget.h
index 4ea2ad62..5756e230 100644
--- a/src/corelib/widgets/core/mwidget.h
+++ b/src/corelib/widgets/core/mwidget.h
@@ -46,6 +46,8 @@ class M_EXPORT MWidget : public QGraphicsWidget
Q_PROPERTY(QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy)
Q_PROPERTY(bool selected READ isSelected WRITE setSelected)
+ Q_PROPERTY(bool onDisplay READ isOnDisplay)
+ Q_PROPERTY(QPointF paintOffset READ paintOffset WRITE setPaintOffset)
public:
MWidget(QGraphicsItem *parent = 0);
@@ -76,6 +78,9 @@ public:
* Returning false means that currently this widget cannot be seen
* on the display in any way. E.g.: If the widget happens to be out of sight of all the
* QGraphicsViews that are rendering his scene.
+ *
+ * Its computational cost is significantly higher than that of a simple attribute
+ * getter such as isVisible().
*/
bool isOnDisplay() const;
@@ -85,6 +90,31 @@ public:
*/
bool isSelected() const;
+ /*!
+ Returns the offset by which the widget will be transformed when painted.
+
+ This convenience function is equivalent to querying the horizontal and
+ vertical translation factors of the widgets's transform().
+
+ \sa setPaintOffset()
+ */
+ QPointF paintOffset() const;
+
+ /*!
+ Sets the offset by which the widget will be transformed when painted.
+
+ This convenience function is equivalent to calling setTransform on the widget,
+ supplying a QTransform that shifts the widget by \a offset.
+
+ The paint offset allows for a widget to appear as if in a position
+ different than that of the widget's pos() property. This allows for example
+ to animate the widget's apparent location using a QPropertyAnimation
+ without affecting layouting or the layout affecting the animation.
+
+ \sa paintOffset()
+ */
+ void setPaintOffset(const QPointF & offset);
+
/*! \reimp
* We reimplement these to distinguish between the user hiding items
* explicitly, and the layout hiding them.
diff --git a/src/corelib/widgets/core/mwidgetcontroller.h b/src/corelib/widgets/core/mwidgetcontroller.h
index 1c12e72a..9836c65d 100644
--- a/src/corelib/widgets/core/mwidgetcontroller.h
+++ b/src/corelib/widgets/core/mwidgetcontroller.h
@@ -43,7 +43,7 @@ class MAbstractWidgetAnimation;
stores the widget's state in the model and delegates painting and event handling to the view.
Although the controller provides methods to set the view and model components, widgets derived from MWidgetController
- always provide an already initalised model while a view is constructed at the time it is needed unless otherwise explicitly
+ always provide an already initialised model while a view is constructed at the time it is needed unless otherwise explicitly
set.
*/
diff --git a/src/corelib/widgets/core/mwidgetview.cpp b/src/corelib/widgets/core/mwidgetview.cpp
index d8601a72..d2518ac0 100644
--- a/src/corelib/widgets/core/mwidgetview.cpp
+++ b/src/corelib/widgets/core/mwidgetview.cpp
@@ -366,6 +366,8 @@ void MWidgetView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void MWidgetView::cancelEvent(MCancelEvent *event)
{
+ style()->cancelFeedback().play();
+
Q_UNUSED(event);
}
diff --git a/src/corelib/widgets/mabstractcellcreator.cpp b/src/corelib/widgets/mabstractcellcreator.cpp
index 929f6ded..0a9539ba 100644
--- a/src/corelib/widgets/mabstractcellcreator.cpp
+++ b/src/corelib/widgets/mabstractcellcreator.cpp
@@ -19,3 +19,13 @@
#include "mabstractcellcreator.h"
+// this hack is needed, because under windows
+// the template symbols are not exported...
+#ifdef Q_OS_WIN
+#include "mcontentitem.h"
+#include "mimagewidget.h"
+#include "mwidgetcontroller.h"
+template class MAbstractCellCreator<MContentItem>;
+template class MAbstractCellCreator<MImageWidget>;
+template class MAbstractCellCreator<MWidgetController>;
+#endif
diff --git a/src/corelib/widgets/mapplicationpage.h b/src/corelib/widgets/mapplicationpage.h
index e0067360..5d8de699 100644
--- a/src/corelib/widgets/mapplicationpage.h
+++ b/src/corelib/widgets/mapplicationpage.h
@@ -75,6 +75,42 @@ class MPannableViewport;
\endcode
centralWidget() returns MWidget, layout can be used to group more than one widget.
+
+ \section navigating-between-pages Navigating between pages.
+
+ Only one page can be displayed at any given time. The framework enforces this behavior.
+ Thus in order to make your application navigate to a child page all you have to do is
+ call the child's appear() method. That will automatically make the current page disappear
+ to make room for the child page that is starting to appear.
+
+ In an hypothetical music browser application, the following code snippet
+ would make it transition from the current album page to a child page displaying
+ one of its songs:
+
+ \code
+ class AlbumPage : public MApplicationPage {
+ ...
+ void displaySong(Song song) {
+ MApplicationPage *songPage = new SongPage(song);
+
+ // I don't need this page anymore after it gets dismissed
+ songPage->appear(MSceneWindow::DestroyWhenDismissed);
+ }
+ ...
+ };
+ \endcode
+
+ The code above will put AlbumPage onto the top of the page history's stack and make
+ SongPage be displayed. Since the escapeMode of the SongPage is MApplicationPageModel::EscapeAuto
+ (the default value) the escape button panel will automatically show a back button that, when clicked,
+ will bring the application back to the AlbumPage. Therefore no code is required to make your
+ application navigate back to its previous page.
+
+ To implement a different behavior for the escape button you have set the escapeMode of the page to either
+ MApplicationPageModel::EscapeManualBack or MApplicationPageModel::EscapeCloseWindow.
+
+ You can also check and manually modify the page navigation history of your application using the methods
+ MSceneManager::pageHistory() and MSceneManager::setPageHistory().
*/
class M_EXPORT MApplicationPage : public MSceneWindow
diff --git a/src/corelib/widgets/mapplicationwindow.cpp b/src/corelib/widgets/mapplicationwindow.cpp
index 70e8eac8..0d58e98c 100644
--- a/src/corelib/widgets/mapplicationwindow.cpp
+++ b/src/corelib/widgets/mapplicationwindow.cpp
@@ -41,6 +41,7 @@
#include "mapplication_p.h"
#include "mscene.h"
#include "mstatusbar.h"
+#include "mdeviceprofile.h"
#include <QList>
#include <QEvent>
@@ -83,12 +84,19 @@ MApplicationWindowPrivate::MApplicationWindowPrivate()
, homeButtonPanel(new MHomeButtonPanel)
, escapeButtonPanel(new MEscapeButtonPanel)
, menu(new MApplicationMenu)
- , statusBar(new MStatusBar)
, isMenuOpen(false)
- , callOngoing(false)
+#ifdef HAVE_CONTEXTSUBSCRIBER
+ , callStatusProperty("Phone.Call")
+#endif
, showingStatusBar(false)
, showingDockWidget(false)
{
+ if(MDeviceProfile::instance()->showStatusbar()) {
+ statusBar = new MStatusBar;
+ }
+ else{
+ statusBar = NULL;
+ }
}
MApplicationWindowPrivate::~MApplicationWindowPrivate()
@@ -141,7 +149,7 @@ void MApplicationWindowPrivate::init()
q->connect(menu, SIGNAL(disappeared()),
q, SLOT(_q_menuDisappeared()));
- if (!MApplication::fullScreen()) {
+ if (!MApplication::fullScreen() && statusBar ) {
sceneManager->appearSceneWindowNow(statusBar);
}
@@ -163,16 +171,9 @@ void MApplicationWindowPrivate::init()
initAutoHideComponentsTimer();
-#ifdef HAVE_DBUS
- // TODO: Take that info from Context Framework instead,
- // once it becomes available.
- // Initialization of callOngoing variable is missing at the moment.
- QDBusConnection systemBus(QDBusConnection::systemBus());
- systemBus.connect("", "/com/nokia/csd/csnet",
- "com.nokia.csd.CSNet", "ActivityChanged", q,
- SLOT(_q_updateCallOngoingState(QString)));
+#ifdef HAVE_CONTEXTSUBSCRIBER
+ q->connect(&callStatusProperty, SIGNAL(valueChanged()), SLOT(_q_updateStatusBarVisibility()));
#endif
-
q->connect(q, SIGNAL(orientationAngleChanged(M::OrientationAngle)),
SLOT(_q_updatePageExposedContentRect()));
}
@@ -214,33 +215,36 @@ void MApplicationWindowPrivate::initAutoHideComponentsTimer()
void MApplicationWindowPrivate::windowStateChangeEvent(QWindowStateChangeEvent *event)
{
Q_Q(MApplicationWindow);
- Q_ASSERT(statusBar != 0);
+ if (!statusBar)
+ return;
// Status bar should always be visible while a phone call is ongoing.
- if (!callOngoing) {
- if (q->isFullScreen() && !event->oldState().testFlag(Qt::WindowFullScreen)) {
- q->sceneManager()->disappearSceneWindowNow(statusBar);
- } else if (!q->isFullScreen() && event->oldState().testFlag(Qt::WindowFullScreen)) {
- q->sceneManager()->appearSceneWindowNow(statusBar);
- }
+#ifdef HAVE_CONTEXTSUBSCRIBER
+ if (callStatusProperty.value().toString() == "active")
+ return;
+#endif
+
+ if (q->isFullScreen() && !event->oldState().testFlag(Qt::WindowFullScreen)) {
+ q->sceneManager()->disappearSceneWindowNow(statusBar);
+ } else if (!q->isFullScreen() && event->oldState().testFlag(Qt::WindowFullScreen)) {
+ q->sceneManager()->appearSceneWindowNow(statusBar);
}
}
-#ifdef HAVE_DBUS
-void MApplicationWindowPrivate::_q_updateCallOngoingState(QString mode)
+#ifdef HAVE_CONTEXTSUBSCRIBER
+void MApplicationWindowPrivate::_q_updateStatusBarVisibility()
{
Q_Q(MApplicationWindow);
-
+ if (!statusBar)
+ return;
// Status bar should always be visible while a phone call is ongoing.
- if (mode == "Call") {
- callOngoing = true;
- if (q->isFullScreen())
+ if (q->isFullScreen()) {
+ if (callStatusProperty.value().toString() == "active") {
q->sceneManager()->appearSceneWindowNow(statusBar);
- } else if (callOngoing) {
- callOngoing = false;
- if (q->isFullScreen())
+ } else {
q->sceneManager()->disappearSceneWindowNow(statusBar);
+ }
}
}
#endif
@@ -588,6 +592,8 @@ void MApplicationWindowPrivate::sceneWindowAppearEvent(MSceneWindowEvent *event)
break;
case MSceneWindow::StatusBar:
+ if (!statusBar)
+ return;
showingStatusBar = true;
_q_updatePageExposedContentRect();
break;
@@ -617,6 +623,8 @@ void MApplicationWindowPrivate::sceneWindowDisappearEvent(MSceneWindowEvent *eve
break;
case MSceneWindow::StatusBar:
+ if(!statusBar)
+ return;
showingStatusBar = false;
_q_updatePageExposedContentRect();
break;
@@ -649,7 +657,8 @@ void MApplicationWindowPrivate::applicationPageAppearEvent(MSceneWindowEvent *ev
Q_ASSERT(pageFromEvent != page);
if (page != 0) {
- menu->disappear();
+ if (menu->isVisible())
+ menu->disappear();
disconnectPage(page);
}
@@ -664,7 +673,8 @@ void MApplicationWindowPrivate::applicationPageDisappearEvent(MSceneWindowEvent
// Page is going away. Let's disconnect it if it's the current page.
if (pageFromEvent == page) {
- menu->disappear();
+ if (menu->isVisible())
+ menu->disappear();
disconnectPage(pageFromEvent);
}
}
@@ -1040,6 +1050,8 @@ void MApplicationWindow::mouseReleaseEvent(QMouseEvent *event)
Q_D(MApplicationWindow);
MSceneWindow *component;
+ MWindow::mouseReleaseEvent(event);
+
if (d->componentsOnAutoHide.count() > 0) {
const int count = d->componentsOnAutoHide.count();
for (int i = 0; i < count; ++i) {
@@ -1063,8 +1075,6 @@ void MApplicationWindow::mouseReleaseEvent(QMouseEvent *event)
closeMenu();
}
}
-
- MWindow::mouseReleaseEvent(event);
}
#include "moc_mapplicationwindow.cpp"
diff --git a/src/corelib/widgets/mapplicationwindow.h b/src/corelib/widgets/mapplicationwindow.h
index e68dd8f6..37c360e1 100644
--- a/src/corelib/widgets/mapplicationwindow.h
+++ b/src/corelib/widgets/mapplicationwindow.h
@@ -170,8 +170,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_handlePageModelModifications(const QList<const char *>&))
Q_PRIVATE_SLOT(d_func(), void _q_menuAppeared())
Q_PRIVATE_SLOT(d_func(), void _q_menuDisappeared())
-#ifdef HAVE_DBUS
- Q_PRIVATE_SLOT(d_func(), void _q_updateCallOngoingState(QString))
+#ifdef HAVE_CONTEXTSUBSCRIBER
+ Q_PRIVATE_SLOT(d_func(), void _q_updateStatusBarVisibility())
#endif
#ifdef HAVE_N900
Q_PRIVATE_SLOT(d_func(), void _q_exitAppView())
diff --git a/src/corelib/widgets/mapplicationwindow_p.h b/src/corelib/widgets/mapplicationwindow_p.h
index 84bb9978..7eeb4fa9 100644
--- a/src/corelib/widgets/mapplicationwindow_p.h
+++ b/src/corelib/widgets/mapplicationwindow_p.h
@@ -27,6 +27,10 @@
#include <QPointer>
#include <QTimer>
+#ifdef HAVE_CONTEXTSUBSCRIBER
+# include "contextproperty.h"
+#endif
+
class QGraphicsItemAnimation;
class QTimeLine;
class MScene;
@@ -61,7 +65,10 @@ public:
QTimer autoHideComponentsTimer;
QList<MSceneWindow *> componentsOnAutoHide;
bool isMenuOpen;
- bool callOngoing;
+
+#ifdef HAVE_CONTEXTSUBSCRIBER
+ ContextProperty callStatusProperty;
+#endif
// TODO: Use some API like "bool MSceneWindow::isAppearing()" or something,
// once it becomes available, instead of manually tracking the scene windows
@@ -132,8 +139,8 @@ public:
void _q_handlePageModelModifications(const QList<const char *>&);
void _q_menuAppeared();
void _q_menuDisappeared();
-#ifdef HAVE_DBUS
- void _q_updateCallOngoingState(QString mode);
+#ifdef HAVE_CONTEXTSUBSCRIBER
+ void _q_updateStatusBarVisibility();
#endif
#ifdef HAVE_N900
void _q_exitAppView();
diff --git a/src/corelib/widgets/mbutton.cpp b/src/corelib/widgets/mbutton.cpp
index 8b5e9d7f..b71b263a 100644
--- a/src/corelib/widgets/mbutton.cpp
+++ b/src/corelib/widgets/mbutton.cpp
@@ -118,12 +118,21 @@ QString MButton::toggledIconID() const
return model()->toggledIconID();
}
+void MButton::setIcon(const QIcon &icon)
+{
+ model()->setIcon(icon);
+}
+
+QIcon MButton::icon() const
+{
+ return model()->icon();
+}
+
void MButton::setText(const QString &text)
{
model()->setText(text);
}
-
QString MButton::text() const
{
return model()->text();
diff --git a/src/corelib/widgets/mbutton.h b/src/corelib/widgets/mbutton.h
index c6cf99d8..f4bde0cf 100644
--- a/src/corelib/widgets/mbutton.h
+++ b/src/corelib/widgets/mbutton.h
@@ -163,6 +163,12 @@ class M_EXPORT MButton : public MWidgetController
Q_PROPERTY(QString toggledIconID READ toggledIconID WRITE setToggledIconID)
/*!
+ \property MButton::icon
+ \brief See MButtonModel::icon
+ */
+ Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
+
+ /*!
\property MButton::textVisible
\brief See MButtonModel::textVisible
*/
@@ -256,6 +262,20 @@ public:
QString toggledIconID() const;
/*!
+ \brief Sets the \a icon of the button.
+
+ \sa icon(), setIconVisible(), setIconID()
+ */
+ void setIcon(const QIcon &icon);
+
+ /*!
+ \brief Returns the icon of the button.
+
+ \sa setIcon()
+ */
+ QIcon icon() const;
+
+ /*!
\brief Returns the text of the button.
If the button has no text, the text() function will return an empty string.
diff --git a/src/corelib/widgets/mbuttongroup.cpp b/src/corelib/widgets/mbuttongroup.cpp
index 6e06f8e7..9fee5927 100644
--- a/src/corelib/widgets/mbuttongroup.cpp
+++ b/src/corelib/widgets/mbuttongroup.cpp
@@ -27,7 +27,8 @@
MButtonGroupPrivate::MButtonGroupPrivate()
: checkedButton(0),
- exclusive(true)
+ exclusive(true),
+ q_ptr(0)
{
}
diff --git a/src/corelib/animation/scene/mscenewindowanimation_p.h b/src/corelib/widgets/mbuttonmodel.cpp
index 812ffae4..7e87518c 100644
--- a/src/corelib/animation/scene/mscenewindowanimation_p.h
+++ b/src/corelib/widgets/mbuttonmodel.cpp
@@ -17,18 +17,15 @@
**
****************************************************************************/
-#ifndef MSCENEWINDOWANIMATION_P_H
-#define MSCENEWINDOWANIMATION_P_H
+#include "mbuttonmodel.h"
-#include "mgroupanimation_p.h"
-
-class MSceneWindow;
-
-class MSceneWindowAnimationPrivate : public MGroupAnimationPrivate
+const QIcon& MButtonModel::icon() const
{
- Q_DECLARE_PUBLIC(MSceneWindowAnimation)
-public:
- MSceneWindow *sceneWindow;
-};
+ return _icon();
+}
-#endif
+void MButtonModel::setIcon(const QIcon& icon)
+{
+ _icon() = icon;
+ memberModified(Icon);
+}
diff --git a/src/corelib/widgets/mbuttonmodel.h b/src/corelib/widgets/mbuttonmodel.h
index 368bab16..afeb9abe 100644
--- a/src/corelib/widgets/mbuttonmodel.h
+++ b/src/corelib/widgets/mbuttonmodel.h
@@ -21,6 +21,7 @@
#define MBUTTONMODEL_H
#include <mwidgetmodel.h>
+#include <QIcon>
/*!
\class MButtonModel
@@ -36,17 +37,23 @@ class M_EXPORT MButtonModel : public MWidgetModel
/*!
\property MButtonModel::iconID
- \brief Id of the icon that is displayed whe a non-toggled button.
+ \brief ID of the icon that is displayed for a non-toggled button.
*/
M_MODEL_PROPERTY(QString, iconID, IconID, true, QString())
/*!
\property MButtonModel::toggledIconID
- \brief Id of the icon that is displayed when button is in toggled/down state.
+ \brief ID of the icon that is displayed when the button is in toggled/down state.
*/
M_MODEL_PROPERTY(QString, toggledIconID, ToggledIconID, true, QString::null)
/*!
+ \property MButtonModel::icon
+ \brief QIcon that is displayed for the button.
+ */
+ M_MODEL_PROPERTY(QIcon, icon, Icon, false, QIcon())
+
+ /*!
\property MButtonModel::text
\brief Text of the button.
*/
diff --git a/src/corelib/widgets/mcontentitem.cpp b/src/corelib/widgets/mcontentitem.cpp
index 10b64829..c06b4e6e 100644
--- a/src/corelib/widgets/mcontentitem.cpp
+++ b/src/corelib/widgets/mcontentitem.cpp
@@ -22,21 +22,23 @@
#include "mcontentitem.h"
#include "mcontentitem_p.h"
#include "mcontentitemmodel.h"
-#include <QDebug>
#include "mwidgetcreator.h"
#include <mprogressindicator.h>
#include <mlabel.h>
+
M_REGISTER_WIDGET(MContentItem)
MContentItemPrivate::MContentItemPrivate():
MWidgetControllerPrivate(),
- smallItem(0)
+ smallText(0)
{
}
MContentItemPrivate::~MContentItemPrivate()
{
+ if (smallText)
+ delete smallText;
}
MContentItem::MContentItem(MContentItem::ContentItemStyle itemStyle, QGraphicsItem *parent)
@@ -101,6 +103,13 @@ void MContentItem::setImage(const QImage &image)
model()->setItemImage(d->image);
}
+void MContentItem::setImage(const QString &id)
+{
+ Q_D(MContentItem);
+ d->imageID = id;
+ model()->setItemImageID(d->imageID);
+}
+
void MContentItem::setTitle(const QString &text)
{
model()->setTitle(text);
@@ -177,20 +186,29 @@ void MContentItem::enableProgressBar()
void MContentItem::setSmallItem(MWidget* widget)
{
Q_D(MContentItem);
- d->smallItem = widget;
+
+ if (d->smallText) {
+ delete d->smallText;
+ d->smallText = 0;
+ }
+ model()->setSmallItem(widget);
}
MWidget* MContentItem::smallItem() const
{
- Q_D(const MContentItem);
- return d->smallItem;
+ return model()->smallItem();
}
void MContentItem::setSmallText(QString text)
{
Q_D(MContentItem);
- MLabel* label = new MLabel(text);
- label->setAlignment( Qt::AlignRight );
- d->smallItem = label;
+
+ if (d->smallText) {
+ d->smallText->setText(text);
+ } else {
+ d->smallText = new MLabel(text);
+ d->smallText->setAlignment( Qt::AlignRight );
+ model()->setSmallItem(d->smallText);
+ }
}
diff --git a/src/corelib/widgets/mcontentitem.h b/src/corelib/widgets/mcontentitem.h
index 5ac1c69f..7734375a 100644
--- a/src/corelib/widgets/mcontentitem.h
+++ b/src/corelib/widgets/mcontentitem.h
@@ -39,10 +39,14 @@ class MContentItemPrivate;
queried via isSelected() function.
MContentItem provides the following styles:
- \li ContentItemStyle::IconAndTwoTextLabels
- \li ContentItemStyle::SingleTextLabel
- \li ContentItemStyle::IconAndSingleTextLabel
- \li ContentItemStyle::TwoTextLabels
+ \li MContentItem::IconAndTwoTextLabels
+ \li MContentItem::SingleTextLabel
+ \li MContentItem::IconAndSingleTextLabel
+ \li MContentItem::TwoTextLabels
+ \li MContentItem::SingleIcon
+ \li MContentItem::IconAndSingleTextLabelVertical
+ \li MContentItem::IconAndTwoTextLabelsVertical
+ \li MContentItem::TwoIconsTwoWidgets
MContentItem can be in one of the modes provided by ContentItemMode enumeration.
For each mode there is a dedicated graphics which is up to the view to show. The purpose of mode is to indicate
@@ -57,7 +61,7 @@ class M_EXPORT MContentItem : public MWidgetController
public:
/*!
- ContentItemStyle indicates how text and thumbnail should be shown. There are 4 predefined layouts.
+ ContentItemStyle indicates how text and thumbnail should be shown. There are 8 predefined layouts.
Exact look and feel depends on the view.
\sa MContentItemView
@@ -223,6 +227,12 @@ public Q_SLOTS:
void setImage(const QImage &pixmap);
/**
+ \brief Sets thumbnail image.
+ \param id, image id in theme system.
+ */
+ void setImage(const QString &id);
+
+ /**
\brief Set title text. This is first line.
\param text text.
*/
diff --git a/src/corelib/widgets/mcontentitem_p.h b/src/corelib/widgets/mcontentitem_p.h
index e5e6cfe3..0f9c4be4 100644
--- a/src/corelib/widgets/mcontentitem_p.h
+++ b/src/corelib/widgets/mcontentitem_p.h
@@ -23,6 +23,7 @@
#include "private/mwidgetcontroller_p.h"
#include <QPixmap>
#include <QImage>
+#include <MLabel>
class MContentItemPrivate : public MWidgetControllerPrivate
{
@@ -32,9 +33,10 @@ public:
QPixmap pixmap;
QImage image;
+ QString imageID;
QPixmap optionalPixmap;
QImage optionalImage;
- MWidget* smallItem;
+ MLabel* smallText;
};
#endif
diff --git a/src/corelib/widgets/mcontentitemmodel.h b/src/corelib/widgets/mcontentitemmodel.h
index b65392d0..6a182ac5 100644
--- a/src/corelib/widgets/mcontentitemmodel.h
+++ b/src/corelib/widgets/mcontentitemmodel.h
@@ -77,6 +77,8 @@ public:
M_MODEL_PROPERTY(QImage, itemQImage, ItemQImage, false, QImage())
+ M_MODEL_PROPERTY(QString, itemImageID, ItemImageID, true, QString())
+
/*!
\property MContentItemModel::selected
\brief Contains selection status of item.
@@ -101,6 +103,12 @@ public:
In case there is already a subtitle it will be replaced.
*/
M_MODEL_PTR_PROPERTY(MWidget*, additionalItem, AdditionalItem, true, NULL)
+
+ /*!
+ \property MContentItemModel::smallItem
+ \brief MWidget as e.g. progress bar, visible on the lower right corner
+ */
+ M_MODEL_PTR_PROPERTY(MWidget*, smallItem, SmallItem, true, NULL)
};
#endif
diff --git a/src/corelib/widgets/mdialog.cpp b/src/corelib/widgets/mdialog.cpp
index 8135b9d9..993b02f6 100644
--- a/src/corelib/widgets/mdialog.cpp
+++ b/src/corelib/widgets/mdialog.cpp
@@ -186,7 +186,7 @@ bool MDialogPrivate::prepareStandAloneAppearance(MSceneWindow::DeletionPolicy po
standAloneWindow->setTranslucentBackground(true);
#ifdef Q_WS_X11
standAloneWindow->setAttribute(Qt::WA_X11NetWmWindowTypeDialog, true);
- XSetTransientForHint(QX11Info::display(), standAloneWindow->winId(), MApplication::activeWindow()->winId());
+ standAloneWindow->setWindowModality(Qt::WindowModal);
#endif
q->connect(q, SIGNAL(disappeared()), SLOT(_q_onStandAloneDialogDisappeared()));
}
@@ -405,6 +405,12 @@ void MDialog::accept()
void MDialog::reject()
{
+ Q_D(MDialog);
+
+ QObject *sender= QObject::sender();
+ if (sender != 0 && sender->objectName() == "MDialogCloseButton") {
+ d->clickedButton = 0;
+ }
done(Rejected);
}
diff --git a/src/corelib/widgets/mdialog.h b/src/corelib/widgets/mdialog.h
index 251de0c5..a41155ef 100644
--- a/src/corelib/widgets/mdialog.h
+++ b/src/corelib/widgets/mdialog.h
@@ -43,7 +43,7 @@ class MDismissEvent;
A MDialog is comprised by three components:
- \li A title bar containig a title text, a progress indicator and a close button.
+ \li A title bar containing a title text, a progress indicator and a close button.
The close button, the progress indicator or the entire title bar can be hidden.
The progress indicator is hidden by default.
\li A customizable central widget, that is meant to contain either the message or query
@@ -122,7 +122,8 @@ class MDismissEvent;
centralWidget,
M::OkButton | M::ResetButton);
- dialog->exec();
+ connect(dialog, SIGNAL(disappeared()), SLOT(processDialogResult()));
+ dialog->appear();
\endcode
Constructing a question dialog, it is easier to use MMessageBox instead:
@@ -130,7 +131,8 @@ class MDismissEvent;
MDialog* dialog = new MDialog("Question",
new MLabel("Lorem ipsum dolor sit amet?"),
M::YesButton | M::NoButton);
- dialog->exec();
+ connect(dialog, SIGNAL(disappeared()), SLOT(processDialogResult()));
+ dialog->appear();
\endcode
\sa MDialogView, MDialogStyle
@@ -486,6 +488,12 @@ public Q_SLOTS:
* If the dialog was dismissed with either accept() or reject() (or the equivalent done()
* calls), a DialogCode result is returned instead.
*
+ * \warning Usage of this method is discouraged as running a local event loop can
+ * lead to hard-to-predict code paths and therefore is likely to cause
+ * bugs. See <a href="http://labs.trolltech.com/blogs/2010/02/23/unpredictable-exec/">Unpredictable exec()</a>
+ * article for more info. Instead, summon the dialog with appear() and
+ * process its result upon the emission of its disappeared() signal.
+ *
* \sa StandardButton, setSystemModal()
*/
int exec(MWindow *window = 0);
diff --git a/src/corelib/widgets/mimagewidget.cpp b/src/corelib/widgets/mimagewidget.cpp
index 1040256b..519347bd 100644
--- a/src/corelib/widgets/mimagewidget.cpp
+++ b/src/corelib/widgets/mimagewidget.cpp
@@ -38,7 +38,6 @@ MImageWidgetPrivate::MImageWidgetPrivate()
MImageWidgetPrivate::~MImageWidgetPrivate()
{
-
cleanUp();
}
@@ -76,11 +75,12 @@ MImageWidgetPrivate &MImageWidgetPrivate::operator=(const MImageWidgetPrivate &o
if (other.deletePixmap)
pixmap = new QPixmap(*(other.pixmap));
else
- setImageName(other.imageName);
+ setImageName(other.imageName, other.pixmap->size());
}
- deletePixmap = other.deletePixmap;
+ deletePixmap = other.deletePixmap;
imageName = other.imageName;
+
return *this;
}
@@ -162,7 +162,9 @@ void MImageWidget::setImage(const QString &id, const QSize &s)
{
Q_D(MImageWidget);
d->setImageName(id, s);
-
+
+ model()->setCrop(QRect());
+
update();
}
@@ -316,6 +318,8 @@ void MImageWidget::setImage(const QString &id)
Q_D(MImageWidget);
d->setImageName(id);
+ model()->setCrop(QRect());
+
update();
}
@@ -327,6 +331,8 @@ void MImageWidget::setImage(const QImage &image)
d->pixmap = new QPixmap(QPixmap::fromImage(image));
d->deletePixmap = true;
+ model()->setCrop(QRect());
+
update();
}
@@ -338,6 +344,7 @@ void MImageWidget::setPixmap(const QPixmap &pixmap)
d->pixmap = new QPixmap(pixmap);
d->deletePixmap = true;
+ model()->setCrop(QRect());
+
update();
}
-
diff --git a/src/corelib/widgets/mlabel.cpp b/src/corelib/widgets/mlabel.cpp
index 0b5362c8..8e7d04e1 100644
--- a/src/corelib/widgets/mlabel.cpp
+++ b/src/corelib/widgets/mlabel.cpp
@@ -32,11 +32,13 @@ M_REGISTER_WIDGET(MLabel)
MLabel::MLabel(QGraphicsItem *parent, MLabelModel *model) :
MWidgetController(new MLabelPrivate, model == NULL ? new MLabelModel : model, parent)
{
+ grabGesture(Qt::TapAndHoldGesture);
}
MLabel::MLabel(QString const &text, QGraphicsItem *parent) :
MWidgetController(new MLabelPrivate, new MLabelModel, parent)
{
+ grabGesture(Qt::TapAndHoldGesture);
setText(text);
}
@@ -167,6 +169,6 @@ void MLabel::removeHighlighter(MLabelHighlighter *highlighter)
void MLabel::removeAllHighlighters()
{
- model()->setHighlighters(MLabelHighlighterList());
+ model()->setHighlighters(QList<MLabelHighlighter *>());
}
diff --git a/src/corelib/widgets/mlabel.h b/src/corelib/widgets/mlabel.h
index 6352081e..9338f228 100644
--- a/src/corelib/widgets/mlabel.h
+++ b/src/corelib/widgets/mlabel.h
@@ -27,8 +27,6 @@ class MLabelPrivate;
class MLabelHighlighter;
class QString;
-Q_DECLARE_METATYPE(QTextOption::WrapMode)
-
/*!
\class MLabel
\brief MLabel provides functionality for displaying text.
diff --git a/src/corelib/widgets/mlabelmodel.cpp b/src/corelib/widgets/mlabelmodel.cpp
index 05935c6d..51075cea 100644
--- a/src/corelib/widgets/mlabelmodel.cpp
+++ b/src/corelib/widgets/mlabelmodel.cpp
@@ -21,7 +21,7 @@
void MLabelModel::addHighlighter(MLabelHighlighter *highlighter)
{
- MLabelHighlighterList &list = _highlighters();
+ QList<MLabelHighlighter *> &list = _highlighters();
if (list.indexOf(highlighter) == -1) {
list.append(highlighter);
memberModified(Highlighters);
@@ -30,7 +30,7 @@ void MLabelModel::addHighlighter(MLabelHighlighter *highlighter)
void MLabelModel::removeHighlighter(MLabelHighlighter *highlighter)
{
- MLabelHighlighterList &list = _highlighters();
+ QList<MLabelHighlighter *> &list = _highlighters();
if (list.removeOne(highlighter))
memberModified(Highlighters);
}
diff --git a/src/corelib/widgets/mlabelmodel.h b/src/corelib/widgets/mlabelmodel.h
index fd5ff894..e80140aa 100644
--- a/src/corelib/widgets/mlabelmodel.h
+++ b/src/corelib/widgets/mlabelmodel.h
@@ -20,11 +20,13 @@
#ifndef MLABELMODEL_H
#define MLABELMODEL_H
-#include <mwidgetmodel.h>
#include <QApplication>
+#include <QList>
+#include <QTextOption>
+#include <mwidgetmodel.h>
class MLabelHighlighter;
-typedef QList<MLabelHighlighter *> MLabelHighlighterList;
+Q_DECLARE_METATYPE(QTextOption::WrapMode)
/*!
\class MLabelModel
@@ -118,7 +120,7 @@ class M_EXPORT MLabelModel : public MWidgetModel
fragments like urls, email addresses etc. Objects also receive callbacks
when the highlighted items are interacted by the user.
*/
- M_MODEL_PROPERTY(MLabelHighlighterList, highlighters, Highlighters, true, MLabelHighlighterList())
+ M_MODEL_PROPERTY(QList<MLabelHighlighter *>, highlighters, Highlighters, true, QList<MLabelHighlighter *>())
public:
void emitLinkActivated(const QString &link) const {
diff --git a/src/corelib/widgets/mlist.cpp b/src/corelib/widgets/mlist.cpp
index 0f7f2934..decec0f3 100644
--- a/src/corelib/widgets/mlist.cpp
+++ b/src/corelib/widgets/mlist.cpp
@@ -193,6 +193,16 @@ void MList::setShowGroups(bool showGroups)
model()->setShowGroups(showGroups);
}
+void MList::setIndexVisible(bool visible)
+{
+ model()->setListIndexVisible(visible);
+}
+
+bool MList::indexVisible()
+{
+ return model()->listIndexVisible();
+}
+
int MList::columns() const
{
return model()->columns();
diff --git a/src/corelib/widgets/mlist.h b/src/corelib/widgets/mlist.h
index b15066c2..f525db0a 100644
--- a/src/corelib/widgets/mlist.h
+++ b/src/corelib/widgets/mlist.h
@@ -314,6 +314,11 @@ public:
*/
void setShowGroups(bool showGroups);
+ /*!
+ \return Returns the status of the list index availability.
+ */
+ bool indexVisible();
+
public Q_SLOTS:
/*!
\brief Convenience function - Select the given item.
@@ -337,6 +342,11 @@ public Q_SLOTS:
*/
void scrollTo(const QModelIndex &index, ScrollHint hint);
+ /*!
+ \brief Specifies whether the list index for a grouped model should be visible or not.
+ */
+ void setIndexVisible(bool visible);
+
Q_SIGNALS:
/*!
\brief Emitted when scrollTo(index) is called to tell the view to scroll
diff --git a/src/corelib/widgets/mlistmodel.h b/src/corelib/widgets/mlistmodel.h
index 053f6320..8bb29f07 100644
--- a/src/corelib/widgets/mlistmodel.h
+++ b/src/corelib/widgets/mlistmodel.h
@@ -47,6 +47,7 @@ private:
M_MODEL_PROPERTY(QModelIndex, scrollToIndex, ScrollToIndex, false, QModelIndex())
M_MODEL_PROPERTY(int, scrollHint, ScrollHint, true, 0)
M_MODEL_PROPERTY(QPointF, longTap, LongTap, true, QPointF())
+ M_MODEL_PROPERTY(bool, listIndexVisible, ListIndexVisible, true, false)
};
#endif
diff --git a/src/corelib/widgets/mobjectmenu.cpp b/src/corelib/widgets/mobjectmenu.cpp
index 65ab9db9..ca2f05dc 100644
--- a/src/corelib/widgets/mobjectmenu.cpp
+++ b/src/corelib/widgets/mobjectmenu.cpp
@@ -94,3 +94,13 @@ void MObjectMenu::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
event->accept();
}
+
+QPointF MObjectMenu::cursorPosition() const
+{
+ return model()->cursorPosition();
+}
+
+void MObjectMenu::setCursorPosition(const QPointF &pos)
+{
+ model()->setCursorPosition(pos);
+}
diff --git a/src/corelib/widgets/mobjectmenu.h b/src/corelib/widgets/mobjectmenu.h
index 81b2c47a..7a6fe172 100644
--- a/src/corelib/widgets/mobjectmenu.h
+++ b/src/corelib/widgets/mobjectmenu.h
@@ -120,6 +120,8 @@ class M_EXPORT MObjectMenu : public MSceneWindow
Q_DISABLE_COPY(MObjectMenu)
M_CONTROLLER(MObjectMenu)
+ Q_PROPERTY(QPointF cursorPosition READ cursorPosition WRITE setCursorPosition)
+
public:
/*!
\brief Constructs an object menu.
@@ -134,6 +136,9 @@ public:
*/
virtual ~MObjectMenu();
+ QPointF cursorPosition() const;
+ void setCursorPosition(const QPointF &pos);
+
protected:
//! \reimp
virtual bool eventFilter(QObject *obj, QEvent *event);
diff --git a/src/corelib/widgets/mobjectmenumodel.h b/src/corelib/widgets/mobjectmenumodel.h
index 340d7deb..521a806d 100644
--- a/src/corelib/widgets/mobjectmenumodel.h
+++ b/src/corelib/widgets/mobjectmenumodel.h
@@ -48,6 +48,14 @@ class M_EXPORT MObjectMenuModel : public MSceneWindowModel
*/
M_MODEL_PROPERTY(MActionList, actions, Actions, true, MActionList())
+ /*!
+ \property MObjectMenuModel::cursorPosition
+ \brief Position of the cursor that invokes the object menu
+
+ This property contains the position of the cursor that causes menu to appear.
+ */
+ M_MODEL_PROPERTY(QPointF, cursorPosition, CursorPosition, true, QPointF())
+
public:
/*!
\brief Adds the \a action to the actions list.
diff --git a/src/corelib/widgets/mpannablewidget.cpp b/src/corelib/widgets/mpannablewidget.cpp
index 4d7c7e36..441bb13d 100644
--- a/src/corelib/widgets/mpannablewidget.cpp
+++ b/src/corelib/widgets/mpannablewidget.cpp
@@ -444,12 +444,15 @@ void MPannableWidget::glassPanEvent(QGestureEvent *event, QPanGesture* panGestur
return;
}
- if ((panGesture->offset().x() != 0 && panDirection().testFlag(Qt::Vertical)) ||
- (panGesture->offset().y() != 0 && panDirection().testFlag(Qt::Horizontal)))
- {
- // Panning against the pannable direction, we aren't interested in it.
- event->ignore(panGesture);
- return;
+ if (panDirection().testFlag(Qt::Vertical) == false || panDirection().testFlag(Qt::Horizontal) == false) {
+ //Ignoring gestures that aren't aligned to allowed pan direction.
+ if ((panGesture->offset().x() != 0 && panDirection().testFlag(Qt::Vertical)) ||
+ (panGesture->offset().y() != 0 && panDirection().testFlag(Qt::Horizontal)))
+ {
+ // Panning against the pannable direction, we aren't interested in it.
+ event->ignore(panGesture);
+ return;
+ }
}
switch (panGesture->state())
diff --git a/src/corelib/widgets/mpannablewidget.h b/src/corelib/widgets/mpannablewidget.h
index 9e9c4209..a4d1a27d 100644
--- a/src/corelib/widgets/mpannablewidget.h
+++ b/src/corelib/widgets/mpannablewidget.h
@@ -39,8 +39,18 @@ class MOnDisplayChangeEvent;
* and interprets them. If the events form a panning gesture, a
* physics class is used to create a natural Newtonian movement in the
* direction of panning. Panning position is provided as an
- * overridable slot UpdatePosition(). If the events don't form a
+ * overridable slot updatePosition(). If the events don't form a
* panning gesture, they are forwarded underneath the glass.
+ *
+ * In order to change the current position of the viewport the user
+ * can call setPosition() method. When this is done, integration engine
+ * is started and in case that the position is outside specified bounds,
+ * the physics engine will start spring action to move the viewport to
+ * the allowed borders.
+ *
+ * The physics engine object can be obtained by calling physics() method.
+ *
+ * \sa MPhysics2DPanning, MPannableViewport
*/
class M_EXPORT MPannableWidget : public MWidgetController
{
diff --git a/src/corelib/widgets/mrichtextedit.cpp b/src/corelib/widgets/mrichtextedit.cpp
new file mode 100644
index 00000000..d42e14b4
--- /dev/null
+++ b/src/corelib/widgets/mrichtextedit.cpp
@@ -0,0 +1,256 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#include <QTextDocument>
+#include <QTextCursor>
+#include <QTextDocumentFragment>
+#include <QApplication>
+#include <QClipboard>
+#include "mrichtextedit.h"
+#include "mrichtextedit_p.h"
+
+#include "mwidgetcreator.h"
+M_REGISTER_WIDGET(MRichTextEdit)
+
+namespace
+{
+ //! Toolbar file
+ const QString ToolbarFile = QString("/usr/share/meegotouch/imtoolbars/RichTextEditorToolbar1.xml");
+}
+
+
+MRichTextEditPrivate::MRichTextEditPrivate()
+ : MTextEditPrivate()
+{
+}
+
+
+MRichTextEditPrivate::~MRichTextEditPrivate()
+{
+}
+
+
+bool MRichTextEditPrivate::insertFromMimeData(const QMimeData *source)
+{
+ Q_Q(MRichTextEdit);
+
+ QTextDocumentFragment fragment;
+ bool updated = false;
+
+ if (source->hasHtml()) {
+ fragment = QTextDocumentFragment::fromHtml(source->html());
+ updated = true;
+ } else {
+ QString text = source->text();
+ if (!text.isNull()) {
+ fragment = QTextDocumentFragment::fromPlainText(text);
+ updated = true;
+ }
+ }
+
+ if (updated) {
+ QTextCursor textcursor = q->textCursor();
+ textcursor.insertFragment(fragment);
+ q->setTextCursor(textcursor);
+ }
+
+ return updated;
+}
+
+
+QMimeData *MRichTextEditPrivate::createMimeDataFromSelection()
+{
+ Q_Q(MRichTextEdit);
+
+ const QTextDocumentFragment fragment(q->textCursor());
+ QMimeData *mimeData = new QMimeData();
+
+ mimeData->setData(QLatin1String("text/html"), fragment.toHtml("utf-8").toUtf8());
+ mimeData->setText(fragment.toPlainText());
+
+ return mimeData;
+}
+
+
+bool MRichTextEditPrivate::copy()
+{
+ Q_Q(MRichTextEdit);
+
+ QClipboard *clipboard = QApplication::clipboard();
+
+ if (!q->hasSelectedText()
+ || q->echoMode() != MTextEditModel::Normal // only allow copy from normal echo mode entry
+ || !clipboard) {
+ return false;
+ }
+
+ clipboard->setMimeData(createMimeDataFromSelection());
+ return true;
+}
+
+///////////////////////////////////////////////
+// Actual class implementation
+
+
+MRichTextEdit::MRichTextEdit(MTextEditModel::LineMode type, const QString &text, QGraphicsItem *parent)
+ : MTextEdit(new MRichTextEditPrivate, new MTextEditModel, parent)
+{
+ model()->setText(text);
+ model()->setLine(type);
+ attachToolbar(ToolbarFile);
+}
+
+
+MRichTextEdit::MRichTextEdit(MTextEditModel *model, QGraphicsItem *parent)
+ : MTextEdit(new MRichTextEditPrivate, model, parent)
+{
+ attachToolbar(ToolbarFile);
+}
+
+
+MRichTextEdit::~MRichTextEdit()
+{
+}
+
+
+void MRichTextEdit::copy()
+{
+ Q_D(MRichTextEdit);
+
+ d->copy();
+}
+
+
+void MRichTextEdit::paste()
+{
+ Q_D(MRichTextEdit);
+
+ QClipboard *clipboard = QApplication::clipboard();
+
+ if (isReadOnly() || !clipboard) {
+ return;
+ }
+
+ const QMimeData *mimedata = clipboard->mimeData();
+
+ bool updated = false;
+
+ if (mimedata)
+ updated = d->insertFromMimeData(mimedata);
+
+ if (updated) {
+ emit textChanged();
+ updateMicroFocus();
+ }
+}
+
+
+void MRichTextEdit::cut()
+{
+ MTextEdit::cut();
+}
+
+
+void MRichTextEdit::setFontUnderline(bool underline)
+{
+ Q_D(MRichTextEdit);
+
+ if (d->isPreediting() == true) {
+ d->addStyleToPreeditStyling(MRichTextEditPrivate::Underline, underline);
+ } else {
+ QTextCursor textcursor = textCursor();
+ QTextCharFormat format;
+ format.setFontUnderline(underline);
+ textcursor.mergeCharFormat(format);
+ setTextCursor(textcursor);
+ }
+}
+
+
+void MRichTextEdit::setFontItalic(bool italic)
+{
+ Q_D(MRichTextEdit);
+
+ if (d->isPreediting() == true) {
+ d->addStyleToPreeditStyling(MRichTextEditPrivate::Italic, italic);
+ } else {
+ QTextCursor textcursor = textCursor();
+ QTextCharFormat format;
+ format.setFontItalic(italic);
+ textcursor.mergeCharFormat(format);
+ setTextCursor(textcursor);
+ }
+}
+
+
+void MRichTextEdit::setFontBold(bool bold)
+{
+ Q_D(MRichTextEdit);
+
+ if (d->isPreediting() == true) {
+ d->addStyleToPreeditStyling(MRichTextEditPrivate::Bold, bold);
+ } else {
+ QTextCursor textcursor = textCursor();
+
+ QFont::Weight wt = QFont::Normal;
+ if (bold)
+ wt = QFont::Bold;
+
+ QTextCharFormat format;
+ format.setFontWeight(wt);
+ textcursor.mergeCharFormat(format);
+ setTextCursor(textcursor);
+ }
+}
+
+
+QFont MRichTextEdit::currentFont()
+{
+ QTextCursor textcursor = textCursor();
+
+ return textcursor.charFormat().font();
+}
+
+
+void MRichTextEdit::keyPressEvent(QKeyEvent *event)
+{
+ if (QEvent::KeyPress == event->type()) {
+ if (event->matches(QKeySequence::Bold)) {
+ QFont curFont = currentFont();
+ bool boldStyle = !curFont.bold();
+ // set current bold style option
+ setFontBold(boldStyle);
+ } else if (event->matches(QKeySequence::Italic)) {
+ QFont curFont = currentFont();
+ bool italicStyle = !curFont.italic();
+ // set current italic style option
+ setFontItalic(italicStyle);
+ } else if (event->matches(QKeySequence::Underline)) {
+ QFont curFont = currentFont();
+ bool underlineStyle = !curFont.underline();
+ // set current underline style option
+ setFontUnderline(underlineStyle);
+ } else {
+ // Pass the remaining events to MTextEdit will handle
+ MTextEdit::keyPressEvent(event);
+ }
+ }
+}
+
+#include "moc_mrichtextedit.cpp"
diff --git a/src/corelib/widgets/mrichtextedit.h b/src/corelib/widgets/mrichtextedit.h
new file mode 100644
index 00000000..cdefb1b9
--- /dev/null
+++ b/src/corelib/widgets/mrichtextedit.h
@@ -0,0 +1,98 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef MRICHTEXTEDIT_H
+#define MRICHTEXTEDIT_H
+
+#include <MTextEdit>
+#include <QTextCharFormat>
+
+class MRichTextEditPrivate;
+
+class M_EXPORT MRichTextEdit : public MTextEdit
+{
+ Q_OBJECT
+
+public:
+ /*!
+ * \brief Default constructor. Creates a textEdit field containing the specified text and line mode with rich text support.
+ * \param type widget type (single line or multiline).
+ * \param text optional text.
+ * \param parent optional parent.
+ */
+ explicit MRichTextEdit(MTextEditModel::LineMode type = MTextEditModel::SingleLine,
+ const QString &text = QString(), QGraphicsItem *parent = 0);
+ /*!
+ * \brief Creates a textEdit field with a specified line mode, model and parent with rich text support.
+ * \param model the model to be used.
+ * \param parent the parent of the text edit.
+ */
+ MRichTextEdit(MTextEditModel *model, QGraphicsItem *parent);
+
+ /*!
+ * \brief - Destructor
+ */
+ virtual ~MRichTextEdit();
+
+ /*! \reimp */
+ virtual void copy();
+
+ virtual void paste();
+
+ virtual void cut();
+ /*! \reimp_end */
+
+ /*!
+ * \brief sets the Underline style and apply the style to the current selection if any
+ */
+ void setFontUnderline(bool underline);
+
+ /*!
+ * \brief sets the italic style and apply the style to the current selection if any
+ */
+ void setFontItalic(bool italic);
+
+ /*!
+ * \brief sets the bold style and apply the style to the current selection if any
+ */
+ void setFontBold(bool bold);
+
+ /*!
+ * \brief Retrieves the font information of current selection
+ * Use the bold(),italic(),overline(), etc methods of font
+ * object to get more info about the selection.
+ * \return - Font properties of selection
+ */
+ QFont currentFont();
+
+protected:
+ /*! \reimp */
+ virtual void keyPressEvent(QKeyEvent *event);
+ /*! \reimp_end */
+
+private:
+ Q_DECLARE_PRIVATE(MRichTextEdit)
+ Q_DISABLE_COPY(MRichTextEdit)
+
+#ifdef UNIT_TEST
+ friend class Ut_MRichTextEdit;
+#endif
+};
+
+#endif //MRichTEXTEDIT_H
diff --git a/src/corelib/widgets/mrichtextedit_p.h b/src/corelib/widgets/mrichtextedit_p.h
new file mode 100644
index 00000000..75f6cdaa
--- /dev/null
+++ b/src/corelib/widgets/mrichtextedit_p.h
@@ -0,0 +1,61 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef MRICHTEXTEDIT_P_H
+#define MRICHTEXTEDIT_P_H
+
+#include <QMimeData>
+#include "mtextedit_p.h"
+#include "mrichtextedit.h"
+
+class MRichTextEditPrivate : public MTextEditPrivate
+{
+ Q_DECLARE_PUBLIC(MRichTextEdit)
+
+public:
+ /*!
+ * \brief constructor
+ */
+ MRichTextEditPrivate();
+ /*!
+ * \brief destructor
+ */
+ virtual ~MRichTextEditPrivate();
+ /*!
+ * \brief Return the mime information about the selection
+ * The mime will contain both text and html formats
+ * \return MimeData - Caller has to release memory when done
+ */
+ QMimeData *createMimeDataFromSelection();
+
+ /*!
+ * \brief Paste the mimedata to the selection.
+ * Paste richtext if available, otherwise paste plain text.
+ * \param source - Input mime data
+ */
+ bool insertFromMimeData(const QMimeData *source);
+
+ /*!
+ * \brief copy the text cursor's selection to the clipbaord.
+ * \return True if operation compeled successfully.
+ */
+ virtual bool copy();
+};
+
+#endif
diff --git a/src/corelib/widgets/mscenewindow.cpp b/src/corelib/widgets/mscenewindow.cpp
index 26d7783f..67dfe49b 100644
--- a/src/corelib/widgets/mscenewindow.cpp
+++ b/src/corelib/widgets/mscenewindow.cpp
@@ -22,6 +22,7 @@
#include <QGestureEvent>
#include <QTapAndHoldGesture>
#include <QGraphicsSceneContextMenuEvent>
+#include <QTimer>
#include "mscenewindow.h"
#include "mscenewindowmodel.h"
#include "mscenewindow_p.h"
@@ -38,19 +39,20 @@
M_REGISTER_WIDGET_NO_CREATE(MSceneWindow)
MSceneWindowPrivate::MSceneWindowPrivate()
- : windowType(MSceneWindow::PlainSceneWindow),
- policy(MSceneWindow::KeepWhenDone),
- managedManually(false),
- shown(false),
- dismissed(false),
- effect(0),
- appearanceAnimation(0),
- disappearanceAnimation(0)
+ : windowType(MSceneWindow::PlainSceneWindow),
+ policy(MSceneWindow::KeepWhenDone),
+ managedManually(false),
+ shown(false),
+ dismissed(false),
+ waitingForContextMenuEvent(false),
+ effect(0),
+ appearanceAnimation(0),
+ disappearanceAnimation(0)
{
}
MSceneWindow::MSceneWindow(QGraphicsItem *parent) :
- MWidgetController(new MSceneWindowPrivate, new MSceneWindowModel, parent)
+ MWidgetController(new MSceneWindowPrivate, new MSceneWindowModel, parent)
{
Q_D(MSceneWindow);
@@ -60,7 +62,7 @@ MSceneWindow::MSceneWindow(QGraphicsItem *parent) :
MSceneWindow::MSceneWindow(MSceneWindowPrivate *dd, MSceneWindowModel *model, MSceneWindow::WindowType windowType, const QString &viewType, QGraphicsItem *parent) :
- MWidgetController(dd, model, parent)
+ MWidgetController(dd, model, parent)
{
Q_D(MSceneWindow);
setViewType(viewType);
@@ -101,6 +103,12 @@ void MSceneWindow::setManagedManually(bool managedManually)
void MSceneWindow::appear(MWindow *window, MSceneWindow::DeletionPolicy policy)
{
+ if (view()) {
+ if (model()->disappearTimeout() != 0) {
+ QTimer::singleShot(model()->disappearTimeout(), this, SLOT(disappear()));
+ }
+ }
+
if (!window) {
window = MApplication::activeWindow();
if (!window) {
@@ -200,6 +208,8 @@ void MSceneWindow::closeEvent(QCloseEvent *event)
void MSceneWindow::tapAndHoldGestureEvent(QGestureEvent *event, QTapAndHoldGesture *gesture)
{
+ Q_D(MSceneWindow);
+
if (gesture->state() == Qt::GestureFinished) {
QGraphicsSceneContextMenuEvent contextEvent(QEvent::GraphicsSceneContextMenu);
@@ -207,9 +217,11 @@ void MSceneWindow::tapAndHoldGestureEvent(QGestureEvent *event, QTapAndHoldGestu
contextEvent.setScenePos(gesture->hotSpot());
contextEvent.setScreenPos(gesture->hotSpot().toPoint());
+ d->waitingForContextMenuEvent = true;
QApplication::sendEvent(scene(), &contextEvent);
- if (contextEvent.isAccepted()) {
+ if (contextEvent.isAccepted() && d->waitingForContextMenuEvent) {
+ //Event has been accepted by some widget on top of this scenewindow.
if ((scene() == NULL) || (scene()->views().size() == 0)) {
// If this widget has been removed from the scene and/or there
// is no view, return
@@ -224,8 +236,9 @@ void MSceneWindow::tapAndHoldGestureEvent(QGestureEvent *event, QTapAndHoldGestu
if (scene()->items().contains(item))
scene()->sendEvent(item, &cancelEvent);
}
-
}
+ d->waitingForContextMenuEvent = false;
+
}
event->accept(gesture);
@@ -233,8 +246,19 @@ void MSceneWindow::tapAndHoldGestureEvent(QGestureEvent *event, QTapAndHoldGestu
bool MSceneWindow::event(QEvent *event)
{
+ Q_D(MSceneWindow);
if (event->type() == MDismissEvent::eventType()) {
dismissEvent(static_cast<MDismissEvent *>(event));
+ } else if (event->type() == QEvent::GraphicsSceneContextMenu) {
+ //Event was not accepted by any of our child widgets.
+ //We need to accept it so that it doesn't propagate further and
+ //clear the flag, so that the tap&hold gesture event handler
+ //will know that the event wasn't delivered.
+ if (d->waitingForContextMenuEvent) {
+ event->accept();
+ d->waitingForContextMenuEvent = false;
+ return true;
+ }
}
return MWidgetController::event(event);
diff --git a/src/corelib/widgets/mscenewindow.h b/src/corelib/widgets/mscenewindow.h
index 2054de5e..378a58fd 100644
--- a/src/corelib/widgets/mscenewindow.h
+++ b/src/corelib/widgets/mscenewindow.h
@@ -29,11 +29,11 @@ class MSceneWindowPrivate;
/*!
* \class MSceneWindow
- * \brief MSceneWindow objects are the base graphical items in a Direct UI scene.
+ * \brief MSceneWindow objects are the base graphical items in a MeeGo Touch scene.
*
- * All graphical components of a standard Direct UI application are held in
+ * All graphical components of a standard MeeGo Touch application are held in
* a MSceneWindow of some type. MSceneWindow instances form the base
- * level of a Direct UI application's scene graph.
+ * level of a MeeGo Touch application's scene graph.
*
* MSceneWindows in a MScene are analogous to top level windows in a
* traditional windowing system.
diff --git a/src/corelib/widgets/mscenewindow_p.h b/src/corelib/widgets/mscenewindow_p.h
index cf2683b2..3fa15232 100644
--- a/src/corelib/widgets/mscenewindow_p.h
+++ b/src/corelib/widgets/mscenewindow_p.h
@@ -22,10 +22,12 @@
#include "mscenewindow.h"
#include "private/mwidgetcontroller_p.h"
+#include <mabstractwidgetanimation.h>
+
+#include <QPointer>
class MWindow;
class MSceneLayerEffect;
-class MAbstractWidgetAnimation;
class MSceneWindowPrivate : public MWidgetControllerPrivate
{
@@ -43,11 +45,12 @@ public:
bool managedManually;
bool shown;
bool dismissed;
+ bool waitingForContextMenuEvent;
MSceneLayerEffect *effect;
- MAbstractWidgetAnimation *appearanceAnimation;
- MAbstractWidgetAnimation *disappearanceAnimation;
+ QPointer<MAbstractWidgetAnimation> appearanceAnimation;
+ QPointer<MAbstractWidgetAnimation> disappearanceAnimation;
};
diff --git a/src/corelib/widgets/mscenewindowmodel.h b/src/corelib/widgets/mscenewindowmodel.h
index b0e4a281..1321515d 100644
--- a/src/corelib/widgets/mscenewindowmodel.h
+++ b/src/corelib/widgets/mscenewindowmodel.h
@@ -26,6 +26,11 @@ class M_EXPORT MSceneWindowModel : public MWidgetModel
{
Q_OBJECT
M_MODEL_INTERNAL(MSceneWindowModel)
+
+ /*!
+ * \property The scene window will disappear after a timeout
+ */
+ M_MODEL_PROPERTY(int, disappearTimeout, DisappearTimeout, true, 0)
};
#endif
diff --git a/src/corelib/widgets/mtextedit.cpp b/src/corelib/widgets/mtextedit.cpp
index bf231f33..f95eaf96 100644
--- a/src/corelib/widgets/mtextedit.cpp
+++ b/src/corelib/widgets/mtextedit.cpp
@@ -78,7 +78,7 @@ namespace
* \param type widget type (single line or multiline)
*/
MTextEditPrivate::MTextEditPrivate()
- : pendingSoftwareInputPanelRequest(true),
+ : pendingSoftwareInputPanelRequest(false),
validator(0),
ownValidator(false),
completer(0),
@@ -199,11 +199,24 @@ bool MTextEditPrivate::doBackspace()
}
QTextCursor currentPositionCursor = q->textCursor();
+ int position = currentPositionCursor.position();
+
+ if (position == 0) {
+ return false;
+ }
+
currentPositionCursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
QTextDocumentFragment currentFragment = currentPositionCursor.selection();
+
+ QTextCharFormat format;
+ // setPosition() is required to get the style that would be applied when a text is inserted at the cursor position
+ currentPositionCursor.setPosition(position);
+ format = currentPositionCursor.charFormat();
+
cursor()->deletePreviousChar();
if (validateCurrentBlock() == true) {
+ cursor()->setCharFormat(format);
return true;
} else {
@@ -230,15 +243,13 @@ bool MTextEditPrivate::doDelete()
QTextDocumentFragment currentFragment = currentPositionCursor.selection();
cursor()->deleteChar();
- if (validateCurrentBlock() == true) {
- emit q->cursorPositionChanged();
- return true;
-
- } else {
+ if (!validateCurrentBlock()) {
// document doesn't validate after delete -> put the character back
cursor()->insertFragment(currentFragment);
return false;
}
+
+ return true;
}
@@ -317,7 +328,7 @@ bool MTextEditPrivate::doSignCycle()
* \param text text to be inserted
* \return true if some text was successfully inserted
*/
-bool MTextEditPrivate::doTextInsert(const QString &text)
+bool MTextEditPrivate::doTextInsert(const QString &text, bool usePreeditStyling)
{
Q_Q(MTextEdit);
@@ -346,6 +357,8 @@ bool MTextEditPrivate::doTextInsert(const QString &text)
int textPosition = 0;
int filteredTextLength = filteredText.length();
int snippetLength = -1;
+ int listIndex = -1;
+ int count = 0;
do {
if (textPosition >= filteredTextLength) {
@@ -372,7 +385,12 @@ bool MTextEditPrivate::doTextInsert(const QString &text)
QString textSnippet = filteredText.mid(textPosition, snippetLength);
int cursorPosBefore = cursor()->position();
- cursor()->insertText(textSnippet);
+
+ if (usePreeditStyling == true) {
+ insertTextWithPreeditStyling(textSnippet, listIndex, count);
+ } else {
+ cursor()->insertText(textSnippet);
+ }
if (validateCurrentBlock() == true) {
changed = true;
@@ -481,7 +499,10 @@ void MTextEditPrivate::setPreeditText(const QString &text,
// If this becomes problematic, we should move this formatting to paintContext of the view.
layout->setAdditionalFormats(preeditStyles);
- textCursor->insertText(text);
+ int listIndex = -1;
+ int count = 0;
+ insertTextWithPreeditStyling(text, listIndex, count);
+ clearUnusedPreeditStyling(listIndex, count);
// mark preedit as selection
int position = textCursor->position();
@@ -498,6 +519,8 @@ void MTextEditPrivate::commitPreedit()
{
Q_Q(MTextEdit);
+ preeditStyling.clear();
+
// Nothing to commit if not pre-editing
if (isPreediting() == false) {
return;
@@ -638,6 +661,33 @@ bool MTextEditPrivate::isPreediting() const
return (q->mode() == MTextEditModel::EditModeActive);
}
+void MTextEditPrivate::requestSip()
+{
+ Q_Q(MTextEdit);
+ Q_ASSERT_X(q->sceneManager(),
+ "MTextEditPrivate::requestSip()",
+ "Invalid SIP request - no scene manager found!");
+
+ q->sceneManager()->requestSoftwareInputPanel(q);
+ pendingSoftwareInputPanelRequest = false;
+}
+
+void MTextEditPrivate::requestAutoSip(Qt::FocusReason fr)
+{
+ Q_Q(MTextEdit);
+
+ if (!q->isAutoSipEnabled()) {
+ return;
+ }
+
+ if (fr == Qt::MouseFocusReason) {
+ // Wait for the mouse release event instead so that the window relocation that might
+ // happen does not change the mouse position *before* the button is released.
+ pendingSoftwareInputPanelRequest = true;
+ } else {
+ requestSip();
+ }
+}
/*!
* \brief Sends mouse events to input context mouse handling method
@@ -715,6 +765,172 @@ QEvent::Type MTextEditPrivate::translateGraphicsSceneMouseTypeToQMouse(QEvent::T
return result;
}
+/*!
+ * \brief stores the style information of text in pre-edit mode
+ * \param start position from where to start reading the style for storing
+ * \param end position where to end reading the style
+ */
+void MTextEditPrivate::storePreeditTextStyling(int start, int end)
+{
+ QTextCursor *textCursor = cursor();
+ int cursorPosition = textCursor->position();
+
+ for (int i = start + 1; i <= end; ++i) {
+ textCursor->setPosition(i, QTextCursor::KeepAnchor);
+ QTextCharFormat charFormat = textCursor->charFormat();
+
+ if (preeditStyling.isEmpty() == false) {
+ styleData &currentStyle = preeditStyling.last();
+
+ if (currentStyle.charFormat != charFormat) {
+ styleData newStyle;
+
+ newStyle.charFormat = charFormat;
+ newStyle.count = 1;
+ preeditStyling.push_back(newStyle);
+ } else {
+ currentStyle.count++;
+ }
+ } else {
+ styleData newStyle;
+
+ newStyle.charFormat = charFormat;
+ newStyle.count = 1;
+ preeditStyling.push_back(newStyle);
+ }
+ }
+
+ textCursor->setPosition(cursorPosition, QTextCursor::KeepAnchor);
+}
+
+
+/*!
+ * \brief inserts text by applying the stored preedit styling information
+ * \param currentListIndex styling list index to start reading from the stored styling
+ * \param currentCount character index within the current styling list index
+ */
+void MTextEditPrivate::insertTextWithPreeditStyling(const QString &text, int &currentListIndex, int &currentCount)
+{
+ QTextCursor *textCursor = cursor();
+ const int textLength = text.length();
+ int listIndex = currentListIndex;
+ int count = currentCount;
+ int preeditStyleSize = preeditStyling.size();
+ int currentIndex = textLength;
+
+ QTextCharFormat format = textCursor->charFormat();
+
+ styleData newStyle;
+ newStyle.charFormat = format;
+ newStyle.count = 1;
+
+ if (preeditStyleSize == 0) {
+ preeditStyling.push_back(newStyle);
+ preeditStyleSize++;
+ }
+
+ for (int i = 0; i < textLength; ++i) {
+ if (preeditStyling.isEmpty() != true) {
+ if (count == 0) {
+ listIndex++;
+ if (listIndex == preeditStyleSize) {
+ QTextCharFormat charFormat = preeditStyling.at(preeditStyleSize - 1).charFormat;
+ textCursor->setCharFormat(charFormat);
+ currentIndex = i;
+ listIndex = preeditStyleSize - 1;
+ break;
+ }
+
+ count = preeditStyling.at(listIndex).count;
+ }
+
+ if (count == 0) {
+ styleData &lastStyle = preeditStyling[listIndex];
+ lastStyle.count++;
+ count = 1;
+ }
+
+ QTextCharFormat charFormat = preeditStyling.at(listIndex).charFormat;
+ textCursor->setCharFormat(charFormat);
+ count--;
+ }
+
+ textCursor->insertText(text.at(i));
+ }
+
+ for (int i = currentIndex; i < textLength; ++i) {
+ if (preeditStyling.isEmpty() != true) {
+ styleData &newStyle = preeditStyling[listIndex];
+ newStyle.count++;
+ }
+ textCursor->insertText(text.at(i));
+ }
+
+ currentListIndex = listIndex;
+ currentCount = count;
+}
+
+
+/*!
+ * \brief adds a style to the stored preedit styling
+ * \param StyleType current style type
+ */
+void MTextEditPrivate::addStyleToPreeditStyling(StyleType currentStyleType, bool setValue)
+{
+ QTextCharFormat format;
+ int preeditStyleSize = preeditStyling.size();
+
+ if (preeditStyleSize > 0) {
+ format = preeditStyling[preeditStyleSize - 1].charFormat;
+ }
+
+ if (currentStyleType == Underline) {
+ format.setFontUnderline(setValue);
+ } else if (currentStyleType == Italic) {
+ format.setFontItalic(setValue);
+ } else { // bold
+ QFont::Weight wt = QFont::Normal;
+ if (setValue)
+ wt = QFont::Bold;
+
+ format.setFontWeight(wt);
+ }
+
+ if ((preeditStyleSize > 0) && (preeditStyling[preeditStyleSize - 1].count == 0)) {
+ preeditStyling[preeditStyleSize - 1].charFormat = format;
+ } else {
+ styleData currentStyle;
+ currentStyle.charFormat = format;
+ currentStyle.count = 0;
+ preeditStyling.push_back(currentStyle);
+ }
+}
+
+
+/*!
+ * \brief clears the unused styling from stored preedit styling information
+ * \param currentListIndex styling list index to start erasing from the stored styling
+ * \param currentCount character index within the current styling list index
+ */
+void MTextEditPrivate::clearUnusedPreeditStyling(int currentListIndex, int currentCount)
+{
+ int preeditTextStyleSize = preeditStyling.size();
+
+ if ((currentListIndex < 0) || (currentListIndex >= preeditTextStyleSize)) {
+ return;
+ }
+
+ styleData &style = preeditStyling[currentListIndex];
+ style.count -= currentCount;
+
+ for (int i = currentListIndex + 1; i < preeditTextStyleSize; i++) {
+ preeditStyling.removeAt(i);
+ }
+
+ if (style.count == 0) {
+ preeditStyling.removeAt(currentListIndex);
+ }
+}
void MTextEditPrivate::_q_confirmCompletion(const QString &completion)
{
@@ -738,6 +954,9 @@ void MTextEditPrivate::_q_confirmCompletion(const QString &completion)
cursor()->setPosition(index + block.position() + prefix.length(), QTextCursor::KeepAnchor);
cursor()->removeSelectedText();
doTextInsert(completion);
+ QObject::disconnect(q, SIGNAL(textChanged()), completer, SLOT(complete()));
+ emit q->textChanged();
+ QObject::connect(q, SIGNAL(textChanged()), completer, SLOT(complete()));
q->updateMicroFocus();
}
@@ -966,6 +1185,10 @@ void MTextEdit::keyPressEvent(QKeyEvent *event)
copy();
event->accept();
return;
+ } else if (event->matches(QKeySequence::SelectAll)) {
+ selectAll();
+ event->accept();
+ return;
}
if ((textInteractionFlags() & Qt::TextEditable) == 0) {
@@ -980,10 +1203,6 @@ void MTextEdit::keyPressEvent(QKeyEvent *event)
cut();
event->accept();
return;
- } else if (event->matches(QKeySequence::SelectAll)) {
- selectAll();
- event->accept();
- return;
}
// we continue by assuming some input is to be made
@@ -997,8 +1216,16 @@ void MTextEdit::keyPressEvent(QKeyEvent *event)
QTextDocumentFragment selectedFragment;
int selectionStart = -1;
+ QTextCharFormat format;
if (wasSelecting == true) {
+ QTextCursor positionCursor = textCursor();
+ int position = positionCursor.selectionStart();
+ // setPosition() is required to get the style that would be applied when a text is
+ // inserted at the position + 1
+ positionCursor.setPosition(position + 1);
+ format = positionCursor.charFormat();
+
selectionStart = d->cursor()->selectionStart();
selectedFragment = d->cursor()->selection();
d->cursor()->removeSelectedText();
@@ -1015,6 +1242,7 @@ void MTextEdit::keyPressEvent(QKeyEvent *event)
if (wasSelecting == false) {
modified = d->doBackspace();
} else {
+ d->cursor()->setCharFormat(format);
modified = true;
}
break;
@@ -1076,6 +1304,19 @@ void MTextEdit::keyPressEvent(QKeyEvent *event)
}
}
+
+void MTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ Q_D(MTextEdit);
+ MWidgetController::mouseReleaseEvent(event);
+
+ // Widget was focused-in on corresponding mouse press event:
+ if (d->pendingSoftwareInputPanelRequest) {
+ d->requestSip();
+ }
+}
+
+
void MTextEdit::focusInEvent(QFocusEvent *event)
{
Q_D(MTextEdit);
@@ -1090,13 +1331,7 @@ void MTextEdit::focusInEvent(QFocusEvent *event)
sceneManager(), SLOT(ensureCursorVisible()),
Qt::UniqueConnection);
- if (event->reason() == Qt::MouseFocusReason) {
- // Wait for the mouse release event instead so that the window relocation that might
- // happen does not change the mouse position *before* the button is released.
- d->pendingSoftwareInputPanelRequest = true;
- } else {
- sceneManager()->requestSoftwareInputPanel(this);
- }
+ d->requestAutoSip(event->reason());
}
if (model()->autoSelectionEnabled() == true) {
@@ -1157,6 +1392,7 @@ bool MTextEdit::insert(const QString &text)
emit selectionChanged();
} else if (mode() == MTextEditModel::EditModeActive) {
d->removePreedit();
+ d->preeditStyling.clear();
}
d->setMode(MTextEditModel::EditModeBasic);
@@ -1183,9 +1419,11 @@ bool MTextEdit::setText(const QString &text)
int cursorPosBefore = d->cursor()->position();
bool wasSelecting = hasSelectedText();
+ bool wasEmpty = (document()->characterCount() == 0);
// clear the state
d->removePreedit();
+ d->preeditStyling.clear();
d->cursor()->clearSelection();
document()->clear();
d->setMode(MTextEditModel::EditModeBasic);
@@ -1204,16 +1442,25 @@ bool MTextEdit::setText(const QString &text)
d->cursor()->insertText(filteredText);
- bool accepted = hasAcceptableInput();
+ bool accepted = true;
- if (accepted == true) {
- updateMicroFocus();
- emit textChanged();
+ if (d->validator) {
+ QString textCopy = text;
+ int cursorPos = text.length();
+ QValidator::State result = d->validator->validate(textCopy, cursorPos);
+ accepted = (result != QValidator::Invalid);
+ }
- } else {
+ if (!accepted) {
document()->clear();
}
+ // only avoid signaling if empty before and after
+ if (!((document()->characterCount() == 0) && wasEmpty)) {
+ updateMicroFocus();
+ emit textChanged();
+ }
+
if (d->cursor()->position() != cursorPosBefore) {
emit cursorPositionChanged();
}
@@ -1268,12 +1515,6 @@ void MTextEdit::handleMouseRelease(int eventCursorPosition, QGraphicsSceneMouseE
int cursorPositionBefore = cursorPosition();
- // Widget was focused-in on corresponding mouse press event:
- if (sceneManager() && d->pendingSoftwareInputPanelRequest) {
- sceneManager()->requestSoftwareInputPanel(this);
- d->pendingSoftwareInputPanelRequest = false;
- }
-
deselect();
if (d->isPositionOnPreedit(eventCursorPosition) == false) {
@@ -1296,6 +1537,7 @@ void MTextEdit::handleMouseRelease(int eventCursorPosition, QGraphicsSceneMouseE
int end = breakIterator.next(eventCursorPosition);
QString preedit = text.mid(start, end - start);
+ d->storePreeditTextStyling(start, end);
d->cursor()->setPosition(start);
d->cursor()->setPosition(end, QTextCursor::KeepAnchor);
QTextDocumentFragment preeditFragment = d->cursor()->selection();
@@ -1317,6 +1559,7 @@ void MTextEdit::handleMouseRelease(int eventCursorPosition, QGraphicsSceneMouseE
if (injectionAccepted == false) {
d->cursor()->insertFragment(preeditFragment);
d->setCursorPosition(eventCursorPosition);
+ d->preeditStyling.clear();
}
} else {
@@ -1418,6 +1661,7 @@ void MTextEdit::paste()
if (changed) {
emit textChanged();
+ emit cursorPositionChanged();
updateMicroFocus();
} else {
mDebug("MTextEdit") << __PRETTY_FUNCTION__ << "paste failed";
@@ -1450,6 +1694,7 @@ void MTextEdit::cut()
d->sendCopyAvailable(false);
emit selectionChanged();
emit textChanged();
+ emit cursorPositionChanged();
updateMicroFocus();
}
}
@@ -1515,7 +1760,8 @@ void MTextEdit::inputMethodEvent(QInputMethodEvent *event)
// append possible commit string
if (commitString.isEmpty() == false) {
- insertionSuccess = d->doTextInsert(commitString);
+ insertionSuccess = d->doTextInsert(commitString, true);
+ d->preeditStyling.clear();
if (insertionSuccess == false && wasSelecting == true) {
// validation failed, put the old selection back
@@ -1624,37 +1870,65 @@ void MTextEdit::setTextCursor(const QTextCursor &cursor)
void MTextEdit::setContentType(M::TextContentType type)
{
Q_D(MTextEdit);
- Qt::InputMethodHints newHint;
model()->setType(type);
+ // update validator if it's currently our, otherwise leave it intact
// FIXME: doesn't work if model has content type already from somewhere
if (d->ownValidator == true) {
delete d->validator;
+ d->validator = 0;
+ d->ownValidator = false;
}
- d->validator = 0;
+ if (d->validator == 0) {
+ QRegExp rx;
+
+ switch (type) {
+ case M::NumberContentType:
+ rx.setPattern(NumberCharacterSet);
+ d->validator = new QRegExpValidator(rx, 0);
+ break;
- QRegExp rx;
+ case M::PhoneNumberContentType:
+ rx.setPattern(PhoneNumberCharacterSet);
+ d->validator = new QRegExpValidator(rx, 0);
+ break;
+
+ case M::EmailContentType:
+ rx.setPattern(EmailCharacterSet);
+ d->validator = new QRegExpValidator(rx, 0);
+ break;
+
+ case M::UrlContentType:
+ //TODO: No check rule for URL yet
+ break;
+
+ default:
+ break;
+ }
+
+ // if a validator was created, we own it
+ if (d->validator != 0) {
+ d->ownValidator = true;
+ }
+ }
+
+ // update other state
+ Qt::InputMethodHints newHint;
switch (type) {
case M::NumberContentType:
- rx.setPattern(NumberCharacterSet);
- d->validator = new QRegExpValidator(rx, 0);
setInputMethodCorrectionEnabled(false);
newHint = Qt::ImhFormattedNumbersOnly;
break;
case M::PhoneNumberContentType:
- rx.setPattern(PhoneNumberCharacterSet);
- d->validator = new QRegExpValidator(rx, 0);
setInputMethodCorrectionEnabled(false);
newHint = Qt::ImhDialableCharactersOnly;
break;
case M::EmailContentType:
- rx.setPattern(EmailCharacterSet);
- d->validator = new QRegExpValidator(rx, 0);
setInputMethodCorrectionEnabled(false);
setInputMethodAutoCapitalizationEnabled(false);
newHint = Qt::ImhEmailCharactersOnly;
@@ -1663,7 +1937,6 @@ void MTextEdit::setContentType(M::TextContentType type)
case M::UrlContentType:
setInputMethodCorrectionEnabled(false);
setInputMethodAutoCapitalizationEnabled(false);
- //TODO: No check rule for URL yet
newHint = Qt::ImhUrlCharactersOnly;
break;
@@ -1672,11 +1945,6 @@ void MTextEdit::setContentType(M::TextContentType type)
break;
}
- // if a validator was created, we own it
- if (d->validator != 0) {
- d->ownValidator = true;
- }
-
setInputMethodHints((inputMethodHints() & ~Qt::ImhExclusiveInputMask) | newHint);
}
@@ -1990,6 +2258,16 @@ MCompleter *MTextEdit::completer()
return d->completer;
}
+void MTextEdit::setAutoSipEnabled(bool enabled)
+{
+ model()->setAutoSipEnabled(enabled);
+}
+
+bool MTextEdit::isAutoSipEnabled() const
+{
+ return model()->isAutoSipEnabled();
+}
+
void MTextEdit::attachToolbar(const QString &name)
{
if (attachedToolbar() == name)
diff --git a/src/corelib/widgets/mtextedit.h b/src/corelib/widgets/mtextedit.h
index 1eddae1e..0c18d7f5 100644
--- a/src/corelib/widgets/mtextedit.h
+++ b/src/corelib/widgets/mtextedit.h
@@ -75,6 +75,7 @@ class M_EXPORT MTextEdit : public MWidgetController
Q_PROPERTY(bool inputMethodPredictionEnabled READ inputMethodPredictionEnabled WRITE setInputMethodPredictionEnabled)
Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength)
Q_PROPERTY(MTextEditModel::EchoMode echoMode READ echoMode WRITE setEchoMode)
+ Q_PROPERTY(bool autoSipEnabled READ isAutoSipEnabled WRITE setAutoSipEnabled)
public:
typedef M::TextContentType TextContentType; // workaround for moc bug
@@ -362,6 +363,17 @@ public:
MCompleter *completer();
/*!
+ * \brief Allows control over SIP handling
+ *
+ * When a text edit is focused and this property is disabled, no software
+ * input panel will be requested.
+ */
+ void setAutoSipEnabled(bool enabled);
+
+ //! \sa setAutoSipEnabled
+ bool isAutoSipEnabled() const;
+
+ /*!
* \brief Attaches a custom toolbar named \a name.
* \param name is the absolute file name of a custom toolbar, or the relative file under
* /usr/share/meegotouch/imtoolbars/.
@@ -501,6 +513,7 @@ Q_SIGNALS:
protected:
/*! \reimp */
virtual void keyPressEvent(QKeyEvent *event);
+ virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void focusInEvent(QFocusEvent *event);
virtual void focusOutEvent(QFocusEvent *event);
virtual void inputMethodEvent(QInputMethodEvent *);
diff --git a/src/corelib/widgets/mtextedit_p.h b/src/corelib/widgets/mtextedit_p.h
index d69d3a0c..b4d424a2 100644
--- a/src/corelib/widgets/mtextedit_p.h
+++ b/src/corelib/widgets/mtextedit_p.h
@@ -54,7 +54,7 @@ public:
bool doBackspace();
bool doDelete();
bool doTab();
- bool doTextInsert(const QString &text);
+ bool doTextInsert(const QString &text, bool usePreeditStyling = false);
bool onReturnPressed(QKeyEvent *event);
bool doSignCycle();
@@ -69,6 +69,9 @@ public:
bool isPositionOnPreedit(int cursorPosition) const;
bool isPreediting() const;
+ void requestSip();
+ void requestAutoSip(Qt::FocusReason fr);
+
void setMode(MTextEditModel::EditMode mode);
void notifyInputContextMouseHandler(int position, QGraphicsSceneMouseEvent *event);
@@ -77,12 +80,32 @@ public:
static QEvent::Type translateGraphicsSceneMouseTypeToQMouse(QEvent::Type input);
+ enum StyleType
+ {
+ Bold,
+ Italic,
+ Underline
+ };
+
+ struct styleData
+ {
+ QTextCharFormat charFormat;
+ int count;
+ };
+ QList<styleData> preeditStyling;
+
+ void storePreeditTextStyling(int start, int end);
+ void addStyleToPreeditStyling(StyleType currentStyleType, bool setValue);
+ void insertTextWithPreeditStyling(const QString &text, int &currentListIndex, int &currentCount);
+ void clearUnusedPreeditStyling(int currentListIndex, int currentCount);
+
void _q_confirmCompletion(const QString &);
- bool copy();
+ virtual bool copy();
-private:
bool pendingSoftwareInputPanelRequest;
+
+private:
const QValidator *validator;
bool ownValidator; // setting content type creates a validator that the widget owns
diff --git a/src/corelib/widgets/mtexteditmodel.h b/src/corelib/widgets/mtexteditmodel.h
index 9d3ba3a9..2dd495b4 100644
--- a/src/corelib/widgets/mtexteditmodel.h
+++ b/src/corelib/widgets/mtexteditmodel.h
@@ -88,6 +88,7 @@ private:
M_MODEL_PROPERTY(QString, toolbar, Toolbar, true, QString())
M_MODEL_PROPERTY(int, toolbarId, ToolbarId, true, -1)
M_MODEL_PROPERTY(MTextEditModel::EchoMode, echo, Echo, true, MTextEditModel::Normal)
+ M_MODEL_PROPERTY(bool, isAutoSipEnabled, AutoSipEnabled, true, true)
public:
void updateCursor() {
diff --git a/src/corelib/widgets/mtoolbar.cpp b/src/corelib/widgets/mtoolbar.cpp
index 1d65b20f..96c61fe1 100644
--- a/src/corelib/widgets/mtoolbar.cpp
+++ b/src/corelib/widgets/mtoolbar.cpp
@@ -47,10 +47,9 @@ void MToolBarPrivate::initLayout()
{
Q_Q(MToolBar);
- QGraphicsLinearLayout *layout = new QGraphicsLinearLayout();
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(q);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
- q->setLayout(layout);
}
MToolBar::MToolBar(QGraphicsItem *parent, const QString &viewType)
diff --git a/src/corelib/widgets/mwindow.cpp b/src/corelib/widgets/mwindow.cpp
index 4c927b23..27d5856d 100644
--- a/src/corelib/widgets/mwindow.cpp
+++ b/src/corelib/widgets/mwindow.cpp
@@ -136,6 +136,8 @@ void MWindowPrivate::init()
q->viewport()->grabGesture(Qt::TapAndHoldGesture);
q->viewport()->grabGesture(Qt::PinchGesture);
q->viewport()->grabGesture(Qt::PanGesture);
+ q->viewport()->grabGesture(Qt::SwipeGesture);
+ q->viewport()->grabGesture(Qt::TapGesture);
q->setAttribute(Qt::WA_AcceptTouchEvents);
}
@@ -207,6 +209,13 @@ M::Orientation MWindowPrivate::orientation(M::OrientationAngle angle) const
return (angle == M::Angle0 || angle == M::Angle180) ? M::Landscape : M::Portrait;
}
+// return true if modifiers match what is required for debug keyboard shortcuts
+bool MWindowPrivate::debugShortcutModifiersPresent(Qt::KeyboardModifiers modifiers) const
+{
+ return (modifiers & (Qt::ControlModifier | Qt::AltModifier)
+ && (modifiers & Qt::ShiftModifier));
+}
+
void MWindowPrivate::notifyWidgetsAboutOrientationChange()
{
Q_Q(MWindow);
@@ -357,6 +366,12 @@ void MWindow::setTranslucentBackground(bool enable)
d->glWidget->setPalette(palette);
} else {
d->glWidget = MComponentCache::glWidget();
+
+ if (d->glWidget->isValid() == false) {
+ qCritical("Could not create a valid QGLWidget, quitting.");
+ exit(EXIT_FAILURE);
+ }
+
setViewport(d->glWidget);
}
#ifdef M_USE_OPENGL
@@ -733,34 +748,37 @@ bool MWindow::event(QEvent *event)
bool updateNeeded = false;
//SIMULATION OF ROTATION FOR DEVELOPMENT PURPOSES
- QKeyEvent *k = (QKeyEvent *) event;
- if (Qt::Key_R == k->key() && (k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {
- foreach(MWindow * window, MApplication::windows()) {
- int newAngle = (window->orientationAngle() + ((k->modifiers() & Qt::ShiftModifier) ? 270 : 90)) % 360;
+ QKeyEvent *k = static_cast<QKeyEvent *>(event);
+ if (Qt::Key_R == k->key() && d->debugShortcutModifiersPresent(k->modifiers())) {
+ foreach (MWindow *window, MApplication::windows()) {
+ int newAngle = (window->orientationAngle()
+ + ((k->modifiers() & Qt::AltModifier) ? 270 : 90)) % 360;
if (!window->isOrientationAngleLocked()) {
- if (!window->isOrientationLocked() || window->orientation() == (M::Orientation)newAngle)
- window->setOrientationAngle((M::OrientationAngle)newAngle);
+ if ((!window->isOrientationLocked())
+ || window->orientation() == static_cast<M::Orientation>(newAngle)) {
+ window->setOrientationAngle(static_cast<M::OrientationAngle>(newAngle));
+ }
}
}
- } else if (Qt::Key_P == k->key() && (k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {
+ } else if (Qt::Key_P == k->key() && d->debugShortcutModifiersPresent(k->modifiers())) {
MApplication::setShowPosition(!MApplication::showPosition());
updateNeeded = true;
- } else if (Qt::Key_S == k->key() && (k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {
+ } else if (Qt::Key_S == k->key() && d->debugShortcutModifiersPresent(k->modifiers())) {
MApplication::setShowSize(!MApplication::showSize());
updateNeeded = true;
- } else if (Qt::Key_B == k->key() && (k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {
+ } else if (Qt::Key_B == k->key() && d->debugShortcutModifiersPresent(k->modifiers())) {
MApplication::setShowBoundingRect(!MApplication::showBoundingRect());
updateNeeded = true;
- } else if (Qt::Key_M == k->key() && (k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {
+ } else if (Qt::Key_M == k->key() && d->debugShortcutModifiersPresent(k->modifiers())) {
MApplication::setShowMargins(!MApplication::showMargins());
updateNeeded = true;
- } else if (Qt::Key_N == k->key() && (k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {
+ } else if (Qt::Key_N == k->key() && d->debugShortcutModifiersPresent(k->modifiers())) {
MApplication::setShowObjectNames(!MApplication::showObjectNames());
updateNeeded = true;
- } else if (Qt::Key_F == k->key() && (k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {
+ } else if (Qt::Key_F == k->key() && d->debugShortcutModifiersPresent(k->modifiers())) {
MApplication::setShowFps(!MApplication::showFps());
updateNeeded = true;
- } else if (Qt::Key_D == k->key() && (k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {
+ } else if (Qt::Key_D == k->key() && d->debugShortcutModifiersPresent(k->modifiers())) {
Qt::LayoutDirection dir = MApplication::layoutDirection();
if (dir == Qt::LeftToRight)
@@ -771,7 +789,7 @@ bool MWindow::event(QEvent *event)
MApplication::setLayoutDirection(dir);
updateNeeded = true;
- } else if (Qt::Key_L == k->key() && (k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) {
+ } else if (Qt::Key_L == k->key() && d->debugShortcutModifiersPresent(k->modifiers())) {
// switch language
QString language;
diff --git a/src/corelib/widgets/mwindow_p.h b/src/corelib/widgets/mwindow_p.h
index 5eeb40a9..faf70762 100644
--- a/src/corelib/widgets/mwindow_p.h
+++ b/src/corelib/widgets/mwindow_p.h
@@ -40,6 +40,7 @@ public:
void handleApplicationLayoutDirectionChangeEvent(QGraphicsItem *item);
void handleLanguageChangeEvent(QGraphicsItem *item);
M::Orientation orientation(M::OrientationAngle angle) const;
+ bool debugShortcutModifiersPresent(Qt::KeyboardModifiers modifiers) const;
#ifdef Q_WS_X11
void appendVisibilityChangeMask();
diff --git a/src/corelib/widgets/widgets.pri b/src/corelib/widgets/widgets.pri
index be1ef10f..ca45964c 100644
--- a/src/corelib/widgets/widgets.pri
+++ b/src/corelib/widgets/widgets.pri
@@ -36,6 +36,7 @@ PUBLIC_HEADERS += \
$$WIDGETS_SRC_DIR/mpopuplist_p.h \
$$WIDGETS_SRC_DIR/mpositionindicator.h \
$$WIDGETS_SRC_DIR/mprogressindicator.h \
+ $$WIDGETS_SRC_DIR/mrichtextedit.h \
$$WIDGETS_SRC_DIR/mscenewindow.h \
$$WIDGETS_SRC_DIR/mseekbar.h \
$$WIDGETS_SRC_DIR/mslider.h \
@@ -101,6 +102,7 @@ SOURCES += \
$$WIDGETS_SRC_DIR/mapplicationpage.cpp \
$$WIDGETS_SRC_DIR/mapplicationwindow.cpp \
$$WIDGETS_SRC_DIR/mbutton.cpp \
+ $$WIDGETS_SRC_DIR/mbuttonmodel.cpp \
$$WIDGETS_SRC_DIR/mbuttongroup.cpp \
$$WIDGETS_SRC_DIR/mcombobox.cpp \
$$WIDGETS_SRC_DIR/mcontainer.cpp \
@@ -131,6 +133,7 @@ SOURCES += \
$$WIDGETS_SRC_DIR/mpopuplist.cpp \
$$WIDGETS_SRC_DIR/mpositionindicator.cpp \
$$WIDGETS_SRC_DIR/mprogressindicator.cpp \
+ $$WIDGETS_SRC_DIR/mrichtextedit.cpp \
$$WIDGETS_SRC_DIR/mscenewindow.cpp \
$$WIDGETS_SRC_DIR/mseekbar.cpp \
$$WIDGETS_SRC_DIR/mslider.cpp \
diff --git a/src/corelib/workspace/devices.conf b/src/corelib/workspace/devices.conf
index d5847a4a..a3292730 100644
--- a/src/corelib/workspace/devices.conf
+++ b/src/corelib/workspace/devices.conf
@@ -3,40 +3,47 @@ resolutionX=864
resolutionY=480
ppiX=261
ppiY=261
+showStatusBar=true
[N900]
resolutionX=800
resolutionY=480
ppiX=261
ppiY=261
+showStatusBar=false
[N95]
resolutionX=240
resolutionY=320
ppiX=153
ppiY=153
+showStatusBar=false
[Pineapple]
resolutionX=480
resolutionY=320
ppiX=163
ppiY=163
+showStatusBar=false
[N95i]
resolutionX=240
resolutionY=800
ppiX=152
ppiY=152
+showStatusBar=false
[QVGAL]
resolutionX=320
resolutionY=240
ppiX=152
ppiY=152
+showStatusBar=true
[N97]
resolutionX=640
resolutionY=360
ppiX=209
ppiY=209
+showStatusBar=false
diff --git a/src/corelib/workspace/mdeviceprofile.cpp b/src/corelib/workspace/mdeviceprofile.cpp
index 0ff17d2d..7810ef0f 100644
--- a/src/corelib/workspace/mdeviceprofile.cpp
+++ b/src/corelib/workspace/mdeviceprofile.cpp
@@ -21,6 +21,7 @@
#include <QSize>
#include <QSettings>
#include <QFile>
+#include <QDir>
#include "mdebug.h"
#include "mdeviceprofile.h"
@@ -35,6 +36,14 @@ MDeviceProfilePrivate::MDeviceProfilePrivate()
{
QString filename = "/etc/meegotouch/devices.conf";
+#ifdef Q_OS_WIN
+ QDir appDir(QCoreApplication::applicationDirPath());
+ appDir.cdUp();
+ appDir.cd("etc");
+ appDir.cd("meegotouch");
+ filename = appDir.path().append("/devices.conf" );
+#endif
+
if(!load(filename)) {
qFatal("Failed to load device profile.");
}
@@ -61,6 +70,7 @@ bool MDeviceProfilePrivate::load(const QString& filename)
resolution.setHeight(settings.value(device + "/resolutionY", 0).toInt());
pixelsPerInch.setWidth(settings.value(device + "/ppiX", 0).toInt());
pixelsPerInch.setHeight(settings.value(device + "/ppiY", 0).toInt());
+ showStatusBar=settings.value(device+"/showStatusBar",false).toBool();
return true;
}
@@ -71,8 +81,14 @@ MDeviceProfile *MDeviceProfile::instance()
{
MComponentData *data = MComponentData::instance();
if (!data)
+ {
qFatal("There is no instance of MDeviceProfile. Please create MComponentData first.");
- return data->d_ptr->deviceProfile;
+ return 0;
+ }
+ else
+ {
+ return data->d_ptr->deviceProfile;
+ }
}
MDeviceProfile::MDeviceProfile(QObject *parent)
@@ -104,3 +120,9 @@ QSize MDeviceProfile::pixelsPerInch() const
Q_D(const MDeviceProfile);
return d->pixelsPerInch;
}
+
+bool MDeviceProfile::showStatusbar() const
+{
+ Q_D(const MDeviceProfile);
+ return d->showStatusBar;
+}
diff --git a/src/corelib/workspace/mdeviceprofile.h b/src/corelib/workspace/mdeviceprofile.h
index 6d70c672..fc447453 100644
--- a/src/corelib/workspace/mdeviceprofile.h
+++ b/src/corelib/workspace/mdeviceprofile.h
@@ -52,6 +52,9 @@ public:
//! Return the target device pixels per inch
QSize pixelsPerInch() const;
+ //! Return whether the status bar should be shown on target device
+ bool showStatusbar() const;
+
protected:
MDeviceProfilePrivate *const d_ptr;
diff --git a/src/corelib/workspace/mdeviceprofile_p.h b/src/corelib/workspace/mdeviceprofile_p.h
index 5c43ead5..b29beef6 100644
--- a/src/corelib/workspace/mdeviceprofile_p.h
+++ b/src/corelib/workspace/mdeviceprofile_p.h
@@ -36,6 +36,7 @@ public:
QSize resolution;
QSize pixelsPerInch;
+ bool showStatusBar;
protected:
MDeviceProfile *q_ptr;