ui/views/slideshowview/src/glxslideshowview.cpp
changeset 26 c499df2dbb33
parent 24 99ad1390cd33
child 29 2c833fc9e98f
equal deleted inserted replaced
24:99ad1390cd33 26:c499df2dbb33
    30 #include "glxdocloaderdefs.h"
    30 #include "glxdocloaderdefs.h"
    31 #include "glxslideshowview.h"
    31 #include "glxslideshowview.h"
    32 #include "glxslideshowwidget.h"
    32 #include "glxslideshowwidget.h"
    33 #include "glxcommandhandlers.hrh" //To:Do temporary remove once orbit back problem is resolved
    33 #include "glxcommandhandlers.hrh" //To:Do temporary remove once orbit back problem is resolved
    34 
    34 
    35 #include <glxhdmicontroller.h>
    35 #include <glxtvoutwrapper.h>
       
    36 
    36 #include <glxlog.h>
    37 #include <glxlog.h>
    37 #include <glxtracer.h>
    38 #include <glxtracer.h>
    38 
    39 
    39 GlxSlideShowView::GlxSlideShowView(HbMainWindow *window,HbDocumentLoader *DocLoader) : GlxView(GLX_SLIDESHOWVIEW_ID), mModel(NULL),
    40 GlxSlideShowView::GlxSlideShowView(HbMainWindow *window,HbDocumentLoader *DocLoader) : GlxView(GLX_SLIDESHOWVIEW_ID), mModel(NULL),
    40                   mWindow(window), mSlideShowWidget(NULL),iHdmiController(NULL)
    41                   mWindow(window), mSlideShowWidget(NULL),mTvOutWrapper(NULL)
    41 {
    42 {
    42     TRACER("GlxSlideShowView::GlxSlideShowView()");
    43     TRACER("GlxSlideShowView::GlxSlideShowView()");
    43     mDocLoader = DocLoader;
    44     mDocLoader = DocLoader;
    44 }
    45 }
    45 
    46 
    69     loadObjects();
    70     loadObjects();
    70     setItemVisible(Hb::AllItems, false) ;
    71     setItemVisible(Hb::AllItems, false) ;
    71     connect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) ); 
    72     connect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) ); 
    72     connect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) );
    73     connect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) );
    73     
    74     
    74     if (!iHdmiController) {
    75     if (!mTvOutWrapper){
    75         GLX_LOG_INFO("GlxSlideShowView::activate() - CGlxHdmi" );
    76         mTvOutWrapper = new GlxTvOutWrapper();
    76         iHdmiController = CGlxHdmiController::NewL();
    77         }
    77     } 
       
    78 }
    78 }
    79 
    79 
    80 void GlxSlideShowView::deActivate()
    80 void GlxSlideShowView::deActivate()
    81 {
    81 {
    82     TRACER("GlxSlideShowView::deActivate()");
    82     TRACER("GlxSlideShowView::deActivate()");
    85     disconnect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) );
    85     disconnect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) );
    86     disconnect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) );
    86     disconnect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) );
    87     //Delete the Items in the slide show widget
    87     //Delete the Items in the slide show widget
    88     mSlideShowWidget->cleanUp();
    88     mSlideShowWidget->cleanUp();
    89     mModel = NULL;
    89     mModel = NULL;
    90     if (iHdmiController) {
    90     if (mTvOutWrapper){
    91         GLX_LOG_INFO("GlxSlideShowView() deActivate delete iHdmiController " );
    91         delete mTvOutWrapper;
    92         delete iHdmiController;
    92         mTvOutWrapper = NULL;
    93         iHdmiController = NULL;
       
    94     }
    93     }
    95 }
    94 }
    96 
    95 
    97 void GlxSlideShowView::setModel(QAbstractItemModel *model)
    96 void GlxSlideShowView::setModel(QAbstractItemModel *model)
    98 {
    97 {
   101     if ( mModel == model ) {
   100     if ( mModel == model ) {
   102         return ;
   101         return ;
   103     }
   102     }
   104     mModel = model;
   103     mModel = model;
   105     mSlideShowWidget->setModel(mModel);
   104     mSlideShowWidget->setModel(mModel);
   106     SetImageToHdmiL();
   105     if (mTvOutWrapper){
       
   106         mTvOutWrapper->setModel(mModel);
       
   107         mTvOutWrapper->setImagetoHDMI();
       
   108         }
   107 }
   109 }
   108 
   110 
   109 void GlxSlideShowView::setModelContext()
   111 void GlxSlideShowView::setModelContext()
   110 {
   112 {
   111     TRACER("GlxSlideShowView::setModelContext()");
   113     TRACER("GlxSlideShowView::setModelContext()");
   151 }
   153 }
   152 
   154 
   153 void GlxSlideShowView::indexchanged()
   155 void GlxSlideShowView::indexchanged()
   154 {
   156 {
   155     TRACER("GlxSlideShowView::indexchanged()");
   157     TRACER("GlxSlideShowView::indexchanged()");
   156     SetImageToHdmiL();
   158     if (mTvOutWrapper){
       
   159         mTvOutWrapper->setImagetoHDMI();
       
   160     }
       
   161 
   157 }
   162 }
   158 
   163 
   159 bool GlxSlideShowView::event(QEvent *event)
   164 bool GlxSlideShowView::event(QEvent *event)
   160 {
   165 {
   161     TRACER("GlxSlideShowView::event()");
   166     TRACER("GlxSlideShowView::event()");
   180     //Initialise the Slideshow widget
   185     //Initialise the Slideshow widget
   181     mSlideShowWidget->setSlideShowWidget(mDocLoader);
   186     mSlideShowWidget->setSlideShowWidget(mDocLoader);
   182     mSlideShowWidget->setItemGeometry( screenGeometry() );  
   187     mSlideShowWidget->setItemGeometry( screenGeometry() );  
   183 }
   188 }
   184 
   189 
   185 void GlxSlideShowView::SetImageToHdmiL()
       
   186 {
       
   187     TRACER("GlxSlideShowView::SetImageToHdmiL() - CGlxHdmi 1" );
       
   188     if (iHdmiController) {
       
   189         GLX_LOG_INFO("GlxSlideShowView::SetImageToHdmiL() - CGlxHdmi 2" );
       
   190         // Get the image uri
       
   191         QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxUriRole)).value<QString>();
       
   192         if(imagePath.isNull()) {
       
   193             GLX_LOG_INFO("GlxSlideShowView::SetImageToHdmiL() path is null" );
       
   194         }
       
   195         qDebug() << "GlxSlideShowView::SetImageToHdmiL() imagePath= " << imagePath;
       
   196         TPtrC aPtr = reinterpret_cast<const TUint16*>(imagePath.utf16());
       
   197 
       
   198         iHdmiController->SetImageL(aPtr);
       
   199     }
       
   200 }