ui/views/fullscreenview/src/glxfullscreenview.cpp
changeset 61 743eb0b9959e
parent 55 fb37077c270f
child 67 199e6e1e0b54
equal deleted inserted replaced
55:fb37077c270f 61:743eb0b9959e
    58     mModel( NULL ), 
    58     mModel( NULL ), 
    59     mWindow( window ), 
    59     mWindow( window ), 
    60     mCoverFlow( NULL ) , 
    60     mCoverFlow( NULL ) , 
    61     mImageStrip( NULL ), 
    61     mImageStrip( NULL ), 
    62     mUiOffTimer( NULL ),
    62     mUiOffTimer( NULL ),
       
    63     mBackGroundItem( NULL ),
    63     mTvOutWrapper( NULL ),
    64     mTvOutWrapper( NULL ),
    64     mFullScreenToolBar( NULL ),
    65     mFullScreenToolBar( NULL ),
    65 	mZoomWidget( NULL ),
    66 	mZoomWidget( NULL ),
    66 	mUiOff ( false)
    67 	mUiOff ( false )
    67 {
    68 {
    68     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY );
    69     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY );
    69     mIconItems[0] = NULL;
    70     mIconItems[0] = NULL;
    70     mIconItems[1] = NULL;
    71     mIconItems[1] = NULL;
    71     mDocLoader = DocLoader;
    72     mDocLoader = DocLoader;
   166 {
   167 {
   167     HbAction *action = new HbAction( this ); 
   168     HbAction *action = new HbAction( this ); 
   168     action->setData( commandId );
   169     action->setData( commandId );
   169     action->setIcon( HbIcon( iconName ) ); 
   170     action->setIcon( HbIcon( iconName ) ); 
   170     action->setObjectName( name );
   171     action->setObjectName( name );
   171     mFullScreenToolBar->addAction( action);
   172     mFullScreenToolBar->addAction( action );
   172     connect(action, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); 
   173     connect(action, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); 
   173 }
   174 }
   174 
   175 
   175 void GlxFullScreenView::activate()
   176 void GlxFullScreenView::activate()
   176 {
   177 {
   376         mUiOffTimer->start(KUiOffTime);
   377         mUiOffTimer->start(KUiOffTime);
   377     }
   378     }
   378     setModelContext();
   379     setModelContext();
   379     loadViewSection();
   380     loadViewSection();
   380     setLayout();
   381     setLayout();
   381     playOrientChangeAnim();
   382     
       
   383     if ( mZoomWidget->zValue() >= mCoverFlow->zValue() ) {
       
   384         playZoomOrientChangeAnim();
       
   385     }
       
   386     else {
       
   387         playOrientChangeAnim();
       
   388     }
   382     
   389     
   383     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ORIENTATIONCHANGED_EXIT );
   390     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ORIENTATIONCHANGED_EXIT );
   384 }
   391 }
   385 
   392 
   386 void GlxFullScreenView::activateUI()
   393 void GlxFullScreenView::activateUI()
   407             HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapShow"), this, "effectFinished" );
   414             HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapShow"), this, "effectFinished" );
   408         }
   415         }
   409         else if( getSubState() == IMAGEVIEWER_S){
   416         else if( getSubState() == IMAGEVIEWER_S){
   410             setTitle(GLX_IMAGE_VIEWER);
   417             setTitle(GLX_IMAGE_VIEWER);
   411         }
   418         }
       
   419         mFullScreenToolBar->setOpacity( 1 );
   412         mFullScreenToolBar->show();
   420         mFullScreenToolBar->show();
   413     }
   421     }
   414     else {
   422     else {
   415         hideUi();
   423         hideUi();
   416     }
   424     }
   572     
   580     
   573     switch( e ){
   581     switch( e ){
   574     case TAP_EVENT :
   582     case TAP_EVENT :
   575         activateUI();
   583         activateUI();
   576         break ;
   584         break ;
   577         
   585                 
       
   586     //hide the ui component without animation  
   578     case PANNING_START_EVENT :
   587     case PANNING_START_EVENT :
   579         hideUi();
       
   580         break ;
       
   581         
       
   582     //hide the ui component without animation  
       
   583     case ZOOM_START_EVENT : {
   588     case ZOOM_START_EVENT : {
   584         HbEffect::EffectStatus e;
   589         HbEffect::EffectStatus e;
   585         mUiOff = TRUE;
   590         mUiOff = TRUE;
   586         if( mFullScreenToolBar ) {
   591         if( mFullScreenToolBar ) {
   587            mFullScreenToolBar->hide();
   592             /** 
       
   593              * Browsing has higer priority then playing animation of hiding tool bar
       
   594              * so it is taking time to hide the toolbar during browsing of images 
       
   595              * so set the opacity value to 0 to immediate hide the tool bar 
       
   596              */
       
   597             mFullScreenToolBar->setOpacity( 0 );
       
   598             mFullScreenToolBar->hide();
   588         }
   599         }
   589         setViewFlags( viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden );
   600         setViewFlags( viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden );
   590         effectFinished( e );
   601         effectFinished( e );
   591     }
   602     }
   592         break;
   603         break;
   630     
   641     
   631     for ( int i = 0; i < NBR_ANIM_ITEM; i++ ) { 
   642     for ( int i = 0; i < NBR_ANIM_ITEM; i++ ) { 
   632         mIconItems[ i ]->resetTransform();
   643         mIconItems[ i ]->resetTransform();
   633         mIconItems[ i ]->setVisible( false );
   644         mIconItems[ i ]->setVisible( false );
   634     }
   645     }
       
   646     mBackGroundItem->setVisible( false );
   635     
   647     
   636     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   648     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   637     if ( variant.isValid() &&  variant.canConvert<int> ()  ) {
   649     if ( variant.isValid() &&  variant.canConvert<int> ()  ) {
   638         mCoverFlow->indexChanged( variant.value<int>() ) ;         
   650         mCoverFlow->indexChanged( variant.value<int>() ) ;         
   639     }
   651     }
   646 void GlxFullScreenView::orientChangeAnimFinished( const HbEffect::EffectStatus status )
   658 void GlxFullScreenView::orientChangeAnimFinished( const HbEffect::EffectStatus status )
   647 {
   659 {
   648     qDebug( "GlxFullScreenView::LsOrientChangeAnimFinished reason %d ", status.reason );
   660     qDebug( "GlxFullScreenView::LsOrientChangeAnimFinished reason %d ", status.reason );
   649     mIconItems[ 0 ]->resetTransform();   
   661     mIconItems[ 0 ]->resetTransform();   
   650     mIconItems[ 0 ]->setVisible( false );
   662     mIconItems[ 0 ]->setVisible( false );
       
   663     mBackGroundItem->setVisible( false );
   651     mCoverFlow->setVisible( true );
   664     mCoverFlow->setVisible( true );
   652     mZoomWidget->setVisible( true );
   665     mZoomWidget->setVisible( true );
       
   666 }
       
   667 
       
   668 void GlxFullScreenView::zoomOrientChangeAnimFinished( const HbEffect::EffectStatus status )
       
   669 {
       
   670     mZoomWidget->resetTransform();
   653 }
   671 }
   654 
   672 
   655 void GlxFullScreenView::setLayout()
   673 void GlxFullScreenView::setLayout()
   656 {
   674 {
   657     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETLAYOUT_ENTRY );
   675     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETLAYOUT_ENTRY );
   750     
   768     
   751 	cleanUp();
   769 	cleanUp();
   752 	for ( int i = 0; i < NBR_ANIM_ITEM; i++ ) {
   770 	for ( int i = 0; i < NBR_ANIM_ITEM; i++ ) {
   753 	    delete mIconItems[ i ] ;
   771 	    delete mIconItems[ i ] ;
   754 	}
   772 	}
       
   773 	delete mBackGroundItem;
   755     delete mImageStrip;
   774     delete mImageStrip;
   756     delete mFullScreenToolBar;
   775     delete mFullScreenToolBar;
   757     delete mCoverFlow;
   776     delete mCoverFlow;
   758     delete mZoomWidget;
   777     delete mZoomWidget;
   759 
   778 
   773 }
   792 }
   774 
   793 
   775 void GlxFullScreenView::initAnimationItem()
   794 void GlxFullScreenView::initAnimationItem()
   776 {
   795 {
   777     if( mIconItems[0] == NULL ) {
   796     if( mIconItems[0] == NULL ) {
       
   797         mBackGroundItem = new HbIconItem( mImageStrip->parentItem() );
       
   798         mBackGroundItem->setBrush( QBrush( Qt::black ) );
       
   799         mBackGroundItem->setZValue( mImageStrip->zValue() - 3 );
       
   800         mBackGroundItem->setPos( 0, 0 );
   778         for( int i = 0; i < NBR_ANIM_ITEM; i++ ) {
   801         for( int i = 0; i < NBR_ANIM_ITEM; i++ ) {
   779             mIconItems[ i ] = new HbIconItem( mImageStrip->parentItem() );
   802             mIconItems[ i ] = new HbIconItem( mImageStrip->parentItem() );
   780             mIconItems[ i ]->setBrush( QBrush( Qt::black ) );
       
   781             mIconItems[ i ]->setZValue( mImageStrip->zValue() - 2 );
   803             mIconItems[ i ]->setZValue( mImageStrip->zValue() - 2 );
   782             mIconItems[ i ]->setPos( 0, 0 );
   804             mIconItems[ i ]->setPos( 0, 0 );
   783             mIconItems[ i ]->setAlignment( Qt::AlignCenter );
   805             mIconItems[ i ]->setAlignment( Qt::AlignCenter );
   784         }
   806         }        
   785     }
   807     }
   786 }
   808 }
   787 
   809 
   788 void GlxFullScreenView::imageSelectionAnimation(const QModelIndex &index)
   810 void GlxFullScreenView::imageSelectionAnimation(const QModelIndex &index)
   789 {
   811 {
   792     initAnimationItem();
   814     initAnimationItem();
   793     for ( int i = 0; i < NBR_ANIM_ITEM; i++ ) {
   815     for ( int i = 0; i < NBR_ANIM_ITEM; i++ ) {
   794         mIconItems[ i ]->setVisible( true );
   816         mIconItems[ i ]->setVisible( true );
   795         mIconItems[ i ]->setSize( screenSize() );
   817         mIconItems[ i ]->setSize( screenSize() );
   796     }
   818     }
       
   819     mBackGroundItem->setVisible( true );
       
   820     mBackGroundItem->setSize( screenSize() );
   797     
   821     
   798     mIconItems[ 0 ]->setIcon( mCoverFlow->getIcon( mCoverFlow->getFocusIndex() ) );    
   822     mIconItems[ 0 ]->setIcon( mCoverFlow->getIcon( mCoverFlow->getFocusIndex() ) );    
   799     mIconItems[ 1 ]->setIcon( mCoverFlow->getIcon( index.row() ) );   
   823     mIconItems[ 1 ]->setIcon( mCoverFlow->getIcon( index.row() ) );   
   800     mCoverFlow->setVisible( false );
   824     mCoverFlow->setVisible( false );
   801     mZoomWidget->setVisible( false );
   825     mZoomWidget->setVisible( false );
   821     mIconItems[ 0 ]->setOpacity( 1 );
   845     mIconItems[ 0 ]->setOpacity( 1 );
   822     mIconItems[ 0 ]->setSize( screenSize() );
   846     mIconItems[ 0 ]->setSize( screenSize() );
   823     mIconItems[ 0 ]->setVisible( true );
   847     mIconItems[ 0 ]->setVisible( true );
   824     mIconItems[ 0 ]->setIcon( mCoverFlow->getIcon( mCoverFlow->getFocusIndex() ) );
   848     mIconItems[ 0 ]->setIcon( mCoverFlow->getIcon( mCoverFlow->getFocusIndex() ) );
   825     
   849     
       
   850     mBackGroundItem->setVisible( true );
       
   851     mBackGroundItem->setSize( screenSize() );
       
   852     
   826     mCoverFlow->setVisible( false );
   853     mCoverFlow->setVisible( false );
   827     mZoomWidget->setVisible( false );
   854     mZoomWidget->setVisible( false );
   828     if ( mWindow->orientation() == Qt::Horizontal ) {
   855     if ( mWindow->orientation() == Qt::Horizontal ) {
   829         HbEffect::start( mIconItems[0], QString( "HbIconItem" ), QString( "RotateFSLS" ), this, "orientChangeAnimFinished" );
   856         HbEffect::start( mIconItems[0], QString( "HbIconItem" ), QString( "RotateFSLS" ), this, "orientChangeAnimFinished" );
   830     }
   857     }
   831     else {
   858     else {
   832         HbEffect::start( mIconItems[0], QString( "HbIconItem" ), QString( "RotateFSPT" ), this, "orientChangeAnimFinished" );
   859         HbEffect::start( mIconItems[0], QString( "HbIconItem" ), QString( "RotateFSPT" ), this, "orientChangeAnimFinished" );
   833     }
   860     }
       
   861 }
       
   862 
       
   863 void GlxFullScreenView::playZoomOrientChangeAnim()
       
   864 {
       
   865     if ( mWindow->orientation() == Qt::Horizontal ) {
       
   866         HbEffect::start( mZoomWidget, QString( "HbIconItem" ), QString( "RotateFSLS" ), this, "zoomOrientChangeAnimFinished" );
       
   867     }
       
   868     else {
       
   869         HbEffect::start( mZoomWidget, QString( "HbIconItem" ), QString( "RotateFSPT" ), this, "zoomOrientChangeAnimFinished" );
       
   870     }    
   834 }
   871 }
   835 	
   872 	
   836 void GlxFullScreenView::handleToolBarAction()
   873 void GlxFullScreenView::handleToolBarAction()
   837 {
   874 {
   838     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_HANDLETOOLBARACTION_ENTRY );
   875     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_HANDLETOOLBARACTION_ENTRY );