libsaria: Rename playlist stack to playlist deck
I'm going to make it less stack-ish because I was getting confused. Turns out people don't think people have a hard time thinking about song order starting from the end... :-( Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
6f3397c1a4
commit
5194130db4
|
@ -9,7 +9,7 @@ using namespace std;
|
|||
namespace libsaria
|
||||
{
|
||||
|
||||
namespace stack
|
||||
namespace deck
|
||||
{
|
||||
|
||||
void push(Playlist *);
|
|
@ -3,7 +3,7 @@
|
|||
#include <libsaria/controls.h>
|
||||
#include <libsaria/print.h>
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/stack.h>
|
||||
#include <libsaria/deck.h>
|
||||
#include "audio.h"
|
||||
|
||||
GstElement *player = NULL;
|
||||
|
@ -38,7 +38,7 @@ static gboolean on_message(GstBus *bus, GstMessage *message, gpointer data)
|
|||
case GST_MESSAGE_ERROR:
|
||||
parse_error(message);
|
||||
case GST_MESSAGE_EOS:
|
||||
libsaria::stack::next();
|
||||
libsaria::deck::next();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <libsaria/controls.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/stack.h>
|
||||
#include <libsaria/deck.h>
|
||||
|
||||
//static bool pause_after_current = false;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright (c) 2011 Bryan Schumaker.
|
||||
#include <libsaria/playlist.h>
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/stack.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/deck.h>
|
||||
#include <libsaria/fs.h>
|
||||
#include "library.h"
|
||||
|
||||
|
@ -72,7 +72,7 @@ namespace libsaria
|
|||
{
|
||||
app::mkdir("library");
|
||||
next_id = schedule_load();
|
||||
stack::push(&lib_playlist);
|
||||
deck::push(&lib_playlist);
|
||||
}
|
||||
|
||||
}; /* namespace: libsaria */
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <libsaria/print.h>
|
||||
#include <libsaria/audio.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/stack.h>
|
||||
#include <libsaria/deck.h>
|
||||
#include <libsaria/idle.h>
|
||||
#include <libsaria/fs.h>
|
||||
/*#include <libsaria/audio.h>
|
||||
|
@ -42,7 +42,7 @@ namespace libsaria
|
|||
/*println("saria dir: %s", get_saria_dir().c_str());
|
||||
make_saria_dir();*/
|
||||
|
||||
libsaria::stack::init();
|
||||
libsaria::deck::init();
|
||||
libsaria::library::init();
|
||||
/*libsaria::stack_init();*/
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright (c) 2012 Bryan Schumaker.
|
||||
#include <libsaria/playlist.h>
|
||||
#include <libsaria/stack.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/print.h>
|
||||
#include <libsaria/deck.h>
|
||||
|
||||
#include <list>
|
||||
#include <sstream>
|
||||
|
@ -12,7 +12,7 @@ static unsigned int max_playlists = 10;
|
|||
static unsigned int num_static = 0;
|
||||
static void (*on_new_playlist)(libsaria::Playlist *) = NULL;
|
||||
|
||||
static list<libsaria::Playlist *> playlist_stack;
|
||||
static list<libsaria::Playlist *> playlist_deck;
|
||||
static libsaria::List recent_plist("Recent", PL_STATIC | PL_NO_DRAIN);
|
||||
|
||||
static string itoa(unsigned int i)
|
||||
|
@ -33,9 +33,9 @@ static void list_recent_track(libsaria::Track *track)
|
|||
static void rename_playlists()
|
||||
{
|
||||
string new_name;
|
||||
list<libsaria::Playlist *>::iterator it = playlist_stack.begin();
|
||||
list<libsaria::Playlist *>::iterator it = playlist_deck.begin();
|
||||
|
||||
for (unsigned int i = 0; i < (playlist_stack.size() - num_static); i++) {
|
||||
for (unsigned int i = 0; i < (playlist_deck.size() - num_static); i++) {
|
||||
switch ((*it)->get_type()) {
|
||||
case PLIST_SET:
|
||||
new_name = "Set (" + itoa(i) + ")";
|
||||
|
@ -53,8 +53,8 @@ static void rename_playlists()
|
|||
|
||||
libsaria::Playlist *find_nth_plist(unsigned int n)
|
||||
{
|
||||
list<libsaria::Playlist *>::iterator it = playlist_stack.begin();
|
||||
unsigned int max = (playlist_stack.size() - num_static);
|
||||
list<libsaria::Playlist *>::iterator it = playlist_deck.begin();
|
||||
unsigned int max = (playlist_deck.size() - num_static);
|
||||
println("n: %u, max: %u", n, max);
|
||||
|
||||
if (n >= max)
|
||||
|
@ -68,16 +68,16 @@ libsaria::Playlist *find_nth_plist(unsigned int n)
|
|||
namespace libsaria
|
||||
{
|
||||
|
||||
void stack::push(Playlist *plist)
|
||||
void deck::push(Playlist *plist)
|
||||
{
|
||||
playlist_stack.push_front(plist);
|
||||
playlist_deck.push_front(plist);
|
||||
if (plist->is_static())
|
||||
num_static++;
|
||||
}
|
||||
|
||||
void stack::next()
|
||||
void deck::next()
|
||||
{
|
||||
Playlist *plist = playlist_stack.front();
|
||||
Playlist *plist = playlist_deck.front();
|
||||
Track *track = plist->next();
|
||||
if (track) {
|
||||
track->play_now();
|
||||
|
@ -88,12 +88,12 @@ namespace libsaria
|
|||
println("Removing non-static playlist");
|
||||
plist->prepare_for_removal();
|
||||
delete plist;
|
||||
playlist_stack.pop_front();
|
||||
playlist_deck.pop_front();
|
||||
rename_playlists();
|
||||
};
|
||||
}
|
||||
|
||||
void stack::prev()
|
||||
void deck::prev()
|
||||
{
|
||||
Track *track = recent_plist.next();
|
||||
if (track)
|
||||
|
@ -109,7 +109,7 @@ namespace libsaria
|
|||
{
|
||||
Playlist *plist;
|
||||
|
||||
if ((playlist_stack.size() - num_static) == max_playlists)
|
||||
if ((playlist_deck.size() - num_static) == max_playlists)
|
||||
return;
|
||||
|
||||
switch (type) {
|
||||
|
@ -127,21 +127,21 @@ namespace libsaria
|
|||
on_new_playlist(plist);
|
||||
plist->add_tracks(tracks);
|
||||
|
||||
stack::push(plist);
|
||||
deck::push(plist);
|
||||
rename_playlists();
|
||||
}
|
||||
|
||||
void stack::init()
|
||||
void deck::init()
|
||||
{
|
||||
push(&recent_plist);
|
||||
}
|
||||
|
||||
Playlist *stack::get_recent_plist()
|
||||
Playlist *deck::get_recent_plist()
|
||||
{
|
||||
return &recent_plist;
|
||||
}
|
||||
|
||||
PlaylistRenderer *stack::get_nth_renderer(unsigned int n)
|
||||
PlaylistRenderer *deck::get_nth_renderer(unsigned int n)
|
||||
{
|
||||
Playlist *plist = find_nth_plist(n);
|
||||
if (plist)
|
||||
|
@ -149,7 +149,7 @@ namespace libsaria
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void stack::add_to_nth_plist(unsigned int n, list<Track *> &tracks)
|
||||
void deck::add_to_nth_plist(unsigned int n, list<Track *> &tracks)
|
||||
{
|
||||
Playlist *plist = find_nth_plist(n);
|
||||
if (plist)
|
|
@ -4,7 +4,7 @@
|
|||
#include <ocarina/body.h>
|
||||
|
||||
#include <libsaria/audio.h>
|
||||
#include <libsaria/stack.h>
|
||||
#include <libsaria/deck.h>
|
||||
|
||||
static GtkWidget *notebook;
|
||||
static GtkWidget *idle_progress;
|
||||
|
@ -70,12 +70,12 @@ static void on_click_stop(GtkWidget *b, GdkEvent *e, gpointer d)
|
|||
|
||||
static void on_click_prev(GtkWidget *b, GdkEvent *e, gpointer d)
|
||||
{
|
||||
libsaria::stack::prev();
|
||||
libsaria::deck::prev();
|
||||
}
|
||||
|
||||
static void on_click_next(GtkWidget *b, GdkEvent *e, gpointer d)
|
||||
{
|
||||
libsaria::stack::next();
|
||||
libsaria::deck::next();
|
||||
}
|
||||
|
||||
static GtkWidget *make_controls()
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include <ocarina/body.h>
|
||||
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/stack.h>
|
||||
#include <libsaria/print.h>
|
||||
#include <libsaria/deck.h>
|
||||
|
||||
static ocarina::Playlist library_renderer(PL_STATIC);
|
||||
static ocarina::Playlist recent_renderer(PL_STATIC);
|
||||
|
@ -29,7 +29,7 @@ namespace ocarina
|
|||
|
||||
void playlist::switch_to_plist(unsigned int n)
|
||||
{
|
||||
ocarina::Playlist *renderer = (ocarina::Playlist *)libsaria::stack::get_nth_renderer(n);
|
||||
ocarina::Playlist *renderer = (ocarina::Playlist *)libsaria::deck::get_nth_renderer(n);
|
||||
if (renderer)
|
||||
renderer->switch_to();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace ocarina
|
|||
void playlist::init()
|
||||
{
|
||||
libsaria::set_on_new_playlist(on_new_playlist);
|
||||
recent_renderer.set_playlist(libsaria::stack::get_recent_plist());
|
||||
recent_renderer.set_playlist(libsaria::deck::get_recent_plist());
|
||||
library_renderer.set_playlist(libsaria::library::get_playlist());
|
||||
library_renderer.switch_to();
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include <ocarina/playlist.h>
|
||||
#include "playlist.h"
|
||||
|
||||
#include <libsaria/stack.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/deck.h>
|
||||
|
||||
#include <list>
|
||||
#include <sstream>
|
||||
|
@ -70,7 +70,7 @@ gboolean key_pressed(GtkWidget *widget, GdkEvent *event, gpointer data)
|
|||
plist->list_selected_tracks(tracks);
|
||||
if (tracks.size() == 0)
|
||||
return FALSE;
|
||||
libsaria::stack::add_to_nth_plist(k, tracks);
|
||||
libsaria::deck::add_to_nth_plist(k, tracks);
|
||||
} else if (key == "Escape") {
|
||||
plist->select_none();
|
||||
return FALSE;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <ocarina/ocarina.h>
|
||||
#include <ocarina/songlist.h>
|
||||
#include <ocarina/shortcut.h>
|
||||
#include <libsaria/stack.h>
|
||||
#include <libsaria/deck.h>
|
||||
|
||||
#include <list>
|
||||
using namespace std;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#include <ocarina/window.h>
|
||||
|
||||
#include <libsaria/audio.h>
|
||||
#include <libsaria/stack.h>
|
||||
#include <libsaria/prefs.h>
|
||||
#include <libsaria/deck.h>
|
||||
|
||||
static GtkWidget *win;
|
||||
static int old_w, old_h;
|
||||
|
@ -80,9 +80,9 @@ static gboolean key_pressed(GtkWidget *widget, GdkEvent *event, gpointer data)
|
|||
else if (key == "r" || key == "R")
|
||||
ocarina::playlist::switch_to_recent();
|
||||
else if (key == "n" || key == "N")
|
||||
libsaria::stack::next();
|
||||
libsaria::deck::next();
|
||||
else if (key == "p" || key == "P")
|
||||
libsaria::stack::prev();
|
||||
libsaria::deck::prev();
|
||||
else if (key == "space")
|
||||
libsaria::audio::toggle_play();
|
||||
else if (key == "Escape")
|
||||
|
|
Loading…
Reference in New Issue