hgwidgets_plat/hgcacheproxymodel_api/inc/hgdataprovidermodel.h
changeset 5 4fa04caf0f43
parent 2 49c70dcc3f17
child 6 1cdcc61142d2
equal deleted inserted replaced
3:c863538fcbb6 5:4fa04caf0f43
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 *  Version     : %version: 5 %
    16 *  Version     : %version: 8 %
    17 */
    17 */
    18 #ifndef HGDATAPROVIDERMODEL_H_
    18 #ifndef HGDATAPROVIDERMODEL_H_
    19 #define HGDATAPROVIDERMODEL_H_
    19 #define HGDATAPROVIDERMODEL_H_
    20 
    20 
    21 #include <QObject>
    21 #include <QObject>
    22 #include <QList>
    22 #include <QList>
    23 #include <QPair>
    23 #include <QPair>
    24 #include <QPixmap.h>
    24 #include <QPixmap>
    25 #include <QMap>
    25 #include <QMap>
    26 #include <QMutex>
    26 #include <QMutex>
    27 #include <QAbstractItemModel>
    27 #include <QAbstractItemModel>
    28 
    28 
    29 class HbIcon;
    29 class HbIcon;
    94 public:    
    94 public:    
    95     void resetModel();
    95     void resetModel();
    96 
    96 
    97 protected:    
    97 protected:    
    98     virtual void doResetModel() {};
    98     virtual void doResetModel() {};
       
    99     virtual QVariant getData(int idx, int role) const {return QVariant(); };
    99     
   100     
   100 // helpers fot emits
   101 // helpers fot emits
   101 protected:  
   102 protected:  
   102     void emitDataChanged(int start, int end, bool silent);
   103     void emitDataChanged(int start, int end, bool silent);
   103     
   104     
   117     QList<QMap<int, QVariant>*>* mCache;   
   118     QList<QMap<int, QVariant>*>* mCache;   
   118     int mCacheSize; //Number of cached Icons. Not same as mCache->count()
   119     int mCacheSize; //Number of cached Icons. Not same as mCache->count()
   119     QList< QPixmap* > mFreePixmaps;
   120     QList< QPixmap* > mFreePixmaps;
   120     QMap< int, QPixmap* > mUsedPixmaps;    
   121     QMap< int, QPixmap* > mUsedPixmaps;    
   121     int mUnallocatedPixmaps;
   122     int mUnallocatedPixmaps;
   122 //    QMutex mQPixmapsLock;
   123     QMutex mQPixmapsLock;
       
   124     QMutex mDataLock;    
   123     HgDataProviderModelObserver *mObserver;
   125     HgDataProviderModelObserver *mObserver;
   124 };
   126 };
   125 
   127 
   126 inline bool HgDataProviderModel::isIndexValid(int idx) const
   128 inline bool HgDataProviderModel::isIndexValid(int idx) const
   127 {
   129 {
   134 {
   136 {
   135     return ( isIndexValid(idx) && 
   137     return ( isIndexValid(idx) && 
   136              mCache->at(idx)->contains(role) ); 
   138              mCache->at(idx)->contains(role) ); 
   137 }
   139 }
   138 
   140 
   139 
       
   140 
       
   141 
       
   142 #endif // HGDATAPROVIDERMODEL_H_
   141 #endif // HGDATAPROVIDERMODEL_H_