ui/views/slideshowview/inc/glxslideshowwidget.h
branchRCL_3
changeset 59 8e5f6eea9c9f
equal deleted inserted replaced
57:ea65f74e6de4 59:8e5f6eea9c9f
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef GLXSLIDESHOWWIDGET_H
       
    21 #define GLXSLIDESHOWWIDGET_H
       
    22 
       
    23 //Includes
       
    24 #include <hbwidget.h>
       
    25 #include <hbeffect.h>
       
    26 
       
    27 //Qt/Orbit forward declarations
       
    28 class QTimer;
       
    29 class QGestureEvent;
       
    30 class HbIconItem;
       
    31 class HbMainWindow;
       
    32 class HbPushButton;
       
    33 class HbMainWindow;
       
    34 class QGraphicsItem;
       
    35 class HbDocumentLoader;
       
    36 class HbAbstractDataModel;
       
    37 class HbLabel;
       
    38 
       
    39 //User Forward Declarations
       
    40 class GlxEffectEngine;
       
    41 class GlxSettingInterface;
       
    42 
       
    43 #define NBR_ITEM 3
       
    44 typedef enum
       
    45 {
       
    46     UI_ON_EVENT, //send the signal when user tap on screen ( on the UI )
       
    47     UI_OFF_EVENT, //send the signal when user press continous button ( off the UI)
       
    48     EMPTY_DATA_EVENT, //send the signal when model have no data
       
    49     EFFECT_STARTED  // sends the signal when effect is started.
       
    50 } GlxSlideShowEvent;
       
    51 
       
    52 /**
       
    53  * Class Description
       
    54  * This is Slideshow widget class used to play the slide show animation and ahndle the user action like pause and play.
       
    55  */
       
    56 class GlxSlideShowWidget : public HbWidget
       
    57 {
       
    58 Q_OBJECT
       
    59 
       
    60 public :
       
    61     /**
       
    62      * Constructor
       
    63      * @param - QGraphicsItem
       
    64      */    
       
    65     GlxSlideShowWidget ( QGraphicsItem *parent = NULL );
       
    66     
       
    67     /**
       
    68      * Destructor
       
    69      */    
       
    70     ~GlxSlideShowWidget ();
       
    71     
       
    72     /**
       
    73      * setmodel() - To set the model of the widget.
       
    74      * @param - QAbstractItemModel.
       
    75      */    
       
    76     void setModel ( QAbstractItemModel *model );
       
    77     
       
    78     /**
       
    79      * setItemGeometry() - To Set the layout data of widgets item.
       
    80      * @param scrren gemoetry
       
    81      */
       
    82     void setItemGeometry( QRect screenRect );
       
    83     
       
    84     /**
       
    85      * startSlideShow() - To start the slide show timer to run the slide show.
       
    86      */
       
    87     void startSlideShow();
       
    88     
       
    89     /**
       
    90      * stopSlideShow() - To stop slide show timer.
       
    91      */
       
    92     void stopSlideShow();
       
    93     
       
    94     /*
       
    95      * setSlideShowWidget() - Initialise the slideshow widget and creation of the icons are done here.
       
    96      * @param - docloader
       
    97      */
       
    98     void setSlideShowWidget( HbDocumentLoader *DocLoader );
       
    99     
       
   100     /*
       
   101      * cleanUp() -Cleans up the slide show widget
       
   102      */
       
   103     void cleanUp();
       
   104     
       
   105     /*
       
   106      * animationItem() - Return the icon to use for some transition effect
       
   107      */
       
   108     QGraphicsItem * animationItem();
       
   109     
       
   110     /**
       
   111      * updateAnimationItem() - upadte the z value of anition item for smooth effect.
       
   112      */    
       
   113     void updateAnimationItem();
       
   114     
       
   115     
       
   116 signals:
       
   117     /**
       
   118      * slideShowEvent() - This signal is emitted when slide show event happend lide ui on/off
       
   119      * @param - GlxSlideShowEvent.
       
   120      */
       
   121     void slideShowEvent( GlxSlideShowEvent e );
       
   122     
       
   123     /**
       
   124      * indexchanged() - This signal is emmitted when image selected index is changed. 
       
   125      */
       
   126     void indexchanged();
       
   127     
       
   128 public slots :
       
   129     /**
       
   130      * triggeredEffect() - To start the slide show animation.
       
   131      */
       
   132     void triggeredEffect();
       
   133 
       
   134     /**
       
   135      * continueSlideShow() - Play the slide show.
       
   136      * @param - From HbAbstractButton.
       
   137      */
       
   138     void continueSlideShow( bool check );
       
   139     
       
   140     /**
       
   141      * effectFinshed() -  Call back to get notification of slide show animation has been finshed.
       
   142      */
       
   143     void effectFinshed();
       
   144     
       
   145     /**
       
   146      * dataChanged() - call back to monitor the widget data changed.
       
   147      * @param - start index of data changed.
       
   148      * @param - end index of data changed.
       
   149      */
       
   150     void dataChanged( QModelIndex startIndex, QModelIndex endIndex );
       
   151     
       
   152     /**
       
   153      * rowsInserted() - call back of new row inserted in the model.
       
   154      * @param - Items are inserted under parent.
       
   155      * @param - start index of items inserted.
       
   156      * @param - end index of items removed.
       
   157      */
       
   158     void rowsInserted( const QModelIndex &parent, int start, int end );
       
   159     
       
   160     /**
       
   161      * rowsRemoved() - call back of new row removed in the model.
       
   162      * @param - Items are removed from parent item.
       
   163      * @param - start index of items inserted.
       
   164      * @param - end index of items removed.
       
   165      */    
       
   166     void rowsRemoved( const QModelIndex &parent, int start, int end );
       
   167     
       
   168     /**
       
   169      * modelDestroyed() - call back to monitor the model destroy.
       
   170      */
       
   171     void modelDestroyed();
       
   172     
       
   173     /**
       
   174      * orientationChanged() - relayout the data when orientation has been changed
       
   175      * @param - Screen Geometry
       
   176      */
       
   177     void orientationChanged( QRect screenRect );
       
   178 
       
   179     /**
       
   180      * leftMoveEffectFinished() - call back, when animation of browse the image in forward direction
       
   181      * has been finished.
       
   182      * @param - staus of effect
       
   183      */
       
   184     void leftMoveEffectFinished( const HbEffect::EffectStatus &status );
       
   185 
       
   186     /**
       
   187      * leftMoveEffectFinished() - call back, when animation of browse the image in backward direction
       
   188      * has been finished.
       
   189      * @param - staus of effect
       
   190      */
       
   191     void rightMoveEffectFinished( const HbEffect::EffectStatus &status );
       
   192     
       
   193 protected slots :
       
   194     /**
       
   195      * leftGesture() - To handle the left move event
       
   196      * @parma number of pixel  move.
       
   197      */
       
   198     void leftGesture ( int value );
       
   199     
       
   200     /**
       
   201      * rightGesture() - To handle the right move event
       
   202      * @parma number of pixel  move.
       
   203      */
       
   204     void rightGesture ( int value );
       
   205     
       
   206 protected :
       
   207     /**
       
   208      * gestureEvent() - gesture event handler.
       
   209      * @param - QGestureEvent
       
   210      */
       
   211     void gestureEvent( QGestureEvent *event );
       
   212     
       
   213 private :
       
   214     /**
       
   215      * clearCurrentModel() - clear all the model call backs
       
   216      */
       
   217     void clearCurrentModel();
       
   218     
       
   219     /**
       
   220      * initializeNewModel() - register the model data change call backs
       
   221      */
       
   222     void initializeNewModel();
       
   223     
       
   224     /**
       
   225      * resetSlideShow() - Reinitialise the widget property.
       
   226      */
       
   227     void resetSlideShow();
       
   228     
       
   229     /**
       
   230      * moveImage() - Sopport function to handle the user browsing.
       
   231      * @param -  next selected image index.
       
   232      * @param - position of next image index.
       
   233      * @param - effect event
       
   234      * @param - animation finished callback function
       
   235      */
       
   236     void moveImage( int nextIndex, int posX, const QString & move, char * callBack );
       
   237     
       
   238     /**
       
   239      * addConnections() - register the internal and effect engine callback.
       
   240      */
       
   241     void addConnections();
       
   242 	
       
   243     /**
       
   244      * removeConnections() - deregister the internal and effect engine callback.
       
   245      */
       
   246     void removeConnections();
       
   247     
       
   248     /**
       
   249      * cancelEffect() - To cancel the currnet effect running.
       
   250      */
       
   251     void cancelEffect();
       
   252     
       
   253     /**
       
   254      * pauseSlideShow() - Pause the slide show.
       
   255      */
       
   256     void pauseSlideShow();
       
   257     
       
   258     /**
       
   259      * getFocusIndex() -To get the focus index
       
   260      */
       
   261     int getFocusIndex( );
       
   262 
       
   263     /*
       
   264      * getIcon() - To get the full screen icon of the image
       
   265      * @param - index of the icon
       
   266      */
       
   267     HbIcon getIcon( int index );
       
   268     
       
   269     /**
       
   270      * isCorrupt() - To check the itemis corrupted or not
       
   271      * @param - index of the icon
       
   272      */
       
   273     bool isCorrupt( int index );
       
   274     
       
   275     /**
       
   276      * setFocusItemIcon() - To set the current ( focus ) item icon
       
   277      * @return - return the success or failure status
       
   278      */
       
   279     bool setFocusItemIcon();
       
   280     
       
   281     /**
       
   282      * setNextItemIcon() - To set the next itme icon in the list
       
   283      * @return - return the success or failure status
       
   284      */
       
   285     bool setNextItemIcon();
       
   286     
       
   287     /**
       
   288      * setPreItemIcon() - To set the previous icon in the list
       
   289      * @return - return the success or failure status
       
   290      */
       
   291     bool setPreItemIcon();
       
   292     
       
   293     /**
       
   294      * showErrorNote() - In the case of all the image are corrupted then show the error notes
       
   295      */
       
   296     void showErrorNote();
       
   297     
       
   298     /**
       
   299      * hideErrorNote() - It will hide the corrupted images note
       
   300      */
       
   301     void hideErrorNote();    
       
   302 
       
   303 private:
       
   304     GlxEffectEngine          *mEffectEngine;
       
   305     GlxSettingInterface      *mSettings;               //no ownership
       
   306     HbIconItem               *mIconItems[ NBR_ITEM ]; 
       
   307     HbIconItem               *mAnimItem;
       
   308     HbIconItem               *mBackGroundItem;
       
   309     HbPushButton             *mContinueButton;
       
   310     HbLabel                  *mErrorNote ;               //when all the image are corrupted then show the no image label
       
   311     int                      mItemIndex;
       
   312     int                      mSelIndex[ NBR_ITEM ];
       
   313     QTimer                   *mSlideTimer;
       
   314     QAbstractItemModel       *mModel;
       
   315     QRect                    mScreenRect;
       
   316     QList <QGraphicsItem *>  mItemList;
       
   317     bool                     mIsPause;
       
   318     int                      mSlideShowItemCount;
       
   319     bool                     mIsAutoMoving;
       
   320 };
       
   321 
       
   322 #endif /* GLXSLIDESHOWWIDGET_H */