videocollection/videocollectionwrapper/inc/videocollectionwrapper_p.h
changeset 62 0e1e938beb1a
parent 46 adbe7d5ba2f5
equal deleted inserted replaced
59:a76e86df7ccd 62:0e1e938beb1a
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:   VideoCollectionWrapperPrivate class definition
    14 * Description: VideoCollectionWrapperPrivate class definition
    15 * 
    15 * 
    16 */
    16 */
    17 
    17 
    18 #ifndef __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
    18 #ifndef __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
    19 #define __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
    19 #define __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
    27 
    27 
    28 // FORWARD DECLARATIONS
    28 // FORWARD DECLARATIONS
    29 class CMPXMediaArray;
    29 class CMPXMediaArray;
    30 class CMPXMedia;
    30 class CMPXMedia;
    31 class VideoListDataModel;
    31 class VideoListDataModel;
    32 class VideoSortFilterProxyModel;
    32 class VideoProxyModelGeneric;
       
    33 class VideoProxyModelAllVideos;
       
    34 class VideoProxyModelCollections;
       
    35 class VideoProxyModelContent;
    33 
    36 
    34 class VideoCollectionWrapperPrivate : public QObject        
    37 class VideoCollectionWrapperPrivate : public QObject        
    35 {    
    38 {    
    36 	Q_DISABLE_COPY(VideoCollectionWrapperPrivate) 
    39 	Q_DISABLE_COPY(VideoCollectionWrapperPrivate) 
    37 	
    40 	
    49 	
    52 	
    50 	/**
    53 	/**
    51 	 * Destructor
    54 	 * Destructor
    52 	 */
    55 	 */
    53 	~VideoCollectionWrapperPrivate();	
    56 	~VideoCollectionWrapperPrivate();	
    54 
    57     
    55     /**
    58     /**
    56      * Returns the pointer into model. Creates the model if it doesn't exists yet.
    59      * Returns the pointer into generic video model. Creates the model if it doesn't 
       
    60      * exist yet.
    57      * 
    61      * 
    58      * Noter that if application has signaled aboutToQuit -signal indicating closing, all
    62      * Noter that if application has signaled aboutToQuit -signal indicating closing, all
    59      * previously created models have been removed and new ones will not be created 
    63      * previously created models have been removed and new ones will not be created 
    60      * anymore
    64      * anymore
    61      *  
    65      *
    62      * @param type type of model
       
    63      * @return address of model, NULL if creation did not succeed or if application is closing.
    66      * @return address of model, NULL if creation did not succeed or if application is closing.
    64      */    
    67      */    
    65 	VideoSortFilterProxyModel* getModel(VideoCollectionCommon::TModelType &type);
    68     VideoProxyModelGeneric* getGenericModel();
       
    69 
       
    70     /**
       
    71      * Returns the pointer into all videos model. Creates the model if it doesn't exist yet.
       
    72      * 
       
    73      * Noter that if application has signaled aboutToQuit -signal indicating closing, all
       
    74      * previously created models have been removed and new ones will not be created 
       
    75      * anymore
       
    76      *
       
    77      * @return address of model, NULL if creation did not succeed or if application is closing.
       
    78      */    
       
    79  
       
    80     VideoProxyModelGeneric* getAllVideosModel();
       
    81 
       
    82     /**
       
    83      * Returns the pointer into collections model. Creates the model if it doesn't exist yet.
       
    84      * 
       
    85      * Noter that if application has signaled aboutToQuit -signal indicating closing, all
       
    86      * previously created models have been removed and new ones will not be created 
       
    87      * anymore
       
    88      *
       
    89      * @return address of model, NULL if creation did not succeed or if application is closing.
       
    90      */    
       
    91  
       
    92     VideoProxyModelGeneric* getCollectionsModel();
       
    93     
       
    94     /**
       
    95      * Returns the pointer into collection content model. Creates the model if it doesn't 
       
    96      * exist yet.
       
    97      * 
       
    98      * Noter that if application has signaled aboutToQuit -signal indicating closing, all
       
    99      * previously created models have been removed and new ones will not be created 
       
   100      * anymore
       
   101      * 
       
   102      * @return address of model, NULL if creation did not succeed or if application is closing.
       
   103      */     
       
   104     VideoProxyModelGeneric* getCollectionContentModel();
    66 
   105 
    67 private slots:
   106 private slots:
    68   
   107 
    69     
       
    70     /**
   108     /**
    71      * Signaled when UI environment is about to be destroyed. 
   109      * Signaled when UI environment is about to be destroyed. 
    72      * All models needs to be cleaned up before of that.
   110      * All models needs to be cleaned up before of that.
    73      * 
   111      * 
    74      */
   112      */
    75     void aboutToQuitSlot();
   113     void aboutToQuitSlot();
    76            
   114     
    77 private:
   115 private:
       
   116     
       
   117     /**
       
   118      * Creates proxy model and returns the pointer.
       
   119      * 
       
   120      * Noter that if application has signaled aboutToQuit -signal indicating closing, all
       
   121      * previously created models have been removed and new ones will not be created 
       
   122      * anymore.
       
   123      * 
       
   124      * @return address of model, NULL if creation did not succeed or if application is closing.
       
   125      */
       
   126     template<class T>
       
   127     T *initProxyModelModel()
       
   128     {
       
   129         if(mAboutToClose)
       
   130         {
       
   131             return 0;
       
   132         }
       
   133         
       
   134         if(!initSourceModel())
       
   135         {
       
   136             return 0;
       
   137         }
       
   138         
       
   139         T *model = 0;
       
   140 
       
   141         model = new T();
       
   142             
       
   143         if(model->initialize(mSourceModel) || 
       
   144            !connect(model, SIGNAL(shortDetailsReady(TMPXItemId)), 
       
   145                    mSourceModel, SIGNAL(shortDetailsReady(TMPXItemId))))
       
   146         {
       
   147             delete model;
       
   148             model = 0;
       
   149         }
       
   150         
       
   151         return model;
       
   152     }
       
   153     
       
   154 private:
       
   155 
       
   156     /**
       
   157      * Initializes source model.
       
   158      * 
       
   159      * @return true if initialization succeeds, otherwise false.
       
   160      */
       
   161     bool initSourceModel();
       
   162     
       
   163 private:
       
   164     
       
   165     /**
       
   166      * data model for collection content
       
   167      */
       
   168     QPointer<VideoProxyModelGeneric> mGenericModel;
    78     
   169     
    79 	/**
   170 	/**
    80      * data model for all videos
   171      * data model for all videos
    81      */
   172      */
    82 	QPointer<VideoSortFilterProxyModel> mAllVideosModel;
   173 	QPointer<VideoProxyModelAllVideos> mAllVideosModel;
    83 	
   174 	
    84 	/**
   175 	/**
    85 	 * data model for collections
   176 	 * data model for collections
    86 	 */
   177 	 */
    87 	QPointer<VideoSortFilterProxyModel> mCollectionsModel;
   178 	QPointer<VideoProxyModelCollections> mCollectionsModel;
    88 	
   179 	
    89 	/**
   180 	/**
    90 	 * data model for collection content
   181 	 * data model for collection content
    91 	 */
   182 	 */
    92     QPointer<VideoSortFilterProxyModel> mCollectionContentModel;
   183     QPointer<VideoProxyModelContent> mCollectionContentModel;
    93 	
       
    94 	/**
       
    95 	 * data model for collection content
       
    96 	 */
       
    97 	QPointer<VideoSortFilterProxyModel> mGenericModel;
       
    98 	
   184 	
    99 	/**
   185 	/**
   100 	 * source model
   186 	 * source model
   101 	 */
   187 	 */
   102 	QPointer<VideoListDataModel>        mSourceModel;
   188 	QPointer<VideoListDataModel>     mSourceModel;
   103 	
   189 	
   104 	/**
   190 	/**
   105 	 * flag to indicate, that object is to be deallocated, so no
   191 	 * flag to indicate, that object is to be deallocated, so no
   106 	 * models are to be returned anymore 
   192 	 * models are to be returned anymore 
   107 	 */
   193 	 */
   109     
   195     
   110 };
   196 };
   111 #endif  // __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
   197 #endif  // __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
   112 
   198 
   113 // End of file
   199 // End of file
   114     
       
   115 
       
   116