libsaria: Tell playlist renderers to goto a specific index
I want to use this to scroll the library list when a new song is picked. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
5f7e5890c8
commit
acef058afa
|
@ -36,6 +36,7 @@ namespace libsaria
|
|||
|
||||
void incr_iter();
|
||||
Track *picked_next();
|
||||
unsigned int find_cur_index();
|
||||
|
||||
protected:
|
||||
string name;
|
||||
|
|
|
@ -20,6 +20,8 @@ namespace libsaria
|
|||
bool is_static();
|
||||
virtual void prepare_for_removal();
|
||||
|
||||
virtual void goto_index(unsigned int);
|
||||
|
||||
virtual void insert_prepare();
|
||||
virtual void insert(Track *, unsigned int);
|
||||
virtual void insert_done();
|
||||
|
|
|
@ -20,14 +20,14 @@ namespace libsaria
|
|||
Track *Playlist::picked_next()
|
||||
{
|
||||
Track *res = (*cur);
|
||||
unsigned int index = 0;
|
||||
list<Track *>::iterator it;
|
||||
unsigned int index;
|
||||
|
||||
if (flags & PL_NO_DRAIN)
|
||||
index = find_cur_index();
|
||||
|
||||
if (flags & PL_NO_DRAIN) {
|
||||
RENDER(goto_index(index));
|
||||
return res;
|
||||
|
||||
for (it = plist.begin(); it != cur; it++)
|
||||
index++;
|
||||
}
|
||||
|
||||
cur = plist.erase(cur);
|
||||
if (cur == plist.end())
|
||||
|
|
|
@ -59,4 +59,14 @@ namespace libsaria
|
|||
cur = plist.begin();
|
||||
}
|
||||
|
||||
unsigned int Playlist::find_cur_index()
|
||||
{
|
||||
list<Track *>::iterator it;
|
||||
unsigned int index = 0;
|
||||
|
||||
for (it = plist.begin(); it != cur; it++)
|
||||
index++;
|
||||
return index;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,4 +45,8 @@ namespace libsaria
|
|||
{
|
||||
}
|
||||
|
||||
void PlaylistRenderer::goto_index(unsigned int index)
|
||||
{
|
||||
}
|
||||
|
||||
}; /* Namespace: libsaria */
|
||||
|
|
Loading…
Reference in New Issue