qtinternetradio/irqfavoritesdb/inc/irqfavoritesdb.h
changeset 0 09774dfdd46b
child 3 ee64f059b8e1
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     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 #ifndef IRQFAVORITESDB_H
       
    18 #define IRQFAVORITESDB_H
       
    19 
       
    20 #include <QObject>
       
    21 #include <pspresetobserver.h> 
       
    22 
       
    23 class CIRFavoritesDb;
       
    24 class IRQPreset;
       
    25 
       
    26 class IRQFavoritesDB : public QObject, public MPSPresetObserver
       
    27 {
       
    28 Q_OBJECT
       
    29 public:
       
    30 
       
    31     IMPORT_C IRQFavoritesDB();
       
    32 
       
    33     ~IRQFavoritesDB();
       
    34 
       
    35     /* add a preset 
       
    36      * @param IRQPreset& the isds preset,
       
    37      * @return  errcode
       
    38      */
       
    39     IMPORT_C int addPreset(const IRQPreset& aPreset);
       
    40 
       
    41     /* add a preset manually
       
    42      * @return  errcode
       
    43      * @param 
       
    44      */
       
    45     IMPORT_C int addPreset(const QString& aName, const QString& aURL);
       
    46 
       
    47     /* get a preset uniq id
       
    48      * @return 
       
    49      * @param
       
    50      */
       
    51     IMPORT_C int getUniqId(int aNum);
       
    52     /* delete a preset by uniq id
       
    53      * @return errcode
       
    54      * @param
       
    55      */
       
    56     IMPORT_C int deletePreset(int aUniqId);
       
    57     /* search a preset by uniqpresetId / isdspresetid
       
    58      * warning: the function needs further checking
       
    59      *  @return errcode
       
    60      */
       
    61     IMPORT_C int searchPreset(int aUniqPresetId, int aIsdsPresetId);
       
    62 
       
    63     /* get the previouse preset index in the internal list
       
    64      * @return the index
       
    65      */
       
    66     IMPORT_C int getPreviousPreset(int aIndex);
       
    67 
       
    68     /* get the next preset index
       
    69      * @return the index
       
    70      */
       
    71     IMPORT_C int getNextPreset(int aIndex); 
       
    72 
       
    73     /* replace with new preset
       
    74      * @return errcode 
       
    75      */
       
    76     IMPORT_C int replacePreset(const IRQPreset& aNewPreset);
       
    77 
       
    78     /* @return errcode
       
    79      */
       
    80     IMPORT_C int replaceUserDefinedPreset(const IRQPreset& aNewPreset);
       
    81 
       
    82     /* change the preset type to user defined
       
    83      * @return errcode
       
    84      */
       
    85     IMPORT_C int makePresetUserDefined(int aChannelId,
       
    86             int aUserDefinedChannelId);
       
    87 
       
    88     /* get the empty preset left count
       
    89      * @return the count of empty presets left 
       
    90      */
       
    91     IMPORT_C int emptyPresetCount() const;
       
    92 
       
    93     /* get the max preset count supported now
       
    94      * @return errcode 
       
    95      */
       
    96     IMPORT_C int maxPresetCount();
       
    97 
       
    98     /* the interface is not used currently.
       
    99      **/
       
   100     IMPORT_C void setMoveStatus(bool aStatus);
       
   101 
       
   102     /* the interface is not used currently 
       
   103      */
       
   104     IMPORT_C bool getMoveStatus();
       
   105 
       
   106     /* for CIRPreset is just an interface so we can wrapper it into the IRQPreset.
       
   107      * the interface get the IRQPreset list. The upper layer will free all the items
       
   108      * in the list and the list self*/
       
   109     IMPORT_C QList<IRQPreset*>* getPresets() const;
       
   110 
       
   111     /*
       
   112      * Increase the played times of the preset if it's in the favorites
       
   113      */
       
   114     IMPORT_C void increasePlayedTimes(const IRQPreset &aPreset);
       
   115     
       
   116     /*
       
   117      * get the CIRFavoritesDb 
       
   118      */
       
   119     IMPORT_C CIRFavoritesDb * getCIRFavoriteDB() const;
       
   120 
       
   121 signals:
       
   122     /*
       
   123      * the signal will triggered when we receive the message that preset is changed
       
   124      */
       
   125     void presetChanged(int aId, TUid aDataHandler,
       
   126             MPSPresetObserver::TPSReason aType);
       
   127 
       
   128 private:
       
   129     CIRFavoritesDb * iIRFavoritesDb;
       
   130     void addPresetL(const IRQPreset& aPreset, int& aRetValue);
       
   131     void replacePresetL(const IRQPreset& aNewPreset);
       
   132     void replaceUserDefinedPresetL(const IRQPreset& aNewPreset);
       
   133     void increasePlayedTimesL(const IRQPreset &aPreset);
       
   134     
       
   135 private:
       
   136     /* from MPSPresetObserver */
       
   137     void HandlePresetChangedL(TInt aId, TUid aDataHandler,
       
   138             MPSPresetObserver::TPSReason aType);
       
   139 };
       
   140 #endif