ocarina/include/playlist.h
Bryan Schumaker cf8ded7d5d libsaria: Remove name field from playlists
I know what playlists are library, recent and banned.  All others are
just named "Playlist" so there is no need to set up a name variable.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-11-03 15:34:13 -04:00

105 lines
2.1 KiB
C++

// Copyright (c) 2012 Bryan Schumaker.
#ifndef LIBSARIA_PLAYLIST_H
#define LIBSARIA_PLAYLIST_H
#include <notify.h>
#include <index.h>
#include <fs.h>
#include <list>
#include <string>
#include <vector>
using namespace std;
enum PlaylistFlags {
PL_NONE = (0),
PL_NO_DRAIN = (1 << 0),
PL_STATIC = (1 << 1),
PL_DISABLED = (1 << 2),
PL_RANDOM = (1 << 3),
PL_SORTED = (1 << 4),
};
namespace libsaria
{
/* Forward declaration of Track class */
class Track;
class Playlist {
private:
int number;
unsigned int flags;
unsigned int length;
DataState data_state;
unsigned int cur;
Index index;
void set_flag(bool, PlaylistFlags);
void schedule_save();
void rm_file();
void notify_ui(notify_t, Track *, unsigned int);
void notify_update_all();
void incr_iter();
Track *picked_next();
unsigned int find_cur_index();
unsigned int find_index(Track *);
void add_track(Track *, unsigned int);
void insert_sorted(Track *);
void do_remove_tracks(list<Track *> &);
unsigned int remove_track_it(vector<Track *>::iterator it, unsigned int);
void do_sort();
protected:
vector<Track *> plist;
void pick_random();
void pick_sequential();
void add_sorted(list<Track *> &);
public:
Playlist(unsigned int);
virtual ~Playlist();
void push_front(Track *);
void push_back(Track *);
void push_back(list<Track *> &);
Track *next();
void set_random(bool);
bool get_random();
void set_sorted(bool);
bool get_sorted();
void save(ofstream &);
bool is_static();
bool is_disabled();
void prepare_for_removal();
void reset_iterator();
void set_filter_text(string &);
bool is_visible(libsaria::Track *);
void set_disabled(bool);
void renumber(int);
unsigned int get_number();
unsigned int get_size();
unsigned int get_length();
void remove_indices(list<unsigned int> &);
void remove_track(Track *);
void track_updated(Track *);
};
struct PlaylistNotification {
Playlist *plist;
Track *track;
unsigned int index;
};
}; /* Namespace: libsaria */
#endif /* LIBSARIA_PLAYLIST_H */