ui/views/effectengine/inc/glxeffectengine.h
branchGCC_SURGE
changeset 51 525c140ec8db
parent 38 c9962d0368d9
parent 49 f291796e213d
equal deleted inserted replaced
38:c9962d0368d9 51:525c140ec8db
     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 #ifndef GLXEFFECTENGINE_H
       
    20 #define GLXEFFECTENGINE_H
       
    21 
       
    22 #ifdef BUILD_GLXVIEWS
       
    23 #define GLX_VIEW_EXPORT Q_DECL_EXPORT
       
    24 #else
       
    25 #define GLX_VIEW_EXPORT Q_DECL_IMPORT
       
    26 #endif
       
    27 
       
    28 #include <QObject>
       
    29 #include <hbeffect.h>
       
    30 #include <QString>
       
    31 #include <QHash>
       
    32 #include <QList>
       
    33 #include "glxuistd.h"
       
    34 
       
    35 class XQSettingsKey;
       
    36 class XQSettingsManager;
       
    37 class QStringList;
       
    38 typedef enum 
       
    39 {
       
    40     NO_MOVE,
       
    41     MOVE_FORWARD,
       
    42     MOVE_BACKWARD,
       
    43 } GlxSlideShowMoveDir;
       
    44 
       
    45 /*
       
    46  * This class is used for read the setting either from File System or from some xml file.
       
    47  * This Setting is used by both server and client, but It is coupled with the server and client retreive the data through the server
       
    48  */
       
    49 class GlxSlideShowSetting
       
    50 {
       
    51 public :
       
    52     GlxSlideShowSetting(int slideDelayTime = 0, GlxEffect effect = NO_EFFECT, GlxSlideShowMoveDir moveDir = NO_MOVE);
       
    53     ~GlxSlideShowSetting();
       
    54     int slideDelayTime ( ) { return mSlideDelayTime; }
       
    55     GlxEffect effect() { return mEffect ; }
       
    56     void setEffect(GlxEffect effect) { mEffect = effect ;}
       
    57     GlxSlideShowMoveDir slideShowMoveDir() { return mMoveDir; }
       
    58     /* Returns the index to the selected transition effect
       
    59     This value is fetched from Central repository */
       
    60     int slideShowEffectIndex() ;
       
    61     /*SlideShowSettingsView will call this API to set the index of the transition effect chosen. 
       
    62     This data will be written to the Central Repository*/
       
    63      void setslideShowEffectIndex( int index );
       
    64     
       
    65     /* Returns the index to the selected transition delay /
       
    66     This value is fetched from Central repository */
       
    67     int slideShowDelayIndex();
       
    68     
       
    69     /*SlideShowSettingsView will call this API to set the index of the transition delay chosen. 
       
    70     This data will be written to the Central Repository*/
       
    71     void setSlideShowDelayIndex( int index );
       
    72     
       
    73     /*This will return the list of effects as available in the central repository */
       
    74     QStringList slideShowEffectList();
       
    75  
       
    76 /*
       
    77  * This funtion read the user setting store in a file system.
       
    78  * 
       
    79  */	
       
    80     void readSlideShowSetting();
       
    81 	
       
    82 private :
       
    83     int mSlideDelayTime; //user set time interval in between showing slide
       
    84     GlxEffect mEffect;         //user defined effect, To:Do It is either some integer value or some enum
       
    85     GlxSlideShowDelay mDelay;
       
    86     GlxSlideShowMoveDir mMoveDir;	//user defined slide move direction
       
    87     QStringList mEffectList;
       
    88     XQSettingsManager *mSettingsManager;
       
    89     XQSettingsKey *mTransitionEffectCenrepKey;
       
    90     XQSettingsKey *mTransitionDelayCenrepKey;
       
    91     XQSettingsKey *mWaveEffectCenRepKey;
       
    92     XQSettingsKey *mFadeEffectCenRepKey;
       
    93     XQSettingsKey *mZoomEffectCenRepKey;
       
    94     XQSettingsKey *mSlowCenRepKey;
       
    95     XQSettingsKey *mMediumCenRepKey;
       
    96     XQSettingsKey *mFastCenRepKey;
       
    97 };
       
    98 
       
    99 /*
       
   100  * This class have the views transition effect information
       
   101  */
       
   102 class GlxTransitionEffectSetting
       
   103 {
       
   104 public :
       
   105     GlxTransitionEffectSetting(GlxEffect effect);
       
   106     ~GlxTransitionEffectSetting();
       
   107     
       
   108     QList <QString > effectFileList() { return mEffectFileList ; }
       
   109     QList <QString > itemType() { return mItemType ; }
       
   110     QList <QString > eventType() { return mEventType ; }
       
   111     bool isTransitionLater() { return mTransitionLater ; }
       
   112     QGraphicsItem * animationItem() { return mItem ; }
       
   113     
       
   114     void setEffectFileList( QList <QString > & effectFileList) { mEffectFileList = effectFileList ; }
       
   115     void setItemTypes( QList <QString > & itemType) { mItemType = itemType; }
       
   116     void setEventTypes( QList <QString > & eventType) { mEventType = eventType ; }
       
   117     void setTransitionLater(bool transitionLater) { mTransitionLater = transitionLater ; }
       
   118     void setAnimationItem(QGraphicsItem *item) { mItem = item ;}
       
   119     int count() { return mEffectFileList.count() ; }
       
   120     
       
   121 private :
       
   122     void init();
       
   123     
       
   124 private :
       
   125     GlxEffect mEffect;     //transition effect type
       
   126     bool mTransitionLater; //second animation will run same time(false) or later (true)
       
   127     QGraphicsItem *mItem; //it will used in the case of animation run later
       
   128     QList <QString > mEffectFileList; //list of fxml file used for animation
       
   129     QList <QString > mItemType; //list of item type 
       
   130     QList <QString > mEventType; //list of event type
       
   131 };
       
   132 
       
   133 
       
   134 /*
       
   135  * It is customise class for Photo Application to run the effect.
       
   136  * In the case of effect setting required to read through File System: 
       
   137  * first read the setting, register the effect and then run the effect.
       
   138  * In the case of run the client effect: first Set the effect, register the effect and then run the effect.
       
   139  */
       
   140  
       
   141 class GlxEffectPluginBase;
       
   142 
       
   143 class GLX_VIEW_EXPORT GlxSlideShowEffectEngine : public QObject
       
   144 {
       
   145     Q_OBJECT
       
   146     
       
   147 public:
       
   148     GlxSlideShowEffectEngine( );
       
   149     ~GlxSlideShowEffectEngine();
       
   150     int slideDelayTime ( ) { return mSlideShowSetting.slideDelayTime(); }    
       
   151     GlxSlideShowMoveDir slideShowMoveDir() { return mSlideShowSetting.slideShowMoveDir(); }
       
   152     void readSetting() { mSlideShowSetting.readSlideShowSetting(); }
       
   153     void setEffect(GlxEffect effect) { mSlideShowSetting.setEffect( effect ); }
       
   154     
       
   155     void registerEffect(const QString &itemType);
       
   156     void deRegisterEffect(const QString &itemType);
       
   157     
       
   158 /*  To register a set of transition effect 
       
   159  *  e.g "grid to full screeen", "fullscreen to grid"
       
   160  *  
       
   161  */  
       
   162     void registerTransitionEffect();    
       
   163     void deregistertransitionEffect();
       
   164     
       
   165     void runEffect(QGraphicsItem *  item, const QString &  itemType ); 
       
   166     void runEffect(QList< QGraphicsItem * > &  items, const QString &  itemType );
       
   167     void runEffect(QList< QGraphicsItem * > &  items, GlxEffect transitionEffect);
       
   168     
       
   169     void cancelEffect(QGraphicsItem *  item);
       
   170     void cancelEffect( const QList< QGraphicsItem * > &  items );
       
   171     void cancelEffect(QList< QGraphicsItem * > &  items, GlxEffect transitionEffect);
       
   172     
       
   173     bool isEffectRuning(QGraphicsItem *  item);
       
   174     bool isEffectRuning(const QList< QGraphicsItem * > &  items);
       
   175     
       
   176 signals:
       
   177     void effectFinished();
       
   178     
       
   179 public slots:
       
   180     void slideShowEffectFinished( const HbEffect::EffectStatus &status );
       
   181     void transitionEffectFinished( const HbEffect::EffectStatus &status );
       
   182 
       
   183 private:
       
   184     void effectPluginResolver();
       
   185     void initTransitionEffect();
       
   186     void cleanTransitionEfffect();
       
   187     
       
   188 private:
       
   189     GlxSlideShowSetting mSlideShowSetting;	
       
   190     int mNbrEffectRunning;               //containe the number of effect running
       
   191     GlxEffectPluginBase *mEffectPlugin;
       
   192     QHash<GlxEffect, GlxTransitionEffectSetting *> mTransitionEffectList;
       
   193     GlxEffect mTransitionEffect;
       
   194 };
       
   195 
       
   196 #endif /*GLXEFFECTENGINE_H*/