ui/views/fullscreenview/inc/glxcoverflow.h
changeset 61 743eb0b9959e
parent 55 fb37077c270f
child 67 199e6e1e0b54
equal deleted inserted replaced
55:fb37077c270f 61:743eb0b9959e
    34 typedef enum
    34 typedef enum
    35 {
    35 {
    36     NO_MOVE,
    36     NO_MOVE,
    37     TAP_MOVE,
    37     TAP_MOVE,
    38     LEFT_MOVE,
    38     LEFT_MOVE,
    39     RIGHT_MOVE,
    39     RIGHT_MOVE
    40     LONGPRESS_MOVE,
       
    41 } GlxUserMove;
    40 } GlxUserMove;
    42 
    41 
    43 typedef enum
    42 typedef enum
    44 {
    43 {
    45     TAP_EVENT, //send the signal when user tap on full screen
    44     TAP_EVENT, //send the signal when user tap on full screen
    46     PANNING_START_EVENT, //send the signal when panning of full screen start
    45     PANNING_START_EVENT, //send the signal when panning of full screen start
    47     EMPTY_ROW_EVENT, //send the signal when model have no data
    46     EMPTY_ROW_EVENT, //send the signal when model have no data
    48     ZOOM_START_EVENT
    47     ZOOM_START_EVENT
    49 } GlxCoverFlowEvent;
    48 } GlxCoverFlowEvent;
    50 
    49 
       
    50 /**
       
    51  * Class Description
       
    52  * This is cover flow class to show and browse the image in fullscreen mode.
       
    53  */
    51 class GlxCoverFlow : public HbWidget
    54 class GlxCoverFlow : public HbWidget
    52 {
    55 {
    53 Q_OBJECT
    56 Q_OBJECT
    54 
    57 
    55 public :
    58 public :
       
    59     /**
       
    60      * Constructor
       
    61      * @param - QGraphicsItem parent of this widget
       
    62      */    
    56 	GlxCoverFlow (QGraphicsItem *parent = NULL);
    63 	GlxCoverFlow (QGraphicsItem *parent = NULL);
       
    64 	
       
    65     /**
       
    66      * Destructor
       
    67      */	
    57 	~GlxCoverFlow ();
    68 	~GlxCoverFlow ();
    58     void setItemSize (QSize &size);
    69 	
    59     void setModel (QAbstractItemModel *model);
    70 	/**
    60     void indexChanged (int index);
    71 	 * setItemSize() - To set the fullscreen image size.
    61     void setUiOn(bool uiOn) { mUiOn = uiOn; }
    72 	 * @param - size of fullscreen.
       
    73 	 */
       
    74     void setItemSize( QSize &size );
       
    75     
       
    76     /**
       
    77      * setModel() - To set the data provider of the widget.
       
    78      * @param - data model pointor 
       
    79      */
       
    80     void setModel( QAbstractItemModel *model );
       
    81     
       
    82     /**
       
    83      * indexChanged() - Call back to get the focus index change.
       
    84      * @param - new focus index.
       
    85      */
       
    86     void indexChanged( int index );
       
    87     
       
    88     /**
       
    89      * setUiOn() - Call back to get the ui on/off status.
       
    90      * @param - ui on/off status
       
    91      */
       
    92     void setUiOn( bool uiOn ) { mUiOn = uiOn; }
       
    93     
       
    94     /**
       
    95      * partiallyClean() - To clean all the item except focus one for improved the
       
    96      * view transition animation.
       
    97      */
    62     void partiallyClean();
    98     void partiallyClean();
    63     void partiallyCreate(QAbstractItemModel *model, QSize itemSize, int posY = 0 );
    99     
    64 	void setCoverFlow();
   100     /*
       
   101      * partiallyCreate() - To update the focus item only for improved the view transition
       
   102      * animtaion.
       
   103      * @param - data model pointer
       
   104      * @param - size of fullscreen.
       
   105      * @param - image pos in the screen. 
       
   106      */
       
   107     void partiallyCreate( QAbstractItemModel *model, QSize itemSize, int posY = 0 );
       
   108 	
       
   109     /**
       
   110 	 * setCoverFlow() - To initialise the coverflow.
       
   111 	 */
       
   112     void setCoverFlow();
       
   113     
       
   114     /**
       
   115      * ClearCoverFlow() - To cleanup the memory and connection.
       
   116      */
    65     void ClearCoverFlow();
   117     void ClearCoverFlow();
    66 	void setMultitouchFilter(QGraphicsItem* multitouchFilter);
   118     
    67 	
   119     /**
    68 	/*
   120      * setMultitouchFilter(() - To Set the widget who is interested in multi touch
    69      * To get the focus index
   121      * gesture event.
       
   122      * @param - widget pointer
       
   123      */
       
   124 	void setMultitouchFilter( QGraphicsItem* multitouchFilter );
       
   125 	
       
   126 	/**
       
   127      * getFocusIndex() - To return the focus index
       
   128      * @return - focus index.
    70      */
   129      */
    71     int getFocusIndex( );
   130     int getFocusIndex( );
    72 
   131 
    73     /*
   132     /**
    74      * To get the full screen icon of the image
   133      * getIcon() - to retuen the full screen icon of the image
       
   134      * @param  - index of imges which icon is required.
       
   135      * @return - icon of the image.
    75      */
   136      */
    76     HbIcon getIcon( int index );
   137     HbIcon getIcon( int index );
    77 		    
   138 		    
    78 public slots:
   139 public slots:
    79 	void zoomStarted(int index);
   140     /**
    80 	void zoomFinished(int index);
   141      * zoomStarted() - Call back about user has start the zooming.
       
   142      * @param - focus index.
       
   143      */
       
   144 	void zoomStarted( int index );
       
   145 	
       
   146 	/**
       
   147 	 * zoomFinished() - Call back about user has finished the zoom and come back 
       
   148 	 * to coverflow.
       
   149 	 *  @param - focus index.
       
   150 	 */
       
   151 	void zoomFinished( int index );
    81 
   152 
    82 signals :
   153 signals :
    83     void coverFlowEvent(GlxCoverFlowEvent e);
   154     /**
    84     void changeSelectedIndex(const QModelIndex &index);
   155      * coverFlowEvent() - To emit signal about coverflow event happen like panning, zomming ( For ui off ),
       
   156      * Tap ( for ui on/off ) etc.
       
   157      * @param - type of event
       
   158      */
       
   159     void coverFlowEvent( GlxCoverFlowEvent e );
       
   160     
       
   161     /**
       
   162      * changeSelectedIndex() - To emit the signal about focus inde change
       
   163      * @param - new focus index
       
   164      */
       
   165     void changeSelectedIndex( const QModelIndex &index );
       
   166     
       
   167     /**
       
   168      * autoLeftMoveSignal() - Internal signal to move the next image with transition animation.
       
   169      */
    85     void autoLeftMoveSignal();
   170     void autoLeftMoveSignal();
       
   171     
       
   172     /**
       
   173      * autoRightMoveSignal() - Internal signal to move the previous image with transition animation.
       
   174      */
    86     void autoRightMoveSignal();
   175     void autoRightMoveSignal();
    87     void doubleTapEventReceived(QPointF position);
   176     
       
   177     /**
       
   178      * doubleTapEventReceived() - To emit the signal about double tap happen.
       
   179      * @param - coordinate of double tap postion with respect of view.
       
   180      */
       
   181     void doubleTapEventReceived( QPointF position );
       
   182     
       
   183     /**
       
   184      * moveNextSignal() - Internal signal to handle the buffering logic when user move
       
   185      * to prevoius image.
       
   186      */
       
   187     void moveNextSignal();
       
   188     
       
   189     /**
       
   190      * movePreviousSignal() - Internal signal to handle the buffernig loigc when user move 
       
   191      * to previous image.
       
   192      */
       
   193     void movePreviousSignal();
    88 
   194 
    89 protected slots:
   195 protected slots:
    90     void panGesture ( const QPointF & delta )  ;
   196     /**
    91     void longPressGesture(const QPointF &point) ;
   197      * panGesture() - To handle the pan gesture event.
    92     void dataChanged(QModelIndex startIndex, QModelIndex endIndex);
   198      * @param -  user move delta postion.
    93     void rowsInserted(const QModelIndex &parent, int start, int end);
   199      */
    94     void rowsRemoved(const QModelIndex &parent, int start, int end);
   200     void panGesture ( const QPointF & delta ) ;
       
   201     
       
   202     /**
       
   203      * dataChanged() - call back to monitor the widget data changed.
       
   204      * @param - start index of data changed.
       
   205      * @param - end index of data changed.
       
   206      */
       
   207     void dataChanged( QModelIndex startIndex, QModelIndex endIndex );
       
   208     
       
   209     /**
       
   210      * rowsInserted() - call back of new row inserted in the model.
       
   211      * @param - Items are inserted under parent.
       
   212      * @param - start index of items inserted.
       
   213      * @param - end index of items removed.
       
   214      */    
       
   215     void rowsInserted( const QModelIndex &parent, int start, int end );
       
   216     
       
   217     /**
       
   218      * rowsRemoved() - call back of new row removed in the model.
       
   219      * @param - Items are removed from parent item.
       
   220      * @param - start index of items inserted.
       
   221      * @param - end index of items removed.
       
   222      */    
       
   223     void rowsRemoved( const QModelIndex &parent, int start, int end );
       
   224     
       
   225     /**
       
   226      * modelDestroyed() - call back to monitor the model destroy.
       
   227      */
    95     void modelDestroyed();
   228     void modelDestroyed();
       
   229 
       
   230     /**
       
   231      * autoLeftMove() - To play the next image move and bounce back transition animation.
       
   232      */
    96     void autoLeftMove();
   233     void autoLeftMove();
       
   234     
       
   235     /**
       
   236      * autoRightMove() - To play the previous image move and bounce back transition animation.
       
   237      */
    97     void autoRightMove();
   238     void autoRightMove();
       
   239     
       
   240     /**
       
   241      * moveNextImage() - To Handle user next image move for buffering logic, emit the signal about
       
   242      * new focus index and set some widget properties.
       
   243      */
       
   244     void moveNextImage();
       
   245     
       
   246     /**
       
   247      * movePreviousImage() - To Handle user pervious image move for buffering logic, emit the signal about
       
   248      * new focus index and set some widget properties.
       
   249      */    
       
   250     void movePreviousImage();
    98 
   251 
    99 protected:
   252 protected:
   100 	void gestureEvent(QGestureEvent *event);
   253     /**
   101     void move(int value);
   254      * gestureEvent() - override function to handle the gesture event.
       
   255      * @param - pointer of QGestureEvent
       
   256      */
       
   257 	void gestureEvent( QGestureEvent *event );
       
   258 	
       
   259 	/**
       
   260 	 * move() - Change the postion of items for transition animation.
       
   261 	 * @parma - delta move.
       
   262 	 */
       
   263     void move( int value );
       
   264     
       
   265     /**
       
   266      * setRows() - set the number of rows.
       
   267      */
   102     void setRows() ;
   268     void setRows() ;
       
   269     
       
   270     /**
       
   271      * setStripLen() - set the virtual strip length of coverflow.
       
   272      */
   103     void setStripLen();
   273     void setStripLen();
       
   274     
       
   275     /**
       
   276      * calculateIndex() - For cyclic cover flow map the index to actual item index.
       
   277      * @param - index of the index.
       
   278      */
   104     int calculateIndex(int index);
   279     int calculateIndex(int index);
   105     
   280     
       
   281     /**
       
   282      * loadIconItems() - Set the icon, size and postion of the icon items.
       
   283      */
   106     void loadIconItems (); 
   284     void loadIconItems (); 
   107     void updateIconItem (qint16 selIndex, qint16 selIconIndex, qint16 deltaX);
   285     
       
   286     /**
       
   287      * updateIconItem() - Set the icon, size and postion of the a particular item.
       
   288      * It is used to support buffering logic and when user move to next or previous image.
       
   289      * @param - image index.
       
   290      * @param - item index in array.
       
   291      * @param - position of the item.
       
   292      */
       
   293     void updateIconItem ( qint16 selIndex, qint16 selIconIndex, qint16 posX );
       
   294     
       
   295     /**
       
   296      * playAnimation() - In the case of animated image, it will play the animation for focus image
       
   297      */
       
   298     void playAnimation();
       
   299     
       
   300     /**
       
   301      * stopAnimation() - To stop the animation
       
   302      */
       
   303     void stopAnimation();
   108     
   304     
   109     /*
   305     /*
   110      * In the case of animated image, it will play the animation for focus image
   306      * clearCurrentModel() - clear all the model connection
   111      */
   307      */
   112     void playAnimation();
   308     void clearCurrentModel();
   113     
   309     
   114     /*
   310     /*
   115      * To stop the animation
   311      * initializeNewModel() - add the connection to the model
   116      */
   312      */
   117     void stopAnimation();
   313     void initializeNewModel();
   118     
   314     
   119     /*
   315     /*
   120      * clear all the model connection
   316      * resetCoverFlow() - reset all the data of cover flow
   121      */
       
   122     void clearCurrentModel();
       
   123     
       
   124     /*
       
   125      * add the connection to the model
       
   126      */
       
   127     void initializeNewModel();
       
   128     
       
   129     /*
       
   130      * reset all the data of cover flow
       
   131      */    
   317      */    
   132     void resetCoverFlow();
   318     void resetCoverFlow();
       
   319     
       
   320     /**
       
   321      * getSubState() - To get the substate of fullscreen state.
       
   322      * @return - return the substate of fullscreen state.
       
   323      */
   133     int getSubState();
   324     int getSubState();
   134     void timerEvent(QTimerEvent *event);
   325     
   135     
   326     /**
   136     /*
   327      * timerEvent() - To handle the double tap timer
   137      * To get the URI of the image
   328      * @param - pointer of QTimerEvent.
       
   329      */
       
   330     void timerEvent( QTimerEvent *event );
       
   331     
       
   332     /**
       
   333      * getUri() - To get the URI of the image.
       
   334      * @param - image index.
       
   335      * @return - return the uri of the image.
   138      */
   336      */
   139     QString getUri( int index );
   337     QString getUri( int index );
   140     
   338     
   141     /*
   339     /**
   142      * To get the GIF file info of the image
   340      * isAnimatedImage() - To get the GIF file info of the image
       
   341      * @param - image index.
       
   342      * @return - true if it GIF image else false.
   143      */
   343      */
   144     bool isAnimatedImage( int index );
   344     bool isAnimatedImage( int index );
   145     
   345     
   146 private:
   346 private:
   147 	HbIconItem *mIconItem[NBR_ICON_ITEM];      //at most contain only five item
   347 	HbIconItem *mIconItem[NBR_ICON_ITEM];      //at most contain only five item
   148     qint16 mSelItemIndex;                    // current full screen index
   348     qint16 mSelItemIndex;                    // current full screen index
   149     qint16 mRows;                        // total number of item  
   349     qint16 mRows;                        // total number of item  
   150     //QModelIndex mIndex;                  //current model index of seleced item
       
   151     qint16 mSelIndex;                    // remove once model concept is integreted
   350     qint16 mSelIndex;                    // remove once model concept is integreted
   152     qint32 mStripLen;                    //virtual strip lenght
   351     qint32 mStripLen;                    //virtual strip lenght
   153     qint32 mCurrentPos;                   //current postion in the virtual strip
   352     qint32 mCurrentPos;                   //current postion in the virtual strip
   154     QSize mItemSize;                     //hb icon item size
   353     QSize mItemSize;                     //hb icon item size
   155     bool mUiOn;
   354     bool mUiOn;
   159     int mSpeed;        
   358     int mSpeed;        
   160 	bool mZoomOn;
   359 	bool mZoomOn;
   161 	QGraphicsItem* mMultitouchFilter;
   360 	QGraphicsItem* mMultitouchFilter;
   162     int mTimerId;
   361     int mTimerId;
   163     bool mIsInit;
   362     bool mIsInit;
       
   363     bool mIsAutoMoving;
   164 };
   364 };
   165 
   365 
   166 #endif /* GLXCOVERFLOW_H_ */
   366 #endif /* GLXCOVERFLOW_H_ */