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