ui/views/fullscreenview/src/glxfullscreenview.cpp
changeset 55 fb37077c270f
parent 49 f291796e213d
child 61 743eb0b9959e
equal deleted inserted replaced
49:f291796e213d 55:fb37077c270f
    28 #include <hbdocumentloader.h>
    28 #include <hbdocumentloader.h>
    29 #include <QAbstractItemModel>
    29 #include <QAbstractItemModel>
    30 #include <hbabstractviewitem.h>
    30 #include <hbabstractviewitem.h>
    31 #include <hbiconitem.h>
    31 #include <hbiconitem.h>
    32 #include <QCoreApplication>
    32 #include <QCoreApplication>
    33 
    33 #include <xqserviceutil.h>
    34 //User Includes
    34 //User Includes
    35 #include "glxlog.h"
    35 #include "glxlog.h"
    36 #include "glxtracer.h"
    36 #include "glxtracer.h"
    37 #include "glxviewids.h"  //contains the view ids of all the views in photos app.
    37 #include "glxviewids.h"  //contains the view ids of all the views in photos app.
    38 #include "glxicondefs.h" //Contains the icon names/Ids
    38 #include "glxicondefs.h" //Contains the icon names/Ids
    42 #include "glxloggerenabler.h"
    42 #include "glxloggerenabler.h"
    43 #include "glxtvoutwrapper.h"
    43 #include "glxtvoutwrapper.h"
    44 #include "glxfullscreenview.h" 
    44 #include "glxfullscreenview.h" 
    45 #include "glxcommandhandlers.hrh"
    45 #include "glxcommandhandlers.hrh"
    46 #include "glxzoomwidget.h"
    46 #include "glxzoomwidget.h"
    47 
    47 #include "glxlocalisationstrings.h"
    48 #include "OstTraceDefinitions.h"
    48 #include "OstTraceDefinitions.h"
    49 #ifdef OST_TRACE_COMPILER_IN_USE
    49 #ifdef OST_TRACE_COMPILER_IN_USE
    50 #include "glxfullscreenviewTraces.h"
    50 #include "glxfullscreenviewTraces.h"
    51 #endif
    51 #endif
    52  
    52  
    53 
    53 
    54 const int KUiOffTime = 3000;
    54 const int KUiOffTime = 3000;
    55 
    55 
    56 GlxFullScreenView::GlxFullScreenView(HbMainWindow *window,HbDocumentLoader *DocLoader) : 
    56 GlxFullScreenView::GlxFullScreenView(HbMainWindow *window,HbDocumentLoader *DocLoader) : 
    57     GlxView ( GLX_FULLSCREENVIEW_ID), 
    57     GlxView ( GLX_FULLSCREENVIEW_ID ), 
    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     mIconItem(NULL),
    63     mTvOutWrapper( NULL ),
    64     mTvOutWrapper(NULL),
    64     mFullScreenToolBar( NULL ),
    65     mFullScreenToolBar(NULL),
    65 	mZoomWidget( NULL ),
    66 	mZoomWidget(NULL)
    66 	mUiOff ( false)
    67 {
    67 {
    68     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY );
    68     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY );
    69     
    69     mIconItems[0] = NULL;
       
    70     mIconItems[1] = NULL;
    70     mDocLoader = DocLoader;
    71     mDocLoader = DocLoader;
    71     setContentFullScreen( true );
    72     setContentFullScreen( true );
    72     HbEffect::add( QString("HbGridView"), QString(":/data/transitionup.fxml"), QString( "TapShow" ));
    73     
    73     HbEffect::add( QString("HbGridView"), QString(":/data/transitiondown.fxml"), QString( "TapHide" ));
    74     HbEffect::add( QString( "HbGridView" ), QString( ":/data/transitionup.fxml" ), QString( "TapShow" ) );
    74     HbEffect::add( QString("HbGridViewItem"), QString(":/data/gridtofullscreenhide.fxml"), QString( "Select" ));
    75     HbEffect::add( QString( "HbGridView" ), QString( ":/data/transitiondown.fxml" ), QString( "TapHide" ) );
       
    76     HbEffect::add( QString( "HbGridViewItem" ), QString( ":/data/zoomin.fxml" ), QString( "SelectHide" ) );
       
    77     HbEffect::add( QString( "HbGridViewItem" ), QString( ":/data/zoomout.fxml" ), QString( "SelectShow" ) );
       
    78     HbEffect::add( QString( "HbIconItem" ), QString( ":/data/rotatefslandscape.fxml" ), QString( "RotateFSLS" ) );
       
    79     HbEffect::add( QString( "HbIconItem" ), QString( ":/data/rotatefsprotrait.fxml" ), QString( "RotateFSPT" ) );
    75     
    80     
    76     OstTraceFunctionExit0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_EXIT );
    81     OstTraceFunctionExit0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_EXIT );
    77 }
    82 }
    78 
    83 
    79 void GlxFullScreenView::initializeView(QAbstractItemModel *model)
    84 void GlxFullScreenView::initializeView( QAbstractItemModel *model, GlxView *preView )
    80 {
    85 {
    81     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_INITIALIZEVIEW_ENTRY );
    86     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_INITIALIZEVIEW_ENTRY );
    82     
    87     
    83     // if animations is on, then Set the image to HDMI here
    88     // if animations is on, then Set the image to HDMI here
    84     if (!mTvOutWrapper){
    89     if (!mTvOutWrapper){
    85         mTvOutWrapper = new GlxTvOutWrapper();
    90         mTvOutWrapper = new GlxTvOutWrapper();
    86     }
    91     }
    87     setHdmiModel(model);
    92     setHdmiModel(model);
    88     loadWidgets();
    93     loadWidgets();
    89 
    94 
    90     // Initialize the coverflow and partially creates the coverflow with one image
    95     /* 
    91     // to make the widget light weight in order to make transition smooth 
    96      * Initialize the coverflow and partially creates the coverflow with one image
    92     mCoverFlow->partiallyCreate( model, screenSize() );
    97      * to make the widget light weight in order to make transition smooth 
       
    98      */
       
    99     /* 
       
   100      * Grid view is not in full screen mode so this view have some flicker after transtion is finshed 
       
   101      * and some cases in grid view status bar is visible and some cases it is not
       
   102      * so adjust the initial postion of fullscreen base on status bar visiblity.
       
   103      */
       
   104     if ( preView->compare( GLX_GRIDVIEW_ID ) && preView->isItemVisible ( Hb::StatusBarItem ) ) {
       
   105         qreal chromeHeight = 0;
       
   106         style()->parameter( "hb-param-widget-chrome-height", chromeHeight );
       
   107         mCoverFlow->partiallyCreate( model, screenSize(), -chromeHeight );
       
   108     }
       
   109     else {
       
   110         mCoverFlow->partiallyCreate( model, screenSize() );
       
   111     }
    93     
   112     
    94     OstTraceFunctionExit0( GLXFULLSCREENVIEW_INITIALIZEVIEW_EXIT );
   113     OstTraceFunctionExit0( GLXFULLSCREENVIEW_INITIALIZEVIEW_EXIT );
    95 }
   114 }
    96 
   115 
    97 void GlxFullScreenView::loadWidgets()
   116 void GlxFullScreenView::loadWidgets()
   111     //When the widget is loaded/retreived the widgets are shown by default.
   130     //When the widget is loaded/retreived the widgets are shown by default.
   112     //@to do : hide the widgets by default in docml
   131     //@to do : hide the widgets by default in docml
   113     mImageStrip->hide();      
   132     mImageStrip->hide();      
   114 	mImageStrip->setLayoutName( QString( "ImageStrip" ) ); // To distinguish in CSS file
   133 	mImageStrip->setLayoutName( QString( "ImageStrip" ) ); // To distinguish in CSS file
   115 	mImageStrip->setEnabledAnimations( HbAbstractItemView::None );
   134 	mImageStrip->setEnabledAnimations( HbAbstractItemView::None );
       
   135 	mImageStrip->setHorizontalScrollBarPolicy( HbScrollArea::ScrollBarAlwaysOff );
   116 	
   136 	
   117     OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADWIDGETS_EXIT );
   137     OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADWIDGETS_EXIT );
   118 }
   138 }
   119 
   139 
   120 void GlxFullScreenView::loadFullScreenToolBar()
   140 void GlxFullScreenView::loadFullScreenToolBar()
   164     if( !mCoverFlow ) {
   184     if( !mCoverFlow ) {
   165         loadWidgets();  //retrives the widgets
   185         loadWidgets();  //retrives the widgets
   166     }
   186     }
   167     //Loads the widgets corresponding to the orientation.
   187     //Loads the widgets corresponding to the orientation.
   168     loadViewSection();
   188     loadViewSection();
   169     
   189 	
   170     setStatusBarVisible(FALSE);
   190     HbView::HbViewFlags flags( HbView::ViewTitleBarTransparent | HbView::ViewStatusBarTransparent);
   171     setTitleBarVisible(FALSE);
   191     setViewFlags(flags);
       
   192 	
       
   193 	// In case of fetcher don't hide status pane and title bar
       
   194     if(!(XQServiceUtil::isService() && (0 == XQServiceUtil::interfaceName().compare(QLatin1String("com.nokia.symbian.IImageFetch"))))) {
       
   195         setViewFlags( viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden );
       
   196 		mUiOff = true;
       
   197 	}
       
   198     else
       
   199         {
       
   200         HbAction* selectAction = new HbAction(GLX_BUTTON_SELECT);
       
   201         selectAction->setObjectName( "FS Select" );
       
   202         
       
   203         connect(selectAction, SIGNAL(triggered()), this, SLOT(handleFSSelect()));
       
   204         HbToolBar* toolBar = new HbToolBar();
       
   205         toolBar->setOrientation( Qt::Horizontal );
       
   206         toolBar->setVisible(true);
       
   207         toolBar->addAction(selectAction);
       
   208         setToolBar(toolBar);
       
   209         }
   172         
   210         
   173     mUiOffTimer = new QTimer();
   211     mUiOffTimer = new QTimer();
   174     mUiOff = true;
       
   175     mUiOffTimer->stop();        
   212     mUiOffTimer->stop();        
   176     mCoverFlow->setUiOn(FALSE);    
   213     mCoverFlow->setUiOn(FALSE);    
   177     addConnection(); 
   214     addConnection(); 
   178     setLayout();
   215     setLayout();
   179      
   216      
   180     if (!mTvOutWrapper){
   217     if (!mTvOutWrapper) {
   181         mTvOutWrapper = new GlxTvOutWrapper();
   218         mTvOutWrapper = new GlxTvOutWrapper();
   182     }
   219     }
       
   220     
       
   221     mWindow->setAutomaticOrientationEffectEnabled( false );
   183     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ACTIVATE_EXIT );
   222     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ACTIVATE_EXIT );
       
   223 }
       
   224 
       
   225 void GlxFullScreenView::handleFSSelect()
       
   226 {
       
   227     emit actionTriggered( EGlxCmdFetcherSelect );
   184 }
   228 }
   185 
   229 
   186 void GlxFullScreenView::loadViewSection()
   230 void GlxFullScreenView::loadViewSection()
   187 {
   231 {
   188     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADVIEWSECTION_ENTRY );    
   232     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADVIEWSECTION_ENTRY );    
   202 
   246 
   203 void GlxFullScreenView::resetView()
   247 void GlxFullScreenView::resetView()
   204 {
   248 {
   205     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_RESETVIEW_ENTRY );    
   249     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_RESETVIEW_ENTRY );    
   206 
   250 
       
   251     cancelSelectionAnimation(); //cancel the image selection effect before cleaning the view
   207     //Clean up the rest of the resources allocated
   252     //Clean up the rest of the resources allocated
   208     cleanUp(); 
   253     cleanUp(); 
   209         
   254         
   210     //Clear the 4 icons present in the Coverflow,so that the transition between the views are smooth
   255     //Clear the 4 icons present in the Coverflow,so that the transition between the views are smooth
   211     mCoverFlow->partiallyClean();
   256     mCoverFlow->partiallyClean();
   215 
   260 
   216 void GlxFullScreenView::deActivate()
   261 void GlxFullScreenView::deActivate()
   217 { 
   262 { 
   218     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_DEACTIVATE_ENTRY );    
   263     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_DEACTIVATE_ENTRY );    
   219     
   264     
       
   265     cancelSelectionAnimation(); //cancel the image selection effect before cleaning the view
   220 	//Clean up the rest of the resources allocated
   266 	//Clean up the rest of the resources allocated
   221     cleanUp();
   267     cleanUp();
   222     QCoreApplication::instance()->removeEventFilter(this);
   268     QCoreApplication::instance()->removeEventFilter(this);
   223     //deletes the iconitems in the coverflow   
   269     //deletes the iconitems in the coverflow   
   224     mCoverFlow->ClearCoverFlow();
   270     mCoverFlow->ClearCoverFlow();
   225 
   271 
   226     //the coverflow is not deleted as it is loaded by document loader
   272     //the coverflow is not deleted as it is loaded by document loader
   227     //the coverflow is initialised to null 
   273     //the coverflow is initialised to null 
   228     //to just reset to the initial state
   274     //to just reset to the initial state
   229     mCoverFlow = NULL;
   275     mCoverFlow = NULL;
   230     
   276     mWindow->setAutomaticOrientationEffectEnabled( true );
   231     OstTraceFunctionExit0( GLXFULLSCREENVIEW_DEACTIVATE_EXIT );
   277     OstTraceFunctionExit0( GLXFULLSCREENVIEW_DEACTIVATE_EXIT );
   232 }
   278 }
   233 
   279 
   234 void GlxFullScreenView::cleanUp()
   280 void GlxFullScreenView::cleanUp()
   235 { 
   281 { 
   244         mUiOffTimer = NULL;
   290         mUiOffTimer = NULL;
   245     }
   291     }
   246 
   292 
   247     if(mFullScreenToolBar) {
   293     if(mFullScreenToolBar) {
   248        mFullScreenToolBar->clearActions();
   294        mFullScreenToolBar->clearActions();
       
   295        mFullScreenToolBar->hide();
   249        mFullScreenToolBar = NULL;
   296        mFullScreenToolBar = NULL;
   250     }
   297     }
   251     
   298     
   252     if (mTvOutWrapper) {
   299     if (mTvOutWrapper) {
   253         delete mTvOutWrapper;
   300         delete mTvOutWrapper;
   283     setHdmiModel(mModel);
   330     setHdmiModel(mModel);
   284 	mZoomWidget->setModel(mModel);  
   331 	mZoomWidget->setModel(mModel);  
   285     mCoverFlow->setModel(mModel);
   332     mCoverFlow->setModel(mModel);
   286     setImageStripModel();
   333     setImageStripModel();
   287     if(getSubState() == IMAGEVIEWER_S) {
   334     if(getSubState() == IMAGEVIEWER_S) {
   288         setTitle("Image Viewer");
   335         setTitle(GLX_IMAGE_VIEWER);
   289     }
   336     }
   290 	else if(getSubState() == FETCHER_S){
   337 	else if(getSubState() == FETCHER_S){ //do not zoom in case of fetcher
   291 		setStatusBarVisible(TRUE);
   338 		disconnect(mCoverFlow,SIGNAL( doubleTapEventReceived(QPointF) ), mZoomWidget, SLOT( animateZoomIn(QPointF) ) );
   292         setTitleBarVisible(TRUE);
       
   293 	}
   339 	}
   294     OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETMODEL_EXIT );
   340     OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETMODEL_EXIT );
   295 }
   341 }
   296 
   342 
   297 void GlxFullScreenView::setHdmiModel(QAbstractItemModel* model)
   343 void GlxFullScreenView::setHdmiModel(QAbstractItemModel* model)
   298 {
   344 {
   299     if (mTvOutWrapper) {
   345     if (mTvOutWrapper) {
   300         mTvOutWrapper->setModel(model); 
   346         mTvOutWrapper->setModel(model, screenSize()); 
   301         mTvOutWrapper->setImagetoHDMI(); // for the first image on screen
   347         mTvOutWrapper->setImagetoHDMI(); // for the first image on screen
   302     }    
   348     }    
   303 }
   349 }
   304 
   350 
   305 void GlxFullScreenView::setModelContext()
   351 void GlxFullScreenView::setModelContext()
   330         mUiOffTimer->start(KUiOffTime);
   376         mUiOffTimer->start(KUiOffTime);
   331     }
   377     }
   332     setModelContext();
   378     setModelContext();
   333     loadViewSection();
   379     loadViewSection();
   334     setLayout();
   380     setLayout();
       
   381     playOrientChangeAnim();
   335     
   382     
   336     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ORIENTATIONCHANGED_EXIT );
   383     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ORIENTATIONCHANGED_EXIT );
   337 }
   384 }
   338 
   385 
   339 void GlxFullScreenView::activateUI()
   386 void GlxFullScreenView::activateUI()
   340 {
   387 {
   341     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATEUI_ENTRY );
   388     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATEUI_ENTRY );
   342     
   389     
   343     if ( mUiOff && getSubState() != FETCHER_S){      
   390     if ( mUiOff && getSubState() != FETCHER_S ){      
   344         if( !mFullScreenToolBar ) {
   391         if( !mFullScreenToolBar ) {
   345             loadFullScreenToolBar();
   392             loadFullScreenToolBar();
   346         }
   393         }
   347         mUiOff = FALSE;
   394         mUiOff = FALSE;
   348         
   395         
   349         QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   396         QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   350         if ( variant.isValid() &&  variant.canConvert<int> ()  ) {
   397         if ( variant.isValid() &&  variant.canConvert<int> ()  ) {
   351             mImageStrip->setCurrentIndex ( mModel->index( variant.value<int>(), 0) );    
   398             mImageStrip->setCurrentIndex ( mModel->index( variant.value<int>(), 0) );    
   352             mImageStrip->scrollTo( mModel->index( variant.value<int>(), 0), HbGridView::PositionAtTop ); 
   399             mImageStrip->scrollTo( mModel->index( variant.value<int>(), 0), HbGridView::PositionAtTop ); 
   353         }
   400         }
   354         
   401 
   355         mFullScreenToolBar->show();
   402         setItemVisible( Hb::AllItems, TRUE );
   356 		setStatusBarVisible(TRUE);
   403         setViewFlags( viewFlags() &~ HbView::ViewTitleBarHidden &~ HbView::ViewStatusBarHidden );
   357         setTitleBarVisible(TRUE);
       
   358        
   404        
   359         if ( mImageStrip && getSubState() != IMAGEVIEWER_S) {
   405         if ( mImageStrip && getSubState() != IMAGEVIEWER_S) {
   360             mImageStrip->show(); 
   406             mImageStrip->show(); 
   361             HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapShow"), this, "effectFinished" );
   407             HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapShow"), this, "effectFinished" );
   362         }
   408         }
   363         else if( getSubState() == IMAGEVIEWER_S){
   409         else if( getSubState() == IMAGEVIEWER_S){
   364             setTitle("Image Viewer");
   410             setTitle(GLX_IMAGE_VIEWER);
   365         }
   411         }
       
   412         mFullScreenToolBar->show();
   366     }
   413     }
   367     else {
   414     else {
   368         hideUi();
   415         hideUi();
   369     }
   416     }
   370     
   417     
   382         return ;
   429         return ;
   383     }
   430     }
   384     
   431     
   385     mUiOff = TRUE;
   432     mUiOff = TRUE;
   386 	if ( getSubState() != FETCHER_S ) {
   433 	if ( getSubState() != FETCHER_S ) {
   387 		setStatusBarVisible(FALSE);
   434 	    setViewFlags( viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden );
   388         setTitleBarVisible(FALSE);
       
   389 	}
   435 	}
   390     if ( mImageStrip && ( getSubState() != IMAGEVIEWER_S && getSubState() != FETCHER_S )) {
   436     if ( mImageStrip && ( getSubState() != IMAGEVIEWER_S && getSubState() != FETCHER_S ) ) {
   391         HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapHide"), this, "effectFinished" );
   437         HbEffect::start( mImageStrip, QString("HbGridView"), QString("TapHide"), this, "effectFinished" );
   392     }
   438     }
   393 
   439 
   394     if(mFullScreenToolBar) {
   440     if(mFullScreenToolBar) {
   395        mFullScreenToolBar->hide();
   441        mFullScreenToolBar->hide();
   396     }
   442     }
   417     }
   463     }
   418     
   464     
   419     mModel->setData( index, index.row(), GlxFocusIndexRole );
   465     mModel->setData( index, index.row(), GlxFocusIndexRole );
   420     mModel->setData( index, index.row(), GlxVisualWindowIndex );
   466     mModel->setData( index, index.row(), GlxVisualWindowIndex );
   421 	mZoomWidget->indexChanged(index.row());  
   467 	mZoomWidget->indexChanged(index.row());  
       
   468 
   422     if (mTvOutWrapper){
   469     if (mTvOutWrapper){
   423         // for the image changed on swipe
   470         // for the image changed on swipe
   424         mTvOutWrapper->setImagetoHDMI();
   471         mTvOutWrapper->setImagetoHDMI();
   425     }
   472     }
   426     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_CHANGESELECTEDINDEX_EXIT );
   473     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_CHANGESELECTEDINDEX_EXIT );
   433     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   480     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   434     if ( variant.isValid() &&  variant.canConvert<int> () && ( index.row() == variant.value<int>() ) ) {
   481     if ( variant.isValid() &&  variant.canConvert<int> () && ( index.row() == variant.value<int>() ) ) {
   435        OstTraceFunctionExit0( GLXFULLSCREENVIEW_INDEXCHANGED_EXIT );
   482        OstTraceFunctionExit0( GLXFULLSCREENVIEW_INDEXCHANGED_EXIT );
   436        return;
   483        return;
   437     }         
   484     }         
       
   485     
       
   486     if (mTvOutWrapper){
       
   487         // for the indexchnaged through filmstrip
       
   488         mTvOutWrapper->setImagetoHDMI();
       
   489     }
       
   490     //disable the animation for the time being
       
   491     imageSelectionAnimation( index );
       
   492     
   438     mModel->setData( index, index.row(), GlxFocusIndexRole );
   493     mModel->setData( index, index.row(), GlxFocusIndexRole );
   439 	mZoomWidget->indexChanged(index.row());
   494     mZoomWidget->indexChanged(index.row());
   440     mCoverFlow->indexChanged(index.row());
   495     mZoomWidget->setVisible( false );
   441     mImageStrip->scrollTo(index, HbGridView::EnsureVisible );
       
   442     if (mTvOutWrapper){
       
   443     // for the indexchnaged through filmstrip
       
   444     mTvOutWrapper->setImagetoHDMI();
       
   445     }
       
   446     //disable the animation for the time being
       
   447     //imageSelectionAnimation( index );
       
   448     
   496     
   449     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_INDEXCHANGED_EXIT );
   497     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_INDEXCHANGED_EXIT );
   450 }
   498 }
   451 
   499 
   452 void GlxFullScreenView::scrollingStarted()
   500 void GlxFullScreenView::scrollingStarted()
   529         
   577         
   530     case PANNING_START_EVENT :
   578     case PANNING_START_EVENT :
   531         hideUi();
   579         hideUi();
   532         break ;
   580         break ;
   533         
   581         
       
   582     //hide the ui component without animation  
       
   583     case ZOOM_START_EVENT : {
       
   584         HbEffect::EffectStatus e;
       
   585         mUiOff = TRUE;
       
   586         if( mFullScreenToolBar ) {
       
   587            mFullScreenToolBar->hide();
       
   588         }
       
   589         setViewFlags( viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden );
       
   590         effectFinished( e );
       
   591     }
       
   592         break;
       
   593         
   534     case EMPTY_ROW_EVENT :
   594     case EMPTY_ROW_EVENT :
   535         emit actionTriggered( EGlxCmdEmptyData );
   595         emit actionTriggered( EGlxCmdEmptyData );
   536         break ;
   596         break ;
   537         
   597         
   538     default :
   598     default :
   552     
   612     
   553     if ( mUiOff ) {
   613     if ( mUiOff ) {
   554         mUiOffTimer->stop();        
   614         mUiOffTimer->stop();        
   555         mCoverFlow->setUiOn(FALSE);
   615         mCoverFlow->setUiOn(FALSE);
   556         mImageStrip->hide();
   616         mImageStrip->hide();
       
   617         setItemVisible( Hb::AllItems, FALSE );
   557     }
   618     }
   558     else {
   619     else {
   559         mUiOffTimer->start(KUiOffTime);
   620         mUiOffTimer->start(KUiOffTime);
   560         mCoverFlow->setUiOn(TRUE);               
   621         mCoverFlow->setUiOn(TRUE);               
   561     }
   622     }
   565 
   626 
   566 void GlxFullScreenView::imageSelectionEffectFinished( const HbEffect::EffectStatus  )
   627 void GlxFullScreenView::imageSelectionEffectFinished( const HbEffect::EffectStatus  )
   567 {
   628 {
   568     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_IMAGESELECTIONEFFECTFINISHED_ENTRY );
   629     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_IMAGESELECTIONEFFECTFINISHED_ENTRY );
   569     
   630     
   570     mIconItem->resetTransform();
   631     for ( int i = 0; i < NBR_ANIM_ITEM; i++ ) { 
   571     mIconItem->setVisible( false );
   632         mIconItems[ i ]->resetTransform();
       
   633         mIconItems[ i ]->setVisible( false );
       
   634     }
   572     
   635     
   573     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   636     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   574     if ( variant.isValid() &&  variant.canConvert<int> ()  ) {
   637     if ( variant.isValid() &&  variant.canConvert<int> ()  ) {
   575         mCoverFlow->indexChanged( variant.value<int>() ) ;         
   638         mCoverFlow->indexChanged( variant.value<int>() ) ;         
   576     }
   639     }
       
   640     mCoverFlow->setVisible( true );
       
   641     mZoomWidget->setVisible( true );
   577 
   642 
   578     OstTraceFunctionExit0( GLXFULLSCREENVIEW_IMAGESELECTIONEFFECTFINISHED_EXIT );
   643     OstTraceFunctionExit0( GLXFULLSCREENVIEW_IMAGESELECTIONEFFECTFINISHED_EXIT );
       
   644 }
       
   645 
       
   646 void GlxFullScreenView::orientChangeAnimFinished( const HbEffect::EffectStatus status )
       
   647 {
       
   648     qDebug( "GlxFullScreenView::LsOrientChangeAnimFinished reason %d ", status.reason );
       
   649     mIconItems[ 0 ]->resetTransform();   
       
   650     mIconItems[ 0 ]->setVisible( false );
       
   651     mCoverFlow->setVisible( true );
       
   652     mZoomWidget->setVisible( true );
   579 }
   653 }
   580 
   654 
   581 void GlxFullScreenView::setLayout()
   655 void GlxFullScreenView::setLayout()
   582 {
   656 {
   583     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETLAYOUT_ENTRY );
   657     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETLAYOUT_ENTRY );
   594 {
   668 {
   595     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ADDCONNECTION_ENTRY );
   669     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ADDCONNECTION_ENTRY );
   596     
   670     
   597     if ( mCoverFlow ) {    
   671     if ( mCoverFlow ) {    
   598         connect( mCoverFlow, SIGNAL( coverFlowEvent( GlxCoverFlowEvent ) ), this, SLOT( coverFlowEventHandle( GlxCoverFlowEvent ) ) );
   672         connect( mCoverFlow, SIGNAL( coverFlowEvent( GlxCoverFlowEvent ) ), this, SLOT( coverFlowEventHandle( GlxCoverFlowEvent ) ) );
   599         connect( mCoverFlow, SIGNAL(changeSelectedIndex(const QModelIndex &)), this, SLOT( changeSelectedIndex( const QModelIndex & )));
   673         connect( mCoverFlow, SIGNAL( changeSelectedIndex( const QModelIndex & ) ), this, SLOT( changeSelectedIndex( const QModelIndex & ) ) );
   600     }
   674     }
   601 
   675 
   602     if ( mImageStrip ) {
   676     if ( mImageStrip ) {
   603         connect(mImageStrip, SIGNAL( activated(const QModelIndex &) ), this, SLOT( indexChanged(const QModelIndex &) ));
   677         connect( mImageStrip, SIGNAL( activated(const QModelIndex &) ), this, SLOT( indexChanged(const QModelIndex &) ) );
   604         connect(mImageStrip, SIGNAL( scrollingStarted()),  this, SLOT( scrollingStarted()));
   678         connect( mImageStrip, SIGNAL( scrollingStarted()), this, SLOT( scrollingStarted() ) );
   605         connect(mImageStrip, SIGNAL( scrollingEnded()),    this, SLOT( scrollingEnded()));
   679         connect( mImageStrip, SIGNAL( scrollingEnded()), this, SLOT( scrollingEnded() ) );
   606         connect(mImageStrip, SIGNAL( pressed(const QModelIndex &) ),      this, SLOT( pressed(const QModelIndex &) ));
   680         connect( mImageStrip, SIGNAL( pressed( const QModelIndex & ) ), this, SLOT( pressed( const QModelIndex & ) ) );
   607         connect(mImageStrip, SIGNAL( released(const QModelIndex &) ),     this, SLOT( released(const QModelIndex &) ));
   681         connect( mImageStrip, SIGNAL( released( const QModelIndex & ) ),     this, SLOT( released( const QModelIndex & ) ) );
   608     }
   682     }
   609 
   683 
   610     if ( mUiOffTimer ) {
   684     if ( mUiOffTimer ) {
   611         connect(mUiOffTimer, SIGNAL(timeout()), this, SLOT(hideUi()));
   685         connect( mUiOffTimer, SIGNAL( timeout() ), this, SLOT( hideUi() ) );
   612     }
   686     }
   613     
   687     
   614     if(mCoverFlow && mZoomWidget) {
   688     if( mCoverFlow && mZoomWidget ) {
   615 		connect(mZoomWidget,SIGNAL( pinchGestureReceived(int) ), mCoverFlow, SLOT( zoomStarted(int) ) );
   689 		connect( mZoomWidget, SIGNAL( pinchGestureReceived( int ) ), mCoverFlow, SLOT( zoomStarted( int ) ) );
   616 		connect(mZoomWidget,SIGNAL( zoomWidgetMovedBackground(int) ), mCoverFlow, SLOT( zoomFinished(int) ) );
   690 		connect( mZoomWidget, SIGNAL( zoomWidgetMovedBackground( int ) ), mCoverFlow, SLOT( zoomFinished( int ) ) );
   617         connect(mCoverFlow,SIGNAL( doubleTapEventReceived(QPointF) ), mZoomWidget, SLOT( animateZoomIn(QPointF) ) );
   691         connect( mCoverFlow, SIGNAL( doubleTapEventReceived( QPointF ) ), mZoomWidget, SLOT( animateZoomIn( QPointF ) ) );
   618 	}
   692 	}
   619 
   693 
   620     connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation)));
   694     connect( mWindow, SIGNAL( orientationChanged( Qt::Orientation ) ), this, SLOT( orientationChanged( Qt::Orientation ) ) );
   621 
   695 
   622     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ADDCONNECTION_EXIT );
   696     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ADDCONNECTION_EXIT );
   623 }
   697 }
   624 
   698 
   625 void GlxFullScreenView::removeConnection()
   699 void GlxFullScreenView::removeConnection()
   673 GlxFullScreenView::~GlxFullScreenView()
   747 GlxFullScreenView::~GlxFullScreenView()
   674 {
   748 {
   675     OstTraceFunctionEntry0( DUP1_GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY );
   749     OstTraceFunctionEntry0( DUP1_GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY );
   676     
   750     
   677 	cleanUp();
   751 	cleanUp();
   678 	
   752 	for ( int i = 0; i < NBR_ANIM_ITEM; i++ ) {
   679 	delete mIconItem ;
   753 	    delete mIconItems[ i ] ;
       
   754 	}
   680     delete mImageStrip;
   755     delete mImageStrip;
   681     delete mFullScreenToolBar;
   756     delete mFullScreenToolBar;
   682     delete mCoverFlow;
   757     delete mCoverFlow;
   683     delete mZoomWidget;
   758     delete mZoomWidget;
   684 
   759 
   687         delete mDocLoader;    
   762         delete mDocLoader;    
   688     }
   763     }
   689     
   764     
   690     HbEffect::remove( QString("HbGridView"), QString(":/data/transitionup.fxml"), QString( "TapShow" ));
   765     HbEffect::remove( QString("HbGridView"), QString(":/data/transitionup.fxml"), QString( "TapShow" ));
   691     HbEffect::remove( QString("HbGridView"), QString(":/data/transitiondown.fxml"), QString( "TapHide" ));
   766     HbEffect::remove( QString("HbGridView"), QString(":/data/transitiondown.fxml"), QString( "TapHide" ));
   692     HbEffect::remove( QString("HbGridViewItem"), QString(":/data/gridtofullscreenhide.fxml"), QString( "Select" ));
   767     HbEffect::remove( QString( "HbGridViewItem" ), QString( ":/data/zoomin.fxml" ), QString( "SelectHide" ) );
   693 
   768     HbEffect::remove( QString( "HbGridViewItem" ), QString( ":/data/zoomout.fxml" ), QString( "SelectShow" ) );
       
   769     HbEffect::remove( QString( "HbIconItem" ), QString( ":/data/rotatefslandscape.fxml" ), QString( "RotateFSLS" ) );
       
   770     HbEffect::remove( QString( "HbIconItem" ), QString( ":/data/rotatefsprotrait.fxml" ), QString( "RotateFSPT" ) );
       
   771         
   694     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_EXIT );
   772     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_EXIT );
   695 }
   773 }
   696 
   774 
       
   775 void GlxFullScreenView::initAnimationItem()
       
   776 {
       
   777     if( mIconItems[0] == NULL ) {
       
   778         for( int i = 0; i < NBR_ANIM_ITEM; i++ ) {
       
   779             mIconItems[ i ] = new HbIconItem( mImageStrip->parentItem() );
       
   780             mIconItems[ i ]->setBrush( QBrush( Qt::black ) );
       
   781             mIconItems[ i ]->setZValue( mImageStrip->zValue() - 2 );
       
   782             mIconItems[ i ]->setPos( 0, 0 );
       
   783             mIconItems[ i ]->setAlignment( Qt::AlignCenter );
       
   784         }
       
   785     }
       
   786 }
       
   787 
   697 void GlxFullScreenView::imageSelectionAnimation(const QModelIndex &index)
   788 void GlxFullScreenView::imageSelectionAnimation(const QModelIndex &index)
   698 {
   789 {
   699     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_IMAGESELECTIONANIMATION_ENTRY );
   790     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_IMAGESELECTIONANIMATION_ENTRY );
   700 
   791     
   701     if ( mIconItem == NULL ) {
   792     initAnimationItem();
   702         mIconItem = new HbIconItem( mCoverFlow );
   793     for ( int i = 0; i < NBR_ANIM_ITEM; i++ ) {
   703         mIconItem->setBrush( QBrush( Qt::black ) );
   794         mIconItems[ i ]->setVisible( true );
   704         mIconItem->setZValue( mCoverFlow->zValue() );
   795         mIconItems[ i ]->setSize( screenSize() );
   705     }
   796     }
   706     
   797     
   707     HbAbstractViewItem *mItem = mImageStrip->itemByIndex( index );    
   798     mIconItems[ 0 ]->setIcon( mCoverFlow->getIcon( mCoverFlow->getFocusIndex() ) );    
   708     mIconItem->setSize( mItem->size() );    
   799     mIconItems[ 1 ]->setIcon( mCoverFlow->getIcon( index.row() ) );   
   709     mIconItem->setPos( mItem->sceneTransform().map( QPoint(0,0)).x() , screenSize().height() - 2 * mItem->size().height() ); 
   800     mCoverFlow->setVisible( false );
   710     mIconItem->setVisible( true );
   801     mZoomWidget->setVisible( false );
   711     
   802     
   712     QVariant variant = mModel->data( index, Qt::DecorationRole );
   803     HbEffect::start( mIconItems[ 0 ], QString( "HbGridViewItem" ), QString( "SelectHide" ) );
   713     if ( variant.isValid() &&  variant.canConvert<HbIcon> () ) {
   804     HbEffect::start( mIconItems[ 1 ], QString( "HbGridViewItem" ), QString( "SelectShow" ), this, "imageSelectionEffectFinished" );
   714         mIconItem->setIcon ( variant.value<HbIcon>() ) ; 
   805 
       
   806     OstTraceFunctionExit0( GLXFULLSCREENVIEW_IMAGESELECTIONANIMATION_EXIT );
       
   807 }
       
   808 
       
   809 void GlxFullScreenView::cancelSelectionAnimation()
       
   810 {
       
   811     if ( mIconItems[0] && HbEffect::effectRunning( mIconItems[1], QString( "SelectShow" ) ) ) {
       
   812         HbEffect::cancel( mIconItems[0], QString( "SelectHide" ), false, false, true );
       
   813         HbEffect::cancel( mIconItems[1], QString( "SelectShow" ), false, true, true );
       
   814     }
       
   815 }
       
   816 
       
   817 void GlxFullScreenView::playOrientChangeAnim()
       
   818 {
       
   819     qDebug("GlxFullScreenView::playOrientChangeAnim()");
       
   820     initAnimationItem();
       
   821     mIconItems[ 0 ]->setOpacity( 1 );
       
   822     mIconItems[ 0 ]->setSize( screenSize() );
       
   823     mIconItems[ 0 ]->setVisible( true );
       
   824     mIconItems[ 0 ]->setIcon( mCoverFlow->getIcon( mCoverFlow->getFocusIndex() ) );
       
   825     
       
   826     mCoverFlow->setVisible( false );
       
   827     mZoomWidget->setVisible( false );
       
   828     if ( mWindow->orientation() == Qt::Horizontal ) {
       
   829         HbEffect::start( mIconItems[0], QString( "HbIconItem" ), QString( "RotateFSLS" ), this, "orientChangeAnimFinished" );
   715     }
   830     }
   716     else {
   831     else {
   717         mIconItem->setIcon( HbIcon() );
   832         HbEffect::start( mIconItems[0], QString( "HbIconItem" ), QString( "RotateFSPT" ), this, "orientChangeAnimFinished" );
   718     }    
   833     }
   719     HbEffect::start( mIconItem, QString("HbGridViewItem"), QString("Select"), this, "imageSelectionEffectFinished" ); 
       
   720 
       
   721     OstTraceFunctionExit0( GLXFULLSCREENVIEW_IMAGESELECTIONANIMATION_EXIT );
       
   722 }
   834 }
   723 	
   835 	
   724 void GlxFullScreenView::handleToolBarAction()
   836 void GlxFullScreenView::handleToolBarAction()
   725 {
   837 {
   726     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_HANDLETOOLBARACTION_ENTRY );
   838     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_HANDLETOOLBARACTION_ENTRY );
   750     GLX_LOG_INFO1("GlxFullScreenView::event() %d event type", ev->type());
   862     GLX_LOG_INFO1("GlxFullScreenView::event() %d event type", ev->type());
   751     if ( ev->type() ==  QEvent::ApplicationActivate && mTvOutWrapper) {
   863     if ( ev->type() ==  QEvent::ApplicationActivate && mTvOutWrapper) {
   752         GLX_LOG_INFO("GlxFullScreenView::event() shift to native - CGlxHdmi");
   864         GLX_LOG_INFO("GlxFullScreenView::event() shift to native - CGlxHdmi");
   753         mTvOutWrapper->setToNativeMode();    
   865         mTvOutWrapper->setToNativeMode();    
   754     }
   866     }
   755     if ( ev->type() ==  QEvent::ApplicationDeactivate && mTvOutWrapper) {
   867     if (ev->type() ==  QEvent::ApplicationDeactivate)
   756         GLX_LOG_INFO("GlxFullScreenView::event() shift to Clone - CGlxHdmi");
   868     {
   757         mTvOutWrapper->setToCloningMode();    
   869         if(mZoomWidget) {
       
   870             mZoomWidget->forceZoomToBackground();
       
   871         }
       
   872         if (mTvOutWrapper) {
       
   873             GLX_LOG_INFO("GlxFullScreenView::event() shift to Clone - CGlxHdmi");
       
   874             mTvOutWrapper->setToCloningMode();    
       
   875         }
   758     }
   876     }
   759     return HbView::eventFilter(obj,ev);
   877     return HbView::eventFilter(obj,ev);
   760 }
   878 }
   761 
   879