15 * |
15 * |
16 */ |
16 */ |
17 #include <fbs.h> |
17 #include <fbs.h> |
18 #include "tsthumbnailprovider.h" |
18 #include "tsthumbnailprovider.h" |
19 //------------------------------------------------------------------------------ |
19 //------------------------------------------------------------------------------ |
|
20 /** |
|
21 * Constructor - initialize provider instance |
|
22 * @param observer - thumnail observer |
|
23 * @param obj - object which request and receive new thumnails using signal/slot interface |
|
24 */ |
20 TsThumbnailProvider::TsThumbnailProvider(MTsThumbnailObserver& observer, QObject* obj) |
25 TsThumbnailProvider::TsThumbnailProvider(MTsThumbnailObserver& observer, QObject* obj) |
21 : |
26 : |
22 mObserver(observer) |
27 mObserver(observer) |
23 { |
28 { |
24 connect(this, |
29 connect(this, |
30 SIGNAL(thumbnailCreated(QPixmap, const void*)), |
35 SIGNAL(thumbnailCreated(QPixmap, const void*)), |
31 this, |
36 this, |
32 SLOT(thumbnailCreated(QPixmap, const void*))); |
37 SLOT(thumbnailCreated(QPixmap, const void*))); |
33 } |
38 } |
34 //------------------------------------------------------------------------------ |
39 //------------------------------------------------------------------------------ |
|
40 /** |
|
41 * Function create interface for Symbian clients. |
|
42 */ |
35 void TsThumbnailProvider::createThumbnail(CFbsBitmap& source, int angle) |
43 void TsThumbnailProvider::createThumbnail(CFbsBitmap& source, int angle) |
36 { |
44 { |
37 emit createThumbnail(QPixmap::fromSymbianCFbsBitmap(&source), |
45 emit createThumbnail(QPixmap::fromSymbianCFbsBitmap(&source), |
38 angle, |
46 angle, |
39 this); |
47 this); |
40 } |
48 } |
41 |
49 |
42 //------------------------------------------------------------------------------ |
50 //------------------------------------------------------------------------------ |
|
51 /** |
|
52 * Retrieve requests done by Symbian interface and forward results to observer |
|
53 */ |
43 void TsThumbnailProvider::thumbnailCreated(const QPixmap& thumbnail, |
54 void TsThumbnailProvider::thumbnailCreated(const QPixmap& thumbnail, |
44 const void *userData) |
55 const void *userData) |
45 { |
56 { |
46 if (this != userData) { |
57 if (this != userData) { |
47 return; |
58 return; |
48 } |
59 } |
49 CFbsBitmap *bitmap(thumbnail.toSymbianCFbsBitmap()); |
60 CFbsBitmap *bitmap(thumbnail.toSymbianCFbsBitmap()); |
50 if(0 != bitmap) { |
61 if(0 != bitmap) { |
51 mObserver.thumbnailCreated(*bitmap); |
62 mObserver.ThumbnailCreated(*bitmap); |
52 } |
63 } |
53 delete bitmap; |
64 delete bitmap; |
54 } |
65 } |