ui/views/slideshowview/src/glxslideshowwidget.cpp
changeset 58 383b67fbdb11
parent 54 0f0f3f26f787
child 62 36d93b4dc635
equal deleted inserted replaced
54:0f0f3f26f787 58:383b67fbdb11
    51       mContinueButton( NULL ), 
    51       mContinueButton( NULL ), 
    52       mErrorNote( NULL ),
    52       mErrorNote( NULL ),
    53       mItemIndex( 1 ),  
    53       mItemIndex( 1 ),  
    54       mSlideTimer( NULL ), 
    54       mSlideTimer( NULL ), 
    55       mModel( NULL ), 
    55       mModel( NULL ), 
    56       mSlideShowItemCount( 0 )
    56       mSlideShowItemCount( 0 ),
       
    57       mIsAutoMoving ( false )
    57 {
    58 {
    58     TRACER("GlxSlideShowWidget::GlxSlideShowWidget()");
    59     TRACER("GlxSlideShowWidget::GlxSlideShowWidget()");
    59     mSettings = GlxSettingInterface::instance() ; //no owner ship
    60     mSettings = GlxSettingInterface::instance() ; //no owner ship
    60     grabGesture( Qt::PanGesture );
    61     grabGesture( Qt::PanGesture );
    61     grabGesture( Qt::TapGesture );
    62     grabGesture( Qt::TapGesture );
   348     mItemIndex = ( ++mItemIndex ) % NBR_ITEM;
   349     mItemIndex = ( ++mItemIndex ) % NBR_ITEM;
   349     mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxFocusIndexRole );
   350     mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxFocusIndexRole );
   350     mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxVisualWindowIndex );
   351     mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxVisualWindowIndex );
   351     setNextItemIcon();
   352     setNextItemIcon();
   352     startSlideShow();
   353     startSlideShow();
       
   354     mIsAutoMoving = false;
   353     emit indexchanged(); // on left swipe
   355     emit indexchanged(); // on left swipe
   354 }
   356 }
   355 
   357 
   356 void GlxSlideShowWidget::rightMoveEffectFinished( const HbEffect::EffectStatus &status )
   358 void GlxSlideShowWidget::rightMoveEffectFinished( const HbEffect::EffectStatus &status )
   357 {
   359 {
   362     mItemIndex = mItemIndex ? mItemIndex - 1 : NBR_ITEM - 1;
   364     mItemIndex = mItemIndex ? mItemIndex - 1 : NBR_ITEM - 1;
   363     mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxFocusIndexRole );
   365     mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxFocusIndexRole );
   364     mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxVisualWindowIndex );
   366     mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxVisualWindowIndex );
   365     setPreItemIcon();
   367     setPreItemIcon();
   366     startSlideShow();
   368     startSlideShow();
       
   369     mIsAutoMoving = false;
   367     emit indexchanged(); // on right swipe
   370     emit indexchanged(); // on right swipe
   368 } 
   371 } 
   369  
   372  
   370 void GlxSlideShowWidget::gestureEvent(QGestureEvent *event)
   373 void GlxSlideShowWidget::gestureEvent(QGestureEvent *event)
   371 {  
   374 {  
   376             }
   379             }
   377             event->accept(gesture);
   380             event->accept(gesture);
   378         }
   381         }
   379     }
   382     }
   380       
   383       
   381     if (QPanGesture *panningGesture = qobject_cast<QPanGesture*>(event->gesture(Qt::PanGesture))) {
   384     if ( QPanGesture *panningGesture = qobject_cast<QPanGesture*>( event->gesture( Qt::PanGesture ) ) ) {
   382         HbPanGesture *hbPanGesture = qobject_cast<HbPanGesture *>(panningGesture);
   385         HbPanGesture *hbPanGesture = qobject_cast<HbPanGesture *>( panningGesture );
   383         if ( hbPanGesture ) {
   386         if ( hbPanGesture ) {
   384             if( hbPanGesture->state() == Qt::GestureFinished ) {
   387             if( hbPanGesture->state() == Qt::GestureFinished && mIsAutoMoving == FALSE ) {
   385                 QPointF delta( hbPanGesture->sceneDelta() );
   388                 QPointF delta( hbPanGesture->sceneDelta() );
   386                 if ( delta.x() > 0 ) {
   389                 if ( delta.x() > 0 ) {
   387                     rightGesture( delta.x() );
   390                     rightGesture( delta.x() );
   388                 }
   391                 }
   389                 else {
   392                 else {
   462     TRACER("GlxSlideShowWidget::MoveImage()");
   465     TRACER("GlxSlideShowWidget::MoveImage()");
   463 
   466 
   464     if ( mSlideShowItemCount <= 1 || mEffectEngine->isEffectRuning( mItemList ) ) {
   467     if ( mSlideShowItemCount <= 1 || mEffectEngine->isEffectRuning( mItemList ) ) {
   465         return ;
   468         return ;
   466     }
   469     }
   467 
   470     
   468     mSlideTimer->stop();
   471     mSlideTimer->stop();
   469     HbEffect::start( mIconItems[mItemIndex], QString("HbIconItem"), move );
   472     HbEffect::start( mIconItems[mItemIndex], QString("HbIconItem"), move );
   470     mIconItems[nextIndex]->setPos( posX, mScreenRect.top());
   473     mIconItems[nextIndex]->setPos( posX, mScreenRect.top());
   471     mIconItems[nextIndex]->setOpacity(1);
   474     mIconItems[nextIndex]->setOpacity(1);
       
   475     mIsAutoMoving = true;
   472     HbEffect::start(mIconItems[nextIndex], QString("HbIconItem"), QString("Move"), this, callBack );    
   476     HbEffect::start(mIconItems[nextIndex], QString("HbIconItem"), QString("Move"), this, callBack );    
   473 }
   477 }
   474 
   478 
   475 void GlxSlideShowWidget::addConnections()
   479 void GlxSlideShowWidget::addConnections()
   476 {
   480 {