ui/views/fullscreenview/inc/glxfullscreenview.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 02 Sep 2010 20:26:45 +0300
changeset 61 743eb0b9959e
parent 55 fb37077c270f
permissions -rw-r--r--
Revision: 201033 Kit: 201035

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:   ?Description
*
*/



#ifndef GLXFULLSCREENVIEW_H
#define GLXFULLSCREENVIEW_H

//Includes
#include <hbeffect.h>

//User Defined Includes
#include <glxview.h>
#include <glxcoverflow.h>

#define NBR_ANIM_ITEM 2

//Orbit/Qt forward declartion
class QTimer;
class HbAction;
class HbGridView;
class HbMainWindow;
class HbPushButton;
class HbDocumentLoader;
class QAbstractItemModel;
class HbIconItem;

//User Defined forward declartion
class GlxZoomWidget;
class GlxTvOutWrapper;

/**
 * Class Description
 * This is full screen view class to show the image in fullscreen, zoom the image and
 * browse the image through coverflow and imagstrip
 */
class GlxFullScreenView : public GlxView
{
    Q_OBJECT
public :
    /**
     * Constructor
     * @param - HbMainWindow object
     * @param - fullscreen docloader object
     */
    GlxFullScreenView(HbMainWindow *window,HbDocumentLoader *DocLoader);
    
    /**
     * Destructor
     */
    ~GlxFullScreenView();
    
    /**
     * activate()
     * ///From GlxView
     */
    void activate() ;
    
    /**
     * deActivate()
     * ///From GlxView
     */
    void deActivate();

    /**
     * initializeView() - Initialize the coverflow and partially creates the coverflow with one image
     * to make the widget light weight in order to make transition smooth
     * and also loads the widgets. 
     * @param - pointer of model to retreive the view releted data
     * @parm - previous view pointer to get the staus of fullscreen mode of the view
     */
    void initializeView( QAbstractItemModel *model, GlxView *preView );
    
    /**
     * resetView() - resets the view, with just one icon being present in the widget
     * to make the widget light weight in order to make transition smooth
     */
    void resetView();
    
    /**
     * setmodel() 
     * ///from GlxView
     */
    void setModel(QAbstractItemModel *model);
    
    /**
     * setModelContext() - to set the context mode of the model.
     */
    void setModelContext ( );
    
    /**
     * cleanUp() - To clean the custom widgets.
     */
    void cleanUp();
    
    /**
     * getAnimationItem() - To return the animation object to play the view transition animation.
     * @return pointer of widget on which animation are suppose to play.
     */
    QGraphicsItem * getAnimationItem(GlxEffect transitionEffect);
    
    
public slots:
    /**
     * orientationChanged() - Slot to upadte the layout when orientation of device has changed
     * @param new orientation
     */
    void orientationChanged( Qt::Orientation );
    
    /**
     * activateUI() - To show the ui content like status bar, toolbar, and imzge strip.
     */
    void activateUI();
    
    /**
     * hideUi() - To hide the ui content like status bar, toolbar, and imzge strip.
     */
    void hideUi();
    
    /**
     * changeSelectedIndex() - Call back when index is chnaged due to browsing of images in coverflow
     * It will update the selected index in model and notify other widget about index changed.
     * @param - index of new selected item.
     */
    void changeSelectedIndex(const QModelIndex &index);
    
    /**
     * indexChanged() - call back when index is changed from the image strip.
     * It will update the selected index in model and notify other widget about index changed.
     * @param - index of new selected item.  
     */
    void indexChanged(const QModelIndex &index );
    
    /**
     * scrollingStarted() - Call back function to get notification of when scrolling of
     * image strip is start.
     */
    void scrollingStarted();
    
    /**
     * scrollingEnded() - Call back function to get notification of when scrolling of
     * image strip is stop.
     */
    void scrollingEnded();

    /**
     * pressed() - Call back function to get notification of user pressed mouse key or touch the fingure.
     * @param - index of selected item.
     */
    void pressed(const QModelIndex &index );
    
    /**
     * released() - Call back function to get notification of user released mouse key or released the fingure.
     * @param - index of new selected item.
     */
    void released(const QModelIndex &index );

    /**
     * setVisvalWindowIndex() - Set the viisual window index of medialist.
     */
    void setVisvalWindowIndex();
    
