radioapp/radiouiengine/inc/radiostation_p.h
changeset 41 3a6b55c6390c
parent 32 189d20c34778
equal deleted inserted replaced
33:11b6825f0862 41:3a6b55c6390c
    30 class RadioStationPrivate : public QSharedData
    30 class RadioStationPrivate : public QSharedData
    31                           , public RadioStationIf
    31                           , public RadioStationIf
    32 {
    32 {
    33 public:
    33 public:
    34 
    34 
       
    35     /**
       
    36      * Flags to indicate various on/off type information of the radio station
       
    37      */
       
    38     enum StationInfoFlag
       
    39     {
       
    40        RenamedByUser        = 1 << 0,
       
    41        StationSendsRds      = 1 << 1,
       
    42        CallSignCheckDone    = 1 << 2
       
    43     };
       
    44     Q_DECLARE_FLAGS( StationInfo, StationInfoFlag )
       
    45 
    35     explicit RadioStationPrivate( int presetIndex = RadioStation::Invalid, uint frequency = 0 );
    46     explicit RadioStationPrivate( int presetIndex = RadioStation::Invalid, uint frequency = 0 );
    36     explicit RadioStationPrivate( const RadioStationPrivate& other );
    47     explicit RadioStationPrivate( const RadioStationPrivate& other );
    37 
    48 
    38     virtual ~RadioStationPrivate();
    49     virtual ~RadioStationPrivate();
    39 
    50 
    40     void init( int presetIndex, uint frequency = 0 );
    51     void init( int presetIndex, uint frequency = 0 );
    41 
       
    42 private:
       
    43 
    52 
    44 // from base class RadioStationIf
    53 // from base class RadioStationIf
    45 
    54 
    46     int presetIndex() const;
    55     int presetIndex() const;
    47     void setPresetIndex( int presetIndex );
    56     void setPresetIndex( int presetIndex );
    59     void setPiCode( int piCode );
    68     void setPiCode( int piCode );
    60     bool isFavorite() const;
    69     bool isFavorite() const;
    61     void setFavorite( bool favorite );
    70     void setFavorite( bool favorite );
    62     bool isLocalStation() const;
    71     bool isLocalStation() const;
    63     void setLocalStation( bool localStation );
    72     void setLocalStation( bool localStation );
       
    73     bool hasStationSentRds() const;
       
    74     void setStationHasSentRds( bool hasSentRds );
       
    75 
       
    76 // New functions
       
    77 
       
    78     bool isCallSignCheckDone() const;
       
    79     void setCallSignCheckDone( bool checkDone );
    64 
    80 
    65 public: // data
    81 public: // data
    66 
    82 
    67     // ========================================================================
    83     // ========================================================================
    68     // Persistent data. Saved to Central repository
    84     // Persistent data. Saved to Central repository
    88      *     cannot be changed until the user removes the renaming.
   104      *     cannot be changed until the user removes the renaming.
    89      *  3) Callsign calculated from the PI code can be set as the station name if the station
   105      *  3) Callsign calculated from the PI code can be set as the station name if the station
    90      *     does not send RDS information and the current region is America
   106      *     does not send RDS information and the current region is America
    91      */
   107      */
    92     QString                     mName;
   108     QString                     mName;
    93 
       
    94     /**
       
    95      * Flag to indicate whether or not the user has renamed the station
       
    96      */
       
    97     bool                        mRenamedByUser;
       
    98 
   109 
    99     /**
   110     /**
   100      * Station genre received through RDS
   111      * Station genre received through RDS
   101      */
   112      */
   102     int                         mGenre;
   113     int                         mGenre;
   159      * or reset. Used to decide which signals should be sent by the RadioStationModel when the station is saved.
   170      * or reset. Used to decide which signals should be sent by the RadioStationModel when the station is saved.
   160      */
   171      */
   161     RadioStation::Change        mChangeFlags;
   172     RadioStation::Change        mChangeFlags;
   162 
   173 
   163     /**
   174     /**
   164      * Keeps track of station call sign calculation state
       
   165      */
       
   166     bool                        mCallSignCheckDone;
       
   167 
       
   168     /**
       
   169      * Time of the last PS name change. Used to check if the station changes its PS name too often.
   175      * Time of the last PS name change. Used to check if the station changes its PS name too often.
   170      * In bad RDS coverage a station using dynamic PS might be incorrectly determined to use static PS.
   176      * In bad RDS coverage a station using dynamic PS might be incorrectly determined to use static PS.
   171      * This is a corrective effort to change that decision if the name changes too often.
   177      * This is a corrective effort to change that decision if the name changes too often.
   172      */
   178      */
   173     QTime                       mLastPsNameChangeTime;
   179     QTime                       mLastPsNameChangeTime;
   174 
   180 
       
   181     /**
       
   182      * Flags to indicate various on/off type information of the radio station
       
   183      */
       
   184     StationInfo                 mStationInfo;
       
   185 
   175 };
   186 };
   176 
   187 
       
   188 Q_DECLARE_OPERATORS_FOR_FLAGS( RadioStationPrivate::StationInfo )
       
   189 
   177 #endif // RADIOSTATIONINFO_P_H_
   190 #endif // RADIOSTATIONINFO_P_H_