ui/views/slideshowview/src/glxslideshowview.cpp
changeset 33 1ee2af37811f
parent 29 2c833fc9e98f
child 36 6481344a6d67
equal deleted inserted replaced
29:2c833fc9e98f 33:1ee2af37811f
    17 
    17 
    18 
    18 
    19 //Includes
    19 //Includes
    20 #include <QEvent>
    20 #include <QEvent>
    21 #include <QDebug>
    21 #include <QDebug>
       
    22 #include <QCoreApplication>
    22 #include <hbmainwindow.h>
    23 #include <hbmainwindow.h>
    23 #include <hbdocumentloader.h>
    24 #include <hbdocumentloader.h>
    24 
    25 
    25 
    26 
    26 //User Includes
    27 //User Includes
    65     TRACER("GlxSlideShowView::activate()");
    66     TRACER("GlxSlideShowView::activate()");
    66     mWindow->setOrientation(Qt::Horizontal, true);  // Actually it is animation false, Hack for Bug in Media wall -todo- need to Address this ASAP
    67     mWindow->setOrientation(Qt::Horizontal, true);  // Actually it is animation false, Hack for Bug in Media wall -todo- need to Address this ASAP
    67 
    68 
    68     //finds the widgets from the docml
    69     //finds the widgets from the docml
    69     loadObjects();
    70     loadObjects();
    70     setItemVisible(Hb::AllItems, false) ;
    71     setTitleBarVisible(FALSE);
       
    72     setStatusBarVisible(FALSE);
    71     connect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) ); 
    73     connect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) ); 
    72     connect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) );
    74     connect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) );
    73     
    75     
       
    76     QCoreApplication::instance()->installEventFilter(this);
       
    77     
    74     if (!mTvOutWrapper) {
    78     if (!mTvOutWrapper) {
    75         mTvOutWrapper = new GlxTvOutWrapper();
    79         mTvOutWrapper = new GlxTvOutWrapper();
    76     }
    80     }
    77 }
    81 }
    78 
    82 
    79 void GlxSlideShowView::deActivate()
    83 void GlxSlideShowView::deActivate()
    80 {
    84 {
    81     TRACER("GlxSlideShowView::deActivate()");
    85     TRACER("GlxSlideShowView::deActivate()");
    82     mWindow->unsetOrientation(true);         // Actually it is animation false, Hack for Bug in Media wall -todo- need to Address this ASAP
    86     mWindow->unsetOrientation(true);         // Actually it is animation false, Hack for Bug in Media wall -todo- need to Address this ASAP
    83     
    87     
    84     setItemVisible( Hb::AllItems , TRUE );
    88     setStatusBarVisible(TRUE);
       
    89     setTitleBarVisible(TRUE);
       
    90     
       
    91                 
    85     disconnect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) );
    92     disconnect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) );
    86     disconnect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) );
    93     disconnect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) );
    87     //Delete the Items in the slide show widget
    94     //Delete the Items in the slide show widget
    88     mSlideShowWidget->cleanUp();
    95     mSlideShowWidget->cleanUp();
    89     
    96     
       
    97     QCoreApplication::instance()->removeEventFilter(this);
       
    98 
    90     if (mTvOutWrapper){
    99     if (mTvOutWrapper){
    91         delete mTvOutWrapper;
   100         delete mTvOutWrapper;
    92         mTvOutWrapper = NULL;
   101         mTvOutWrapper = NULL;
    93     }
   102     }
    94 }
   103 }
   139 {
   148 {
   140     TRACER("GlxSlideShowView::slideShowEventHandler()");
   149     TRACER("GlxSlideShowView::slideShowEventHandler()");
   141     GLX_LOG_INFO1("GlxSlideShowView::slideShowEventHandler() event %d", e);
   150     GLX_LOG_INFO1("GlxSlideShowView::slideShowEventHandler() event %d", e);
   142     switch ( e ) {
   151     switch ( e ) {
   143         case UI_ON_EVENT :
   152         case UI_ON_EVENT :
   144             setItemVisible(Hb::AllItems, TRUE) ;
   153             setTitleBarVisible(TRUE);
       
   154             setStatusBarVisible(TRUE);
   145             break;
   155             break;
   146 
   156 
   147         case UI_OFF_EVENT :
   157         case UI_OFF_EVENT :
   148             setItemVisible(Hb::AllItems, false) ;
   158             setTitleBarVisible(FALSE);
       
   159             setStatusBarVisible(FALSE);
   149             break;
   160             break;
   150 
   161 
   151         case EMPTY_DATA_EVENT :
   162         case EMPTY_DATA_EVENT :
   152             emit actionTriggered( EGlxCmdEmptyData );
   163             emit actionTriggered( EGlxCmdEmptyData );
   153             break;
   164             break;
   171         disconnect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) );
   182         disconnect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) );
   172         mModel = NULL; 
   183         mModel = NULL; 
   173     }
   184     }
   174 }
   185 }
   175 
   186 
   176 bool GlxSlideShowView::event(QEvent *event)
   187 bool GlxSlideShowView::eventFilter(QObject *obj, QEvent *event)
   177 {
   188 {
   178     TRACER("GlxSlideShowView::event()");
   189     TRACER("GlxSlideShowView::event()");
   179     GLX_LOG_INFO1("GlxSlideShowView::event() %d event type", event->type());
   190     GLX_LOG_INFO1("GlxSlideShowView::event() %d event type", event->type());
   180     if ( event->type() ==  QEvent::WindowActivate && mSlideShowWidget) {
   191     if ( event->type() ==  QEvent::ApplicationActivate && mSlideShowWidget) {
   181         if (mTvOutWrapper){
   192         if (mTvOutWrapper){
       
   193         GLX_LOG_INFO("GlxSlideShowView::event() shift to native - CGlxHdmi");
   182         mTvOutWrapper->setToNativeMode();    
   194         mTvOutWrapper->setToNativeMode();    
   183         }
   195         }
   184         mSlideShowWidget->startSlideShow();
   196         mSlideShowWidget->startSlideShow();
   185     }
   197     }
   186 
   198     if ( event->type() ==  QEvent::ApplicationDeactivate && mSlideShowWidget) {
   187     if ( event->type() ==  QEvent::WindowDeactivate && mSlideShowWidget) {
       
   188         if (mTvOutWrapper){
   199         if (mTvOutWrapper){
       
   200         GLX_LOG_INFO("GlxSlideShowView::event() shift to Clone - CGlxHdmi");
   189         mTvOutWrapper->setToCloningMode();    
   201         mTvOutWrapper->setToCloningMode();    
   190         }
   202         }
   191        mSlideShowWidget->stopSlideShow();
   203        mSlideShowWidget->stopSlideShow();
   192     }
   204     }
   193     return HbView::event(event);
   205     return HbView::eventFilter(obj,event);
   194 }
   206 }
   195 
   207 
   196 void GlxSlideShowView::loadObjects()
   208 void GlxSlideShowView::loadObjects()
   197 {
   209 {
   198     TRACER("GlxSlideShowView::loadObjects");    
   210     TRACER("GlxSlideShowView::loadObjects");