hgcacheproxymodel/tsrc/fute/HgCacheProxyModelTestApp/src/mydataprovider.h
changeset 1 e48454f237ca
child 3 c863538fcbb6
equal deleted inserted replaced
0:89c329efa980 1:e48454f237ca
       
     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 *  Version     : %version: 1 %
       
    17 */
       
    18 #ifndef MYDATAPROVIDER2_H
       
    19 #define MYDATAPROVIDER2_H
       
    20 
       
    21 #include <QtGui>
       
    22 
       
    23 #include <thumbnailmanager_qt.h>
       
    24 #include <hgwidgets/hgdataprovidermodel.h>
       
    25 #include <QList>
       
    26 #include <QPair>
       
    27 #include <mdesession.h>
       
    28 #include <mdequery.h>
       
    29 #include "flogger.h"
       
    30 
       
    31 class HbIcon;
       
    32 class CMdESession;
       
    33 class CActiveSchedulerWait;
       
    34 class QEventLoop;
       
    35 
       
    36 class MyDataProvider : public HgDataProviderModel, public MMdESessionObserver, public MMdEQueryObserver
       
    37 {
       
    38     Q_OBJECT
       
    39 
       
    40 public:
       
    41     MyDataProvider(QObject *parent = 0);
       
    42     ~MyDataProvider();
       
    43     void changeIconSize(ThumbnailManager::ThumbnailSize aThumbnailsize);
       
    44 	
       
    45 //from MMdESessionObserver and MMdEQueryObserver
       
    46     virtual void HandleSessionOpened(CMdESession& aSession, TInt aError);
       
    47     virtual void HandleSessionError(CMdESession& , TInt ){};
       
    48     virtual void HandleQueryNewResults(CMdEQuery& , TInt ,TInt ){};
       
    49     virtual void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError);
       
    50 	
       
    51 //from HgDataProviderModel
       
    52     virtual void doReleaseData(QList<int> list, bool silent);
       
    53     virtual void doRequestData(QList<int> list, bool silent);  
       
    54     virtual QVariant defaultIcon() const;    
       
    55 
       
    56 protected:
       
    57     virtual void doResetModel();
       
    58     
       
    59 public slots:
       
    60     void thumbnailReady( QPixmap , void* , int, int ); 
       
    61 
       
    62 private:
       
    63     void getNextThumbnail();
       
    64     void readMDSData();
       
    65 	
       
    66 private:
       
    67     HbIcon* mDefaultIcon;
       
    68     CActiveSchedulerWait* mScheduler;
       
    69     ThumbnailManager* mWrapper;
       
    70     QList<int> mWaitingThumbnails;
       
    71     bool mThumbnailRequestPending;
       
    72     int mThumbnailRequestIndex;
       
    73     int mThumbnailRequestID;
       
    74 	ThumbnailManager::ThumbnailSize mThumbnailsize;
       
    75 	bool mMDSLoadInProgress;
       
    76 };
       
    77 
       
    78 #endif // MYDATAPROVIDER2_H
       
    79