ui/views/fullscreenview/src/glxfullscreenview.cpp
changeset 69 45459746d5e8
parent 62 36d93b4dc635
child 71 27f2d7aec52a
equal deleted inserted replaced
65:ccee5c4b0de4 69:45459746d5e8
    80     HbEffect::add( QString( "HbIconItem" ), QString( ":/data/rotatefsprotrait.fxml" ), QString( "RotateFSPT" ) );
    80     HbEffect::add( QString( "HbIconItem" ), QString( ":/data/rotatefsprotrait.fxml" ), QString( "RotateFSPT" ) );
    81     
    81     
    82     OstTraceFunctionExit0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_EXIT );
    82     OstTraceFunctionExit0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_EXIT );
    83 }
    83 }
    84 
    84 
       
    85 GlxFullScreenView::~GlxFullScreenView()
       
    86 {
       
    87     OstTraceFunctionEntry0( DUP1_GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY );
       
    88     
       
    89     cleanUp();
       
    90     for ( int i = 0; i < NBR_ANIM_ITEM; i++ ) {
       
    91         delete mIconItems[ i ] ;
       
    92     }
       
    93     delete mBackGroundItem;
       
    94     delete mImageStrip;
       
    95     delete mFullScreenToolBar;
       
    96     delete mCoverFlow;
       
    97     delete mZoomWidget;
       
    98 
       
    99     if( mDocLoader != NULL ) {
       
   100         mDocLoader->reset();
       
   101         delete mDocLoader;    
       
   102     }
       
   103     
       
   104     HbEffect::remove( QString( "HbGridView" ), QString( ":/data/transitionup.fxml" ), QString( "TapShow" ) );
       
   105     HbEffect::remove( QString( "HbGridView" ), QString( ":/data/transitiondown.fxml" ), QString( "TapHide" ) );
       
   106     HbEffect::remove( QString( "HbGridViewItem" ), QString( ":/data/fullscreenzoomin.fxml" ), QString( "SelectHide" ) );
       
   107     HbEffect::remove( QString( "HbGridViewItem" ), QString( ":/data/fullscreenzoomout.fxml" ), QString( "SelectShow" ) );
       
   108     HbEffect::remove( QString( "HbIconItem" ), QString( ":/data/rotatefslandscape.fxml" ), QString( "RotateFSLS" ) );
       
   109     HbEffect::remove( QString( "HbIconItem" ), QString( ":/data/rotatefsprotrait.fxml" ), QString( "RotateFSPT" ) );
       
   110         
       
   111     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_EXIT );
       
   112 }
       
   113 
    85 void GlxFullScreenView::initializeView( QAbstractItemModel *model, GlxView *preView )
   114 void GlxFullScreenView::initializeView( QAbstractItemModel *model, GlxView *preView )
    86 {
   115 {
    87     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_INITIALIZEVIEW_ENTRY );
   116     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_INITIALIZEVIEW_ENTRY );
    88     
   117     
    89     // if animations is on, then Set the image to HDMI here
   118     // if animations is on, then Set the image to HDMI here
    90     if (!mTvOutWrapper){
   119     if ( !mTvOutWrapper ){
    91         mTvOutWrapper = new GlxTvOutWrapper();
   120         mTvOutWrapper = new GlxTvOutWrapper();
    92     }
   121     }
    93     setHdmiModel(model);
   122     setHdmiModel( model );
    94     loadWidgets();
   123     loadWidgets();
    95 
   124 
    96     /* 
   125     /* 
    97      * Initialize the coverflow and partially creates the coverflow with one image
   126      * Initialize the coverflow and partially creates the coverflow with one image
    98      * to make the widget light weight in order to make transition smooth 
   127      * to make the widget light weight in order to make transition smooth 
   112     }
   141     }
   113     
   142     
   114     OstTraceFunctionExit0( GLXFULLSCREENVIEW_INITIALIZEVIEW_EXIT );
   143     OstTraceFunctionExit0( GLXFULLSCREENVIEW_INITIALIZEVIEW_EXIT );
   115 }
   144 }
   116 
   145 
   117 void GlxFullScreenView::loadWidgets()
       
   118 {
       
   119     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADWIDGETS_ENTRY );
       
   120        
       
   121     mCoverFlow = qobject_cast<GlxCoverFlow*> (mDocLoader->findWidget(GLXFULLSCREEN_COVERFLOW));
       
   122     
       
   123     mZoomWidget  =  qobject_cast<GlxZoomWidget*> (mDocLoader->findWidget(GLXFULLSCREENZOOMWIDGET));
       
   124     mZoomWidget->connectDecodeRequestToPinchEvent();
       
   125     mCoverFlow->setMultitouchFilter(mZoomWidget);
       
   126     
       
   127     //initialise the cover flow for basic connections and the rest
       
   128     mCoverFlow->setCoverFlow();
       
   129     mImageStrip = qobject_cast<HbGridView*> (mDocLoader->findWidget(GLXFULLSCREEN_FILMSTRIP));
       
   130      
       
   131     //When the widget is loaded/retreived the widgets are shown by default.
       
   132     //@to do : hide the widgets by default in docml
       
   133     mImageStrip->hide();      
       
   134 	mImageStrip->setLayoutName( QString( "ImageStrip" ) ); // To distinguish in CSS file
       
   135 	mImageStrip->setEnabledAnimations( HbAbstractItemView::None );
       
   136 	mImageStrip->setHorizontalScrollBarPolicy( HbScrollArea::ScrollBarAlwaysOff );
       
   137 	
       
   138     OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADWIDGETS_EXIT );
       
   139 }
       
   140 
       
   141 void GlxFullScreenView::loadFullScreenToolBar()
       
   142 {
       
   143     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADFULLSCREENTOOLBAR_ENTRY );
       
   144     
       
   145     //The fullscreen tool bar is delted when ever the view is deactivated
       
   146     //so load the docml once again and retreive the object
       
   147     bool loaded =true;      
       
   148     mDocLoader->load(GLXFULLSCREENDOCMLPATH,&loaded);
       
   149     loadViewSection();
       
   150 
       
   151     mFullScreenToolBar = qobject_cast<HbToolBar *> (mDocLoader->findObject(QString("toolBar")));
       
   152     mFullScreenToolBar->clearActions();
       
   153     
       
   154     addToolBarAction( EGlxCmdDetailsOpen, GLXICON_FLIP, "Flip Action" ); //create  Flip tool bar button action
       
   155     addToolBarAction( EGlxCmdSend, GLXICON_SEND, "Send Action" );        //create  Send tool bar button action
       
   156     if( getSubState() != IMAGEVIEWER_S ) {        
       
   157         addToolBarAction( EGlxCmdDelete, GLXICON_DELETE, "Delete Action" ); //create  Delete tool bar button action
       
   158     }
       
   159     else {
       
   160         addToolBarAction( EGlxCmdHandled, GLXICON_USEIMAGE, "Use Action" ); //create  Use Image tool bar button action
       
   161     }
       
   162  
       
   163     OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADFULLSCREENTOOLBAR_EXIT );
       
   164 }
       
   165 
       
   166 void GlxFullScreenView::addToolBarAction( int commandId, const QString &iconName, const QString &name )
       
   167 {
       
   168     HbAction *action = new HbAction( this ); 
       
   169     action->setData( commandId );
       
   170     action->setIcon( HbIcon( iconName ) ); 
       
   171     action->setObjectName( name );
       
   172     mFullScreenToolBar->addAction( action );
       
   173     connect(action, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); 
       
   174 }
       
   175 
       
   176 void GlxFullScreenView::activate()
   146 void GlxFullScreenView::activate()
   177 {
   147 {
   178     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATE_ENTRY );    
   148     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATE_ENTRY );    
   179 //for zoom might not be required after wk15 release
   149 //for zoom might not be required after wk15 release
   180 	mWindow->viewport()->setAttribute(Qt::WA_AcceptTouchEvents,true); 
   150     mWindow->viewport()->setAttribute( Qt::WA_AcceptTouchEvents, true ); 
   181 	mWindow->viewport()->grabGesture(Qt::PinchGesture);
   151     mWindow->viewport()->grabGesture( Qt::PinchGesture );
   182 	
   152     
   183 	QCoreApplication::instance()->installEventFilter(this);
   153     QCoreApplication::instance()->installEventFilter( this );
   184 
   154 
   185     if( !mCoverFlow ) {
   155     if( !mCoverFlow ) {
   186         loadWidgets();  //retrives the widgets
   156         loadWidgets();  //retrives the widgets
   187     }
   157     }
   188     //Loads the widgets corresponding to the orientation.
   158     //Loads the widgets corresponding to the orientation.
   189     loadViewSection();
   159     loadViewSection();
   190 	
   160     
   191     HbView::HbViewFlags flags( HbView::ViewTitleBarTransparent | HbView::ViewStatusBarTransparent);
   161     HbView::HbViewFlags flags( HbView::ViewTitleBarTransparent | HbView::ViewStatusBarTransparent);
   192     setViewFlags(flags);
   162     setViewFlags(flags);
   193 	
   163     
   194 	// In case of fetcher don't hide status pane and title bar
   164     // In case of fetcher don't hide status pane and title bar
   195     if(!(XQServiceUtil::isService() && (0 == XQServiceUtil::interfaceName().compare(QLatin1String("com.nokia.symbian.IImageFetch"))))) {
   165     if(!(XQServiceUtil::isService() && (0 == XQServiceUtil::interfaceName().compare(QLatin1String("com.nokia.symbian.IImageFetch"))))) {
   196         setViewFlags( viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden );
   166         setViewFlags( viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden );
   197 		mUiOff = true;
   167         mUiOff = true;
   198 	}
   168     }
   199     else
   169     else {
   200         {
   170         HbAction* selectAction = new HbAction( GLX_BUTTON_SELECT );
   201         HbAction* selectAction = new HbAction(GLX_BUTTON_SELECT);
       
   202         selectAction->setObjectName( "FS Select" );
   171         selectAction->setObjectName( "FS Select" );
   203         
   172         
   204         connect(selectAction, SIGNAL(triggered()), this, SLOT(handleFSSelect()));
   173         connect( selectAction, SIGNAL( triggered() ), this, SLOT( handleFSSelect() ) );
   205         HbToolBar* toolBar = new HbToolBar();
   174         HbToolBar* toolBar = new HbToolBar();
   206         toolBar->setOrientation( Qt::Horizontal );
   175         toolBar->setOrientation( Qt::Horizontal );
   207         toolBar->setVisible(true);
   176         toolBar->setVisible( true );
   208         toolBar->addAction(selectAction);
   177         toolBar->addAction( selectAction );
   209         setToolBar(toolBar);
   178         setToolBar( toolBar );
   210         }
   179     }
   211         
   180         
   212     mUiOffTimer = new QTimer();
   181     mUiOffTimer = new QTimer();
   213     mUiOffTimer->stop();        
   182     mUiOffTimer->stop();        
   214     mCoverFlow->setUiOn(FALSE);    
   183     mCoverFlow->setUiOn( FALSE );    
   215     addConnection(); 
   184     addConnection(); 
   216     setLayout();
   185     setLayout();
   217      
   186      
   218     if (!mTvOutWrapper) {
   187     if (!mTvOutWrapper) {
   219         mTvOutWrapper = new GlxTvOutWrapper();
   188         mTvOutWrapper = new GlxTvOutWrapper();
   221     
   190     
   222     mWindow->setAutomaticOrientationEffectEnabled( false );
   191     mWindow->setAutomaticOrientationEffectEnabled( false );
   223     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ACTIVATE_EXIT );
   192     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ACTIVATE_EXIT );
   224 }
   193 }
   225 
   194 
   226 void GlxFullScreenView::handleFSSelect()
   195 void GlxFullScreenView::deActivate()
   227 {
   196 { 
   228     emit actionTriggered( EGlxCmdFetcherSelect );
   197     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_DEACTIVATE_ENTRY );    
   229 }
   198     
   230 
   199     cancelSelectionAnimation(); //cancel the image selection effect before cleaning the view
   231 void GlxFullScreenView::loadViewSection()
   200     //Clean up the rest of the resources allocated
   232 {
   201     cleanUp();
   233     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADVIEWSECTION_ENTRY );    
   202     QCoreApplication::instance()->removeEventFilter( this );
   234 
   203     //deletes the iconitems in the coverflow   
   235     bool loaded =true;
   204     mCoverFlow->ClearCoverFlow();
   236     if( mWindow->orientation() == Qt::Horizontal ) {
   205 
   237         //Load the Landscape section for Horizontal
   206     //the coverflow is not deleted as it is loaded by document loader
   238         mDocLoader->load(GLXFULLSCREENDOCMLPATH,GLXFULLSCREENLSSECTION,&loaded);
   207     //the coverflow is initialised to null 
   239     }
   208     //to just reset to the initial state
   240     else{
   209     mCoverFlow = NULL;
   241         //Load the Portrait section for Horizontal
   210     mWindow->setAutomaticOrientationEffectEnabled( true );
   242         mDocLoader->load(GLXFULLSCREENDOCMLPATH,GLXFULLSCREENPTSECTION,&loaded);    
   211     OstTraceFunctionExit0( GLXFULLSCREENVIEW_DEACTIVATE_EXIT );
   243     }
       
   244     
       
   245     OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADVIEWSECTION_EXIT );
       
   246 }
   212 }
   247 
   213 
   248 void GlxFullScreenView::resetView()
   214 void GlxFullScreenView::resetView()
   249 {
   215 {
   250     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_RESETVIEW_ENTRY );    
   216     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_RESETVIEW_ENTRY );    
   257     mCoverFlow->partiallyClean();
   223     mCoverFlow->partiallyClean();
   258     
   224     
   259     OstTraceFunctionExit0( GLXFULLSCREENVIEW_RESETVIEW_EXIT );
   225     OstTraceFunctionExit0( GLXFULLSCREENVIEW_RESETVIEW_EXIT );
   260 }
   226 }
   261 
   227 
   262 void GlxFullScreenView::deActivate()
   228 void GlxFullScreenView::setModel( QAbstractItemModel *model )
   263 { 
   229 {
   264     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_DEACTIVATE_ENTRY );    
   230     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETMODEL_ENTRY );
   265     
   231     OstTraceExt2( TRACE_NORMAL, GLXFULLSCREENVIEW_SETMODEL, "GlxFullScreenView::setModel; model=%x; mModel=%u", ( TUint )( model ), ( TUint ) mModel );
   266     cancelSelectionAnimation(); //cancel the image selection effect before cleaning the view
   232     
   267 	//Clean up the rest of the resources allocated
   233     mModel = model;     
   268     cleanUp();
   234     setModelContext();  
   269     QCoreApplication::instance()->removeEventFilter(this);
   235     setHdmiModel( mModel );
   270     //deletes the iconitems in the coverflow   
   236     mZoomWidget->setModel( mModel );  
   271     mCoverFlow->ClearCoverFlow();
   237     mCoverFlow->setModel( mModel );
   272 
   238     setImageStripModel();
   273     //the coverflow is not deleted as it is loaded by document loader
   239     if( getSubState() == IMAGEVIEWER_S ) {
   274     //the coverflow is initialised to null 
   240         setTitle(GLX_IMAGE_VIEWER);
   275     //to just reset to the initial state
   241     }
   276     mCoverFlow = NULL;
   242 	else if(getSubState() == FETCHER_S){ //do not hide UI in case of fetcher
   277     mWindow->setAutomaticOrientationEffectEnabled( true );
   243         disconnect(mZoomWidget,SIGNAL( pinchGestureReceived(int) ), mCoverFlow, SLOT( zoomStarted(int) ) );
   278     OstTraceFunctionExit0( GLXFULLSCREENVIEW_DEACTIVATE_EXIT );
   244     }
       
   245     OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETMODEL_EXIT );
       
   246 }
       
   247 
       
   248 void GlxFullScreenView::setModelContext()
       
   249 {
       
   250     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETMODELCONTEXT_ENTRY );
       
   251     
       
   252     if ( mModel && mWindow ) {
       
   253         if ( mWindow->orientation() == Qt::Horizontal ) {
       
   254             WRITE_TIMESTAMP("set the fullscreen landscape context")
       
   255             mModel->setData(QModelIndex(), (int)GlxContextLsFs, GlxContextRole );
       
   256         }
       
   257         else {
       
   258             WRITE_TIMESTAMP("set the fullscreen portrait context")
       
   259             mModel->setData(QModelIndex(), (int)GlxContextPtFs, GlxContextRole );
       
   260         }
       
   261     }
       
   262     
       
   263     OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETMODELCONTEXT_EXIT );
   279 }
   264 }
   280 
   265 
   281 void GlxFullScreenView::cleanUp()
   266 void GlxFullScreenView::cleanUp()
   282 { 
   267 { 
   283     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_CLEANUP_ENTRY );
   268     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_CLEANUP_ENTRY );
   319     }
   304     }
   320 
   305 
   321     return NULL;    
   306     return NULL;    
   322 }
   307 }
   323 
   308 
   324 void GlxFullScreenView::setModel( QAbstractItemModel *model )
       
   325 {
       
   326     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETMODEL_ENTRY );
       
   327     OstTraceExt2( TRACE_NORMAL, GLXFULLSCREENVIEW_SETMODEL, "GlxFullScreenView::setModel; model=%x; mModel=%u", ( TUint )( model ), ( TUint ) mModel );
       
   328     
       
   329     mModel = model;     
       
   330 	setModelContext();  
       
   331     setHdmiModel(mModel);
       
   332 	mZoomWidget->setModel(mModel);  
       
   333     mCoverFlow->setModel(mModel);
       
   334     setImageStripModel();
       
   335     if(getSubState() == IMAGEVIEWER_S) {
       
   336         setTitle(GLX_IMAGE_VIEWER);
       
   337     }
       
   338 	else if(getSubState() == FETCHER_S){ //do not zoom in case of fetcher
       
   339 		disconnect(mCoverFlow,SIGNAL( doubleTapEventReceived(QPointF) ), mZoomWidget, SLOT( animateZoomIn(QPointF) ) );
       
   340 	}
       
   341     OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETMODEL_EXIT );
       
   342 }
       
   343 
       
   344 void GlxFullScreenView::setHdmiModel(QAbstractItemModel* model)
       
   345 {
       
   346     if (mTvOutWrapper) {
       
   347         mTvOutWrapper->setModel(model, screenSize()); 
       
   348         mTvOutWrapper->setImagetoHDMI(); // for the first image on screen
       
   349     }    
       
   350 }
       
   351 
       
   352 void GlxFullScreenView::setModelContext()
       
   353 {
       
   354     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETMODELCONTEXT_ENTRY );
       
   355     
       
   356     if ( mModel && mWindow ) {
       
   357         if ( mWindow->orientation() == Qt::Horizontal ) {
       
   358             WRITE_TIMESTAMP("set the fullscreen landscape context")
       
   359             mModel->setData(QModelIndex(), (int)GlxContextLsFs, GlxContextRole );
       
   360         }
       
   361         else {
       
   362             WRITE_TIMESTAMP("set the fullscreen portrait context")
       
   363             mModel->setData(QModelIndex(), (int)GlxContextPtFs, GlxContextRole );
       
   364         }
       
   365     }
       
   366     
       
   367     OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETMODELCONTEXT_EXIT );
       
   368 }
       
   369 
       
   370 void GlxFullScreenView::orientationChanged(Qt::Orientation orient)
   309 void GlxFullScreenView::orientationChanged(Qt::Orientation orient)
   371 {
   310 {
   372     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ORIENTATIONCHANGED_ENTRY );
   311     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ORIENTATIONCHANGED_ENTRY );
   373     Q_UNUSED(orient)
   312     Q_UNUSED(orient)
   374     
   313     
   386     else {
   325     else {
   387         playOrientChangeAnim();
   326         playOrientChangeAnim();
   388     }
   327     }
   389     
   328     
   390     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ORIENTATIONCHANGED_EXIT );
   329     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ORIENTATIONCHANGED_EXIT );
   391 }
       
   392 
       
   393 void GlxFullScreenView::activateUI()
       
   394 {
       
   395     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATEUI_ENTRY );
       
   396     
       
   397     if ( mUiOff && getSubState() != FETCHER_S ){      
       
   398         if( !mFullScreenToolBar ) {
       
   399             loadFullScreenToolBar();
       
   400         }
       
   401         mUiOff = FALSE;
       
   402         
       
   403         QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
       
   404         if ( variant.isValid() &&  variant.canConvert<int> ()  ) {
       
   405             mImageStrip->setCurrentIndex ( mModel->index( variant.value<int>(), 0) );    
       
   406             mImageStrip->scrollTo( mModel->index( variant.value<int>(), 0), HbGridView::PositionAtTop ); 
       
   407         }
       
   408 
       
   409         setItemVisible( Hb::AllItems, TRUE );
       
   410         setViewFlags( viewFlags() &~ HbView::ViewTitleBarHidden &~ HbView::ViewStatusBarHidden );
       
   411        
       
   412         if ( mImageStrip && getSubState() != IMAGEVIEWER_S) {
       
   413             mImageStrip->show(); 
       
   414             HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapShow"), this, "effectFinished" );
       
   415         }
       
   416         else if( getSubState() == IMAGEVIEWER_S){
       
   417             setTitle(GLX_IMAGE_VIEWER);
       
   418         }
       
   419         mFullScreenToolBar->setOpacity( 1 );
       
   420         mFullScreenToolBar->show();
       
   421     }
       
   422     else {
       
   423         hideUi();
       
   424     }
       
   425     
       
   426     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ACTIVATEUI_EXIT );
       
   427 }
   330 }
   428 
   331 
   429 void GlxFullScreenView::hideUi()
   332 void GlxFullScreenView::hideUi()
   430 {
   333 {
   431     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_HIDEUI_ENTRY );
   334     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_HIDEUI_ENTRY );
   450     }
   353     }
   451     
   354     
   452     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_HIDEUI_EXIT );
   355     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_HIDEUI_EXIT );
   453 }
   356 }
   454 
   357 
   455 void GlxFullScreenView::changeSelectedIndex(const QModelIndex &index)
   358 void GlxFullScreenView::changeSelectedIndex( const QModelIndex &index )
   456 {
   359 {
   457     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_CHANGESELECTEDINDEX_ENTRY );
   360     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_CHANGESELECTEDINDEX_ENTRY );
   458     
   361     
   459     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   362     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   460     if ( variant.isValid() &&  variant.canConvert<int> () && ( index.row() == variant.value<int>() ) ) {
   363     if ( variant.isValid() &&  variant.canConvert<int> () && ( index.row() == variant.value<int>() ) ) {
   479         mTvOutWrapper->setImagetoHDMI();
   382         mTvOutWrapper->setImagetoHDMI();
   480     }
   383     }
   481     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_CHANGESELECTEDINDEX_EXIT );
   384     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_CHANGESELECTEDINDEX_EXIT );
   482 }
   385 }
   483 
   386 
   484 void GlxFullScreenView::indexChanged(const QModelIndex &index)
   387 void GlxFullScreenView::indexChanged( const QModelIndex &index )
   485 {
   388 {
   486     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_INDEXCHANGED_ENTRY );    
   389     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_INDEXCHANGED_ENTRY );    
   487     
   390     
   488     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   391     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   489     if ( variant.isValid() &&  variant.canConvert<int> () && ( index.row() == variant.value<int>() ) ) {
   392     if ( variant.isValid() &&  variant.canConvert<int> () && ( index.row() == variant.value<int>() ) ) {
   492     }         
   395     }         
   493     
   396     
   494     if (mTvOutWrapper){
   397     if (mTvOutWrapper){
   495         // for the indexchnaged through filmstrip
   398         // for the indexchnaged through filmstrip
   496         mTvOutWrapper->setImagetoHDMI();
   399         mTvOutWrapper->setImagetoHDMI();
   497     }
   400     } 
   498     //disable the animation for the time being
       
   499     imageSelectionAnimation( index );
   401     imageSelectionAnimation( index );
   500     
   402     
   501     mModel->setData( index, index.row(), GlxFocusIndexRole );
   403     mModel->setData( index, index.row(), GlxFocusIndexRole );
   502     mZoomWidget->indexChanged(index.row());
   404     mZoomWidget->indexChanged( index.row() );
   503     mZoomWidget->setVisible( false );
   405     mZoomWidget->setVisible( false );
   504     
   406     
   505     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_INDEXCHANGED_EXIT );
   407     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_INDEXCHANGED_EXIT );
   506 }
   408 }
   507 
   409 
   550     if ( mUiOffTimer && mImageStrip->isScrolling() == false ) {
   452     if ( mUiOffTimer && mImageStrip->isScrolling() == false ) {
   551         mUiOffTimer->start(KUiOffTime);
   453         mUiOffTimer->start(KUiOffTime);
   552     }
   454     }
   553     
   455     
   554     OstTraceFunctionExit0( GLXFULLSCREENVIEW_RELEASED_EXIT );
   456     OstTraceFunctionExit0( GLXFULLSCREENVIEW_RELEASED_EXIT );
   555 }
       
   556 
       
   557 void GlxFullScreenView::setVisvalWindowIndex()
       
   558 {
       
   559     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETVISVALWINDOWINDEX_ENTRY );
       
   560     
       
   561     QList< HbAbstractViewItem * >  visibleItemList =  mImageStrip->visibleItems();
       
   562     if ( visibleItemList.count() <= 0 )
       
   563         return ;
       
   564 
       
   565     HbAbstractViewItem *item = visibleItemList.at(0);
       
   566     if ( item == NULL ) 
       
   567         return ;
       
   568 
       
   569     if (  item->modelIndex().row() < 0 || item->modelIndex().row() >= mModel->rowCount() )
       
   570         return ;
       
   571 
       
   572     mModel->setData( item->modelIndex (), item->modelIndex().row(), GlxVisualWindowIndex);
       
   573     
       
   574     OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETVISVALWINDOWINDEX_EXIT );
       
   575 }
   457 }
   576 
   458 
   577 void GlxFullScreenView::coverFlowEventHandle( GlxCoverFlowEvent e )
   459 void GlxFullScreenView::coverFlowEventHandle( GlxCoverFlowEvent e )
   578 {
   460 {
   579     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_COVERFLOWEVENTHANDLE_ENTRY );
   461     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_COVERFLOWEVENTHANDLE_ENTRY );
   619     
   501     
   620     if ( mUiOffTimer == NULL ){ //view is already deactivate so no need to do any thing
   502     if ( mUiOffTimer == NULL ){ //view is already deactivate so no need to do any thing
   621        return ;
   503        return ;
   622     }
   504     }
   623     
   505     
       
   506     mImageStrip->resetTransform();
   624     if ( mUiOff ) {
   507     if ( mUiOff ) {
   625         mUiOffTimer->stop();        
   508         mUiOffTimer->stop();        
   626         mCoverFlow->setUiOn(FALSE);
   509         mCoverFlow->setUiOn( FALSE );
   627         mImageStrip->hide();
   510         mImageStrip->hide();
   628         setItemVisible( Hb::AllItems, FALSE );
   511         setItemVisible( Hb::AllItems, FALSE );
   629     }
   512     }
   630     else {
   513     else {
   631         mUiOffTimer->start(KUiOffTime);
   514         mUiOffTimer->start( KUiOffTime );
   632         mCoverFlow->setUiOn(TRUE);               
   515         mCoverFlow->setUiOn( TRUE );               
   633     }
   516     }
   634     
   517     
   635     OstTraceFunctionExit0( GLXFULLSCREENVIEW_EFFECTFINISHED_EXIT );
   518     OstTraceFunctionExit0( GLXFULLSCREENVIEW_EFFECTFINISHED_EXIT );
   636 }
   519 }
   637 
   520 
   668 void GlxFullScreenView::zoomOrientChangeAnimFinished( const HbEffect::EffectStatus status )
   551 void GlxFullScreenView::zoomOrientChangeAnimFinished( const HbEffect::EffectStatus status )
   669 {
   552 {
   670     mZoomWidget->resetTransform();
   553     mZoomWidget->resetTransform();
   671 }
   554 }
   672 
   555 
       
   556 void GlxFullScreenView::handleToolBarAction()
       
   557 {
       
   558     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_HANDLETOOLBARACTION_ENTRY );
       
   559     
       
   560     HbAction *action = qobject_cast<HbAction*>(sender());
       
   561     qint32 commandId = action->data().toInt();
       
   562     emit actionTriggered( commandId );
       
   563     
       
   564     OstTraceFunctionExit0( GLXFULLSCREENVIEW_HANDLETOOLBARACTION_EXIT );
       
   565 }
       
   566 
       
   567 void GlxFullScreenView::handleFSSelect()
       
   568 {
       
   569     emit actionTriggered( EGlxCmdFetcherSelect );
       
   570 }
       
   571 
       
   572 bool GlxFullScreenView::eventFilter(QObject *obj, QEvent *ev)
       
   573 {
       
   574     GLX_LOG_INFO1("GlxFullScreenView::event() %d event type", ev->type());
       
   575     if ( ev->type() ==  QEvent::ApplicationActivate && mTvOutWrapper) {
       
   576         GLX_LOG_INFO("GlxFullScreenView::event() shift to native - CGlxHdmi");
       
   577         mTvOutWrapper->setToNativeMode();    
       
   578     }
       
   579     if (ev->type() ==  QEvent::ApplicationDeactivate)
       
   580     {
       
   581         if(mZoomWidget) {
       
   582             mZoomWidget->forceZoomToBackground();
       
   583         }
       
   584         if (mTvOutWrapper) {
       
   585             GLX_LOG_INFO("GlxFullScreenView::event() shift to Clone - CGlxHdmi");
       
   586             mTvOutWrapper->setToCloningMode();    
       
   587         }
       
   588     }
       
   589     return HbView::eventFilter(obj,ev);
       
   590 }
       
   591 
       
   592 void GlxFullScreenView::loadWidgets()
       
   593 {
       
   594     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADWIDGETS_ENTRY );
       
   595        
       
   596     mCoverFlow = qobject_cast<GlxCoverFlow*> (mDocLoader->findWidget(GLXFULLSCREEN_COVERFLOW));
       
   597     
       
   598     mZoomWidget  =  qobject_cast<GlxZoomWidget*> (mDocLoader->findWidget(GLXFULLSCREENZOOMWIDGET));
       
   599     mZoomWidget->connectDecodeRequestToPinchEvent();
       
   600     mCoverFlow->setMultitouchFilter(mZoomWidget);
       
   601     
       
   602     //initialise the cover flow for basic connections and the rest
       
   603     mCoverFlow->setCoverFlow();
       
   604     mImageStrip = qobject_cast<HbGridView*> (mDocLoader->findWidget(GLXFULLSCREEN_FILMSTRIP));
       
   605      
       
   606     //When the widget is loaded/retreived the widgets are shown by default.
       
   607     //@to do : hide the widgets by default in docml
       
   608     mImageStrip->hide();      
       
   609     mImageStrip->setLayoutName( QString( "ImageStrip" ) ); // To distinguish in CSS file
       
   610     mImageStrip->setEnabledAnimations( HbAbstractItemView::None );
       
   611     //mImageStrip->setHorizontalScrollBarPolicy( HbScrollArea::ScrollBarAlwaysOff );
       
   612 	mImageStrip->setItemPixmapCacheEnabled( true );
       
   613     
       
   614     OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADWIDGETS_EXIT );
       
   615 }
       
   616 
       
   617 void GlxFullScreenView::loadViewSection()
       
   618 {
       
   619     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADVIEWSECTION_ENTRY );    
       
   620 
       
   621     bool loaded =true;
       
   622     if( mWindow->orientation() == Qt::Horizontal ) {
       
   623         //Load the Landscape section for Horizontal
       
   624         mDocLoader->load(GLXFULLSCREENDOCMLPATH,GLXFULLSCREENLSSECTION,&loaded);
       
   625     }
       
   626     else{
       
   627         //Load the Portrait section for Horizontal
       
   628         mDocLoader->load(GLXFULLSCREENDOCMLPATH,GLXFULLSCREENPTSECTION,&loaded);    
       
   629     }
       
   630     
       
   631     OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADVIEWSECTION_EXIT );
       
   632 }
       
   633 
   673 void GlxFullScreenView::setLayout()
   634 void GlxFullScreenView::setLayout()
   674 {
   635 {
   675     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETLAYOUT_ENTRY );
   636     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETLAYOUT_ENTRY );
   676     
   637     
   677     QSize sz = screenSize();
   638     QSize sz = screenSize();
   678 
   639 
   679     mCoverFlow->setItemSize(sz);
   640     mCoverFlow->setItemSize(sz);
   680  	mZoomWidget->setWindowSize(sz);
   641  	mZoomWidget->setWindowSize(sz);
   681 
   642 
   682     OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETLAYOUT_EXIT );
   643     OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETLAYOUT_EXIT );
       
   644 }
       
   645 
       
   646 void GlxFullScreenView::activateUI()
       
   647 {
       
   648     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATEUI_ENTRY );
       
   649     
       
   650     if ( mUiOff && getSubState() != FETCHER_S ){      
       
   651         if( !mFullScreenToolBar ) {
       
   652             loadFullScreenToolBar();
       
   653         }
       
   654         mUiOff = FALSE;
       
   655         
       
   656         QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
       
   657         if ( variant.isValid() &&  variant.canConvert<int> ()  ) {
       
   658             mImageStrip->setCurrentIndex ( mModel->index( variant.value<int>(), 0) );    
       
   659             mImageStrip->scrollTo( mModel->index( variant.value<int>(), 0), HbGridView::PositionAtTop ); 
       
   660         }
       
   661 
       
   662         setItemVisible( Hb::AllItems, TRUE );
       
   663         setViewFlags( viewFlags() &~ HbView::ViewTitleBarHidden &~ HbView::ViewStatusBarHidden );
       
   664        
       
   665         if ( mImageStrip && getSubState() != IMAGEVIEWER_S) {
       
   666             mImageStrip->show(); 
       
   667             HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapShow"), this, "effectFinished" );
       
   668         }
       
   669         else if( getSubState() == IMAGEVIEWER_S){
       
   670             setTitle(GLX_IMAGE_VIEWER);
       
   671         }
       
   672         mFullScreenToolBar->setOpacity( 1 );
       
   673         mFullScreenToolBar->show();
       
   674     }
       
   675     else {
       
   676         hideUi();
       
   677     }
       
   678     
       
   679     OstTraceFunctionExit0( GLXFULLSCREENVIEW_ACTIVATEUI_EXIT );
   683 }
   680 }
   684 
   681 
   685 void GlxFullScreenView::addConnection()
   682 void GlxFullScreenView::addConnection()
   686 {
   683 {
   687     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ADDCONNECTION_ENTRY );
   684     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ADDCONNECTION_ENTRY );
   761     }
   758     }
   762     
   759     
   763     OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETIMAGESTRIPMODEL_EXIT );
   760     OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETIMAGESTRIPMODEL_EXIT );
   764 }
   761 }
   765 
   762 
   766 GlxFullScreenView::~GlxFullScreenView()
   763 void GlxFullScreenView::setHdmiModel(QAbstractItemModel* model)
   767 {
   764 {
   768     OstTraceFunctionEntry0( DUP1_GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY );
   765     if (mTvOutWrapper) {
   769     
   766         mTvOutWrapper->setModel(model, screenSize()); 
   770 	cleanUp();
   767         mTvOutWrapper->setImagetoHDMI(); // for the first image on screen
   771 	for ( int i = 0; i < NBR_ANIM_ITEM; i++ ) {
   768     }    
   772 	    delete mIconItems[ i ] ;
   769 }
   773 	}
   770 
   774 	delete mBackGroundItem;
   771 void GlxFullScreenView::loadFullScreenToolBar()
   775     delete mImageStrip;
   772 {
   776     delete mFullScreenToolBar;
   773     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADFULLSCREENTOOLBAR_ENTRY );
   777     delete mCoverFlow;
   774     
   778     delete mZoomWidget;
   775     //The fullscreen tool bar is delted when ever the view is deactivated
   779 
   776     //so load the docml once again and retreive the object
   780     if(mDocLoader != NULL) {
   777     bool loaded =true;      
   781         mDocLoader->reset();
   778     mDocLoader->load(GLXFULLSCREENDOCMLPATH,&loaded);
   782         delete mDocLoader;    
   779     loadViewSection();
   783     }
   780 
   784     
   781     mFullScreenToolBar = qobject_cast<HbToolBar *> (mDocLoader->findObject(QString("toolBar")));
   785     HbEffect::remove( QString("HbGridView"), QString(":/data/transitionup.fxml"), QString( "TapShow" ));
   782     mFullScreenToolBar->clearActions();
   786     HbEffect::remove( QString("HbGridView"), QString(":/data/transitiondown.fxml"), QString( "TapHide" ));
   783     
   787     HbEffect::remove( QString( "HbGridViewItem" ), QString( ":/data/fullscreenzoomin.fxml" ), QString( "SelectHide" ) );
   784     addToolBarAction( EGlxCmdDetailsOpen, GLXICON_FLIP, "Flip Action" ); //create  Flip tool bar button action
   788     HbEffect::remove( QString( "HbGridViewItem" ), QString( ":/data/fullscreenzoomout.fxml" ), QString( "SelectShow" ) );
   785     addToolBarAction( EGlxCmdSend, GLXICON_SEND, "Send Action" );        //create  Send tool bar button action
   789     HbEffect::remove( QString( "HbIconItem" ), QString( ":/data/rotatefslandscape.fxml" ), QString( "RotateFSLS" ) );
   786     if( getSubState() != IMAGEVIEWER_S ) {        
   790     HbEffect::remove( QString( "HbIconItem" ), QString( ":/data/rotatefsprotrait.fxml" ), QString( "RotateFSPT" ) );
   787         addToolBarAction( EGlxCmdDelete, GLXICON_DELETE, "Delete Action" ); //create  Delete tool bar button action
   791         
   788     }
   792     OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_EXIT );
   789     else {
       
   790         addToolBarAction( EGlxCmdHandled, GLXICON_USEIMAGE, "Use Action" ); //create  Use Image tool bar button action
       
   791     }
       
   792  
       
   793     OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADFULLSCREENTOOLBAR_EXIT );
       
   794 }
       
   795 
       
   796 void GlxFullScreenView::addToolBarAction( int commandId, const QString &iconName, const QString &name )
       
   797 {
       
   798     HbAction *action = new HbAction( this ); 
       
   799     action->setData( commandId );
       
   800     action->setIcon( HbIcon( iconName ) ); 
       
   801     action->setObjectName( name );
       
   802     mFullScreenToolBar->addAction( action );
       
   803     connect(action, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); 
       
   804 }
       
   805 
       
   806 void GlxFullScreenView::setVisvalWindowIndex()
       
   807 {
       
   808     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETVISVALWINDOWINDEX_ENTRY );
       
   809     
       
   810     QList< HbAbstractViewItem * >  visibleItemList =  mImageStrip->visibleItems();
       
   811     if ( visibleItemList.count() <= 0 )
       
   812         return ;
       
   813 
       
   814     HbAbstractViewItem *item = visibleItemList.at(0);
       
   815     if ( item == NULL ) 
       
   816         return ;
       
   817 
       
   818     if (  item->modelIndex().row() < 0 || item->modelIndex().row() >= mModel->rowCount() )
       
   819         return ;
       
   820 
       
   821     mModel->setData( item->modelIndex (), item->modelIndex().row(), GlxVisualWindowIndex);
       
   822     
       
   823     OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETVISVALWINDOWINDEX_EXIT );
   793 }
   824 }
   794 
   825 
   795 void GlxFullScreenView::initAnimationItem()
   826 void GlxFullScreenView::initAnimationItem()
   796 {
   827 {
   797     if( mIconItems[0] == NULL ) {
   828     if( mIconItems[0] == NULL ) {
   869     }
   900     }
   870     else {
   901     else {
   871         HbEffect::start( mZoomWidget, QString( "HbIconItem" ), QString( "RotateFSPT" ), this, "zoomOrientChangeAnimFinished" );
   902         HbEffect::start( mZoomWidget, QString( "HbIconItem" ), QString( "RotateFSPT" ), this, "zoomOrientChangeAnimFinished" );
   872     }    
   903     }    
   873 }
   904 }
   874 	
       
   875 void GlxFullScreenView::handleToolBarAction()
       
   876 {
       
   877     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_HANDLETOOLBARACTION_ENTRY );
       
   878     
       
   879     HbAction *action = qobject_cast<HbAction*>(sender());
       
   880     qint32 commandId = action->data().toInt();
       
   881     emit actionTriggered( commandId );
       
   882     
       
   883     OstTraceFunctionExit0( GLXFULLSCREENVIEW_HANDLETOOLBARACTION_EXIT );
       
   884 }
       
   885 
   905 
   886 int GlxFullScreenView::getSubState()
   906 int GlxFullScreenView::getSubState()
   887 {
   907 {
   888 	int substate = NO_FULLSCREEN_S;	
   908 	int substate = NO_FULLSCREEN_S;	
   889 	
   909 	
   894         }
   914         }
   895 	}
   915 	}
   896 	return substate;
   916 	return substate;
   897 }
   917 }
   898 
   918 
   899 bool GlxFullScreenView::eventFilter(QObject *obj, QEvent *ev)
       
   900 {
       
   901     GLX_LOG_INFO1("GlxFullScreenView::event() %d event type", ev->type());
       
   902     if ( ev->type() ==  QEvent::ApplicationActivate && mTvOutWrapper) {
       
   903         GLX_LOG_INFO("GlxFullScreenView::event() shift to native - CGlxHdmi");
       
   904         mTvOutWrapper->setToNativeMode();    
       
   905     }
       
   906     if (ev->type() ==  QEvent::ApplicationDeactivate)
       
   907     {
       
   908         if(mZoomWidget) {
       
   909             mZoomWidget->forceZoomToBackground();
       
   910         }
       
   911         if (mTvOutWrapper) {
       
   912             GLX_LOG_INFO("GlxFullScreenView::event() shift to Clone - CGlxHdmi");
       
   913             mTvOutWrapper->setToCloningMode();    
       
   914         }
       
   915     }
       
   916     return HbView::eventFilter(obj,ev);
       
   917 }
       
   918