contentstorage/caclient/inc/caiconcache.h
changeset 60 f62f87b200ec
child 73 4bc7b118b3df
equal deleted inserted replaced
4:1a2a00e78665 60:f62f87b200ec
       
     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:
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef ICONCACHE_H
       
    19 #define ICONCACHE_H
       
    20 
       
    21 // System includes
       
    22 #include <QCache>
       
    23 #include <HbIcon>
       
    24 
       
    25 // User includes
       
    26 #include "canotifier.h"
       
    27 
       
    28 // Forward declarations
       
    29 class CaEntry;
       
    30 class CaService;
       
    31 
       
    32 // Class declaration
       
    33 class CaIconCache: public QObject
       
    34 {
       
    35     Q_OBJECT
       
    36 public:
       
    37 
       
    38     static CaIconCache *cache();
       
    39     bool exist(const CaEntry &entry, const QSize &size);
       
    40     HbIcon icon(const CaEntry &entry, const QSize &size);
       
    41     void insert(const CaEntry &entry, const QSize &size, const HbIcon &icon);
       
    42 
       
    43 private:
       
    44 
       
    45     explicit CaIconCache(QObject *parent = 0);
       
    46     ~CaIconCache();
       
    47     QString key(const CaEntry &entry, const QSize &size = QSize());
       
    48 
       
    49 private slots:
       
    50 
       
    51     void remove(const CaEntry &entry, ChangeType changeType);
       
    52 
       
    53 private:
       
    54     static QSharedPointer<CaIconCache> mInstance;
       
    55 
       
    56     QCache<QString,HbIcon> mCache; //own
       
    57 
       
    58     QSharedPointer<CaService> mService;//not own
       
    59 
       
    60     CaNotifier *mNotifier;//own
       
    61 
       
    62     friend class QtSharedPointer::ExternalRefCount<CaIconCache>;
       
    63 };
       
    64 
       
    65 #endif // ICONCACHE_H