libsaria: Give playlists a name
Right now this must be set when a new playlist is constructed. I can eventually change this to use a default name based on what type of playlist has been created. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
cdd2fe1af5
commit
abac8883c3
|
@ -24,6 +24,7 @@ namespace libsaria
|
|||
unsigned int flags;
|
||||
|
||||
protected:
|
||||
string name;
|
||||
list<Track *> plist;
|
||||
/*bool del_renderer;
|
||||
unsigned int flags;
|
||||
|
@ -41,10 +42,13 @@ namespace libsaria
|
|||
void add_sorted(list<Track *> &);
|
||||
|
||||
public:
|
||||
Playlist(unsigned int);
|
||||
Playlist(string, unsigned int);
|
||||
//Playlist(string, unsigned int);
|
||||
~Playlist();
|
||||
|
||||
string &get_name();
|
||||
unsigned int get_size();
|
||||
|
||||
virtual void add_tracks(list<Track *> &) = 0;
|
||||
|
||||
/*void set_renderer(PlaylistRenderer *, bool);
|
||||
|
@ -72,7 +76,7 @@ namespace libsaria
|
|||
|
||||
class Set : public Playlist {
|
||||
public:
|
||||
Set(unsigned int);
|
||||
Set(string, unsigned int);
|
||||
~Set();
|
||||
|
||||
void add_tracks(list<Track *> &);
|
||||
|
|
|
@ -8,6 +8,8 @@ namespace libsaria
|
|||
class PlaylistRenderer {
|
||||
private:
|
||||
unsigned int flags;
|
||||
|
||||
protected:
|
||||
Playlist *playlist;
|
||||
|
||||
public:
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace ocarina
|
|||
private:
|
||||
GtkWidget *label;
|
||||
GtkWidget *box;
|
||||
void set_label_text();
|
||||
|
||||
public:
|
||||
Playlist(unsigned int);
|
||||
|
|
|
@ -16,7 +16,7 @@ using namespace std;
|
|||
|
||||
static list<struct libsaria::library::Path> path_list;
|
||||
list<libsaria::library::Driver *> driver_list;
|
||||
libsaria::Set lib_playlist(PL_STATIC | PL_NO_DRAIN);
|
||||
libsaria::Set lib_playlist("Library", PL_STATIC);
|
||||
/*list<libsaria::LibraryPath> path_list;
|
||||
libsaria::Playlist lib_playlist(PL_RANDOM | PL_SEQUENTIAL | PL_FILTER);
|
||||
static map<sid_t, libsaria::Track *> lookup_map;
|
||||
|
|
|
@ -40,8 +40,9 @@ namespace libsaria
|
|||
init_common(file, options);
|
||||
}*/
|
||||
|
||||
Playlist::Playlist(unsigned int f)
|
||||
Playlist::Playlist(string n, unsigned int f)
|
||||
{
|
||||
name = n;
|
||||
flags = f;
|
||||
}
|
||||
|
||||
|
@ -49,6 +50,16 @@ namespace libsaria
|
|||
{
|
||||
}
|
||||
|
||||
string &Playlist::get_name()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
unsigned int Playlist::get_size()
|
||||
{
|
||||
return plist.size();
|
||||
}
|
||||
|
||||
/*void Playlist::set_renderer(PlaylistRenderer *render, bool del_render)
|
||||
{
|
||||
renderer = render;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace libsaria
|
||||
{
|
||||
|
||||
Set::Set(unsigned int flags) : Playlist(flags)
|
||||
Set::Set(string name, unsigned int flags) : Playlist(name, flags)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace ocarina
|
|||
{
|
||||
tabs = gtk_notebook_new();
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tabs), GTK_POS_LEFT);
|
||||
g_object_set(tabs, "tab-border", 0, NULL);
|
||||
gtk_widget_show(tabs);
|
||||
return tabs;
|
||||
};
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
#include <ocarina/playlist.h>
|
||||
#include <ocarina/body.h>
|
||||
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
namespace ocarina
|
||||
{
|
||||
|
||||
|
@ -13,15 +16,28 @@ namespace ocarina
|
|||
{
|
||||
}
|
||||
|
||||
void Playlist::set_label_text()
|
||||
{
|
||||
string text;
|
||||
stringstream stream;
|
||||
|
||||
stream << playlist->get_name() << "\n";
|
||||
stream << playlist->get_size();
|
||||
text = stream.str();
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(label), text.c_str());
|
||||
}
|
||||
|
||||
void Playlist::set_playlist(libsaria::Playlist *p)
|
||||
{
|
||||
libsaria::PlaylistRenderer::set_playlist(p);
|
||||
|
||||
label = gtk_label_new("Label!\n11023");
|
||||
label = gtk_label_new("");
|
||||
box = gtk_vbox_new(FALSE, 0);
|
||||
gtk_widget_show(label);
|
||||
gtk_widget_show(box);
|
||||
|
||||
set_label_text();
|
||||
body::push_page(box, label);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue