|
1 /* |
|
2 * Copyright (c) 2010 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: Private data and helper classes used by class CntCache. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CNTICONFETCHER_H |
|
19 #define CNTICONFETCHER_H |
|
20 |
|
21 #include <HbIcon> |
|
22 #include <cntabstractfetcher.h> |
|
23 |
|
24 class ThumbnailManager; |
|
25 |
|
26 QTM_USE_NAMESPACE |
|
27 |
|
28 class CntIconJob : public CntAbstractJob |
|
29 { |
|
30 public: |
|
31 CntIconJob(QString iconName) { this->iconName = iconName; } |
|
32 bool isEmpty() { return iconName.isEmpty(); } |
|
33 bool equals(const CntAbstractJob &other) { const CntIconJob *o = static_cast<const CntIconJob *>(&other); return (iconName == o->iconName); } |
|
34 QString toString() { return QString("iconName = '%1'").arg(iconName); } |
|
35 |
|
36 public: |
|
37 QString iconName; // set by requester |
|
38 HbIcon icon; // set by icon fetcher |
|
39 }; |
|
40 |
|
41 class CntIconFetcher : public CntAbstractFetcher |
|
42 { |
|
43 Q_OBJECT |
|
44 public: |
|
45 CntIconFetcher(); |
|
46 ~CntIconFetcher(); |
|
47 |
|
48 bool isProcessingJob(); |
|
49 void processNextJob(); |
|
50 |
|
51 signals: |
|
52 void iconFetched(const QString &iconName, const HbIcon &icon); |
|
53 void iconCancelled(const QString &iconName); |
|
54 |
|
55 private slots: |
|
56 void forwardIconToClient(const QPixmap &pixmap, void *data, int id, int error); |
|
57 |
|
58 private: |
|
59 ThumbnailManager *mThumbnailManager; // manager that fetches the icons; owned |
|
60 int mIconRequestId; // the id of the last request to thumbnail manager |
|
61 QString mIconRequestName; // the name of the icon last requested from thumbnail manager |
|
62 |
|
63 friend class TestIconFetcher; |
|
64 }; |
|
65 |
|
66 #endif |