libsaria: Created a library::Renderer class

The UI should inherit from this class to create a driver used to control
the library.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-03-12 08:21:32 -04:00
parent ae9074103a
commit 111e8f2c3b
4 changed files with 47 additions and 7 deletions

View File

@ -10,6 +10,18 @@ namespace libsaria
namespace library
{
struct Path {
string path;
};
class Renderer {
public:
Renderer();
~Renderer();
virtual void path_added(Path *) = 0;
};
void set_renderer(Renderer *);
void add_path(string);
/*namespace iter

View File

@ -10,9 +10,9 @@ using namespace std;
#include <libsaria/library.h>
#include <libsaria/playlist.h>
#include <libsaria/stack.h>*/
#include "library.h"
list<struct LibraryPath> path_list;
static list<struct libsaria::library::Path> path_list;
static libsaria::library::Renderer *renderer;
/*list<libsaria::LibraryPath> path_list;
libsaria::Playlist lib_playlist(PL_RANDOM | PL_SEQUENTIAL | PL_FILTER);
static map<sid_t, libsaria::Track *> lookup_map;
@ -35,6 +35,11 @@ static void do_update(libsaria::LibraryPath *path):
*/
namespace libsaria
{
void library::set_renderer(Renderer *render)
{
renderer = render;
}
/*
void library::init()
{
@ -75,9 +80,11 @@ namespace libsaria
*/
void library::add_path(string dir)
{
struct LibraryPath path;
struct Path path;
path.path = dir;
path_list.push_back(path);
if (renderer)
renderer->path_added(&path);
}
/*
void library::remove_path(string dir)

View File

@ -1,12 +1,12 @@
#ifndef LIBSARIA_LIBRARY_SOURCE_H
#define LIBSARIA_LIBRARY_SOURCE_H
#include <string>
/*#include <string>
using namespace std;
struct LibraryPath {
*/
/*struct LibraryPath {
string path;
};
};*/
/*#include <list>
using namespace std;

View File

@ -0,0 +1,21 @@
// Copyright (c) 2011 Bryan Schumaker.
#include <libsaria/library.h>
namespace libsaria
{
namespace library
{
Renderer::Renderer()
{
}
Renderer::~Renderer()
{
}
}; /* Namespace: library */
}; /* Namespace: libsaria */