src/hbcore/gestures/hbswipegesture.cpp
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 2 06ff229162e9
equal deleted inserted replaced
0:16d8024aca5e 1:f7ac710697a9
    21 ** If you have questions regarding the use of this file, please contact
    21 ** If you have questions regarding the use of this file, please contact
    22 ** Nokia at developer.feedback@nokia.com.
    22 ** Nokia at developer.feedback@nokia.com.
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 
    25 
       
    26 #include "hbgestures_p.h"
    26 #include "hbswipegesture.h"
    27 #include "hbswipegesture.h"
    27 #include "hbswipegesture_p.h"
    28 #include "hbswipegesture_p.h"
       
    29 #include "hbglobal_p.h"
    28 #include <QPointF>
    30 #include <QPointF>
    29 #include <QVariant>
    31 #include <QVariant>
    30 
    32 
    31 HbSwipeGesture::HbSwipeGesture(QObject *parent)
    33 HbSwipeGesture::HbSwipeGesture(QObject *parent)
    32     : QSwipeGesture(parent), d_ptr(new HbSwipeGesturePrivate)
    34     : QSwipeGesture(parent), d_ptr(new HbSwipeGesturePrivate)
    33 
    35 
    34 {
    36 {   
    35 
    37     d_ptr->mSceneSwipeAngle = 0;
    36 }
    38 }
    37 
    39 
    38 HbSwipeGesture::HbSwipeGesture(HbSwipeGesturePrivate &dd, QObject *parent)
    40 HbSwipeGesture::HbSwipeGesture(HbSwipeGesturePrivate &dd, QObject *parent)
    39     : QSwipeGesture(parent), d_ptr(&dd)
    41     : QSwipeGesture(parent), d_ptr(&dd)
    40 {
    42 {
    44 HbSwipeGesture::~HbSwipeGesture()
    46 HbSwipeGesture::~HbSwipeGesture()
    45 {
    47 {
    46     delete d_ptr;
    48     delete d_ptr;
    47 }
    49 }
    48 
    50 
       
    51 QSwipeGesture::SwipeDirection HbSwipeGesture::sceneHorizontalDirection() const
       
    52 {
       
    53     if (d_ptr->mSceneSwipeAngle < 0 || d_ptr->mSceneSwipeAngle == 90 || d_ptr->mSceneSwipeAngle == 270)
       
    54         return QSwipeGesture::NoDirection;
       
    55     else if (d_ptr->mSceneSwipeAngle < 90 || d_ptr->mSceneSwipeAngle > 270)
       
    56         return QSwipeGesture::Right;
       
    57     else
       
    58         return QSwipeGesture::Left;
       
    59 }
       
    60 
       
    61 QSwipeGesture::SwipeDirection HbSwipeGesture::sceneVerticalDirection() const
       
    62 {    
       
    63     if (d_ptr->mSceneSwipeAngle <= 0 || d_ptr->mSceneSwipeAngle == 180)
       
    64         return QSwipeGesture::NoDirection;
       
    65     else if (d_ptr->mSceneSwipeAngle < 180)
       
    66         return QSwipeGesture::Up;
       
    67     else
       
    68         return QSwipeGesture::Down;
       
    69 }
       
    70 
       
    71 qreal HbSwipeGesture::sceneSwipeAngle() const
       
    72 {
       
    73     return d_ptr->mSceneSwipeAngle;
       
    74 }
       
    75 
       
    76 void HbSwipeGesture::setSceneSwipeAngle(qreal value)
       
    77 {
       
    78     d_ptr->mSceneSwipeAngle = value;
       
    79 }
       
    80 
       
    81 
    49 /*!
    82 /*!
    50 
    83     \deprecated
    51     \property speed
    84     \property speed
    52 
    85 
    53     Stores the speed of the swipe gesture in pixels per milliseconds.
    86     Stores the speed of the swipe gesture in pixels per milliseconds.
    54 
       
    55 */
    87 */
    56 qreal HbSwipeGesture::speed() const
    88 qreal HbSwipeGesture::speed() const
    57 {
    89 {    
    58     Q_D(const HbSwipeGesture);
    90     HB_DEPRECATED("HbSwipeGesture::speed is deprecated");
    59     return d->mSpeed;
    91     return 1;
    60 }
    92 }
    61 
    93 
    62 void HbSwipeGesture::setSpeed(qreal speed)
    94 void HbSwipeGesture::setSpeed(qreal speed)
    63 {
    95 {
    64     Q_D(HbSwipeGesture);
    96     Q_UNUSED (speed);
    65     d->mSpeed = speed;
    97     HB_DEPRECATED("HbSwipeGesture::setSpeed is deprecated");
    66 }
    98 }
    67 
    99 
    68 /*!
   100 /*!
    69 
   101     \deprecated
    70     \property touchPointCount
   102     \property touchPointCount
    71 
   103 
    72     Stores the number of touchpoints used in the swipe
   104     Stores the number of touchpoints used in the swipe
    73 
   105 
    74 */
   106 */
    75 int HbSwipeGesture::touchPointCount() const
   107 int HbSwipeGesture::touchPointCount() const
    76 {
   108 {
    77     Q_D(const HbSwipeGesture);
   109     HB_DEPRECATED("HbSwipeGesture::touchPointCount is deprecated");
    78     return d->mTouchPointCount;
   110     return 0;
    79 }
   111 }
    80 
   112 
    81 void HbSwipeGesture::setTouchPointCount(int touchPointCount)
   113 void HbSwipeGesture::setTouchPointCount(int touchPointCount)
    82 {
   114 {
    83     Q_D(HbSwipeGesture);
   115     HB_DEPRECATED("HbSwipeGesture::setTouchPointCount is deprecated");
    84     d->mTouchPointCount = touchPointCount;
   116     Q_UNUSED(touchPointCount)
    85 }
   117 }