ui/views/fullscreenview/src/glxfullscreenview.cpp
changeset 49 f291796e213d
parent 48 d0b4e67b3a60
child 50 a0f57508af73
child 55 fb37077c270f
equal deleted inserted replaced
48:d0b4e67b3a60 49:f291796e213d
    61     mImageStrip (NULL), 
    61     mImageStrip (NULL), 
    62     mUiOffTimer(NULL),
    62     mUiOffTimer(NULL),
    63     mIconItem(NULL),
    63     mIconItem(NULL),
    64     mTvOutWrapper(NULL),
    64     mTvOutWrapper(NULL),
    65     mFullScreenToolBar(NULL),
    65     mFullScreenToolBar(NULL),
    66 	mFlipAction(NULL),
       
    67 	mSendAction(NULL),
       
    68 	mDeleteAction(NULL),
       
    69 	mUseImageAction(NULL),
       
    70 	mZoomWidget(NULL)
    66 	mZoomWidget(NULL)
    71 {
    67 {
    72     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY );
    68     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY );
    73     
    69     
    74     mDocLoader = DocLoader;
    70     mDocLoader = DocLoader;
    87     // if animations is on, then Set the image to HDMI here
    83     // if animations is on, then Set the image to HDMI here
    88     if (!mTvOutWrapper){
    84     if (!mTvOutWrapper){
    89         mTvOutWrapper = new GlxTvOutWrapper();
    85         mTvOutWrapper = new GlxTvOutWrapper();
    90     }
    86     }
    91     setHdmiModel(model);
    87     setHdmiModel(model);
    92 
       
    93     //Load/Retrieve the Widgets
       
    94     loadWidgets();
    88     loadWidgets();
    95 
    89 
    96     //Initialize the coverflow and partially creates the coverflow with one image
    90     // Initialize the coverflow and partially creates the coverflow with one image
    97     // to make the widget light weight in order to make
    91     // to make the widget light weight in order to make transition smooth 
    98     // transition smooth 
    92     mCoverFlow->partiallyCreate( model, screenSize() );
    99     mCoverFlow->partiallyCreate( model, screenSize());
       
   100     
    93     
   101     OstTraceFunctionExit0( GLXFULLSCREENVIEW_INITIALIZEVIEW_EXIT );
    94     OstTraceFunctionExit0( GLXFULLSCREENVIEW_INITIALIZEVIEW_EXIT );
   102 }
    95 }
   103 
    96 
   104 void GlxFullScreenView::loadWidgets()
    97 void GlxFullScreenView::loadWidgets()
   105 {
    98 {
   106     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADWIDGETS_ENTRY );
    99     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADWIDGETS_ENTRY );
   107     
   100        
   108     //Load the Coverflow and image strip widget    
       
   109     mCoverFlow = qobject_cast<GlxCoverFlow*> (mDocLoader->findWidget(GLXFULLSCREEN_COVERFLOW));
   101     mCoverFlow = qobject_cast<GlxCoverFlow*> (mDocLoader->findWidget(GLXFULLSCREEN_COVERFLOW));
   110 
   102     
   111 	 mZoomWidget  =  qobject_cast<GlxZoomWidget*> (mDocLoader->findWidget(GLXFULLSCREENZOOMWIDGET));
   103     mZoomWidget  =  qobject_cast<GlxZoomWidget*> (mDocLoader->findWidget(GLXFULLSCREENZOOMWIDGET));
   112 	 mZoomWidget->connectDecodeRequestToPinchEvent();
   104     mZoomWidget->connectDecodeRequestToPinchEvent();
   113 	 mCoverFlow->setMultitouchFilter(mZoomWidget);
   105     mCoverFlow->setMultitouchFilter(mZoomWidget);
       
   106     
   114     //initialise the cover flow for basic connections and the rest
   107     //initialise the cover flow for basic connections and the rest
   115     mCoverFlow->setCoverFlow();
   108     mCoverFlow->setCoverFlow();
   116 
   109     mImageStrip = qobject_cast<HbGridView*> (mDocLoader->findWidget(GLXFULLSCREEN_FILMSTRIP));
   117    //Load the IMAGE STRIP & FULLSCREEN TOOLBAR[PUSH BUTTON]
       
   118     mImageStrip              =   qobject_cast<HbGridView*> (mDocLoader->findWidget(GLXFULLSCREEN_FILMSTRIP));
       
   119      
   110      
   120     //When the widget is loaded/retreived the widgets are shown by default.
   111     //When the widget is loaded/retreived the widgets are shown by default.
   121     //@to do : hide the widgets by default in docml
   112     //@to do : hide the widgets by default in docml
   122     mImageStrip->hide();      
   113     mImageStrip->hide();      
   123 	mImageStrip->setLayoutName( QString( "ImageStrip" ) );
   114 	mImageStrip->setLayoutName( QString( "ImageStrip" ) ); // To distinguish in CSS file
   124 	mImageStrip->setEnabledAnimations(HbAbstractItemView::None);
   115 	mImageStrip->setEnabledAnimations( HbAbstractItemView::None );
   125 	
   116 	
   126     OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADWIDGETS_EXIT );
   117     OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADWIDGETS_EXIT );
   127 }
   118 }
   128 
   119 
   129 void GlxFullScreenView::loadFullScreenToolBar()
   120 void GlxFullScreenView::loadFullScreenToolBar()
   136     mDocLoader->load(GLXFULLSCREENDOCMLPATH,&loaded);
   127     mDocLoader->load(GLXFULLSCREENDOCMLPATH,&loaded);
   137     loadViewSection();
   128     loadViewSection();
   138 
   129 
   139     mFullScreenToolBar = qobject_cast<HbToolBar *> (mDocLoader->findObject(QString("toolBar")));
   130     mFullScreenToolBar = qobject_cast<HbToolBar *> (mDocLoader->findObject(QString("toolBar")));
   140     mFullScreenToolBar->clearActions();
   131     mFullScreenToolBar->clearActions();
   141 
   132     
   142     //create  Flip tool bar button action
   133     addToolBarAction( EGlxCmdDetailsOpen, GLXICON_FLIP, "Flip Action" ); //create  Flip tool bar button action
   143     mFlipAction = new HbAction(this);
   134     addToolBarAction( EGlxCmdSend, GLXICON_SEND, "Send Action" );        //create  Send tool bar button action
   144     mFlipAction->setData(EGlxCmdDetailsOpen);
   135     if( getSubState() != IMAGEVIEWER_S ) {        
   145     mFlipAction->setIcon(HbIcon(GLXICON_FLIP));
   136         addToolBarAction( EGlxCmdDelete, GLXICON_DELETE, "Delete Action" ); //create  Delete tool bar button action
   146     mFullScreenToolBar->addAction( mFlipAction);
   137     }
   147 
   138     else {
   148     //create  Send tool bar button action
   139         addToolBarAction( EGlxCmdHandled, GLXICON_USEIMAGE, "Use Action" ); //create  Use Image tool bar button action
   149     mSendAction = new HbAction(this);
   140     }
   150     mSendAction->setData(EGlxCmdSend);
   141  
   151     mSendAction->setIcon(HbIcon(GLXICON_SEND));
       
   152     mFullScreenToolBar->addAction( mSendAction);
       
   153 
       
   154     //create  Delete tool bar button action
       
   155     mDeleteAction = new HbAction(this);
       
   156     mDeleteAction->setData(EGlxCmdDelete);        
       
   157     mDeleteAction->setIcon(HbIcon(GLXICON_DELETE)); 
       
   158     
       
   159     //create  Use Image tool bar button action
       
   160     mUseImageAction = new HbAction(this);
       
   161     //mUseImageAction->setData(EGlxCmdDelete);        
       
   162     mUseImageAction->setIcon(HbIcon(GLXICON_USEIMAGE)); 
       
   163     if(getSubState() != IMAGEVIEWER_S){
       
   164         mFullScreenToolBar->addAction( mDeleteAction);
       
   165     }else{
       
   166         mFullScreenToolBar->addAction( mUseImageAction);
       
   167     }
       
   168      
       
   169 
       
   170     connect(mFlipAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); 
       
   171     connect(mSendAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); 
       
   172     connect(mDeleteAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) );
       
   173     connect(mUseImageAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) );
       
   174     
       
   175     OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADFULLSCREENTOOLBAR_EXIT );
   142     OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADFULLSCREENTOOLBAR_EXIT );
   176 }
   143 }
   177 
   144 
       
   145 void GlxFullScreenView::addToolBarAction( int commandId, const QString &iconName, const QString &name )
       
   146 {
       
   147     HbAction *action = new HbAction( this ); 
       
   148     action->setData( commandId );
       
   149     action->setIcon( HbIcon( iconName ) ); 
       
   150     action->setObjectName( name );
       
   151     mFullScreenToolBar->addAction( action);
       
   152     connect(action, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); 
       
   153 }
       
   154 
   178 void GlxFullScreenView::activate()
   155 void GlxFullScreenView::activate()
   179 {
   156 {
   180     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATE_ENTRY );    
   157     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATE_ENTRY );    
   181 
       
   182     setStatusBarVisible(FALSE);
       
   183     setTitleBarVisible(FALSE);
       
   184 	//To:Do remove it later, currently it is solving the problem of status bar is not
       
   185 	//visible when tap on the screen first time
       
   186     setStatusBarVisible(FALSE);
       
   187     setTitleBarVisible(FALSE);  
       
   188 
       
   189 //for zoom might not be required after wk15 release
   158 //for zoom might not be required after wk15 release
   190 	mWindow->viewport()->setAttribute(Qt::WA_AcceptTouchEvents,true); 
   159 	mWindow->viewport()->setAttribute(Qt::WA_AcceptTouchEvents,true); 
   191 	mWindow->viewport()->grabGesture(Qt::PinchGesture);
   160 	mWindow->viewport()->grabGesture(Qt::PinchGesture);
   192 	
   161 	
   193 	QCoreApplication::instance()->installEventFilter(this);
   162 	QCoreApplication::instance()->installEventFilter(this);
   194 
   163 
   195     if(!mCoverFlow){
   164     if( !mCoverFlow ) {
   196         loadWidgets();  //retrives the widgets
   165         loadWidgets();  //retrives the widgets
   197     }
   166     }
   198 
       
   199     //Loads the widgets corresponding to the orientation.
   167     //Loads the widgets corresponding to the orientation.
   200     loadViewSection();   
   168     loadViewSection();
       
   169     
       
   170     setStatusBarVisible(FALSE);
       
   171     setTitleBarVisible(FALSE);
   201         
   172         
   202     mUiOffTimer = new QTimer();
   173     mUiOffTimer = new QTimer();
   203     mUiOff = true;
   174     mUiOff = true;
   204     mUiOffTimer->stop();        
   175     mUiOffTimer->stop();        
   205     mCoverFlow->setUiOn(FALSE);    
   176     mCoverFlow->setUiOn(FALSE);    
   280     
   251     
   281     if (mTvOutWrapper) {
   252     if (mTvOutWrapper) {
   282         delete mTvOutWrapper;
   253         delete mTvOutWrapper;
   283         mTvOutWrapper = NULL;
   254         mTvOutWrapper = NULL;
   284     }
   255     }
       
   256     
   285     if(mZoomWidget)
   257     if(mZoomWidget)
   286     {
   258     {
   287         mZoomWidget->cleanUp();
   259         mZoomWidget->cleanUp();
   288         mZoomWidget = NULL;
   260         mZoomWidget = NULL;
   289     }
   261     }
   367 void GlxFullScreenView::activateUI()
   339 void GlxFullScreenView::activateUI()
   368 {
   340 {
   369     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATEUI_ENTRY );
   341     OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATEUI_ENTRY );
   370     
   342     
   371     if ( mUiOff && getSubState() != FETCHER_S){      
   343     if ( mUiOff && getSubState() != FETCHER_S){      
   372         if(!mFullScreenToolBar) {
   344         if( !mFullScreenToolBar ) {
   373             loadFullScreenToolBar();
   345             loadFullScreenToolBar();
   374         }
   346         }
   375         mUiOff = FALSE;
   347         mUiOff = FALSE;
   376         
   348         
   377         QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   349         QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   382         
   354         
   383         mFullScreenToolBar->show();
   355         mFullScreenToolBar->show();
   384 		setStatusBarVisible(TRUE);
   356 		setStatusBarVisible(TRUE);
   385         setTitleBarVisible(TRUE);
   357         setTitleBarVisible(TRUE);
   386        
   358        
   387 
       
   388         if ( mImageStrip && getSubState() != IMAGEVIEWER_S) {
   359         if ( mImageStrip && getSubState() != IMAGEVIEWER_S) {
   389             mImageStrip->show(); 
   360             mImageStrip->show(); 
   390             HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapShow"), this, "effectFinished" );
   361             HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapShow"), this, "effectFinished" );
   391         }
   362         }
   392         else if( getSubState() == IMAGEVIEWER_S){
   363         else if( getSubState() == IMAGEVIEWER_S){
   435     if ( variant.isValid() &&  variant.canConvert<int> () && ( index.row() == variant.value<int>() ) ) {
   406     if ( variant.isValid() &&  variant.canConvert<int> () && ( index.row() == variant.value<int>() ) ) {
   436         OstTraceFunctionExit0( GLXFULLSCREENVIEW_CHANGESELECTEDINDEX_EXIT );
   407         OstTraceFunctionExit0( GLXFULLSCREENVIEW_CHANGESELECTEDINDEX_EXIT );
   437         if (mTvOutWrapper){
   408         if (mTvOutWrapper){
   438             // for the image changed on deletion
   409             // for the image changed on deletion
   439             mTvOutWrapper->setImagetoHDMI();
   410             mTvOutWrapper->setImagetoHDMI();
       
   411         }
       
   412         if (mZoomWidget){
       
   413             // for the image changed on deletion
       
   414             mZoomWidget->indexChanged();
   440         }
   415         }
   441         return;
   416         return;
   442     }
   417     }
   443     
   418     
   444     mModel->setData( index, index.row(), GlxFocusIndexRole );
   419     mModel->setData( index, index.row(), GlxFocusIndexRole );
   670     if ( mUiOffTimer ) {
   645     if ( mUiOffTimer ) {
   671         GLX_LOG_INFO("GlxFullScreenView::removeConnection() mUiOffTimer  " );
   646         GLX_LOG_INFO("GlxFullScreenView::removeConnection() mUiOffTimer  " );
   672         disconnect(mUiOffTimer, SIGNAL(timeout()), this, SLOT(hideUi()));
   647         disconnect(mUiOffTimer, SIGNAL(timeout()), this, SLOT(hideUi()));
   673     }
   648     }
   674             
   649             
   675     if(mFlipAction) {
   650 	if( mCoverFlow && mZoomWidget ) {
   676         disconnect(mFlipAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) );  
       
   677     }
       
   678 
       
   679     if(mSendAction) {
       
   680         disconnect(mSendAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) );  
       
   681     }
       
   682 
       
   683     if(mDeleteAction) {
       
   684         disconnect(mDeleteAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) );  
       
   685     }
       
   686 
       
   687     if(mUseImageAction) {
       
   688         disconnect(mUseImageAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) );  
       
   689     }
       
   690 	if(mCoverFlow && mZoomWidget) {
       
   691 		disconnect(mZoomWidget,SIGNAL( pinchGestureReceived(int) ), mCoverFlow, SLOT( zoomStarted(int) ) );
   651 		disconnect(mZoomWidget,SIGNAL( pinchGestureReceived(int) ), mCoverFlow, SLOT( zoomStarted(int) ) );
   692 		disconnect(mZoomWidget,SIGNAL( zoomWidgetMovedBackground(int) ), mCoverFlow, SLOT( zoomFinished(int) ) );
   652 		disconnect(mZoomWidget,SIGNAL( zoomWidgetMovedBackground(int) ), mCoverFlow, SLOT( zoomFinished(int) ) );
   693 	}
   653 	}
   694     
   654     
   695 	disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation)));
   655 	disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation)));
   772     OstTraceFunctionExit0( GLXFULLSCREENVIEW_HANDLETOOLBARACTION_EXIT );
   732     OstTraceFunctionExit0( GLXFULLSCREENVIEW_HANDLETOOLBARACTION_EXIT );
   773 }
   733 }
   774 
   734 
   775 int GlxFullScreenView::getSubState()
   735 int GlxFullScreenView::getSubState()
   776 {
   736 {
   777 	int substate = NO_FULLSCREEN_S;
   737 	int substate = NO_FULLSCREEN_S;	
   778 	QVariant variant = mModel->data( mModel->index(0,0), GlxSubStateRole );    
   738 	
   779 	if ( variant.isValid() &&  variant.canConvert<int> ()  ) {
   739 	if ( mModel  ) {	
   780 		substate = variant.value<int>();
   740         QVariant variant = mModel->data( mModel->index(0,0), GlxSubStateRole );    
       
   741         if ( variant.isValid() &&  variant.canConvert<int> ()  ) {
       
   742             substate = variant.value<int>();
       
   743         }
   781 	}
   744 	}
   782 	return substate;
   745 	return substate;
   783 }
   746 }
   784 
   747 
   785 bool GlxFullScreenView::eventFilter(QObject *obj, QEvent *ev)
   748 bool GlxFullScreenView::eventFilter(QObject *obj, QEvent *ev)