11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 * Version : %version: 1 % |
16 * Version : %version: 7 % |
17 */ |
17 */ |
18 #include <QList> |
18 #include <QList> |
19 #include "hglogger.h" |
19 #include "hglogger.h" |
20 #include <hbicon.h> |
20 #include <HbIcon> |
21 #include "mydataprovider.h" |
21 #include "mydataprovider.h" |
22 |
|
23 //#include "x:\sf\mw\qt\src\openvg\qpixmapdata_vg_p.h" |
|
24 //typedef VGImage (*pfnVgCreateEGLImageTargetKHR)(VGeglImageKHR); |
|
25 |
22 |
26 const int KItemIdRole = Qt::UserRole+1; |
23 const int KItemIdRole = Qt::UserRole+1; |
27 |
24 |
28 const int KThumbnailsPriority = EPriorityLess; //standard priority |
25 const int KThumbnailsPriority = EPriorityLess; //standard priority |
29 |
26 |
30 |
27 |
31 MyDataProvider::MyDataProvider(QObject *parent) : |
28 MyDataProvider::MyDataProvider(QObject *parent) : |
32 HgDataProviderModel(parent), |
29 HgDataProviderModel(parent), |
33 mDefaultIcon(new HbIcon(QIcon(QPixmap(":/icons/default.png")))), |
30 mDefaultIcon(QIcon(QPixmap(":/icons/default.png"))), |
34 mScheduler(new CActiveSchedulerWait()), |
31 mScheduler(new CActiveSchedulerWait()), |
35 mWrapper( new ThumbnailManager() ), |
32 mWrapper( new ThumbnailManager() ), |
36 mThumbnailRequestPending(false), |
33 mThumbnailRequestPending(false), |
37 mThumbnailRequestIndex(-1), |
34 mThumbnailRequestIndex(-1), |
38 mThumbnailRequestID(-1), |
35 mThumbnailRequestID(-1), |
39 mThumbnailsize(ThumbnailManager::ThumbnailMedium), |
36 mThumbnailsize(ThumbnailManager::ThumbnailMedium), |
40 mMDSLoadInProgress(false) |
37 mMDSLoadInProgress(false), |
|
38 mMode(0) |
41 { |
39 { |
42 // TX_ENTRY |
40 // TX_ENTRY |
43 Q_UNUSED(parent); |
41 Q_UNUSED(parent); |
|
42 |
44 mWrapper->setThumbnailSize( mThumbnailsize ); |
43 mWrapper->setThumbnailSize( mThumbnailsize ); |
45 mWrapper->setQualityPreference( ThumbnailManager::OptimizeForPerformance ); |
44 mWrapper->setQualityPreference( ThumbnailManager::OptimizeForPerformance ); |
46 |
45 |
47 QObject::connect( mWrapper, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), |
46 QObject::connect( mWrapper, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ), |
48 this, SLOT( thumbnailReady( QPixmap , void* , int , int ))); |
47 this, SLOT( thumbnailReady( QPixmap , void* , int , int ))); |
64 // TX_ENTRY |
62 // TX_ENTRY |
65 // we could remove all icons from cache and put default ones, but probably that would be waste of time, and it's better just to load new icons with correct sizes. |
63 // we could remove all icons from cache and put default ones, but probably that would be waste of time, and it's better just to load new icons with correct sizes. |
66 mThumbnailsize = aThumbnailsize; |
64 mThumbnailsize = aThumbnailsize; |
67 mWrapper->setThumbnailSize( mThumbnailsize ); |
65 mWrapper->setThumbnailSize( mThumbnailsize ); |
68 // TX_EXIT |
66 // TX_EXIT |
|
67 } |
|
68 |
|
69 void MyDataProvider::changeMode(int mode) |
|
70 { |
|
71 if(mMode!=mode){ |
|
72 mMode = mode; |
|
73 resetModel(); |
|
74 } |
69 } |
75 } |
70 |
76 |
71 void MyDataProvider::doRequestData(QList<int> list, bool silent) |
77 void MyDataProvider::doRequestData(QList<int> list, bool silent) |
72 { |
78 { |
73 TX_ENTRY |
79 TX_ENTRY |
219 CMdESession* session = CMdESession::NewL( *this ); |
225 CMdESession* session = CMdESession::NewL( *this ); |
220 mScheduler->Start(); |
226 mScheduler->Start(); |
221 |
227 |
222 CMdENamespaceDef& namespaceDef = session->GetDefaultNamespaceDefL(); |
228 CMdENamespaceDef& namespaceDef = session->GetDefaultNamespaceDefL(); |
223 |
229 |
224 CMdEObjectDef& objectDef = namespaceDef.GetObjectDefL(_L("Image")); |
230 CMdEObjectQuery* imageQuery; |
225 |
231 if ( mMode == 0){ |
226 CMdEObjectQuery* imageQuery = session->NewObjectQueryL( namespaceDef, objectDef, this ); |
232 CMdEObjectDef& objectDef = namespaceDef.GetObjectDefL(_L("Image")); |
|
233 imageQuery = session->NewObjectQueryL( namespaceDef, objectDef, this ); |
|
234 } else { |
|
235 CMdEObjectDef& objectDef = namespaceDef.GetObjectDefL(_L("Audio")); |
|
236 imageQuery = session->NewObjectQueryL( namespaceDef, objectDef, this ); |
|
237 } |
|
238 |
227 CleanupStack::PushL( imageQuery ); |
239 CleanupStack::PushL( imageQuery ); |
228 imageQuery->SetResultMode( EQueryResultModeId ); |
240 imageQuery->SetResultMode( EQueryResultModeId ); |
229 imageQuery->FindL( ); |
241 imageQuery->FindL( ); |
230 mScheduler->Start(); |
242 mScheduler->Start(); |
231 CleanupStack::PopAndDestroy( 1 ); |
243 CleanupStack::PopAndDestroy( 1 ); |