contentstorage/caclient/inc/caiconcache.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 14 May 2010 16:10:06 +0300
changeset 73 4bc7b118b3df
parent 60 f62f87b200ec
child 112 dbfb5e38438b
permissions -rw-r--r--
Revision: 201017 Kit: 201019

/*
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
 * Description:
 *
 */

#ifndef ICONCACHE_H
#define ICONCACHE_H

// System includes
#include <QCache>
#include <HbIcon>

// User includes
#include "canotifier.h"

// Forward declarations
class CaEntry;
class CaService;

// Class declaration
class CaIconCache: public QObject
{
    Q_OBJECT
public:

    static CaIconCache *cache();
    bool exist(const CaEntry &entry, const QSize &size);
    HbIcon icon(const CaEntry &entry, const QSize &size);
    void insert(const CaEntry &entry, const QSize &size, const HbIcon &icon);

private:

    explicit CaIconCache(QObject *parent = 0);
    ~CaIconCache();
    QString key(const CaEntry &entry, const QSize &size = QSize());

private slots:

    void remove(const CaEntry &entry, ChangeType changeType);

private:
    static QSharedPointer<CaIconCache> mInstance;

    QCache<QString,HbIcon> mCache;

    QSharedPointer<CaService> mService;

    CaNotifier *mNotifier;

    friend class QtSharedPointer::ExternalRefCount<CaIconCache>;
};

#endif // ICONCACHE_H