ui/views/slideshowview/inc/glxslideshowwidget.h
changeset 23 74c9f037fd5d
child 29 2c833fc9e98f
equal deleted inserted replaced
5:f7f0874bfe7d 23:74c9f037fd5d
       
     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 <hbscrollarea.h>
       
    25 #include <hbeffect.h>
       
    26 
       
    27 //Qt/Orbit forward declarations
       
    28 class QTimer;
       
    29 class HbIconItem;
       
    30 class HbMainWindow;
       
    31 class HbPushButton;
       
    32 class HbMainWindow;
       
    33 class QGraphicsItem;
       
    34 class HbDocumentLoader;
       
    35 class HbAbstractDataModel;
       
    36 
       
    37 //User Forward Declarations
       
    38 class GlxSlideShowEffectEngine;
       
    39 
       
    40 
       
    41 #define NBR_ITEM 3
       
    42 typedef enum
       
    43 {
       
    44     UI_ON_EVENT, //send the signal when user tap on screen ( on the UI )
       
    45     UI_OFF_EVENT, //send the signal when user press continous button ( off the UI)
       
    46     EMPTY_DATA_EVENT //send the signal when model have no data
       
    47 } GlxSlideShowEvent;
       
    48 
       
    49 class GlxSlideShowWidget : public HbScrollArea
       
    50 {
       
    51 Q_OBJECT
       
    52 
       
    53 public :
       
    54     GlxSlideShowWidget (QGraphicsItem *parent = NULL);
       
    55     ~GlxSlideShowWidget ();
       
    56     void setModel (QAbstractItemModel *model);
       
    57     void setItemGeometry(QRect screenRect);
       
    58     void startSlideShow();
       
    59     void stopSlideShow();
       
    60     /*
       
    61      * Initialise the slideshow widget
       
    62      * creation of the icons are done here
       
    63      */
       
    64     void setSlideShowWidget(HbDocumentLoader *DocLoader);
       
    65     
       
    66     /*
       
    67      * Cleans up the slide show widget
       
    68      */
       
    69     void cleanUp();
       
    70     
       
    71 signals:
       
    72     void slideShowEvent(GlxSlideShowEvent e);
       
    73     void indexchanged();
       
    74     
       
    75 public slots :
       
    76     void triggeredEffect();
       
    77     void effectFinshed();
       
    78     void cancelEffect();
       
    79     void pauseSlideShow();
       
    80     void continueSlideShow(bool check);
       
    81     void dataChanged(QModelIndex startIndex, QModelIndex endIndex);
       
    82     void rowsInserted(const QModelIndex &parent, int start, int end);
       
    83     void rowsRemoved(const QModelIndex &parent, int start, int end);
       
    84     void modelDestroyed();
       
    85     void orientationChanged(QRect screenRect);
       
    86 
       
    87     void leftMoveEffectFinished( const HbEffect::EffectStatus &status );
       
    88     void rightMoveEffectFinished( const HbEffect::EffectStatus &status );
       
    89     
       
    90 protected slots :
       
    91     void leftGesture (int value);
       
    92     void rightGesture (int value);
       
    93     
       
    94 protected :
       
    95     void mouseReleaseEvent( QGraphicsSceneMouseEvent *event);
       
    96     void mousePressEvent ( QGraphicsSceneMouseEvent * event ) ;
       
    97     
       
    98 private :
       
    99     //clear all the model connection
       
   100     void clearCurrentModel();
       
   101     //add the connection to the model
       
   102     void initializeNewModel();
       
   103     void resetSlideShow();
       
   104     void setIconItems(int moveDir);
       
   105     void setItemPos(int moveDir);
       
   106     void moveImage(int nextIndex, int posX, const QString & move, char * callBack);
       
   107     void addConnections();
       
   108     void removeConnections();
       
   109 
       
   110 private:
       
   111     GlxSlideShowEffectEngine *mEffectEngine;
       
   112     HbIconItem               *mIconItems[NBR_ITEM]; 
       
   113     HbPushButton             *mContinueButton;
       
   114     int                      mItemIndex;
       
   115     int                      mSelIndex;
       
   116     QTimer                   *mSlideTimer;
       
   117     QAbstractItemModel       *mModel;
       
   118     QRect                    mScreenRect;
       
   119     QList <QGraphicsItem *>  mItemList;
       
   120     bool                     mIsPause;
       
   121 };
       
   122 
       
   123 #endif /* GLXSLIDESHOWWIDGET_H */