    /**
     * coverFlowEventHandle() -  Handle the event generated by cover flow.
     * @param - cover flow event type
     */
    void coverFlowEventHandle( GlxCoverFlowEvent e);
    
    /**
     * effectFinished() -  call back when ui on\off effect has finished.
     * @param - staus of effect
     */
    void effectFinished( const HbEffect::EffectStatus  );
    
    /**
     * imageSelectionEffectFinished() -  call back when ui image strip selection effect has been finished.
     * @param - staus of effect
     */
    void imageSelectionEffectFinished( const HbEffect::EffectStatus  );

    /**
     * orientChangeAnimFinished() -  call back when custom orientation change effect has been finished.
     * @param - staus of effect
     */
    void orientChangeAnimFinished( const HbEffect::EffectStatus );
    
    /**
     * zoomOrientChangeAnimFinished() -  call back when zoom orientation change effect has been finished.
     * @param - staus of effect
     */
     void zoomOrientChangeAnimFinished( const HbEffect::EffectStatus status );
    
    /**
     * effectFinished -  call back when ui on\off effect has finished
     * @param - staus of effect
     */
    void handleToolBarAction();
    
    /**
     * In case of image fetcher handle select command and emit selected index and model 
     */
    void handleFSSelect();

protected :
    /**
     * eventFilter - To handle the application foregrond and background event
     * ///From HbView
     */
    bool eventFilter(QObject *obj, QEvent *ev);
    
private:    
    /**
     * loadWidgets() - The widgets are retrieved from the docml
     */
    void loadWidgets();

    /**
     * loadViewSection() - Loads the corresponding sections in the docml while the orentation is changed.
     */
    void loadViewSection();
    
    /**
     * setLayout() - To set the widgets laout.
     */
    void setLayout();
    
    /**
     * addConnection() - Add the call back of the widgets.
     */
    void addConnection();
    
    /**
     * removeConnection() - Remove the call back of widgets.
     */
    void removeConnection();
    
    /**
     * setImageStripModel() - set the image strip model.
     */
    void setImageStripModel();
    
    /**
     * loadFullScreenToolBar() - load the fullscreen tool bar from the docml.
     */
    void loadFullScreenToolBar();
    
    /**
     * addToolBarAction() - Crete and add the toolbar acton in toolbar.
     * @param - coomand id to recognise the action.
     * @param - toolbar action icon.
     * @param - action name it is used for automation of test cases. 
     */
    void addToolBarAction( int commandId, const QString &iconName, const QString &name) ;
    
    /**
     * initAnimationItem() - Initialise the custom animation item.
     */
    void initAnimationItem();
    
    /**
     * imageSelectionAnimation() - To trigger the image setection animtaion form the imge strip.
     */
    void imageSelectionAnimation( const QModelIndex &index );
    
    /**
     * cancelSelectionAnimation()- To cancel the image selection animation.
     */
    void cancelSelectionAnimation( );
    
    /**
     * playOrientChangeAnim() - To trigger the custom orientation change animation.
     */
    void playOrientChangeAnim();
    
    /**
     * playZoomOrientChangeAnim() - To trigger the custom orientation change animation for zoom image.
     */
    void playZoomOrientChangeAnim();
    
    /**
     * get the substate of fullscreen state.
     */
    int getSubState();
    
    /**
     * setHdmiModel() - set the image strip model.
     * @param - model
     */
    void setHdmiModel( QAbstractItemModel *model );
    
private:
    QAbstractItemModel  *mModel;   //no ownership
    HbMainWindow        *mWindow;  //no ownership
    GlxCoverFlow        *mCoverFlow;
    HbGridView          *mImageStrip;
    QTimer              *mUiOffTimer;  //use for ui off after 30 sec
    HbIconItem          *mIconItems[ NBR_ANIM_ITEM ] ;   //temporary item for play the image strip select animation
    HbIconItem          *mBackGroundItem;
    GlxTvOutWrapper     *mTvOutWrapper;
    HbToolBar           *mFullScreenToolBar; //Fullscreen Toolbar
    //for Zoom
	GlxZoomWidget		*mZoomWidget;
    HbDocumentLoader    *mDocLoader;
  
    bool                mUiOff;        // to check the current status of ui on / off
};

#endif /* GLXFULLSCREENVIEW_H_ */