Changeset 15


Ignore:
Timestamp:
12/29/07 16:53:59 (4 years ago)
Author:
sander
Message:

Some minor things and a memleak

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • gui/playlisttablemodel.cpp

    r9 r15  
    66{ 
    77    songs = new QList<Song *>; 
    8     song_id = 0; 
     8    song_id = -1; 
    99} 
    1010 
     
    7777void PlaylistTableModel::updateCurrentSong(quint32 id) 
    7878{ 
    79     quint32 oldIndex = 0; 
     79    qint32 oldIndex = -1; 
    8080 
    8181    oldIndex = song_id; 
    8282    song_id = id; 
    8383 
    84     if(oldIndex != 0) 
     84    if(oldIndex != -1) 
    8585        emit dataChanged(index(songIdToRow(oldIndex), 0), index(songIdToRow(oldIndex), 2)); 
    8686 
     
    9191{ 
    9292    // Update song list and refresh model 
     93    while(this->songs->size()) 
     94        delete this->songs->takeLast(); 
     95 
    9396    delete this->songs; 
     97 
    9498    this->songs = songs; 
    9599    reset(); 
    96100} 
    97101 
    98 quint32 PlaylistTableModel::getIdByRow(quint32 row) const 
     102qint32 PlaylistTableModel::getIdByRow(qint32 row) const 
    99103{ 
    100104    if(songs->size() <= row) { 
     
    105109} 
    106110 
    107 qint32 PlaylistTableModel::songIdToRow(quint32 id) 
     111qint32 PlaylistTableModel::songIdToRow(qint32 id) 
    108112{ 
    109113    for(qint32 i = 0; i < songs->size(); i++) { 
  • gui/playlisttablemodel.h

    r9 r15  
    1919        QVariant data(const QModelIndex &, int) const; 
    2020        void updateCurrentSong(quint32 id); 
    21         quint32 getIdByRow(quint32 row) const; 
     21        qint32 getIdByRow(qint32 row) const; 
    2222 
    2323    public slots: 
     
    2626    private: 
    2727        QList<Song *> *songs; 
    28         quint32 song_id; 
     28        qint32 song_id; 
    2929 
    30         qint32 songIdToRow(quint32 id); 
     30        qint32 songIdToRow(qint32 id); 
    3131}; 
    3232 
  • lib/song.cpp

    r3 r15  
    33Song::Song() 
    44{ 
    5     id = 0; 
     5    id = -1; 
    66    time = 0; 
    77    track = 0; 
  • lib/song.h

    r3 r15  
    88{ 
    99    public: 
    10         quint32 id; 
     10        qint32 id; 
    1111        QString file; 
    1212        quint32 time; 
Note: See TracChangeset for help on using the changeset viewer.