qtinternetradio/ui/inc/irchanneldataprovider.h
changeset 15 065198191975
equal deleted inserted replaced
14:896e9dbc5f19 15:065198191975
       
     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 */
       
    17 
       
    18 #ifndef IRCHANNELDATAPROVIDER_H
       
    19 #define IRCHANNELDATAPROVIDER_H
       
    20 
       
    21 #include <hgwidgets/hgdataprovidermodel.h>
       
    22 
       
    23 class IRQChannelItem;
       
    24 class IRQPreset;
       
    25 class IRQIsdsClient;
       
    26 
       
    27 const int KCacheSize = 50;
       
    28 const int KCacheThreshold = 20;
       
    29 
       
    30 class IRChannelDataProvider : public HgDataProviderModel
       
    31 {
       
    32 Q_OBJECT
       
    33     
       
    34 public:
       
    35     IRChannelDataProvider(QObject *aParent);
       
    36     ~IRChannelDataProvider();
       
    37     
       
    38     void activate();
       
    39     void deactivate();
       
    40     IRQChannelItem* getChannelItemByIndex(int aIndex);
       
    41     
       
    42 signals:
       
    43     void dataAvailable();
       
    44 
       
    45 protected:
       
    46     //from HgDataProviderModel
       
    47     void doReleaseData(QList<int> aList, bool aSilent);
       
    48     void doRequestData(QList<int> aList, bool aSilent);  
       
    49     QVariant defaultIcon() const;  
       
    50     void doResetModel();
       
    51     
       
    52 private slots:
       
    53     void updateData(QList<IRQChannelItem*> *aPushItemsList);
       
    54     void presetLogoDownload(IRQPreset* aPreset);
       
    55     void presetLogoDownloadError();
       
    56     void downloadNextLogo();
       
    57     
       
    58 private:
       
    59     void startDownloading(int aIndex);
       
    60     void clearAndDestroyItems();
       
    61     void clearAndDestroyLogos();
       
    62     
       
    63 private:
       
    64     QList<IRQChannelItem*> *iChannelList;
       
    65     QVariant iDefaultLogo;
       
    66     QMap<int, HbIcon*>     iLogos;  //save the downloaded logos
       
    67     QList<int> iRequestedItems; //save the indexes of requested items
       
    68     IRQPreset *iLogoPreset;
       
    69     QTimer *iLogoDownloadTimer;
       
    70     IRQIsdsClient *iIsdsClient;
       
    71     
       
    72     bool iActivated;
       
    73 };
       
    74 
       
    75 #endif