ui/views/fullscreenview/src/glxcoverflow.cpp
changeset 29 2c833fc9e98f
parent 26 c499df2dbb33
child 33 1ee2af37811f
equal deleted inserted replaced
26:c499df2dbb33 29:2c833fc9e98f
    19 //Includes
    19 //Includes
    20 #include <hbiconitem.h>
    20 #include <hbiconitem.h>
    21 #include <QAbstractItemModel>
    21 #include <QAbstractItemModel>
    22 #include <QGraphicsSceneMouseEvent>
    22 #include <QGraphicsSceneMouseEvent>
    23 #include <QDebug>
    23 #include <QDebug>
       
    24 #include <QGesture>
       
    25 #include <hbpangesture.h>
    24 
    26 
    25 //User Includes
    27 //User Includes
    26 #include <glxmodelparm.h>
    28 #include <glxmodelparm.h>
    27 #include <glxcoverflow.h>
    29 #include <glxcoverflow.h>
    28 #include "glxviewids.h"
    30 #include "glxviewids.h"
    29 
    31 
    30 const int KMoveX = 60;  //coverflow auto move speed
    32 #define GLX_COVERFLOW_SPEED 60
    31 
    33 #define GLX_BOUNCEBACK_SPEED 15
    32 GlxCoverFlow::GlxCoverFlow(QGraphicsItem *parent ) : HbScrollArea(parent), mSelItemIndex (0),
    34 
    33               mRows(0), mSelIndex (0), mStripLen (0), mCurrentPos(0), 
    35 GlxCoverFlow::GlxCoverFlow(QGraphicsItem *parent ) 
    34               mItemSize (QSize(0,0)), mModel ( NULL), mMoveDir(NO_MOVE), rotAngle(0) 
    36      : HbWidget(parent), 
       
    37        mSelItemIndex (0),
       
    38        mRows(0),
       
    39        mSelIndex (0),
       
    40        mStripLen (0),
       
    41        mCurrentPos(0),
       
    42        mItemSize (QSize(0,0)),
       
    43        mModel ( NULL),
       
    44        mMoveDir(NO_MOVE),
       
    45        mSpeed ( GLX_COVERFLOW_SPEED )
    35 {
    46 {
    36 //TO:DO through exception
    47 //TO:DO through exception
    37    qDebug("GlxCoverFlow::GlxCoverFlow");
    48    qDebug("GlxCoverFlow::GlxCoverFlow");
    38    HbEffect::add( QString("HbIconItem"), QString(":/data/transitionrotate0.fxml"), QString( "RotateImage0" ));
    49    grabGesture(Qt::PanGesture);
    39    HbEffect::add( QString("HbIconItem"), QString(":/data/transitionrotate90.fxml"), QString( "RotateImage90" ));
    50    grabGesture(Qt::TapGesture);
    40    HbEffect::add( QString("HbIconItem"), QString(":/data/transitionrotate180.fxml"), QString( "RotateImage180" ));
       
    41    HbEffect::add( QString("HbIconItem"), QString(":/data/transitionrotate270.fxml"), QString( "RotateImage270" ));
       
    42    connect( this, SIGNAL( autoLeftMoveSignal() ), this, SLOT( autoLeftMove() ), Qt::QueuedConnection );
    51    connect( this, SIGNAL( autoLeftMoveSignal() ), this, SLOT( autoLeftMove() ), Qt::QueuedConnection );
    43    connect( this, SIGNAL( autoRightMoveSignal() ), this, SLOT( autoRightMove() ), Qt::QueuedConnection );   
    52    connect( this, SIGNAL( autoRightMoveSignal() ), this, SLOT( autoRightMove() ), Qt::QueuedConnection );   
    44 }
    53 }
    45 
    54 
    46 void GlxCoverFlow::setCoverFlow()
    55 void GlxCoverFlow::setCoverFlow()
    81 void GlxCoverFlow::indexChanged( int index )
    90 void GlxCoverFlow::indexChanged( int index )
    82 {
    91 {
    83     qDebug("GlxCoverFlow::indexChanged index = %d mSelIndex = %d ",index, mSelIndex );
    92     qDebug("GlxCoverFlow::indexChanged index = %d mSelIndex = %d ",index, mSelIndex );
    84     if ( index != mSelIndex && mModel) {
    93     if ( index != mSelIndex && mModel) {
    85         loadIconItems();
    94         loadIconItems();
    86 		if(rotAngle) {
    95     }
    87             rotAngle = 0;
    96 }
    88             //HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage270"), this, "rotationEffectFinished" );
    97 
    89             mIconItem[mSelItemIndex]->resetTransform();
    98 void GlxCoverFlow::gestureEvent(QGestureEvent *event)
    90             mIconItem[mSelItemIndex]->resize(mItemSize);
    99 {    
    91         }
   100  if(QTapGesture *gesture = static_cast<QTapGesture *>(event->gesture(Qt::TapGesture))) {        
    92     }
   101         if (gesture->state() == Qt::GestureFinished) {
    93 }
   102                      emit coverFlowEvent( TAP_EVENT );
    94 
   103                       event->accept(gesture);
    95 void GlxCoverFlow::rotateImage ()  
   104             }
    96 {
   105         }
    97     qDebug("GlxCoverFlow::rotateImage ");  
   106   
    98 	if(rotAngle == 0)
   107   if (QPanGesture *panningGesture = qobject_cast<QPanGesture*>(event->gesture(Qt::PanGesture))) {
    99 	{
   108         HbPanGesture *hbPanGesture = qobject_cast<HbPanGesture *>(panningGesture);
   100 		HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage0"), this, "rotationEffectFinished" );
   109          if (hbPanGesture) {
   101 	}
   110             if(hbPanGesture->state() == Qt::GestureUpdated) {
   102 	if(rotAngle == 90)
   111                  QPointF delta(hbPanGesture->sceneDelta());
   103 	{
   112                  panGesture(delta);
   104 		HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage90"), this, "rotationEffectFinished" );
   113                   event->accept(panningGesture);
   105 	}
   114 
   106 	if(rotAngle == 180)
   115             }
   107 	{
   116              if(hbPanGesture->state() == Qt::GestureFinished) {
   108 		HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage180"), this, "rotationEffectFinished" );
   117                  switch( mMoveDir ) {
   109 	}
   118     
   110 	if(rotAngle == 270)
   119                         case LEFT_MOVE: 
   111 	{
   120                             mMoveDir = NO_MOVE;
   112 		HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage270"), this, "rotationEffectFinished" );
   121                             emit autoLeftMoveSignal();
   113 	}	
   122                             break ;
   114 	rotAngle += 90;
   123         
   115 	rotAngle %= 360;	
   124                         case RIGHT_MOVE :
   116 }
   125                             mMoveDir = NO_MOVE;
   117 
   126                             emit autoRightMoveSignal();
   118 void GlxCoverFlow::rotationEffectFinished (const HbEffect::EffectStatus &status)  
   127                             break;
   119 {
   128         
   120     Q_UNUSED(status)
   129                         default:
   121     
   130                             break;
   122     qDebug("GlxCoverFlow::rotationEffectFinished");  
   131                     } 
   123 	QSize itemSize = mItemSize;
   132                   event->accept(panningGesture);
   124 	if((rotAngle == 90) || (rotAngle == 270)) {
   133 
   125 		itemSize.transpose();
   134             }
   126 	}
   135          }
   127 	mIconItem[mSelItemIndex]->resetTransform();
   136     }
   128 	mIconItem[mSelItemIndex]->resize(itemSize);
   137   
   129 	mIconItem[mSelItemIndex]->setPos((mItemSize.width() - itemSize.width())/2, (mItemSize.height() - itemSize.height())/2 );
       
   130 	QTransform rotateTransform = mIconItem[mSelItemIndex]->transform();
       
   131 	rotateTransform.translate((mItemSize.width()/2)-((mItemSize.width() - itemSize.width())/2),(mItemSize.height()/2) - ((mItemSize.height() - itemSize.height())/2));
       
   132 	rotateTransform.rotate(rotAngle);
       
   133 	rotateTransform.translate(-((mItemSize.width()/2)-((mItemSize.width() - itemSize.width())/2)),-((mItemSize.height()/2) - ((mItemSize.height() - itemSize.height())/2)));
       
   134 	mIconItem[mSelItemIndex]->setTransform(rotateTransform);
       
   135 
       
   136 }
   138 }
   137 
   139 
   138 void GlxCoverFlow::panGesture ( const QPointF & delta )  
   140 void GlxCoverFlow::panGesture ( const QPointF & delta )  
   139 {
   141 {
   140     qDebug("GlxCoverFlow::panGesture deltaX= %d", (int)delta.x());  
   142     qDebug("GlxCoverFlow::panGesture deltaX= %d", (int)delta.x());  
   141     if(getSubState() == IMAGEVIEWER_S || getSubState() == FETCHER_S )
   143     if(getSubState() == IMAGEVIEWER_S || getSubState() == FETCHER_S ) {
   142         {
       
   143         return;
   144         return;
   144         }
   145     }
   145 	move((int) delta.x());    
   146     move((int) delta.x());    
   146     if( delta.x() > 0 ) {     
   147     if( delta.x() > 0 ) {     
   147         mMoveDir = RIGHT_MOVE;
   148         mMoveDir = RIGHT_MOVE;
   148     }
   149     }
   149     else if ( delta.x() < 0) {
   150     else if ( delta.x() < 0) {
   150         mMoveDir = LEFT_MOVE;
   151         mMoveDir = LEFT_MOVE;
   156     }
   157     }
   157 }
   158 }
   158 
   159 
   159 void GlxCoverFlow::leftGesture(int value)
   160 void GlxCoverFlow::leftGesture(int value)
   160 {
   161 {
   161 	Q_UNUSED(value);
   162     Q_UNUSED(value);
   162     qDebug("GlxCoverFlow::leftGesture CurrentPos= %d value %d", mCurrentPos, value); 
   163     qDebug("GlxCoverFlow::leftGesture CurrentPos= %d value %d", mCurrentPos, value); 
   163     if(getSubState() == IMAGEVIEWER_S || getSubState() == FETCHER_S )
   164     if(getSubState() == IMAGEVIEWER_S || getSubState() == FETCHER_S ) {
   164         {
       
   165         return;
   165         return;
   166         }
   166     }
   167     mMoveDir = NO_MOVE;
   167     mMoveDir = NO_MOVE;
   168     mBounceBackDeltaX = mItemSize.width() >> 2;
   168     mBounceBackDeltaX = ( mItemSize.width() >> 2 )  + ( mItemSize.width() >> 3 );
   169     emit autoLeftMoveSignal();
   169     emit autoLeftMoveSignal();
   170     if ( mUiOn == TRUE ) {
   170     if ( mUiOn == TRUE ) {
   171         mUiOn = FALSE;
   171         mUiOn = FALSE;
   172         emit coverFlowEvent( PANNING_START_EVENT );        
   172         emit coverFlowEvent( PANNING_START_EVENT );        
   173     }
   173     }
   174 }
   174 }
   175 
   175 
   176 void GlxCoverFlow::rightGesture(int value)
   176 void GlxCoverFlow::rightGesture(int value)
   177 {
   177 {
   178 	Q_UNUSED(value);
   178     Q_UNUSED(value);
   179     qDebug("GlxCoverFlow::rightGesture CurrentPos= %d value %d ", mCurrentPos, value);
   179     qDebug("GlxCoverFlow::rightGesture CurrentPos= %d value %d ", mCurrentPos, value);
   180     if(getSubState() == IMAGEVIEWER_S || getSubState() == FETCHER_S )
   180     if(getSubState() == IMAGEVIEWER_S || getSubState() == FETCHER_S ) {
   181         {
       
   182         return;
   181         return;
   183         }
   182     }
   184     mMoveDir = NO_MOVE;
   183     mMoveDir = NO_MOVE;
   185     mBounceBackDeltaX = mItemSize.width() >> 2;
   184     mBounceBackDeltaX = ( mItemSize.width() >> 2 )  + ( mItemSize.width() >> 3 );
   186     emit autoRightMoveSignal();
   185     emit autoRightMoveSignal();
   187     if ( mUiOn == TRUE  ) {
   186     if ( mUiOn == TRUE  ) {
   188         mUiOn = FALSE;
   187         mUiOn = FALSE;
   189         emit coverFlowEvent( PANNING_START_EVENT );
   188         emit coverFlowEvent( PANNING_START_EVENT );
   190     }     
   189     }     
   243         resetCoverFlow();   
   242         resetCoverFlow();   
   244         emit changeSelectedIndex ( mModel->index ( mSelIndex, 0 ) ) ;
   243         emit changeSelectedIndex ( mModel->index ( mSelIndex, 0 ) ) ;
   245     }
   244     }
   246 }
   245 }
   247 
   246 
   248 void GlxCoverFlow::mousePressEvent(QGraphicsSceneMouseEvent *event)
   247 
   249 {
       
   250     Q_UNUSED(event);
       
   251     qDebug("GlxCoverFlow::mousePressEvent");
       
   252     mMoveDir = TAP_MOVE;
       
   253 }
       
   254 
       
   255 void GlxCoverFlow::mouseReleaseEvent (QGraphicsSceneMouseEvent *event) 
       
   256 {
       
   257     Q_UNUSED(event);
       
   258     qDebug("GlxCoverFlow::mouseReleaseEvent move dir %d", mMoveDir);
       
   259     
       
   260     switch( mMoveDir ) {
       
   261     case NO_MOVE :
       
   262     	break;
       
   263     	
       
   264     case TAP_MOVE :
       
   265 	    mMoveDir = NO_MOVE;
       
   266 	    emit coverFlowEvent( TAP_EVENT );
       
   267     	break;
       
   268     	
       
   269     case LEFT_MOVE: 
       
   270         mMoveDir = NO_MOVE;
       
   271         emit autoLeftMoveSignal();
       
   272         break ;
       
   273         
       
   274     case RIGHT_MOVE :
       
   275         mMoveDir = NO_MOVE;
       
   276         emit autoRightMoveSignal();
       
   277         break;
       
   278         
       
   279     default:
       
   280         break;
       
   281     } 
       
   282 }
       
   283 
   248 
   284 void GlxCoverFlow::autoLeftMove()
   249 void GlxCoverFlow::autoLeftMove()
   285 {
   250 {
   286     qDebug("GlxCoverFlow::autoLeftMove ");
       
   287     int width = mItemSize.width() ;
   251     int width = mItemSize.width() ;
   288     
   252     
   289     qDebug("GlxCoverFlow::autoLeftMove current pos = %d mBounceBackDeltaX x = %d", mCurrentPos, mBounceBackDeltaX);
   253     qDebug("GlxCoverFlow::autoLeftMove current pos = %d mBounceBackDeltaX x = %d", mCurrentPos, mBounceBackDeltaX);
       
   254     
       
   255     if ( mSelIndex == ( mRows -1 )) {
       
   256         mSpeed = GLX_BOUNCEBACK_SPEED;
       
   257     }
   290     //for bounce back effect for last image ( it will do the back)
   258     //for bounce back effect for last image ( it will do the back)
   291     if ( ( mCurrentPos + width ) > ( mStripLen + mBounceBackDeltaX ) && mMoveDir == NO_MOVE ) {
   259     if ( ( mCurrentPos + width ) > ( mStripLen + mBounceBackDeltaX ) && mMoveDir == NO_MOVE ) {
   292         mMoveDir = LEFT_MOVE;
   260         mMoveDir = LEFT_MOVE;
   293         mBounceBackDeltaX = 10;
   261         mBounceBackDeltaX = 10;
   294         autoRightMoveSignal();
   262         autoRightMoveSignal();
   295         return ;
   263         return ;
   296     }
   264     }
   297     
   265     
   298     int deltaX = width - mCurrentPos %  width ; 
   266     int deltaX = width - mCurrentPos %  width ; 
   299     int moveX = deltaX > KMoveX ? KMoveX : deltaX;
   267     int moveX = deltaX > mSpeed ? mSpeed : deltaX;
   300     
   268     
   301     qDebug("GlxCoverFlow::autoLeftMove delta x = %d current pos = %d move x = %d", deltaX, mCurrentPos, moveX);
   269     qDebug("GlxCoverFlow::autoLeftMove delta x = %d current pos = %d move x = %d", deltaX, mCurrentPos, moveX);
   302     
   270     
   303     move (-moveX);//move the image
   271     move (-moveX);//move the image
   304     deltaX -= moveX; //To know the auto move is required or not
   272     deltaX -= moveX; //To know the auto move is required or not
   312             emit autoRightMoveSignal();
   280             emit autoRightMoveSignal();
   313             return;
   281             return;
   314         }
   282         }
   315         int selIndex = mCurrentPos / width ;
   283         int selIndex = mCurrentPos / width ;
   316         if ( mRows == 1 || selIndex != mSelIndex ) {
   284         if ( mRows == 1 || selIndex != mSelIndex ) {
   317 			if(rotAngle) {
       
   318 				rotAngle = 0;
       
   319 				//HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage270"), this, "rotationEffectFinished" );
       
   320 				mIconItem[mSelItemIndex]->resetTransform();
       
   321 				mIconItem[mSelItemIndex]->resize(mItemSize);
       
   322 				mIconItem[mSelItemIndex]->setPos(- mItemSize.width(), 0);
       
   323 			}
       
   324             mSelIndex = selIndex;
   285             mSelIndex = selIndex;
   325             mSelItemIndex = ( ++mSelItemIndex ) % NBR_ICON_ITEM;
   286             mSelItemIndex = ( ++mSelItemIndex ) % NBR_ICON_ITEM;
   326             selIndex = ( mSelItemIndex + 2 ) % NBR_ICON_ITEM;
   287             selIndex = ( mSelItemIndex + 2 ) % NBR_ICON_ITEM;
   327             updateIconItem( mSelIndex + 2, selIndex, width * 2 ) ;
   288             updateIconItem( mSelIndex + 2, selIndex, width * 2 ) ;
   328             emit changeSelectedIndex ( mModel->index ( mSelIndex, 0 ) ) ;
   289             emit changeSelectedIndex ( mModel->index ( mSelIndex, 0 ) ) ;
   329         }
   290         }
   330         mMoveDir = NO_MOVE;
   291         mMoveDir = NO_MOVE;
   331 		mBounceBackDeltaX = 10;
   292         mBounceBackDeltaX = 10;
   332     }	
   293         mSpeed = GLX_COVERFLOW_SPEED;
       
   294     }   
   333 }
   295 }
   334 
   296 
   335 void GlxCoverFlow::autoRightMove()
   297 void GlxCoverFlow::autoRightMove()
   336 {
   298 {
   337     qDebug("GlxCoverFlow::autoRightMove ");
   299     qDebug("GlxCoverFlow::autoRightMove ");
   338     int width = mItemSize.width()  ;
   300     int width = mItemSize.width()  ;
   339     int diffX = mStripLen - mCurrentPos ;
   301     int diffX = mStripLen - mCurrentPos ;
   340     
   302     
       
   303     //slow the speed for bounce back effect
       
   304     if ( mSelIndex == 0 ) {
       
   305         mSpeed = GLX_BOUNCEBACK_SPEED;
       
   306     }
   341     //for bounce back effect for back image ( it will do the back)
   307     //for bounce back effect for back image ( it will do the back)
   342     qDebug("GlxCoverFlow::autoRightMove diffX x = %d current pos = %d mBounceBackDeltaX x = %d", diffX, mCurrentPos, mBounceBackDeltaX);
   308     qDebug("GlxCoverFlow::autoRightMove diffX x = %d current pos = %d mBounceBackDeltaX x = %d", diffX, mCurrentPos, mBounceBackDeltaX);
   343     if ( diffX > mBounceBackDeltaX && diffX < width && mMoveDir == NO_MOVE ){
   309     if ( diffX > mBounceBackDeltaX && diffX < width && mMoveDir == NO_MOVE ){
   344         mMoveDir = RIGHT_MOVE;
   310         mMoveDir = RIGHT_MOVE;
   345         mBounceBackDeltaX = 10;
   311         mBounceBackDeltaX = 10;
   346         autoLeftMoveSignal();        
   312         autoLeftMoveSignal();  
   347         return ;
   313         return ;
   348     }
   314     }
   349     
   315     
   350     int deltaX = mCurrentPos %  width ;	
   316     int deltaX = mCurrentPos %  width ; 
   351     //in the case of deltaX == 0 ( right flick case ) complete image should move
   317     //in the case of deltaX == 0 ( right flick case ) complete image should move
   352     deltaX = deltaX ? deltaX : width ; 
   318     deltaX = deltaX ? deltaX : width ; 
   353     int moveX = deltaX > KMoveX ? KMoveX : deltaX;
   319     int moveX = deltaX > mSpeed ? mSpeed : deltaX;
   354     
   320     
   355     qDebug("GlxCoverFlow::autoRightMove delta x = %d current pos = %d move x = %d", deltaX, mCurrentPos, moveX);
   321     qDebug("GlxCoverFlow::autoRightMove delta x = %d current pos = %d move x = %d", deltaX, mCurrentPos, moveX);
   356     
   322     
   357     move (moveX);
   323     move (moveX);
   358     deltaX -= moveX;
   324     deltaX -= moveX;
   366             emit autoLeftMoveSignal();
   332             emit autoLeftMoveSignal();
   367             return;
   333             return;
   368         }
   334         }
   369         int selIndex = mCurrentPos / width ;
   335         int selIndex = mCurrentPos / width ;
   370         if ( mRows == 1 || selIndex != mSelIndex ) {
   336         if ( mRows == 1 || selIndex != mSelIndex ) {
   371 		    if(rotAngle) {
       
   372 				rotAngle = 0;
       
   373 				//HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage270"), this, "rotationEffectFinished" );
       
   374 				mIconItem[mSelItemIndex]->resetTransform();
       
   375 				mIconItem[mSelItemIndex]->resize(mItemSize);
       
   376 				mIconItem[mSelItemIndex]->setPos(mItemSize.width(), 0);
       
   377 
       
   378 		    }
       
   379             mSelIndex = selIndex;
   337             mSelIndex = selIndex;
   380             mSelItemIndex = ( mSelItemIndex == 0 ) ?  NBR_ICON_ITEM -1 : --mSelItemIndex;
   338             mSelItemIndex = ( mSelItemIndex == 0 ) ?  NBR_ICON_ITEM -1 : --mSelItemIndex;
   381             selIndex = ( mSelItemIndex + 3 ) % NBR_ICON_ITEM;
   339             selIndex = ( mSelItemIndex + 3 ) % NBR_ICON_ITEM;
   382             updateIconItem( mSelIndex - 2, selIndex, - width * 2 ) ;
   340             updateIconItem( mSelIndex - 2, selIndex, - width * 2 ) ;
   383             emit changeSelectedIndex ( mModel->index ( mSelIndex, 0 ) ) ;
   341             emit changeSelectedIndex ( mModel->index ( mSelIndex, 0 ) ) ;
   384         }
   342         }
   385         mMoveDir = NO_MOVE;
   343         mMoveDir = NO_MOVE;
   386 		mBounceBackDeltaX = 10;
   344         mBounceBackDeltaX = 10;
       
   345         mSpeed = GLX_COVERFLOW_SPEED;
   387     }
   346     }
   388 }
   347 }
   389 
   348 
   390 void GlxCoverFlow::move(int value)
   349 void GlxCoverFlow::move(int value)
   391 {
   350 {
   392     qDebug("GlxCoverFlow::move ");
   351     qDebug("GlxCoverFlow::move ");
   393     QPointF pos(0,0);
   352     QPointF pos(0,0);
   394 
   353 
   395     for ( qint8 i = 0; i < NBR_ICON_ITEM ; i++ ) {
   354     for ( qint8 i = 0; i < NBR_ICON_ITEM ; i++ ) {
   396         pos.setX( mIconItem[i]->pos().x() + value);
   355         pos.setX( mIconItem[i]->pos().x() + value);
   397 		pos.setY(mIconItem[i]->pos().y());
   356         pos.setY(mIconItem[i]->pos().y());
   398         mIconItem[i]->setPos(pos);
   357         mIconItem[i]->setPos(pos);
   399     }
   358     }
   400     
   359     
   401     mCurrentPos -= value;
   360     mCurrentPos -= value;
   402     if ( mCurrentPos < 0 ) {
   361     if ( mCurrentPos < 0 ) {
   409 }
   368 }
   410 
   369 
   411 void GlxCoverFlow::setRows()
   370 void GlxCoverFlow::setRows()
   412 {
   371 {
   413     qDebug("GlxCoverFlow::setRows ");
   372     qDebug("GlxCoverFlow::setRows ");
   414 	if (mModel) {
   373     if (mModel) {
   415 	    mRows = mModel->rowCount();
   374         mRows = mModel->rowCount();
   416 	}
   375     }
   417 	else {
   376     else {
   418 	    mRows = 0;
   377         mRows = 0;
   419 	}
   378     }
   420 	qDebug("GlxCoverFlow::setRows number of rows = %d", mRows);
   379     qDebug("GlxCoverFlow::setRows number of rows = %d", mRows);
   421 }
   380 }
   422 
   381 
   423 void GlxCoverFlow::setStripLen()
   382 void GlxCoverFlow::setStripLen()
   424 {  
   383 {  
   425     qDebug("GlxCoverFlow::setStripLen ");
   384     qDebug("GlxCoverFlow::setStripLen ");
   499         mModel = NULL ;
   458         mModel = NULL ;
   500     }
   459     }
   501 /*
   460 /*
   502     disconnect(mModel, SIGNAL(destroyed()), this, SLOT(_q_modelDestroyed()));
   461     disconnect(mModel, SIGNAL(destroyed()), this, SLOT(_q_modelDestroyed()));
   503     disconnect(mModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
   462     disconnect(mModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
   504 */	
   463 */  
   505 }
   464 }
   506 
   465 
   507 void GlxCoverFlow::initializeNewModel()
   466 void GlxCoverFlow::initializeNewModel()
   508 {
   467 {
   509     qDebug("GlxCoverFlow::initializeNewModel" );
   468     qDebug("GlxCoverFlow::initializeNewModel" );
   510     if ( mModel ) {
   469     if ( mModel ) {
   511         connect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) );
   470         connect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) );
   512         connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int)));
   471         connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int)));
   513         connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
   472         connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
   514     }	
   473     }   
   515 }
   474 }
   516 
   475 
   517 void GlxCoverFlow::resetCoverFlow()
   476 void GlxCoverFlow::resetCoverFlow()
   518 {
   477 {
   519     qDebug("GlxCoverFlow::resetCoverFlow model %u", mModel );
   478     qDebug("GlxCoverFlow::resetCoverFlow model %u", mModel );
   548        qDebug("GlxCoverFlow::partiallyCreated index mSelIndex=%d",mSelIndex);
   507        qDebug("GlxCoverFlow::partiallyCreated index mSelIndex=%d",mSelIndex);
   549     }
   508     }
   550     
   509     
   551     variant = model->data( model->index(mSelIndex, 0), GlxFsImageRole );
   510     variant = model->data( model->index(mSelIndex, 0), GlxFsImageRole );
   552     if ( variant.isValid() &&  variant.canConvert<HbIcon> () ) {
   511     if ( variant.isValid() &&  variant.canConvert<HbIcon> () ) {
   553         mIconItem[2]->setIcon ( variant.value<HbIcon>() ) ;    
   512         mIconItem[2]->setIcon ( variant.value<HbIcon>() ) ; 
   554         qDebug("#########################GlxCoverFlow::partiallyCreated,ICON PRES##################");
       
   555     }
   513     }
   556 }
   514 }
   557 
   515 
   558 GlxCoverFlow::~GlxCoverFlow()
   516 GlxCoverFlow::~GlxCoverFlow()
   559 {
   517 {
   560     qDebug("GlxCoverFlow::~GlxCoverFlow model " );
   518     qDebug("GlxCoverFlow::~GlxCoverFlow model " );
   561     disconnect( this, SIGNAL( autoLeftMoveSignal() ), this, SLOT( autoLeftMove() ) );
   519     disconnect( this, SIGNAL( autoLeftMoveSignal() ), this, SLOT( autoLeftMove() ) );
   562     disconnect( this, SIGNAL( autoRightMoveSignal() ), this, SLOT( autoRightMove() ) );
   520     disconnect( this, SIGNAL( autoRightMoveSignal() ), this, SLOT( autoRightMove() ) );
   563     HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionrotate0.fxml"), QString( "RotateImage0" ));
       
   564     HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionrotate90.fxml"), QString( "RotateImage90" ));
       
   565     HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionrotate180.fxml"), QString( "RotateImage180" ));
       
   566     HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionrotate270.fxml"), QString( "RotateImage270" ));
       
   567 }
   521 }
   568 
   522 
   569 
   523 
   570 void GlxCoverFlow::ClearCoverFlow()
   524 void GlxCoverFlow::ClearCoverFlow()
   571 {
   525 {
   574     for ( qint8 i = 0; i < NBR_ICON_ITEM ; i++ ) {
   528     for ( qint8 i = 0; i < NBR_ICON_ITEM ; i++ ) {
   575         if(mIconItem[i] != NULL ) {
   529         if(mIconItem[i] != NULL ) {
   576             delete mIconItem[i] ;
   530             delete mIconItem[i] ;
   577             mIconItem[i] = NULL;
   531             mIconItem[i] = NULL;
   578         }
   532         }
   579     }	
   533     }   
   580 }
   534 }
   581 
   535 
   582 int GlxCoverFlow::getSubState()
   536 int GlxCoverFlow::getSubState()
   583 {
   537 {
   584     int substate = NO_FULLSCREEN_S;
   538     int substate = NO_FULLSCREEN_S;