libsaria: Created a playlist renderer
This class will be given a Playlist and will be in charge of calling Playlist functions. I eventually plan on expanding this to allow the playlist to call renderer functions instead of using my current callback system. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
d8b6f5b0a0
commit
f795af5d6c
|
@ -2,6 +2,7 @@
|
|||
#define LIBSARIA_LIBRARY_H
|
||||
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/playlist.h>
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
@ -52,6 +53,8 @@ namespace libsaria
|
|||
void sort_list();
|
||||
void filter(string &text);
|
||||
bool is_visible(sid_t &);
|
||||
|
||||
Playlist *get_playlist();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef LIBSARIA_QUEUE_H
|
||||
#define LIBSARIA_QUEUE_H
|
||||
|
||||
#include <libsaria/playlist.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <list>
|
||||
using namespace std;
|
||||
|
@ -23,6 +24,8 @@ namespace libsaria
|
|||
|
||||
void save();
|
||||
void load();
|
||||
|
||||
Playlist *get_playlist();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef LIBSARIA_PLAYLIST_RENDERER_H
|
||||
#define LIBSARIA_PLAYLIST_RENDERER_H
|
||||
|
||||
#include <libsaria/playlist.h>
|
||||
|
||||
namespace libsaria
|
||||
{
|
||||
|
||||
class PlaylistRenderer {
|
||||
private:
|
||||
Playlist *playlist;
|
||||
|
||||
public:
|
||||
PlaylistRenderer();
|
||||
~PlaylistRenderer();
|
||||
|
||||
void set_playlist(Playlist *);
|
||||
};
|
||||
|
||||
}; /* Namespace: libsaria */
|
||||
|
||||
#endif /* LIBSARIA_PLAYLIST_RENDERER_H */
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <ocarina/gtk.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/playlist.h>
|
||||
#include <libsaria/renderer.h>
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
@ -30,7 +32,7 @@ struct SongListFuncs
|
|||
bool (*iter_end)();
|
||||
};
|
||||
|
||||
class SongList
|
||||
class SongList : public libsaria::PlaylistRenderer
|
||||
{
|
||||
private:
|
||||
int ins_next;
|
||||
|
@ -53,6 +55,7 @@ class SongList
|
|||
|
||||
public:
|
||||
SongList();
|
||||
SongList(libsaria::Playlist *);
|
||||
~SongList();
|
||||
|
||||
void init(string, SongListFuncs *, list<MenuItem> *, bool);
|
||||
|
|
|
@ -93,5 +93,9 @@ namespace libsaria
|
|||
return it->second;
|
||||
}
|
||||
|
||||
Playlist *library::get_playlist()
|
||||
{
|
||||
return &lib_playlist;
|
||||
}
|
||||
|
||||
}; /* namespace: libsaria */
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) 2012 Bryan Schumaker.
|
||||
#include <libsaria/renderer.h>
|
||||
|
||||
namespace libsaria
|
||||
{
|
||||
|
||||
PlaylistRenderer::PlaylistRenderer()
|
||||
{
|
||||
playlist = NULL;
|
||||
}
|
||||
|
||||
PlaylistRenderer::~PlaylistRenderer()
|
||||
{
|
||||
}
|
||||
|
||||
void PlaylistRenderer::set_playlist(Playlist *plist)
|
||||
{
|
||||
playlist = plist;
|
||||
}
|
||||
|
||||
}; /* Namespace: libsaria */
|
|
@ -64,4 +64,9 @@ namespace libsaria
|
|||
return q_queue.iter_end();
|
||||
}
|
||||
|
||||
Playlist *queue::get_playlist()
|
||||
{
|
||||
return &q_queue;
|
||||
}
|
||||
|
||||
} /* Namespace: libsaria */
|
||||
|
|
|
@ -57,6 +57,7 @@ namespace ocarina
|
|||
|
||||
register_shortcut("q", add_to_queue);
|
||||
|
||||
library_list.set_playlist(libsaria::library::get_playlist());
|
||||
library_list.init("Library", &library_funcs, &library_menu, true);
|
||||
add_page(library_list.get_label(), library_list.get_window(), true);
|
||||
ocarina::library::refresh();
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace ocarina
|
|||
|
||||
register_shortcut("Delete", rm_from_queue);
|
||||
|
||||
queue_list.set_playlist(libsaria::queue::get_playlist());
|
||||
queue_list.init("Queue", &queue_funcs, &queue_menu, false);
|
||||
queue_index = add_page(queue_list.get_label(),
|
||||
queue_list.get_window(), true);
|
||||
|
|
Loading…
Reference in New Issue