radioapp/radiouiengine/src/radiohistorymodel.cpp
branchGCC_SURGE
changeset 37 451b2e1545b2
parent 19 afea38384506
parent 32 189d20c34778
equal deleted inserted replaced
26:6bcf277166c1 37:451b2e1545b2
    33  */
    33  */
    34 RadioHistoryModel::RadioHistoryModel( RadioUiEngine& uiEngine ) :
    34 RadioHistoryModel::RadioHistoryModel( RadioUiEngine& uiEngine ) :
    35     QAbstractListModel( &uiEngine ),
    35     QAbstractListModel( &uiEngine ),
    36     d_ptr( new RadioHistoryModelPrivate( this, uiEngine ) )
    36     d_ptr( new RadioHistoryModelPrivate( this, uiEngine ) )
    37 {
    37 {
    38     connectAndTest( &uiEngine,  SIGNAL(tunedToFrequency(uint,int)),
    38     Radio::connect( &uiEngine,  SIGNAL(tunedToFrequency(uint,int)),
    39                     this,       SLOT(resetCurrentSong()) );
    39                     this,       SLOT(resetCurrentSong()) );
    40     connectAndTest( &uiEngine,  SIGNAL(seekingStarted(int)),
    40     Radio::connect( &uiEngine,  SIGNAL(seekingStarted(int)),
    41                     this,       SLOT(resetCurrentSong()) );
    41                     this,       SLOT(resetCurrentSong()) );
    42 
    42 
    43     Q_D( RadioHistoryModel );
    43     Q_D( RadioHistoryModel );
    44     d->connectToDatabase();
    44     d->connectToDatabase();
    45 }
    45 }
    47 /*!
    47 /*!
    48  *
    48  *
    49  */
    49  */
    50 RadioHistoryModel::~RadioHistoryModel()
    50 RadioHistoryModel::~RadioHistoryModel()
    51 {
    51 {
    52     Q_D( RadioHistoryModel );
       
    53     delete d_ptr;
       
    54 }
    52 }
    55 
    53 
    56 /*!
    54 /*!
    57  * \reimp
    55  * \reimp
    58  */
    56  */
    85     d->mTopItemIsPlaying = false;
    83     d->mTopItemIsPlaying = false;
    86     emit currentSongReset();
    84     emit currentSongReset();
    87 }
    85 }
    88 
    86 
    89 /*!
    87 /*!
    90  * Public slot
       
    91  */
       
    92 void RadioHistoryModel::removeAll()
       
    93 {
       
    94     Q_D( RadioHistoryModel );
       
    95     d->removeAll();
       
    96 }
       
    97 
       
    98 /*!
       
    99  * Sets the icons to be used in the list
    88  * Sets the icons to be used in the list
   100  */
    89  */
   101 void RadioHistoryModel::setIcons( const QIcon& nonTaggedIcon, const QIcon& taggedIcon )
    90 void RadioHistoryModel::setIcons( const QIcon& nonTaggedIcon, const QIcon& taggedIcon )
   102 {
    91 {
   103     Q_D( RadioHistoryModel );
    92     Q_D( RadioHistoryModel );
   129  */
   118  */
   130 void RadioHistoryModel::setShowTagged( bool showTagged )
   119 void RadioHistoryModel::setShowTagged( bool showTagged )
   131 {
   120 {
   132     Q_D( RadioHistoryModel );
   121     Q_D( RadioHistoryModel );
   133     d->setViewMode( showTagged ? RadioHistoryModelPrivate::ShowTagged : RadioHistoryModelPrivate::ShowAll );
   122     d->setViewMode( showTagged ? RadioHistoryModelPrivate::ShowTagged : RadioHistoryModelPrivate::ShowAll );
       
   123     reset();
   134 }
   124 }
   135 
   125 
   136 /*!
   126 /*!
   137  *
   127  *
   138  */
   128  */
   147  */
   137  */
   148 RadioHistoryItem RadioHistoryModel::itemAtIndex( const QModelIndex& index ) const
   138 RadioHistoryItem RadioHistoryModel::itemAtIndex( const QModelIndex& index ) const
   149 {
   139 {
   150     Q_D( const RadioHistoryModel );
   140     Q_D( const RadioHistoryModel );
   151     return d->itemAtIndex( index );
   141     return d->itemAtIndex( index );
       
   142 }
       
   143 
       
   144 /*!
       
   145  *
       
   146  */
       
   147 void RadioHistoryModel::removeAll( bool removeTagged )
       
   148 {
       
   149     Q_D( RadioHistoryModel );
       
   150     d->removeAll( removeTagged );
   152 }
   151 }
   153 
   152 
   154 /*!
   153 /*!
   155  *
   154  *
   156  */
   155  */