ui/views/fullscreenview/src/glxcoverflow.cpp
changeset 24 99ad1390cd33
parent 23 74c9f037fd5d
child 26 c499df2dbb33
equal deleted inserted replaced
23:74c9f037fd5d 24:99ad1390cd33
    33               mRows(0), mSelIndex (0), mStripLen (0), mCurrentPos(0), 
    33               mRows(0), mSelIndex (0), mStripLen (0), mCurrentPos(0), 
    34               mItemSize (QSize(0,0)), mModel ( NULL), mMoveDir(NO_MOVE), rotAngle(0) 
    34               mItemSize (QSize(0,0)), mModel ( NULL), mMoveDir(NO_MOVE), rotAngle(0) 
    35 {
    35 {
    36 //TO:DO through exception
    36 //TO:DO through exception
    37    qDebug("GlxCoverFlow::GlxCoverFlow");
    37    qDebug("GlxCoverFlow::GlxCoverFlow");
       
    38    HbEffect::add( QString("HbIconItem"), QString(":/data/transitionrotate0.fxml"), QString( "RotateImage0" ));
       
    39    HbEffect::add( QString("HbIconItem"), QString(":/data/transitionrotate90.fxml"), QString( "RotateImage90" ));
       
    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 );
       
    43    connect( this, SIGNAL( autoRightMoveSignal() ), this, SLOT( autoRightMove() ), Qt::QueuedConnection );   
    38 }
    44 }
    39 
    45 
    40 void GlxCoverFlow::setCoverFlow()
    46 void GlxCoverFlow::setCoverFlow()
    41 {
    47 {
    42 
       
    43     qDebug("GlxCoverFlow::setCoverFlow");
    48     qDebug("GlxCoverFlow::setCoverFlow");
    44     for ( qint8 i = 0; i < NBR_ICON_ITEM ; i++ ) {
    49     for ( qint8 i = 0; i < NBR_ICON_ITEM ; i++ ) {
    45     mIconItem[i] = new HbIconItem(this);
    50         mIconItem[i] = new HbIconItem(this);
    46     mIconItem[i]->setBrush(QBrush(Qt::black));
    51         mIconItem[i]->setBrush(QBrush(Qt::black));
    47     mIconItem[i]->setSize(QSize(0,0));
    52         mIconItem[i]->setSize(QSize(0,0));
    48     }
    53     }
    49     mUiOn = FALSE;
    54     mUiOn = FALSE;
    50     mBounceBackDeltaX = 10;
    55     mBounceBackDeltaX = 10;
    51     connect( this, SIGNAL( autoLeftMoveSignal() ), this, SLOT( autoLeftMove() ), Qt::QueuedConnection );
       
    52     connect( this, SIGNAL( autoRightMoveSignal() ), this, SLOT( autoRightMove() ), Qt::QueuedConnection );
       
    53 	HbEffect::add( QString("HbIconItem"), QString(":/data/transitionrotate0.fxml"), QString( "RotateImage0" ));
       
    54 	HbEffect::add( QString("HbIconItem"), QString(":/data/transitionrotate90.fxml"), QString( "RotateImage90" ));
       
    55 	HbEffect::add( QString("HbIconItem"), QString(":/data/transitionrotate180.fxml"), QString( "RotateImage180" ));
       
    56 	HbEffect::add( QString("HbIconItem"), QString(":/data/transitionrotate270.fxml"), QString( "RotateImage270" ));
       
    57 }
    56 }
    58 
    57 
    59 void GlxCoverFlow::setItemSize(QSize &size)
    58 void GlxCoverFlow::setItemSize(QSize &size)
    60 {
    59 {
    61     qDebug("GlxCoverFlow::setSize width = %d",size.width() );
    60     qDebug("GlxCoverFlow::setSize width = %d",size.width() );
    67 
    66 
    68 void GlxCoverFlow::setModel(QAbstractItemModel *model)
    67 void GlxCoverFlow::setModel(QAbstractItemModel *model)
    69 {
    68 {
    70     qDebug("GlxCoverFlow::setModel model change = %d", model  );
    69     qDebug("GlxCoverFlow::setModel model change = %d", model  );
    71     
    70     
    72      if ( model == mModel) {
    71     if ( model == mModel) {
    73         return ;
    72         return ;
    74     }
    73     }
    75     
    74     
    76     clearCurrentModel();
    75     clearCurrentModel();
    77     mModel = model;
    76     mModel = model;
    83 {
    82 {
    84     qDebug("GlxCoverFlow::indexChanged index = %d mSelIndex = %d ",index, mSelIndex );
    83     qDebug("GlxCoverFlow::indexChanged index = %d mSelIndex = %d ",index, mSelIndex );
    85     if ( index != mSelIndex && mModel) {
    84     if ( index != mSelIndex && mModel) {
    86         loadIconItems();
    85         loadIconItems();
    87 		if(rotAngle) {
    86 		if(rotAngle) {
    88 				rotAngle = 0;
    87             rotAngle = 0;
    89 				//HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage270"), this, "rotationEffectFinished" );
    88             //HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage270"), this, "rotationEffectFinished" );
    90 				mIconItem[mSelItemIndex]->resetTransform();
    89             mIconItem[mSelItemIndex]->resetTransform();
    91 				mIconItem[mSelItemIndex]->resize(mItemSize);
    90             mIconItem[mSelItemIndex]->resize(mItemSize);
    92 			}
    91         }
    93     }
    92     }
    94 }
    93 }
    95 
    94 
    96 void GlxCoverFlow::rotateImage ()  
    95 void GlxCoverFlow::rotateImage ()  
    97 {
    96 {
   109 		HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage180"), this, "rotationEffectFinished" );
   108 		HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage180"), this, "rotationEffectFinished" );
   110 	}
   109 	}
   111 	if(rotAngle == 270)
   110 	if(rotAngle == 270)
   112 	{
   111 	{
   113 		HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage270"), this, "rotationEffectFinished" );
   112 		HbEffect::start(mIconItem[mSelItemIndex], QString("HbIconItem"), QString("RotateImage270"), this, "rotationEffectFinished" );
   114 	}
   113 	}	
   115 	
       
   116 	rotAngle += 90;
   114 	rotAngle += 90;
   117 	rotAngle %= 360;
   115 	rotAngle %= 360;	
   118 	
       
   119 }
   116 }
   120 
   117 
   121 void GlxCoverFlow::rotationEffectFinished (const HbEffect::EffectStatus &status)  
   118 void GlxCoverFlow::rotationEffectFinished (const HbEffect::EffectStatus &status)  
   122 {
   119 {
   123     Q_UNUSED(status)
   120     Q_UNUSED(status)
   205                 mIconItem[index]->setIcon ( variant.value<HbIcon>() ) ; 
   202                 mIconItem[index]->setIcon ( variant.value<HbIcon>() ) ; 
   206             }
   203             }
   207             else {
   204             else {
   208                 mIconItem[index]->setIcon( HbIcon() );
   205                 mIconItem[index]->setIcon( HbIcon() );
   209             }
   206             }
   210             //break;
       
   211         }
   207         }
   212     }
   208     }
   213 }
   209 }
   214 
   210 
   215 void GlxCoverFlow::rowsInserted(const QModelIndex &parent, int start, int end)
   211 void GlxCoverFlow::rowsInserted(const QModelIndex &parent, int start, int end)
   549 }
   545 }
   550 
   546 
   551 GlxCoverFlow::~GlxCoverFlow()
   547 GlxCoverFlow::~GlxCoverFlow()
   552 {
   548 {
   553     qDebug("GlxCoverFlow::~GlxCoverFlow model " );
   549     qDebug("GlxCoverFlow::~GlxCoverFlow model " );
   554 }
       
   555 
       
   556 
       
   557 void GlxCoverFlow::ClearCoverFlow()
       
   558 {
       
   559     qDebug("GlxCoverFlow::ClearCoverFlow  " );
       
   560     disconnect( this, SIGNAL( autoLeftMoveSignal() ), this, SLOT( autoLeftMove() ) );
   550     disconnect( this, SIGNAL( autoLeftMoveSignal() ), this, SLOT( autoLeftMove() ) );
   561     disconnect( this, SIGNAL( autoRightMoveSignal() ), this, SLOT( autoRightMove() ) );
   551     disconnect( this, SIGNAL( autoRightMoveSignal() ), this, SLOT( autoRightMove() ) );
       
   552     HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionrotate0.fxml"), QString( "RotateImage0" ));
       
   553     HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionrotate90.fxml"), QString( "RotateImage90" ));
       
   554     HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionrotate180.fxml"), QString( "RotateImage180" ));
       
   555     HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionrotate270.fxml"), QString( "RotateImage270" ));
       
   556 }
       
   557 
       
   558 
       
   559 void GlxCoverFlow::ClearCoverFlow()
       
   560 {
       
   561     qDebug("GlxCoverFlow::ClearCoverFlow  " );
   562     clearCurrentModel();    
   562     clearCurrentModel();    
   563     for ( qint8 i = 0; i < NBR_ICON_ITEM ; i++ ) {
   563     for ( qint8 i = 0; i < NBR_ICON_ITEM ; i++ ) {
   564       if(mIconItem[i] != NULL )
   564         if(mIconItem[i] != NULL ) {
   565         delete mIconItem[i] ;
   565             delete mIconItem[i] ;
       
   566             mIconItem[i] = NULL;
       
   567         }
   566     }	
   568     }	
   567 	HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionrotate0.fxml"), QString( "RotateImage0" ));
   569 }
   568 	HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionrotate90.fxml"), QString( "RotateImage90" ));
       
   569 	HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionrotate180.fxml"), QString( "RotateImage180" ));
       
   570 	HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionrotate270.fxml"), QString( "RotateImage270" ));
       
   571 }