ui/views/slideshowview/inc/glxslideshowwidget.h
changeset 55 fb37077c270f
parent 36 6481344a6d67
child 61 743eb0b9959e
equal deleted inserted replaced
49:f291796e213d 55:fb37077c270f
    32 class HbPushButton;
    32 class HbPushButton;
    33 class HbMainWindow;
    33 class HbMainWindow;
    34 class QGraphicsItem;
    34 class QGraphicsItem;
    35 class HbDocumentLoader;
    35 class HbDocumentLoader;
    36 class HbAbstractDataModel;
    36 class HbAbstractDataModel;
       
    37 class HbLabel;
    37 
    38 
    38 //User Forward Declarations
    39 //User Forward Declarations
    39 class GlxEffectEngine;
    40 class GlxEffectEngine;
    40 class GlxSettingInterface;
    41 class GlxSettingInterface;
    41 
    42 
    46     UI_OFF_EVENT, //send the signal when user press continous button ( off the UI)
    47     UI_OFF_EVENT, //send the signal when user press continous button ( off the UI)
    47     EMPTY_DATA_EVENT, //send the signal when model have no data
    48     EMPTY_DATA_EVENT, //send the signal when model have no data
    48     EFFECT_STARTED  // sends the signal when effect is started.
    49     EFFECT_STARTED  // sends the signal when effect is started.
    49 } GlxSlideShowEvent;
    50 } GlxSlideShowEvent;
    50 
    51 
    51 typedef enum 
    52 /**
    52 {
    53  * Class Description
    53     MOVE_FORWARD,
    54  * This is Slideshow widget class used to play the slide show animation and ahndle the user action like pause and play.
    54     MOVE_BACKWARD,
    55  */
    55 } GlxSlideShowMoveDir;
       
    56 
       
    57 class GlxSlideShowWidget : public HbWidget
    56 class GlxSlideShowWidget : public HbWidget
    58 {
    57 {
    59 Q_OBJECT
    58 Q_OBJECT
    60 
    59 
    61 public :
    60 public :
    62     GlxSlideShowWidget (QGraphicsItem *parent = NULL);
    61     /**
       
    62      * Constructor
       
    63      * @param - QGraphicsItem
       
    64      */    
       
    65     GlxSlideShowWidget ( QGraphicsItem *parent = NULL );
       
    66     
       
    67     /**
       
    68      * Destructor
       
    69      */    
    63     ~GlxSlideShowWidget ();
    70     ~GlxSlideShowWidget ();
    64     void setModel (QAbstractItemModel *model);
    71     
    65     void setItemGeometry(QRect screenRect);
    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      */
    66     void startSlideShow();
    87     void startSlideShow();
       
    88     
       
    89     /**
       
    90      * stopSlideShow() - To stop slide show timer.
       
    91      */
    67     void stopSlideShow();
    92     void stopSlideShow();
       
    93     
    68     /*
    94     /*
    69      * Initialise the slideshow widget
    95      * setSlideShowWidget() - Initialise the slideshow widget and creation of the icons are done here.
    70      * creation of the icons are done here
    96      * @param - docloader
    71      */
    97      */
    72     void setSlideShowWidget(HbDocumentLoader *DocLoader);
    98     void setSlideShowWidget( HbDocumentLoader *DocLoader );
    73     
    99     
    74     /*
   100     /*
    75      * Cleans up the slide show widget
   101      * cleanUp() -Cleans up the slide show widget
    76      */
   102      */
    77     void cleanUp();
   103     void cleanUp();
    78     
   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     
    79 signals:
   116 signals:
    80     void slideShowEvent(GlxSlideShowEvent e);
   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      */
    81     void indexchanged();
   126     void indexchanged();
    82     
   127     
    83 public slots :
   128 public slots :
       
   129     /**
       
   130      * triggeredEffect() - To start the slide show animation.
       
   131      */
    84     void triggeredEffect();
   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      */
    85     void effectFinshed();
   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      */
    86     void cancelEffect();
   251     void cancelEffect();
       
   252     
       
   253     /**
       
   254      * pauseSlideShow() - Pause the slide show.
       
   255      */
    87     void pauseSlideShow();
   256     void pauseSlideShow();
    88     void continueSlideShow(bool check);
   257     
    89     void dataChanged(QModelIndex startIndex, QModelIndex endIndex);
   258     /**
    90     void rowsInserted(const QModelIndex &parent, int start, int end);
   259      * getFocusIndex() -To get the focus index
    91     void rowsRemoved(const QModelIndex &parent, int start, int end);
   260      */
    92     void modelDestroyed();
   261     int getFocusIndex( );
    93     void orientationChanged(QRect screenRect);
   262 
    94 
   263     /*
    95     void leftMoveEffectFinished( const HbEffect::EffectStatus &status );
   264      * getIcon() - To get the full screen icon of the image
    96     void rightMoveEffectFinished( const HbEffect::EffectStatus &status );
   265      * @param - index of the icon
    97     
   266      */
    98 protected slots :
   267     HbIcon getIcon( int index );
    99     void leftGesture (int value);
   268     
   100     void rightGesture (int value);
   269     /**
   101     
   270      * isCorrupt() - To check the itemis corrupted or not
   102 protected :
   271      * @param - index of the icon
   103     void gestureEvent(QGestureEvent *event);
   272      */
   104     
   273     bool isCorrupt( int index );
   105 private :
   274     
   106     //clear all the model connection
   275     /**
   107     void clearCurrentModel();
   276      * setFocusItemIcon() - To set the current ( focus ) item icon
   108     //add the connection to the model
   277      * @return - return the success or failure status
   109     void initializeNewModel();
   278      */
   110     void resetSlideShow();
   279     bool setFocusItemIcon();
   111     void setIconItems( int moveDir );
   280     
   112     void moveImage( int nextIndex, int posX, const QString & move, char * callBack );
   281     /**
   113     void addConnections();
   282      * setNextItemIcon() - To set the next itme icon in the list
   114     void removeConnections();
   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();    
   115 
   302 
   116 private:
   303 private:
   117     GlxEffectEngine          *mEffectEngine;
   304     GlxEffectEngine          *mEffectEngine;
   118     GlxSettingInterface      *mSettings;               //no ownership
   305     GlxSettingInterface      *mSettings;               //no ownership
   119     HbIconItem               *mIconItems[NBR_ITEM]; 
   306     HbIconItem               *mIconItems[ NBR_ITEM ]; 
       
   307     HbIconItem               *mAnimItem;
       
   308     HbIconItem               *mBackGroundItem;
   120     HbPushButton             *mContinueButton;
   309     HbPushButton             *mContinueButton;
       
   310     HbLabel                  *mErrorNote ;               //when all the image are corrupted then show the no image label
   121     int                      mItemIndex;
   311     int                      mItemIndex;
   122     int                      mSelIndex;
   312     int                      mSelIndex[ NBR_ITEM ];
   123     QTimer                   *mSlideTimer;
   313     QTimer                   *mSlideTimer;
   124     QAbstractItemModel       *mModel;
   314     QAbstractItemModel       *mModel;
   125     QRect                    mScreenRect;
   315     QRect                    mScreenRect;
   126     QList <QGraphicsItem *>  mItemList;
   316     QList <QGraphicsItem *>  mItemList;
   127     bool                     mIsPause;
   317     bool                     mIsPause;
       
   318     int                      mSlideShowItemCount;
   128 };
   319 };
   129 
   320 
   130 #endif /* GLXSLIDESHOWWIDGET_H */
   321 #endif /* GLXSLIDESHOWWIDGET_H */