diff -r 74c9f037fd5d -r 99ad1390cd33 ui/views/fullscreenview/src/glxfullscreenview.cpp --- a/ui/views/fullscreenview/src/glxfullscreenview.cpp Fri Mar 19 09:28:59 2010 +0200 +++ b/ui/views/fullscreenview/src/glxfullscreenview.cpp Fri Apr 16 14:58:46 2010 +0300 @@ -17,9 +17,10 @@ //Includes -#include #include #include +#include +#include #include #include #include @@ -27,40 +28,58 @@ #include #include #include - +#include //User Includes +#include "glxlog.h" +#include "glxtracer.h" #include "glxviewids.h" //contains the view ids of all the views in photos app. +#include "glxicondefs.h" //Contains the icon names/Ids #include "glxmodelparm.h" #include "glxcoverflow.h" -#include "glxzoomslider.h" -#include "glxzoomcontrol.h" #include "glxdocloaderdefs.h" //contains the definations of path, widget names and view names in docml #include "glxloggerenabler.h" +#include "glxhdmicontroller.h" #include "glxfullscreenview.h" #include "glxcommandhandlers.hrh" -#include -#include -#include +//#include "glxzoomwidget.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "glxfullscreenviewTraces.h" +#endif + const int KUiOffTime = 3000; -GlxFullScreenView::GlxFullScreenView(HbMainWindow *window,HbDocumentLoader *DocLoader) : GlxView ( GLX_FULLSCREENVIEW_ID), - mModel(NULL), mWindow( window), mCoverFlow(NULL) , mImageStrip (NULL), mUiOffTimer(NULL), - mZmPushButton(NULL), mZoomSlider(NULL), mZoomControl(NULL),mSendUserActivityEvent(false), - mFlipPushButton(NULL), nbrCol(0),iHdmiController(NULL) +GlxFullScreenView::GlxFullScreenView(HbMainWindow *window,HbDocumentLoader *DocLoader) : + GlxView ( GLX_FULLSCREENVIEW_ID), + mModel(NULL), + mWindow( window), + mCoverFlow(NULL) , + mImageStrip (NULL), + mUiOffTimer(NULL), + iHdmiController(NULL), + mFullScreenToolBar(NULL), + mFlipAction(NULL), + mSendAction(NULL), + mDeleteAction(NULL) { - TRACER("GlxFullScreenView::GlxFullScreenView()" ); + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY ); + mDocLoader = DocLoader; setContentFullScreen( true ); HbEffect::add( QString("HbGridView"), QString(":/data/transitionup.fxml"), QString( "TapShow" )); HbEffect::add( QString("HbGridView"), QString(":/data/transitiondown.fxml"), QString( "TapHide" )); + HbEffect::add( QString("HbGridViewItem"), QString(":/data/gridtofullscreenhide.fxml"), QString( "Select" )); + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_EXIT ); } void GlxFullScreenView::initializeView(QAbstractItemModel *model) { - TRACER("GlxFullScreenView::initializeView()" ); + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_INITIALIZEVIEW_ENTRY ); + //Load/Retrieve the Widgets loadWidgets(); @@ -68,103 +87,139 @@ //Initialize the coverflow and partially creates the coverflow with one image // to make the widget light weight in order to make // transition smooth - QRect screen_rect = mWindow->geometry(); - QSize sz(screen_rect.width(), screen_rect.height()); - mCoverFlow->partiallyCreate( model, sz); + mCoverFlow->partiallyCreate( model, screenSize()); + setItemVisible(Hb::AllItems, FALSE) ; + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_INITIALIZEVIEW_EXIT ); } void GlxFullScreenView::loadWidgets() - { - TRACER("GlxFullScreenView::loadWidgets()"); - //Load the View and Widget - GlxFullScreenView *view = static_cast (mDocLoader->findWidget(GLXFULLSCREEN_VIEW)); - mCoverFlow = static_cast (mDocLoader->findWidget(GLXFULLSCREEN_COVERFLOW)); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADWIDGETS_ENTRY ); + + //Load the Coverflow and image strip widget + mCoverFlow = qobject_cast (mDocLoader->findWidget(GLXFULLSCREEN_COVERFLOW)); //initialise the cover flow for basic connections and the rest mCoverFlow->setCoverFlow(); - //Load the IMAGE STRIP & FULLSCREEN TOOLBAR[PUSH BUTTON] - mImageStrip = static_cast (mDocLoader->findWidget(GLXFULLSCREEN_FILMSTRIP)); - mFlipPushButton = static_cast (mDocLoader->findWidget(GLXFULLSCREEN_FLIP)); - + //Load the IMAGE STRIP & FULLSCREEN TOOLBAR[PUSH BUTTON] + mImageStrip = qobject_cast (mDocLoader->findWidget(GLXFULLSCREEN_FILMSTRIP)); + //When the widget is loaded/retreived the widgets are shown by default. //@to do : hide the widgets by default in docml - mImageStrip->hide(); - mFlipPushButton->hide(); - } + mImageStrip->hide(); + mImageStrip->setLayoutName( QString( "ImageStrip" ) ); + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADWIDGETS_EXIT ); +} + +void GlxFullScreenView::loadFullScreenToolBar() +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADFULLSCREENTOOLBAR_ENTRY ); + + //The fullscreen tool bar is delted when ever the view is deactivated + //so load the docml once again and retreive the object + bool loaded =true; + mDocLoader->load(GLXFULLSCREENDOCMLPATH,&loaded); + loadViewSection(); + + mFullScreenToolBar = qobject_cast (mDocLoader->findObject(QString("toolBar"))); + mFullScreenToolBar->clearActions(); + + //create Flip tool bar button action + mFlipAction = new HbAction(this); + mFlipAction->setData(EGlxCmdDetailsOpen); + mFlipAction->setIcon(HbIcon(GLXICON_FLIP)); + mFullScreenToolBar->addAction( mFlipAction); + + //create Send tool bar button action + mSendAction = new HbAction(this); + mSendAction->setData(EGlxCmdSend); + mSendAction->setIcon(HbIcon(GLXICON_SEND)); + mFullScreenToolBar->addAction( mSendAction); + + //create Delete tool bar button action + mDeleteAction = new HbAction(this); + mDeleteAction->setData(EGlxCmdDelete); + mDeleteAction->setIcon(HbIcon(GLXICON_DELETE)); + mFullScreenToolBar->addAction( mDeleteAction); + + connect(mFlipAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); + connect(mSendAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); + connect(mDeleteAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADFULLSCREENTOOLBAR_EXIT ); +} void GlxFullScreenView::activate() - { - TRACER("GlxFullScreenView::activate()" ); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATE_ENTRY ); - mWindow->setItemVisible(Hb::AllItems, FALSE) ; + setItemVisible(Hb::AllItems, FALSE) ; - if(!mCoverFlow) - { - //retrives the widgets - loadWidgets(); - } - - loadViewSection(); - - if(mZmPushButton == NULL) { - mZmPushButton = new HbPushButton("ZM",this); - } - - if(NULL == mZoomSlider) { - mZoomSlider = new GlxZoomSlider(this); +//for zoom might not be required after wk15 release + mWindow->viewport()->setAttribute(Qt::WA_AcceptTouchEvents,true); + mWindow->viewport()->grabGesture(Qt::PinchGesture); + + if(!mCoverFlow){ + loadWidgets(); //retrives the widgets } - if(NULL == mZoomControl) { - mZoomControl = new GlxZoomControl(this); - } + //Loads the widgets corresponding to the orientation. + loadViewSection(); + + mUiOffTimer = new QTimer(); + mUiOff = true; + mUiOffTimer->stop(); + mCoverFlow->setUiOn(FALSE); addConnection(); - hideUi(); setLayout(); - mSendUserActivityEvent = true; - if (!iHdmiController) - { - GLX_LOG_INFO("GlxFullScreenView::activate() - CGlxHdmi" ); + + if (!iHdmiController) { + OstTrace0( TRACE_NORMAL, GLXFULLSCREENVIEW_ACTIVATE, "GlxFullScreenView::activate - CGlxHdmi" ); iHdmiController = CGlxHdmiController::NewL(); - } } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_ACTIVATE_EXIT ); +} void GlxFullScreenView::loadViewSection() - { - TRACER("GlxFullScreenView::loadViewSection()" ); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_LOADVIEWSECTION_ENTRY ); + bool loaded =true; - if( mWindow->orientation() == Qt::Horizontal ) - { + if( mWindow->orientation() == Qt::Horizontal ) { //Load the Landscape section for Horizontal mDocLoader->load(GLXFULLSCREENDOCMLPATH,GLXFULLSCREENLSSECTION,&loaded); - } - else - { + } + else{ //Load the Portrait section for Horizontal mDocLoader->load(GLXFULLSCREENDOCMLPATH,GLXFULLSCREENPTSECTION,&loaded); - } } - + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADVIEWSECTION_EXIT ); +} void GlxFullScreenView::resetView() - { - TRACER("GlxFullScreenView::resetView()" ); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_RESETVIEW_ENTRY ); //Clear the 4 icons present in the Coverflow,so that the transition between the views are smooth mCoverFlow->partiallyClean(); //Clean up the rest of the resources allocated - cleanUp(); - } + cleanUp(); + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_RESETVIEW_EXIT ); +} void GlxFullScreenView::deActivate() - { - TRACER("GlxFullScreenView::deActivate()" ); - - mWindow->setItemVisible(Hb::AllItems , TRUE); - - //Clean up the rest of the resources allocated +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_DEACTIVATE_ENTRY ); + + //Clean up the rest of the resources allocated cleanUp(); //deletes the iconitems in the coverflow @@ -174,51 +229,41 @@ //the coverflow is initialised to null //to just reset to the initial state mCoverFlow = NULL; - } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_DEACTIVATE_EXIT ); +} void GlxFullScreenView::cleanUp() - { - TRACER("GlxFullScreenView::cleanUp()" ); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_CLEANUP_ENTRY ); removeConnection(); if ( mUiOffTimer ) { - GLX_LOG_INFO("GlxFullScreenView::cleanUp() mUiOffTimer" ); - mUiOffTimer->stop(); - delete mUiOffTimer; - mUiOffTimer = NULL; - } - - mSendUserActivityEvent = false; - - if(mZmPushButton) { - GLX_LOG_INFO("GlxFullScreenView::cleanUp() delete mZmPushButton " ); - delete mZmPushButton; - mZmPushButton = NULL; + OstTrace0( TRACE_NORMAL, GLXFULLSCREENVIEW_CLEANUP, "GlxFullScreenView::cleanUp() mUiOffTimer" ); + mUiOffTimer->stop(); + delete mUiOffTimer; + mUiOffTimer = NULL; } - if(mZoomSlider) { - GLX_LOG_INFO("GlxFullScreenView::cleanUp() delete mZoomSlider " ); - delete mZoomSlider; - mZoomSlider = NULL; + if(mFullScreenToolBar) { + mFullScreenToolBar->clearActions(); + delete mFullScreenToolBar; + mFullScreenToolBar = NULL; } - - if(mZoomControl) { - GLX_LOG_INFO("GlxFullScreenView::cleanUp() delete mZoomControl " ); - delete mZoomControl; - mZoomControl = NULL; - } + + if (iHdmiController) { - GLX_LOG_INFO("GlxFullScreenView::cleanUp() delete iHdmiController " ); - delete iHdmiController; - iHdmiController = NULL; + OstTrace0( TRACE_NORMAL, DUP2_GLXFULLSCREENVIEW_CLEANUP, "GlxFullScreenView::cleanUp() delete iHdmiController" ); + delete iHdmiController; + iHdmiController = NULL; } - - } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_CLEANUP_EXIT ); +} QGraphicsItem * GlxFullScreenView::getAnimationItem(GlxEffect transitionEffect) - { - TRACER("GlxFullScreenView::getAnimationItem(GlxEffect transitionEffect)"); +{ if ( transitionEffect == GRID_TO_FULLSCREEN || transitionEffect == FULLSCREEN_TO_DETAIL || transitionEffect == DETAIL_TO_FULLSCREEN ) { @@ -226,212 +271,214 @@ } return NULL; - } +} void GlxFullScreenView::setModel( QAbstractItemModel *model ) - { - TRACER("GlxFullScreenView::setModel( QAbstractItemModel *model )"); - GLX_LOG_INFO2("GlxFullScreenView::setModel() model %u mModel %u", model, mModel ); - +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETMODEL_ENTRY ); + OstTraceExt2( TRACE_NORMAL, GLXFULLSCREENVIEW_SETMODEL, "GlxFullScreenView::setModel; model=%x; mModel=%u", ( TUint )( model ), ( TUint ) mModel ); + mModel = model; - mCoverFlow->setModel(mModel); - mZoomSlider->setModel(mModel); - mZoomControl->setModel(mModel); - setImageStripModel(); + mCoverFlow->setModel(mModel); + setImageStripModel(); SetImageToHdmiL(); // for the first image on screen - } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETMODEL_EXIT ); +} void GlxFullScreenView::setModelContext() - { - TRACER("GlxFullScreenView::setModelContext()"); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETMODELCONTEXT_ENTRY ); + if ( mModel && mWindow ) { - GLX_LOG_INFO1("GlxFullScreenView::setModelContext %d", mWindow->orientation() ); - - if ( mWindow->orientation() == Qt::Horizontal ) { - WRITE_TIMESTAMP("set the fullscreen landscape context") - mModel->setData(QModelIndex(), (int)GlxContextLsFs, GlxContextRole ); + if ( mWindow->orientation() == Qt::Horizontal ) { + WRITE_TIMESTAMP("set the fullscreen landscape context") + mModel->setData(QModelIndex(), (int)GlxContextLsFs, GlxContextRole ); + } + else { + WRITE_TIMESTAMP("set the fullscreen portrait context") + mModel->setData(QModelIndex(), (int)GlxContextPtFs, GlxContextRole ); + } } - else { - WRITE_TIMESTAMP("set the fullscreen portrait context") - mModel->setData(QModelIndex(), (int)GlxContextPtFs, GlxContextRole ); - } - } - } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETMODELCONTEXT_EXIT ); +} void GlxFullScreenView::orientationChanged(Qt::Orientation orient) - { - TRACER("GlxFullScreenView::orientationChanged()"); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ORIENTATIONCHANGED_ENTRY ); + Q_UNUSED(orient) + // fullscreen thumnail size is depends on orientation of phone so change the model context before changing the layout - GLX_LOG_INFO1("GlxFullScreenView::orientationChanged() %d", orient ); + if ( mUiOff == FALSE ) { + mUiOffTimer->start(KUiOffTime); + } setModelContext(); loadViewSection(); setLayout(); - } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_ORIENTATIONCHANGED_EXIT ); +} void GlxFullScreenView::activateUI() - { - TRACER("GlxFullScreenView::activateUI()"); - GLX_LOG_INFO1("GlxFullScreenView::activateUI() %d", mUiOff ); - if(mSendUserActivityEvent){ - mSendUserActivityEvent = false; - emit cancelTimer(); - } - if ( mUiOff ){ - - if ( mUiOffTimer == NULL ) { - mUiOffTimer = new QTimer(); - connect(mUiOffTimer, SIGNAL(timeout()), this, SLOT(hideUi())); - } - - //set and scrool the current index to the center - QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole ); - if ( variant.isValid() && variant.canConvert () ) { - mImageStrip->setCurrentIndex ( mModel->index( variant.value(), 0) ); - mImageStrip->scrollTo( mModel->index( variant.value(), 0), HbGridView::PositionAtCenter ); - } - mImageStrip->show(); - - //mZmPushButton->show(); - mFlipPushButton->setZValue( 6 + mCoverFlow->zValue() ); - mFlipPushButton->show(); - mZmPushButton->hide(); - mUiOff = FALSE; - mUiOffTimer->start(KUiOffTime); - mCoverFlow->setUiOn(TRUE); - mWindow->setItemVisible(Hb::AllItems, TRUE) ; - HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapShow"), this, "effectFinished" ); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATEUI_ENTRY ); + + if ( mUiOff ){ + if(!mFullScreenToolBar) { + loadFullScreenToolBar(); + } + mUiOff = FALSE; + + QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole ); + if ( variant.isValid() && variant.canConvert () ) { + mImageStrip->setCurrentIndex ( mModel->index( variant.value(), 0) ); + mImageStrip->scrollTo( mModel->index( variant.value(), 0), HbGridView::PositionAtTop ); + } + + mImageStrip->show(); + mFullScreenToolBar->show(); + setItemVisible(Hb::AllItems, TRUE) ; + HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapShow"), this, "effectFinished" ); } else { - hideUi(); - } + hideUi(); } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_ACTIVATEUI_EXIT ); +} void GlxFullScreenView::hideUi() - { - TRACER("GlxFullScreenView::hideUi()"); - GLX_LOG_INFO1("GlxFullScreenView::hideUi() %d", mUiOff ); - if(mSendUserActivityEvent){ - mSendUserActivityEvent = false; - emit cancelTimer(); - } +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_HIDEUI_ENTRY ); + + //if option menu is open then no need to hide the status bar and image strip HbMenu *menuWidget = menu(); - - //if option menu is open then no need to hide the status bar and image strip if ( menuWidget->isVisible() ) { - return ; + OstTraceFunctionExit0( GLXFULLSCREENVIEW_HIDEUI_EXIT ); + return ; } - - mWindow->setItemVisible(Hb::AllItems, FALSE) ; + + mUiOff = TRUE; + setItemVisible(Hb::AllItems, FALSE) ; if ( mImageStrip ) { - HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapHide"), this, "effectFinished" ); - //mImageStrip->hide(); - } - mZmPushButton->hide(); - - if(mFlipPushButton){ - mFlipPushButton->hide(); + HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapHide"), this, "effectFinished" ); } - if ( mUiOffTimer ) { - mUiOffTimer->stop(); + if(mFullScreenToolBar) { + mFullScreenToolBar->hide(); } - mUiOff = TRUE; - mCoverFlow->setUiOn(FALSE); - } + + OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_HIDEUI_EXIT ); +} void GlxFullScreenView::changeSelectedIndex(const QModelIndex &index) - { - TRACER("GlxFullScreenView::changeSelectedIndex()"); - GLX_LOG_INFO1("GlxFullScreenView::changeSelectedIndex() %d", index.row() ); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_CHANGESELECTEDINDEX_ENTRY ); + QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole ); if ( variant.isValid() && variant.canConvert () && ( index.row() == variant.value() ) ) { - return; + OstTraceFunctionExit0( GLXFULLSCREENVIEW_CHANGESELECTEDINDEX_EXIT ); + return; } mModel->setData( index, index.row(), GlxFocusIndexRole ); - mZoomSlider->indexChanged(index.row()); - // mZoomControl->indexChanged(index.row()); - SetImageToHdmiL(); // for the image changed on swipe - } + SetImageToHdmiL(); // for the image changed on swipe + + OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_CHANGESELECTEDINDEX_EXIT ); +} void GlxFullScreenView::indexChanged(const QModelIndex &index) - { - TRACER("GlxFullScreenView::indexChanged()"); - GLX_LOG_INFO1("GlxFullScreenView::indexChanged() %d", index.row() ); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_INDEXCHANGED_ENTRY ); + QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole ); if ( variant.isValid() && variant.canConvert () && ( index.row() == variant.value() ) ) { - return; + OstTraceFunctionExit0( GLXFULLSCREENVIEW_INDEXCHANGED_EXIT ); + return; } mModel->setData( index, index.row(), GlxFocusIndexRole ); mCoverFlow->indexChanged(index.row()); - mZoomSlider->indexChanged(index.row()); - mImageStrip->scrollTo(index, HbGridView::PositionAtCenter ); - //mZoomControl->indexChanged(index.row()); - SetImageToHdmiL(); // for the indexchnaged through filmstrip - } + mImageStrip->scrollTo(index, HbGridView::EnsureVisible ); + SetImageToHdmiL(); // for the indexchnaged through filmstrip + //disable the animation for the time being + //imageSelectionAnimation( index ); + + OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_INDEXCHANGED_EXIT ); +} void GlxFullScreenView::scrollingStarted() - { - TRACER("GlxFullScreenView::scrollingStarted() "); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SCROLLINGSTARTED_ENTRY ); + //no need to hide the ui during image strip scrolling if ( mUiOffTimer ) { - mUiOffTimer->stop(); + mUiOffTimer->stop(); } - } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_SCROLLINGSTARTED_EXIT ); +} void GlxFullScreenView::scrollingEnded() - { - TRACER("GlxFullScreenView::scrollingEnded() "); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SCROLLINGENDED_ENTRY ); + if ( mUiOffTimer ) { - mUiOffTimer->start(KUiOffTime); + mUiOffTimer->start(KUiOffTime); } setVisvalWindowIndex(); - } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_SCROLLINGENDED_EXIT ); +} void GlxFullScreenView::pressed(const QModelIndex &index) - { +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_PRESSED_ENTRY ); + Q_UNUSED(index) TRACER("GlxFullScreenView::pressed() "); if ( mUiOffTimer ) { - mUiOffTimer->stop(); + mUiOffTimer->stop(); } - } + OstTraceFunctionExit0( GLXFULLSCREENVIEW_PRESSED_EXIT ); +} void GlxFullScreenView::released(const QModelIndex &index) - { +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_RELEASED_ENTRY ); + Q_UNUSED(index) - TRACER("GlxFullScreenView::released() "); - + if ( mUiOffTimer && mImageStrip->isScrolling() == false ) { - mUiOffTimer->start(KUiOffTime); + mUiOffTimer->start(KUiOffTime); } - } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_RELEASED_EXIT ); +} void GlxFullScreenView::setVisvalWindowIndex() - { - TRACER("GlxFullScreenView::setVisvalWindowIndex()"); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETVISVALWINDOWINDEX_ENTRY ); + QList< HbAbstractViewItem * > visibleItemList = mImageStrip->visibleItems(); - - GLX_LOG_INFO1("GlxFullScreenView::setVisvalWindowIndex() %d", visibleItemList.count()); if ( visibleItemList.count() <= 0 ) return ; HbAbstractViewItem *item = visibleItemList.at(0); - GLX_LOG_INFO1("GlxFullScreenView::setVisvalWindowIndex()1 item %u", item); if ( item == NULL ) return ; - GLX_LOG_INFO1("GlxFullScreenView::setVisvalWindowIndex() item %u", item); - - GLX_LOG_INFO1("GlxFullScreenView::setVisvalWindowIndex() visual index %d", item->modelIndex().row() ); if ( item->modelIndex().row() < 0 || item->modelIndex().row() >= mModel->rowCount() ) return ; mModel->setData( item->modelIndex (), item->modelIndex().row(), GlxVisualWindowIndex); - } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETVISVALWINDOWINDEX_EXIT ); +} void GlxFullScreenView::coverFlowEventHandle( GlxCoverFlowEvent e ) - { - TRACER("GlxFullScreenView::coverFlowEventHandle()"); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_COVERFLOWEVENTHANDLE_ENTRY ); + switch( e ){ case TAP_EVENT : activateUI(); @@ -447,216 +494,245 @@ default : break ; - } + } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_COVERFLOWEVENTHANDLE_EXIT ); +} + +void GlxFullScreenView::effectFinished( const HbEffect::EffectStatus ) +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_EFFECTFINISHED_ENTRY ); + + if ( mUiOff ) { + mUiOffTimer->stop(); + mCoverFlow->setUiOn(FALSE); + mImageStrip->hide(); + } + else { + mUiOffTimer->start(KUiOffTime); + mCoverFlow->setUiOn(TRUE); + } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_EFFECTFINISHED_EXIT ); +} + +void GlxFullScreenView::imageSelectionEffectFinished( const HbEffect::EffectStatus ) +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_IMAGESELECTIONEFFECTFINISHED_ENTRY ); + + mIconItem->resetTransform(); + mIconItem->setVisible( false ); + + QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole ); + if ( variant.isValid() && variant.canConvert () ) { + mCoverFlow->indexChanged( variant.value() ) ; + } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_IMAGESELECTIONEFFECTFINISHED_EXIT ); } void GlxFullScreenView::setLayout() - { - TRACER("GlxFullScreenView::setLayout()"); - //TO:DO read form layout doc - GLX_LOG_INFO1("GlxFullScreenView::setLayout() %d", mWindow->orientation() ); - - QRect screen_rect = mWindow->geometry(); - QSize sz(screen_rect.width(), screen_rect.height()); - +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETLAYOUT_ENTRY ); + + QSize sz = screenSize(); mCoverFlow->setItemSize(sz); - mZoomControl->setGeometry(screen_rect); - mZoomControl->setWindowSize(sz); - - mZmPushButton->setZValue(6); - mZmPushButton->setGeometry(QRectF(0,50,50,50)); - } + OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETLAYOUT_EXIT ); +} void GlxFullScreenView::addConnection() - { - TRACER("GlxFullScreenView::addConnection() " ); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ADDCONNECTION_ENTRY ); + if ( mCoverFlow ) { connect( mCoverFlow, SIGNAL( coverFlowEvent( GlxCoverFlowEvent ) ), this, SLOT( coverFlowEventHandle( GlxCoverFlowEvent ) ) ); - connect( mCoverFlow, SIGNAL(changeSelectedIndex(const QModelIndex &)), this, SLOT( changeSelectedIndex( const QModelIndex & ))); - + connect( mCoverFlow, SIGNAL(changeSelectedIndex(const QModelIndex &)), this, SLOT( changeSelectedIndex( const QModelIndex & ))); } if ( mImageStrip ) { - connect(mImageStrip, SIGNAL( activated(const QModelIndex &) ), this, SLOT( indexChanged(const QModelIndex &) )); - connect(mImageStrip, SIGNAL( scrollingStarted()), this, SLOT( scrollingStarted())); - connect(mImageStrip, SIGNAL( scrollingEnded()), this, SLOT( scrollingEnded())); - connect(mImageStrip, SIGNAL( pressed(const QModelIndex &) ), this, SLOT( pressed(const QModelIndex &) )); - connect(mImageStrip, SIGNAL( released(const QModelIndex &) ), this, SLOT( released(const QModelIndex &) )); + connect(mImageStrip, SIGNAL( activated(const QModelIndex &) ), this, SLOT( indexChanged(const QModelIndex &) )); + connect(mImageStrip, SIGNAL( scrollingStarted()), this, SLOT( scrollingStarted())); + connect(mImageStrip, SIGNAL( scrollingEnded()), this, SLOT( scrollingEnded())); + connect(mImageStrip, SIGNAL( pressed(const QModelIndex &) ), this, SLOT( pressed(const QModelIndex &) )); + connect(mImageStrip, SIGNAL( released(const QModelIndex &) ), this, SLOT( released(const QModelIndex &) )); } if ( mUiOffTimer ) { - connect(mUiOffTimer, SIGNAL(timeout()), this, SLOT(hideUi())); + connect(mUiOffTimer, SIGNAL(timeout()), this, SLOT(hideUi())); } - //for Zoom - if(mZmPushButton &&mZoomSlider) { - connect(mZmPushButton, SIGNAL(clicked()), mZoomSlider, SLOT(toggleSliderVisibility())); - } + + connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); - if(mFlipPushButton) - { - connect(mFlipPushButton, SIGNAL(clicked()), this, SLOT(showdetailsview()), Qt::QueuedConnection); - } - - - if(mZoomControl && mZoomSlider) { - connect(mZoomSlider, SIGNAL(initialZoomFactor(int)), mZoomControl, SLOT(initialZoomFactor(int))); - connect(mZoomSlider, SIGNAL(valueChanged(int)), mZoomControl, SLOT(zoomImage(int))); - connect(mZoomControl, SIGNAL(hideFullScreenUi()), this, SLOT(hideUi())); - } - - connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); - } + OstTraceFunctionExit0( GLXFULLSCREENVIEW_ADDCONNECTION_EXIT ); +} void GlxFullScreenView::removeConnection() - { - TRACER("GlxFullScreenView::removeConnection() " ); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_REMOVECONNECTION_ENTRY ); if ( mCoverFlow ) { - GLX_LOG_INFO("GlxFullScreenView::removeConnection() mCoverFlow " ); + GLX_LOG_INFO("GlxFullScreenView::removeConnection() mCoverFlow " ); disconnect( mCoverFlow, SIGNAL( coverFlowEvent( GlxCoverFlowEvent ) ), this, SLOT( coverFlowEventHandle( GlxCoverFlowEvent ) ) ); - disconnect( mCoverFlow, SIGNAL(changeSelectedIndex(const QModelIndex &)), this, SLOT( changeSelectedIndex( const QModelIndex & ))); - + disconnect( mCoverFlow, SIGNAL(changeSelectedIndex(const QModelIndex &)), this, SLOT( changeSelectedIndex( const QModelIndex & ))); } //For Image Strip if ( mImageStrip ) { - GLX_LOG_INFO("GlxFullScreenView::removeConnection() mImageStrip " ); - disconnect(mImageStrip, SIGNAL( activated(const QModelIndex &) ), this, SLOT( indexChanged(const QModelIndex &) )); - disconnect(mImageStrip, SIGNAL( scrollingStarted()), this, SLOT( scrollingStarted())); - disconnect(mImageStrip, SIGNAL( scrollingEnded()), this, SLOT( scrollingEnded())); - disconnect(mImageStrip, SIGNAL( pressed(const QModelIndex &) ), this, SLOT( pressed(const QModelIndex &) )); - disconnect(mImageStrip, SIGNAL( released(const QModelIndex &) ), this, SLOT( released(const QModelIndex &) )); + GLX_LOG_INFO("GlxFullScreenView::removeConnection() mImageStrip " ); + disconnect(mImageStrip, SIGNAL( activated(const QModelIndex &) ), this, SLOT( indexChanged(const QModelIndex &) )); + disconnect(mImageStrip, SIGNAL( scrollingStarted()), this, SLOT( scrollingStarted())); + disconnect(mImageStrip, SIGNAL( scrollingEnded()), this, SLOT( scrollingEnded())); + disconnect(mImageStrip, SIGNAL( pressed(const QModelIndex &) ), this, SLOT( pressed(const QModelIndex &) )); + disconnect(mImageStrip, SIGNAL( released(const QModelIndex &) ), this, SLOT( released(const QModelIndex &) )); } if ( mUiOffTimer ) { - GLX_LOG_INFO("GlxFullScreenView::removeConnection() mUiOffTimer " ); - disconnect(mUiOffTimer, SIGNAL(timeout()), this, SLOT(hideUi())); + GLX_LOG_INFO("GlxFullScreenView::removeConnection() mUiOffTimer " ); + disconnect(mUiOffTimer, SIGNAL(timeout()), this, SLOT(hideUi())); } - //for Zoom - if(mZmPushButton &&mZoomSlider) { - GLX_LOG_INFO("GlxFullScreenView::removeConnection() mZoomSlider " ); - disconnect(mZmPushButton, SIGNAL(clicked()), mZoomSlider, SLOT(toggleSliderVisibility())); + + if(mFlipAction) { + disconnect(mFlipAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); + } + + if(mSendAction) { + disconnect(mSendAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); } - if(mZoomControl &&mZoomSlider) { - GLX_LOG_INFO("GlxFullScreenView::removeConnection() mZoomSlider " ); - disconnect(mZoomSlider, SIGNAL(initialZoomFactor(int)), mZoomControl, SLOT(initialZoomFactor(int))); - disconnect(mZoomSlider, SIGNAL(valueChanged(int)), mZoomControl, SLOT(zoomImage(int))); - disconnect(mZoomControl, SIGNAL(hideFullScreenUi()), this, SLOT(hideUi())); + if(mDeleteAction) { + disconnect(mDeleteAction, SIGNAL(triggered( )), this, SLOT(handleToolBarAction( )) ); } - //for Details view launching - if(mFlipPushButton) { - GLX_LOG_INFO("GlxFullScreenView::removeConnection() mFlipPushButton " ); - disconnect(mFlipPushButton, SIGNAL(clicked()), this, SLOT(showdetailsview())); - } + disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); - disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); - } + OstTraceFunctionExit0( GLXFULLSCREENVIEW_REMOVECONNECTION_EXIT ); +} void GlxFullScreenView::setImageStripModel() - { - TRACER("GlxFullScreenView::setImageStripModel()" ); - if ( mModel && mImageStrip ) { +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETIMAGESTRIPMODEL_ENTRY ); + mImageStrip->setModel( mModel ); QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole ); if ( variant.isValid() && variant.canConvert () ) { - mImageStrip->setCurrentIndex ( mModel->index( variant.value(), 0) ); - } + mImageStrip->setCurrentIndex ( mModel->index( variant.value(), 0) ); } - } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETIMAGESTRIPMODEL_EXIT ); +} GlxFullScreenView::~GlxFullScreenView() - { - TRACER("GlxFullScreenView::~GlxFullScreenView()" ); +{ + OstTraceFunctionEntry0( DUP1_GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY ); + cleanUp(); + + delete mIconItem ; + mIconItem = NULL; if(mImageStrip) { - GLX_LOG_INFO("GlxFullScreenView::cleanUp() delete mImageStrip " ); - delete mImageStrip; - mImageStrip = NULL; + delete mImageStrip; + mImageStrip = NULL; } - if(mFlipPushButton) { - GLX_LOG_INFO("GlxFullScreenView::cleanUp() delete mFlipPushButton " ); - delete mFlipPushButton; - mFlipPushButton = NULL; + if(mFullScreenToolBar) { + delete mFullScreenToolBar; + mFullScreenToolBar = NULL; } if(mCoverFlow) { - GLX_LOG_INFO("GlxFullScreenView::~GlxFullScreenView() delete mCoverFlow " ); - delete mCoverFlow; - mCoverFlow = NULL; + delete mCoverFlow; + mCoverFlow = NULL; } - if(mDocLoader != NULL) - { + if(mDocLoader != NULL) { mDocLoader->reset(); delete mDocLoader; - } + } + HbEffect::remove( QString("HbGridView"), QString(":/data/transitionup.fxml"), QString( "TapShow" )); - HbEffect::remove( QString("HbGridView"), QString(":/data/transitiondown.fxml"), QString( "TapHide" )); - } + HbEffect::remove( QString("HbGridView"), QString(":/data/transitiondown.fxml"), QString( "TapHide" )); + HbEffect::remove( QString("HbGridViewItem"), QString(":/data/gridtofullscreenhide.fxml"), QString( "Select" )); -void GlxFullScreenView::showdetailsview() - { - TRACER("GlxFullScreenView::showdetailsview()" ); - //trigger the details view to be shown - emit actionTriggered( EGlxCmdDetailsOpen ); - } + OstTraceFunctionExit0( DUP1_GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_EXIT ); +} void GlxFullScreenView::handleUserAction(qint32 commandId) - { - TRACER("GlxFullScreenView::handleUserAction()" ); - switch( commandId ) - { +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_HANDLEUSERACTION_ENTRY ); + + switch( commandId ) { case EGlxCmdRotate : //trigger the rotate Effect in CoverFlow mCoverFlow->rotateImage(); break; - case EGlxCmdSend: - { - QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value(),0),GlxUriRole)).value(); - if(imagePath.isNull()) - { - GLX_LOG_INFO("GlxFullScreenView::SendUi() path is null" ); - } - qDebug() << "GlxFullScreenView::SendUi() imagePath= " << imagePath; + - ShareUi dialog; - QList fileList; - fileList.append(QVariant(imagePath)); - dialog.init(fileList,true); - } - break; + default : break; - } } + OstTraceFunctionExit0( GLXFULLSCREENVIEW_HANDLEUSERACTION_EXIT ); +} + void GlxFullScreenView::SetImageToHdmiL() - { - TRACER("GlxFullScreenView::SetImageToHdmiL() - CGlxHdmi 1" ); - if (iHdmiController) - { - GLX_LOG_INFO("GlxFullScreenView::SetImageToHdmiL() - CGlxHdmi 2" ); +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_SETIMAGETOHDMIL_ENTRY ); + + if (iHdmiController) { + OstTrace0( TRACE_NORMAL, GLXFULLSCREENVIEW_SETIMAGETOHDMIL, "GlxFullScreenView::SetImageToHdmiL() - CGlxHdmi 2" ); + // Get the image uri QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value(),0),GlxUriRole)).value(); - if(imagePath.isNull()) - { - GLX_LOG_INFO("GlxFullScreenView::SetImageToHdmiL() path is null" ); - } - qDebug() << "GlxFullScreenView::SetImageToHdmiL() imagePath= " << imagePath; + if(imagePath.isNull()) { + OstTrace0( TRACE_NORMAL, DUP1_GLXFULLSCREENVIEW_SETIMAGETOHDMIL, "GlxFullScreenView::SetImageToHdmiL() path is null" ); + } + TPtrC aPtr = reinterpret_cast(imagePath.utf16()); - // Get the image Dimensions - QSize imageDimension = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value(),0),GlxDimensionsRole)).value(); - TSize imageSize(imageDimension.width(),imageDimension.height()); - - // Get the framecount - int frameCount = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value(),0),GlxFrameCount)).value(); - iHdmiController->SetImageL(aPtr,imageSize, frameCount); - } + iHdmiController->SetImageL(aPtr); + } + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_SETIMAGETOHDMIL_EXIT ); +} + +void GlxFullScreenView::imageSelectionAnimation(const QModelIndex &index) +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_IMAGESELECTIONANIMATION_ENTRY ); + + if ( mIconItem == NULL ) { + mIconItem = new HbIconItem( mCoverFlow ); + mIconItem->setBrush( QBrush( Qt::black ) ); + mIconItem->setZValue( mCoverFlow->zValue() ); } + + HbAbstractViewItem *mItem = mImageStrip->itemByIndex( index ); + mIconItem->setSize( mItem->size() ); + mIconItem->setPos( mItem->sceneTransform().map( QPoint(0,0)).x() , screenSize().height() - 2 * mItem->size().height() ); + mIconItem->setVisible( true ); + + QVariant variant = mModel->data( index, Qt::DecorationRole ); + if ( variant.isValid() && variant.canConvert () ) { + mIconItem->setIcon ( variant.value() ) ; + } + else { + mIconItem->setIcon( HbIcon() ); + } + HbEffect::start( mIconItem, QString("HbGridViewItem"), QString("Select"), this, "imageSelectionEffectFinished" ); + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_IMAGESELECTIONANIMATION_EXIT ); +} + +void GlxFullScreenView::handleToolBarAction() +{ + OstTraceFunctionEntry0( GLXFULLSCREENVIEW_HANDLETOOLBARACTION_ENTRY ); + + HbAction *action = qobject_cast(sender()); + qint32 commandId = action->data().toInt(); + emit actionTriggered( commandId ); + + OstTraceFunctionExit0( GLXFULLSCREENVIEW_HANDLETOOLBARACTION_EXIT ); +}