--- a/qtinternetradio/irqfavoritesdb/inc/irqfavoritesdb.h Mon May 03 12:25:23 2010 +0300
+++ b/qtinternetradio/irqfavoritesdb/inc/irqfavoritesdb.h Fri May 14 15:43:29 2010 +0300
@@ -18,17 +18,26 @@
#define IRQFAVORITESDB_H
#include <QObject>
-#include <pspresetobserver.h>
+
+#include "irqfavoritesdbexporter.h"
-class CIRFavoritesDb;
class IRQPreset;
+class IRQFavoritesDBPrivate;
-class IRQFavoritesDB : public QObject, public MPSPresetObserver
+class IRQFAVORITES_DLL_EXPORT IRQFavoritesDB : public QObject
{
Q_OBJECT
public:
+ enum PSReason
+ {
+ PSCreated,
+ PSDeleted,
+ PSModified
+ };
+
+public:
- IMPORT_C IRQFavoritesDB();
+ IRQFavoritesDB();
~IRQFavoritesDB();
@@ -36,105 +45,96 @@
* @param IRQPreset& the isds preset,
* @return errcode
*/
- IMPORT_C int addPreset(const IRQPreset& aPreset);
+ int addPreset(const IRQPreset& aPreset);
/* add a preset manually
* @return errcode
* @param
*/
- IMPORT_C int addPreset(const QString& aName, const QString& aURL);
+ int addPreset(const QString& aName, const QString& aURL);
/* get a preset uniq id
* @return
* @param
*/
- IMPORT_C int getUniqId(int aNum);
+ int getUniqId(int aNum) const;
+
/* delete a preset by uniq id
* @return errcode
* @param
*/
- IMPORT_C int deletePreset(int aUniqId);
+ int deletePreset(int aUniqId);
+
/* search a preset by uniqpresetId / isdspresetid
* warning: the function needs further checking
* @return errcode
*/
- IMPORT_C int searchPreset(int aUniqPresetId, int aIsdsPresetId);
+ int searchPreset(int aUniqPresetId, int aIsdsPresetId);
/* get the previouse preset index in the internal list
* @return the index
*/
- IMPORT_C int getPreviousPreset(int aIndex);
+ int getPreviousPreset(int aIndex);
/* get the next preset index
* @return the index
*/
- IMPORT_C int getNextPreset(int aIndex);
+ int getNextPreset(int aIndex);
/* replace with new preset
* @return errcode
*/
- IMPORT_C int replacePreset(const IRQPreset& aNewPreset);
+ int replacePreset(const IRQPreset& aNewPreset);
/* @return errcode
*/
- IMPORT_C int replaceUserDefinedPreset(const IRQPreset& aNewPreset);
+ int replaceUserDefinedPreset(const IRQPreset& aNewPreset);
/* change the preset type to user defined
* @return errcode
*/
- IMPORT_C int makePresetUserDefined(int aChannelId,
- int aUserDefinedChannelId);
+ int makePresetUserDefined(int aChannelId, int aUserDefinedChannelId);
/* get the empty preset left count
* @return the count of empty presets left
*/
- IMPORT_C int emptyPresetCount() const;
+ int emptyPresetCount() const;
/* get the max preset count supported now
* @return errcode
*/
- IMPORT_C int maxPresetCount();
+ int maxPresetCount();
/* the interface is not used currently.
**/
- IMPORT_C void setMoveStatus(bool aStatus);
+ void setMoveStatus(bool aStatus);
/* the interface is not used currently
*/
- IMPORT_C bool getMoveStatus();
+ bool getMoveStatus();
/* for CIRPreset is just an interface so we can wrapper it into the IRQPreset.
* the interface get the IRQPreset list. The upper layer will free all the items
* in the list and the list self*/
- IMPORT_C QList<IRQPreset*>* getPresets() const;
+ QList<IRQPreset*>* getPresets() const;
/*
* Increase the played times of the preset if it's in the favorites
*/
- IMPORT_C void increasePlayedTimes(const IRQPreset &aPreset);
+ void increasePlayedTimes(const IRQPreset &aPreset);
- /*
- * get the CIRFavoritesDb
- */
- IMPORT_C CIRFavoritesDb * getCIRFavoriteDB() const;
-
signals:
/*
* the signal will triggered when we receive the message that preset is changed
*/
- void presetChanged(int aId, TUid aDataHandler,
- MPSPresetObserver::TPSReason aType);
+ void presetChanged(int aId, int aDataHandler, PSReason aReason);
private:
- CIRFavoritesDb * iIRFavoritesDb;
- void addPresetL(const IRQPreset& aPreset, int& aRetValue);
- void replacePresetL(const IRQPreset& aNewPreset);
- void replaceUserDefinedPresetL(const IRQPreset& aNewPreset);
- void increasePlayedTimesL(const IRQPreset &aPreset);
+ IRQFavoritesDBPrivate * const d_ptr;
+
+ Q_DISABLE_COPY(IRQFavoritesDB)
-private:
- /* from MPSPresetObserver */
- void HandlePresetChangedL(TInt aId, TUid aDataHandler,
- MPSPresetObserver::TPSReason aType);
+ friend class IRQFavoritesDBPrivate;
};
+
#endif