ui/views/fullscreenview/src/glxcoverflow.cpp
changeset 44 aa2fa096cbfb
parent 43 72396548277c
child 45 863223ea6961
equal deleted inserted replaced
43:72396548277c 44:aa2fa096cbfb
    43        mItemSize (QSize(0,0)),
    43        mItemSize (QSize(0,0)),
    44        mModel ( NULL),
    44        mModel ( NULL),
    45        mMoveDir(NO_MOVE),
    45        mMoveDir(NO_MOVE),
    46        mSpeed ( GLX_COVERFLOW_SPEED ),
    46        mSpeed ( GLX_COVERFLOW_SPEED ),
    47 	   mZoomOn(false),
    47 	   mZoomOn(false),
    48 	   mMultitouchFilter(NULL)
    48 	   mMultitouchFilter(NULL),
       
    49        mTimerId(0)
    49 {
    50 {
    50 //TO:DO through exception
    51 //TO:DO through exception
    51    qDebug("GlxCoverFlow::GlxCoverFlow");
    52    qDebug("GlxCoverFlow::GlxCoverFlow");
    52    grabGesture(Qt::PanGesture);
    53    grabGesture(Qt::PanGesture);
    53    grabGesture(Qt::TapGesture);
    54    grabGesture(Qt::TapGesture);
    61 }
    62 }
    62 void GlxCoverFlow::setCoverFlow()
    63 void GlxCoverFlow::setCoverFlow()
    63 {
    64 {
    64     qDebug("GlxCoverFlow::setCoverFlow");
    65     qDebug("GlxCoverFlow::setCoverFlow");
    65     for ( qint8 i = 0; i < NBR_ICON_ITEM ; i++ ) {
    66     for ( qint8 i = 0; i < NBR_ICON_ITEM ; i++ ) {
    66         mIconItem[i] = new HbIconItem(this);
    67         mIconItem[i] = new HbIconItem( this );
    67         mIconItem[i]->grabGesture(Qt::PinchGesture, Qt::ReceivePartialGestures);
    68         mIconItem[i]->grabGesture( Qt::PinchGesture, Qt::ReceivePartialGestures );
    68         mIconItem[i]->installSceneEventFilter(mMultitouchFilter);
    69         mIconItem[i]->installSceneEventFilter( mMultitouchFilter );
    69         mIconItem[i]->setBrush(QBrush(Qt::black));
    70         mIconItem[i]->setBrush( QBrush( Qt::black ) );
    70         mIconItem[i]->setSize(QSize(0,0));
    71         mIconItem[i]->setSize( QSize( 0, 0 ) );
       
    72         mIconItem[i]->setAlignment( Qt::AlignCenter );
    71     }
    73     }
    72     mUiOn = FALSE;
    74     mUiOn = FALSE;
    73     mBounceBackDeltaX = GLX_BOUNCEBACK_DELTA;
    75     mBounceBackDeltaX = GLX_BOUNCEBACK_DELTA;
    74 }
    76 }
    75 
    77 
   106 
   108 
   107 void GlxCoverFlow::gestureEvent(QGestureEvent *event)
   109 void GlxCoverFlow::gestureEvent(QGestureEvent *event)
   108 {    
   110 {    
   109     if(QTapGesture *gesture = static_cast<QTapGesture *>(event->gesture(Qt::TapGesture))) {        
   111     if(QTapGesture *gesture = static_cast<QTapGesture *>(event->gesture(Qt::TapGesture))) {        
   110         if (gesture->state() == Qt::GestureFinished) {
   112         if (gesture->state() == Qt::GestureFinished) {
   111             emit coverFlowEvent( TAP_EVENT );
   113             if(!mTimerId) {
       
   114                 mTimerId = startTimer(500);
       
   115             }
       
   116             else {
       
   117                 killTimer(mTimerId);
       
   118                 mTimerId = 0;
       
   119                 emit doubleTapEventReceived(gesture->position());
       
   120             }
   112             event->accept(gesture);
   121             event->accept(gesture);
   113         }
   122         }
   114     }
   123     }
   115   
   124   
   116     if (QPanGesture *panningGesture = qobject_cast<QPanGesture*>(event->gesture(Qt::PanGesture))) {
   125     if (QPanGesture *panningGesture = qobject_cast<QPanGesture*>(event->gesture(Qt::PanGesture))) {
   533 { 
   542 { 
   534 	mZoomOn = false;
   543 	mZoomOn = false;
   535 	indexChanged(index);
   544 	indexChanged(index);
   536 
   545 
   537 }
   546 }
       
   547 
       
   548 void GlxCoverFlow::timerEvent(QTimerEvent *event)
       
   549 {
       
   550     if(mTimerId == event->timerId())
       
   551     {
       
   552         killTimer(mTimerId);
       
   553         mTimerId = 0;
       
   554         emit coverFlowEvent( TAP_EVENT );
       
   555     }
       
   556 }