ui/uiengine/model/listmodel/inc/glxalbummodel.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 #ifndef GLXALBUMMODEL_H
       
    19 #define GLXALBUMMODEL_H
       
    20 
       
    21 #include <QAbstractItemModel>
       
    22 #include <QCache>
       
    23 #include <glxmlwrapper.h>
       
    24 #include <glxuistd.h>
       
    25 
       
    26 #ifdef BUILD_LISTMODEL
       
    27 #define GLX_LISTMODEL_EXPORT Q_DECL_EXPORT
       
    28 #else
       
    29 #define GLX_LISTMODEL_EXPORT Q_DECL_IMPORT
       
    30 #endif
       
    31 
       
    32 struct GlxAlbumListParams  
       
    33 {
       
    34    QString title;
       
    35    QString subTitle;
       
    36    QPixmap* image; 
       
    37 };
       
    38 
       
    39 typedef QList<GlxAlbumListParams> GlxAlbumListData;
       
    40 
       
    41 class HbIcon;
       
    42 class GlxModelParm;
       
    43 
       
    44 class GLX_LISTMODEL_EXPORT GlxAlbumModel : public QAbstractItemModel
       
    45 {
       
    46 Q_OBJECT
       
    47 public :    
       
    48     
       
    49     GlxAlbumModel(GlxModelParm & modelParm);
       
    50     ~GlxAlbumModel();
       
    51     int rowCount(const QModelIndex &parent = QModelIndex()) const;
       
    52     int columnCount(const QModelIndex &parent = QModelIndex()) const;
       
    53     QModelIndex parent(const QModelIndex &child) const;
       
    54     QVariant data(const QModelIndex &index, int role) const;
       
    55     bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
       
    56     QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
       
    57 
       
    58 private :    
       
    59     /**
       
    60      * for setting the attribute context mode will be used mainly for retreiving thumbnail of different sizes.
       
    61      */     
       
    62     void setContextMode(GlxContextMode contextMode);
       
    63     void setFocusIndex(const QModelIndex &index);
       
    64     void setSelectedIndex(const QModelIndex &index);
       
    65     QModelIndex getFocusIndex() const;
       
    66     HbIcon* GetPreviewIconItem(int itemIndex, GlxTBContextType tbContextType) const;
       
    67     
       
    68 signals :
       
    69     void iconAvailable(int itemIndex, HbIcon* itemIcon, GlxTBContextType tbContextType) const;
       
    70 public slots:
       
    71     void itemUpdated1(int mlIndex, GlxTBContextType tbContextType);
       
    72     void itemsAdded(int startIndex, int endIndex);
       
    73     void itemsRemoved(int startIndex, int endIndex);
       
    74 protected:
       
    75     
       
    76 private slots:
       
    77      void updateItemIcon(int itemIndex, HbIcon* itemIcon, GlxTBContextType tbContextType); 
       
    78 private:
       
    79     Q_DECL_IMPORT GlxMLWrapper* mMLWrapper;
       
    80     GlxContextMode mContextMode;
       
    81     HbIcon* mDefaultIcon;
       
    82     QCache<int, HbIcon> itemIconCache;
       
    83 };
       
    84 
       
    85 #endif /* GLXALBUMMODEL_H */