ui/viewmanagement/statehandler/inc/glxstatemanager.h
changeset 55 fb37077c270f
parent 49 f291796e213d
child 65 ccee5c4b0de4
equal deleted inserted replaced
49:f291796e213d 55:fb37077c270f
    23 
    23 
    24 #include <QObject>
    24 #include <QObject>
    25 #include <QList>
    25 #include <QList>
    26 #include <glxbasestate.h>
    26 #include <glxbasestate.h>
    27 #include <qmap.h>
    27 #include <qmap.h>
       
    28 #include <QModelIndex>
    28 
    29 
    29 class GlxState;
    30 class GlxState;
    30 class GlxViewManager;
    31 class GlxViewManager;
    31 class GlxMediaModel;
    32 class GlxMediaModel;
    32 class GlxAlbumModel;
    33 class GlxAlbumModel;
    38 #define GLX_STATEMANAGER_EXPORT Q_DECL_EXPORT
    39 #define GLX_STATEMANAGER_EXPORT Q_DECL_EXPORT
    39 #else
    40 #else
    40 #define GLX_STATEMANAGER_EXPORT Q_DECL_IMPORT
    41 #define GLX_STATEMANAGER_EXPORT Q_DECL_IMPORT
    41 #endif
    42 #endif
    42 
    43 
       
    44 /**
       
    45  * Class Description
       
    46  * class to create and manage different states and view navigation 
       
    47  */
       
    48 
    43 class GLX_STATEMANAGER_EXPORT GlxStateManager : public QObject
    49 class GLX_STATEMANAGER_EXPORT GlxStateManager : public QObject
    44 {
    50 {
    45     Q_OBJECT
    51     Q_OBJECT
    46 	friend class TestGlxStateManager;
    52 	friend class TestGlxStateManager;
    47 	
    53 	
    48 public :
    54 public :
    49     /*
    55     /**
    50      * Constructor
    56      * Constructor
    51      */
    57      */
    52     GlxStateManager();
    58     GlxStateManager();
    53     
    59     
    54     /*
    60     /**
    55      * Destructor
    61      * Destructor
    56      */
    62      */
    57     virtual ~GlxStateManager();
    63     virtual ~GlxStateManager();
    58     
    64 
    59     /*
    65     /**
    60      * Fuction to launch the application from some external world
    66      * launchFetcher() - launch image fetcher
       
    67      */
       
    68 	void launchFetcher();    
       
    69 
       
    70 	/**
       
    71      * launchFromExternal() - Fuction to launch the application from some external world
    61      */
    72      */
    62     void launchFromExternal();
    73     void launchFromExternal();
    63     
    74     
    64     /*
    75     /**
    65      * Clean the all externel data
    76      * cleanupExternal() - Clean the all externel data
    66      */
    77      */
    67     void cleanupExternal();
    78     void cleanupExternal();
    68     
    79     
    69     /*
    80     /**
    70      *  Move the views to the multiple item selection state
    81      *  enterMarkingMode() - Move the views to the multiple item selection state
    71      */
    82      */
    72     void enterMarkingMode();
    83     void enterMarkingMode();
    73     
    84     
    74     /*
    85     /**
    75      * Exit from the multiselection state
    86      * exitMarkingMode() - Exit from the multiselection state
    76      */
    87      */
    77     void exitMarkingMode();
    88     void exitMarkingMode();
    78     
    89     
    79     /*
    90     /**
    80      * Execute the commant on multiple selected item
    91      * executeCommand() - Execute the commant on multiple selected item.
    81      */
    92      * @param - command Id to execute.
    82     bool executeCommand(qint32 commandId);
    93      */
    83     
    94     bool executeCommand( qint32 commandId );
    84     /*
    95     
    85      *  when application goes into background or come back to foreground
    96     /**
       
    97      *  eventFilter() - when application goes into background or come back to foreground
    86      *  set and reset the background thumbnail generation property
    98      *  set and reset the background thumbnail generation property
    87      */
    99      *  @param QObject
    88     bool eventFilter(QObject *obj, QEvent *ev);    
   100      *  @param QEvent
       
   101      */
       
   102     bool eventFilter( QObject *obj, QEvent *ev );    
    89 
   103 
    90 signals :
   104 signals :
    91     /*
   105     /**
    92      * Send the user activities ( command ) to the external world
   106      * externalCommand() - Send the user activities ( command ) to the external world
    93      */
   107      * @param - command Id to execute.
    94     void externalCommand(int cmdId);
   108      */
    95     
   109     void externalCommand( int cmdId );
    96     /*
   110     
    97      * TO send the signal to initialise the rest of items
   111     /**
       
   112      * setupItemsSignal() - TO send the signal to initialise the non critical resoruce
    98      * which is not created in the launch sequence
   113      * which is not created in the launch sequence
    99      */
   114      */
   100     void setupItemsSignal();
   115     void setupItemsSignal();
       
   116 
       
   117     /**
       
   118      * gridItemSelected() - signal to send current model and selected index for fetcher service
       
   119      * @param - selected item model index
       
   120      * @param - model
       
   121      */
       
   122     void gridItemSelected( const QModelIndex &,QAbstractItemModel & );   
   101     
   123     
   102 public slots:
   124 public slots:
   103     /*
   125     /**
   104      * To launch the application
   126      * launchApplication() - To launch the application
   105      */
   127      */
   106     void launchApplication();
   128     void launchApplication();
   107     
   129     
   108     /*
   130     /**
   109      * To handle the user action, view switching etc
   131      * actionTriggered() - To handle the user action, view switching etc
   110      */
   132      * @param - user action ID.
   111     void actionTriggered(qint32 id);
   133      */
   112     
   134     void actionTriggered( qint32 id );
   113     /*
   135     
   114      * To create the items which is not created in the aluch sequence
   136     /**
       
   137      * setupItems() -To create the items which is not created in the aluch sequence
   115      */
   138      */
   116     void setupItems();
   139     void setupItems();
   117     
   140     
   118     /*
   141     /**
   119      * call back function to monitor the change in thumbnail manager
   142      * updateTNProgress() - call back function to monitor the change in thumbnail manager
   120      */
   143      * @param - number of item left to generate the thumbnail
   121     void updateTNProgress( int count);
   144      */
       
   145     void updateTNProgress( int count );
       
   146     
       
   147     /**
       
   148      * thumbnailPopulated() - call back to get the information that some initial page are loaded 
       
   149      * into cache.
       
   150      * It will vanish the progressbar dialog.
       
   151      */
       
   152     void thumbnailPopulated();
       
   153     
       
   154     /**
       
   155      * saveData() - To save the activity data
       
   156      */
   122     void saveData();
   157     void saveData();
   123 
   158 
   124 public :
   159 public :
   125     /*
   160     /**
   126      * It will create a new state and replace the current state with new state in the stack.
   161      * changeState() - It will create a new state and replace the current state with new state in the stack.
   127      * It will use in the case of state switching.
   162      * It will use in the case of state switching.
   128      * use -1 if state does not have internal state
   163      * use -1 if state does not have internal state
       
   164      * @param - new state id.
       
   165      * @param - internal or substate of new state.
   129      */    
   166      */    
   130     void changeState(qint32 newStateId, int internalState );
   167     void changeState( qint32 newStateId, int internalState );
   131     
   168     
   132     /*
   169     /**
   133      * Go back to previous state 
   170      * previousState() - Go back to previous state and if there is no state in the stack
       
   171      * then exit the application. 
   134      */    
   172      */    
   135     void previousState();
   173     void previousState();
   136 
   174 
   137     /*
   175     /**
   138      * Go back to a state in hierarchy and pop all the state upto that level.
   176      * goBack() - Go back to a state in hierarchy and pop all the state upto that level.
   139      * if state is not found, then all the state from the hierachy is removed and create a new state on level 0
   177      * if state is not found, then all the state from the hierachy is removed and create a new state on level 0
   140      * This function will be use in the case when more then one back is required in single event.
   178      * This function will be use in the case when more then one back is required in single event.
   141      */
   179      * @param - new state id.
   142     void goBack(qint32 stateId, int internalState);
   180      * @param - internal or substate of new state.
       
   181      */
       
   182     void goBack( qint32 stateId, int internalState );
   143        
   183        
   144     /*
   184     /**
   145      * Create a new state and current state should be pushed into stack.
   185      * nextState() - Create a new state and current state should be pushed into stack.
   146      * use -1 if state does not have internal state
   186      * use -1 if state does not have internal state
       
   187      * @param - new state id.
       
   188      * @param - internal or substate of new state.
   147      */  
   189      */  
   148     void nextState(qint32 newStateId, int internalState );
   190     void nextState( qint32 newStateId, int internalState );
   149 
   191 
   150     /*
   192     /**
   151      * It will delete the current model
   193      * removeCurrentModel() - It will delete the current model
   152      */      
   194      */      
   153     void removeCurrentModel();
   195     void removeCurrentModel();
   154     
   196     
   155     /*
   197     /**
   156      * It will delete the all model used by state manager
   198      * cleanAllModel() - It will delete the all model used by state manager
   157      */
   199      */
   158     void cleanAllModel();
   200     void cleanAllModel();
   159     
   201     
   160 
       
   161 private:
   202 private:
   162 
   203 
   163     /*
   204     /**
   164      *  Launch the harvesting and TN generation progress bar dialog
   205      *  launchProgressDialog() - Launch the harvesting and TN generation progress bar dialog
   165      */
   206      */
   166     void launchProgressDialog();
   207     void launchProgressDialog();
   167     
   208     
   168     /*
   209     /**
   169      * remove the harvesting and TN generation progress bar dialog
   210      * vanishProgressDialog() - create the grid view model and wait for loading of some initial page of data into 
       
   211      * cache.
   170      */
   212      */
   171     void vanishProgressDialog();
   213     void vanishProgressDialog();
   172     
   214     
   173     /*
   215     /**
   174      * Factory function to create the state.
   216      * createState() - Factory function to create the state.
   175      */  
   217      */  
   176     GlxState * createState(qint32 state);
   218     GlxState * createState( qint32 state );
   177     
   219     
   178     /*
   220     /**
   179      * Factory function to create the model.
   221      * createModel() - Factory function to create the model.
       
   222      * @param - state id of the state.
       
   223      * @param -  state navigation direction
   180      */  	
   224      */  	
   181     void createModel(qint32 stateId, NavigationDir dir = NO_DIR);
   225     void createModel( qint32 stateId, NavigationDir dir = NO_DIR );
   182 
   226 
   183     /*
   227     /**
   184      * Factory function to create the grid model.
   228      * createGridModel() - Factory function to create the grid model.
       
   229      * @param -  internal state of grid state.
       
   230      * @param - state navigation direction.
   185      */  	
   231      */  	
   186     void createGridModel(int internalState, NavigationDir dir = NO_DIR);
   232     void createGridModel( int internalState, NavigationDir dir = NO_DIR );
   187 
   233 
   188     /*
   234     /**
   189      * To set the fullscreen context based on the currrent orientation
   235      * setFullScreenContext() - To set the fullscreen context based on the currrent orientation
   190      */    
   236      */    
   191     void setFullScreenContext();
   237     void setFullScreenContext();
   192     
   238     
   193     /*
   239     /**
   194      * Apllication event handler function
   240      * setFullScreenContext() - Apllication event handler function
   195      */
   241      * @param - event id
   196     void eventHandler(qint32 &id);
   242      */
   197     
   243     void eventHandler( qint32 &id );
   198     /*
   244     
   199      * A function to care the exit for application, in the case when application launch from internal and external
   245     /**
       
   246      * exitApplication() - A function to care the exit for application, in the case when application launch from internal and external
   200      */        
   247      */        
   201     void exitApplication();
   248     void exitApplication();
   202 
   249 
   203     /*Launch Application as an acitivyt.
   250     /**
       
   251      * launchActivity() -Launch Application as an activity.
   204      * Return Value @0 : If launching an activity fails
   252      * Return Value @0 : If launching an activity fails
   205      *              @1 : If launch activity passes
   253      *              @1 : If launch activity passes
   206      */
   254      */
   207      bool launchActivity();
   255      bool launchActivity();
       
   256 
       
   257      /**
       
   258       * saveImage() - save current image if it is launched from private path.
       
   259       */
       
   260      void saveImage();
       
   261      
   208 private:
   262 private:
   209     GlxViewManager      *mViewManager;
   263     GlxViewManager      *mViewManager;
   210     GlxMediaModel       *mAllMediaModel;        // for all grid
   264     /// for all grid
   211     GlxMediaModel       *mAlbumGridMediaModel;  // for album grid 
   265     GlxMediaModel       *mAllMediaModel;        
   212     GlxAlbumModel       *mAlbumMediaModel;      // for album list
   266     /// for album grid
   213 	GlxMediaModel       *mImageviewerMediaModel;// for image viewer 
   267     GlxMediaModel       *mAlbumGridMediaModel;  
   214     QAbstractItemModel  *mCurrentModel;         // no owner ship
   268     /// for album list
       
   269     GlxAlbumModel       *mAlbumMediaModel;      
       
   270     /// for image viewer
       
   271 	GlxMediaModel       *mImageviewerMediaModel;
       
   272 	/// no owner ship
       
   273     QAbstractItemModel  *mCurrentModel;         
   215     GlxState            *mCurrentState;		
   274     GlxState            *mCurrentState;		
   216     GlxActionHandler    *mActionHandler;
   275     GlxActionHandler    *mActionHandler;
   217     GlxTNObserver       *mTNObserver;
   276     GlxTNObserver       *mTNObserver;
   218     int                 mCollectionId;
   277     int                 mCollectionId;
   219     bool                isProgressbarRunning;
   278     bool                isProgressbarRunning;