radioapp/radiouiengine/inc/radiostation_p.h
branchGCC_SURGE
changeset 37 451b2e1545b2
parent 14 63aabac4416d
parent 32 189d20c34778
equal deleted inserted replaced
26:6bcf277166c1 37:451b2e1545b2
    17 
    17 
    18 #ifndef RADIOSTATIONINFO_P_H_
    18 #ifndef RADIOSTATIONINFO_P_H_
    19 #define RADIOSTATIONINFO_P_H_
    19 #define RADIOSTATIONINFO_P_H_
    20 
    20 
    21 // System includes
    21 // System includes
       
    22 #include <QSharedData>
    22 #include <QTime>
    23 #include <QTime>
    23 
    24 
    24 // User includes
    25 // User includes
    25 #include "radiostation.h"
    26 #include "radiostation.h"
    26 #include "radiostationif.h"
    27 #include "radiostationif.h"
    27 
    28 
    28 // Class declaration
    29 // Class declaration
    29 class RadioStationPrivate : public RadioStationIf
    30 class RadioStationPrivate : public QSharedData
       
    31                           , public RadioStationIf
    30 {
    32 {
    31 public:
    33 public:
    32 
    34 
    33     explicit RadioStationPrivate( int presetIndex = RadioStation::Invalid, uint frequency = 0 );
    35     explicit RadioStationPrivate( int presetIndex = RadioStation::Invalid, uint frequency = 0 );
    34     explicit RadioStationPrivate( RadioStation::PresetFlag flag );
    36     explicit RadioStationPrivate( const RadioStationPrivate& other );
    35 
    37 
    36     virtual ~RadioStationPrivate();
    38     virtual ~RadioStationPrivate();
    37 
    39 
    38     void init( int presetIndex, uint frequency = 0 );
    40     void init( int presetIndex, uint frequency = 0 );
    39 
    41 
    60     bool isLocalStation() const;
    62     bool isLocalStation() const;
    61     void setLocalStation( bool localStation );
    63     void setLocalStation( bool localStation );
    62 
    64 
    63 public: // data
    65 public: // data
    64 
    66 
    65     /**
       
    66      * Reference count used for implicit sharing.
       
    67      * Has to be named "ref" instead having the 'm' prefix like all other member variables in Radio
       
    68      * This is because convenience functions like qAtomicAssign() expect it to be named "ref"
       
    69      */
       
    70     QAtomicInt                  ref;
       
    71 
       
    72     // ========================================================================
    67     // ========================================================================
    73     // Persistent data. Saved to Central repository
    68     // Persistent data. Saved to Central repository
    74     // ========================================================================
    69     // ========================================================================
    75 
       
    76     /**
       
    77      * Station frequency. The most important bit of information about a radio station.
       
    78      * Is checked to be non-null in the isValid() function
       
    79      */
       
    80     uint                        mFrequency;
       
    81 
    70 
    82     /**
    71     /**
    83      * Station index in the Preset Utility.
    72      * Station index in the Preset Utility.
    84      * Negative values signify an invalid RadioStation that has not and will not be saved.
    73      * Negative values signify an invalid RadioStation that has not and will not be saved.
    85      * Initialized to -100 by default to indicate and invalid station.
    74      * Initialized to -100 by default to indicate and invalid station.
    86      */
    75      */
    87     int                         mPresetIndex;
    76     int                         mPresetIndex;
       
    77 
       
    78     /**
       
    79      * Station frequency. The most important bit of information about a radio station.
       
    80      * Is checked to be non-null in the isValid() function
       
    81      */
       
    82     uint                        mFrequency;
    88 
    83 
    89     /**
    84     /**
    90      * Station name. Contains a name that is set in one of the following ways:
    85      * Station name. Contains a name that is set in one of the following ways:
    91      *  1) Received through RDS as the stations PS name and station does not use dynamic PS
    86      *  1) Received through RDS as the stations PS name and station does not use dynamic PS
    92      *  2) Entered by the user. In this case the mRenamedByUser flag will be set and the name
    87      *  2) Entered by the user. In this case the mRenamedByUser flag will be set and the name