Queue: Remove _del_at

I merged it with _del(index) since they are for exactly the same thing.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2014-12-09 08:48:27 -05:00
parent 39eb22f05c
commit 0758f08642
2 changed files with 16 additions and 22 deletions

View File

@ -142,13 +142,6 @@ unsigned int Queue :: _add_at(Track *track, unsigned int pos)
return pos; return pos;
} }
void Queue :: _del_at(Track *track, unsigned int pos)
{
_tracks.erase(_tracks.begin() + pos);
_length -= track->length();
get_callbacks()->on_queue_track_del(this, pos);
}
unsigned int Queue :: add(Track *track) unsigned int Queue :: add(Track *track)
{ {
unsigned int id = _tracks.size(); unsigned int id = _tracks.size();
@ -157,19 +150,21 @@ unsigned int Queue :: add(Track *track)
return _add_at(track, id); return _add_at(track, id);
} }
void Queue :: del(unsigned int index)
{
_length -= _tracks[index]->length();
_tracks.erase(_tracks.begin() + index);
get_callbacks()->on_queue_track_del(this, index);
}
void Queue :: del(Track *track) void Queue :: del(Track *track)
{ {
for (unsigned int i = 0; i < _tracks.size(); i++) { for (unsigned int i = 0; i < _tracks.size(); i++) {
if (_tracks[i] == track) while ((i < _tracks.size()) && (_tracks[i] == track))
_del_at(track, i); del(i);
} }
} }
void Queue :: del(unsigned int index)
{
_del_at(_tracks[index], index);
}
void Queue :: updated(Track *track) void Queue :: updated(Track *track)
{ {
for (unsigned int i = 0; i < _tracks.size(); i++) { for (unsigned int i = 0; i < _tracks.size(); i++) {

View File

@ -67,7 +67,6 @@ protected:
unsigned int find_sorted_id(Track *); unsigned int find_sorted_id(Track *);
unsigned int _add_at(Track *, unsigned int); unsigned int _add_at(Track *, unsigned int);
void _del_at(Track *, unsigned int);
public: public:
/** /**
@ -127,13 +126,6 @@ public:
*/ */
virtual unsigned int add(Track *); virtual unsigned int add(Track *);
/**
* Remove all instances of a track from the queue.
*
* @param track Track to remove from the queue.
*/
virtual void del(Track *);
/** /**
* Remove a track based on its queue index. * Remove a track based on its queue index.
* *
@ -141,6 +133,13 @@ public:
*/ */
virtual void del(unsigned int); virtual void del(unsigned int);
/**
* Remove all instances of a track from the queue.
*
* @param track Track to remove from the queue.
*/
virtual void del(Track *);
/** /**
* Signal to the queue that a track has been updated. * Signal to the queue that a track has been updated.
* *