Updates for recent library changes
This fixes the gui, deck, and audio code due to the library changes I just did. NOTE: Library updating callbacks have been disabled in the gui. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
208e53c7e9
commit
9ba4dbc218
|
@ -2,6 +2,7 @@
|
|||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <deck.h>
|
||||
#include <library.h>
|
||||
#include <playlist.h>
|
||||
#include <tabs.h>
|
||||
|
||||
|
@ -16,7 +17,7 @@ public:
|
|||
|
||||
|
||||
CollectionTab :: CollectionTab()
|
||||
: Tab(deck::get_library_pq())
|
||||
: Tab(library::get_queue())
|
||||
{
|
||||
tab_random = get_widget<Gtk::ToggleButton>("o_collection_random");
|
||||
tab_search = get_widget<Gtk::SearchEntry>("o_collection_entry");
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <library.h>
|
||||
#include <ocarina.h>
|
||||
|
||||
static void on_library_add(unsigned int id, Library *library);
|
||||
|
||||
static class CollectionColumns : public Gtk::TreeModelColumnRecord {
|
||||
public:
|
||||
|
@ -29,8 +30,9 @@ static void on_collection_ok()
|
|||
|
||||
chooser = get_widget<Gtk::FileChooserWidget>("o_collection_chooser");
|
||||
path = chooser->get_filename();
|
||||
library::add_path(path);
|
||||
Library *library = library::add(path);
|
||||
enable_idle();
|
||||
on_library_add(library->id, library);
|
||||
}
|
||||
|
||||
static void on_collection_update()
|
||||
|
@ -63,7 +65,7 @@ void do_collection_delete()
|
|||
if (path) {
|
||||
Glib::RefPtr<Gtk::ListStore> list = get_collection_list();
|
||||
Gtk::TreeModel::Row row = *(list->get_iter(path));
|
||||
library :: del_path(row[collection_cols.c_col_id]);
|
||||
library :: remove(tagdb :: lookup_library(row[collection_cols.c_col_id]));
|
||||
list->erase(row);
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +88,7 @@ void on_collection_toggled(const Glib::ustring &path)
|
|||
Glib::RefPtr<Gtk::ListStore> list = get_collection_list();
|
||||
Gtk::TreeModel::Row row = *(list->get_iter(path));
|
||||
row[collection_cols.c_col_enabled] = !row[collection_cols.c_col_enabled];
|
||||
library :: set_enabled(row[collection_cols.c_col_id],
|
||||
library :: set_enabled(tagdb :: lookup_library(row[collection_cols.c_col_id]),
|
||||
row[collection_cols.c_col_enabled]);
|
||||
}
|
||||
|
||||
|
@ -102,7 +104,7 @@ static void on_library_add(unsigned int id, Library *library)
|
|||
row[collection_cols.c_col_path] = library->root_path;
|
||||
}
|
||||
|
||||
static void on_library_update(unsigned int id, Library *library)
|
||||
/*static void on_library_update(unsigned int id, Library *library)
|
||||
{
|
||||
Gtk::TreeModel::Row row;
|
||||
Glib::RefPtr<Gtk::ListStore> list = get_collection_list();
|
||||
|
@ -114,11 +116,11 @@ static void on_library_update(unsigned int id, Library *library)
|
|||
if (row[collection_cols.c_col_id] == id)
|
||||
row[collection_cols.c_col_size] = library->count;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
void collection_mgr_init()
|
||||
{
|
||||
struct Callbacks *cb = get_callbacks();
|
||||
//struct Callbacks *cb = get_callbacks();
|
||||
|
||||
Gtk::TreeView *treeview = get_widget<Gtk::TreeView>("o_collection_treeview");
|
||||
Glib::RefPtr<Gtk::ListStore> list = get_collection_list();
|
||||
|
@ -126,8 +128,7 @@ void collection_mgr_init()
|
|||
|
||||
toggle = get_object<Gtk::CellRendererToggle>("o_collection_toggle");
|
||||
|
||||
cb->on_library_add = on_library_add;
|
||||
cb->on_library_update = on_library_update;
|
||||
//cb->on_library_update = on_library_update;
|
||||
|
||||
connect_button("o_collection_ok", on_collection_ok);
|
||||
connect_button("o_collection_update", on_collection_update);
|
||||
|
|
|
@ -29,9 +29,9 @@ Gtk::Window *ocarina_init(int *argc, char ***argv)
|
|||
{
|
||||
Gtk::Window *window = setup_gui();
|
||||
tagdb :: init();
|
||||
library::init();
|
||||
audio::init(argc, argv);
|
||||
deck::init();
|
||||
library::init();
|
||||
playlist::init();
|
||||
|
||||
playlist :: select("Favorites");
|
||||
|
|
|
@ -19,11 +19,6 @@ struct Callbacks {
|
|||
void (*on_pq_created)(Queue *, unsigned int);
|
||||
void (*on_pq_removed)(Queue *);
|
||||
|
||||
/* Library callbacks */
|
||||
void (*on_library_update)(unsigned int, Library *);
|
||||
void (*on_library_track_add)(unsigned int);
|
||||
void (*on_library_track_del)(unsigned int);
|
||||
|
||||
/* Queue callbacks */
|
||||
void (*on_queue_track_add)(Queue *, unsigned int);
|
||||
void (*on_queue_track_del)(Queue *, unsigned int);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
namespace deck
|
||||
{
|
||||
void change_library_track(unsigned int);
|
||||
|
||||
void init();
|
||||
void read();
|
||||
|
|
|
@ -81,7 +81,7 @@ static gboolean on_message(GstBus *bus, GstMessage *message, gpointer data)
|
|||
track = tagdb :: lookup(cur_trackid);
|
||||
if (track) {
|
||||
track->played();
|
||||
deck :: change_library_track(track->id);
|
||||
library :: get_queue()->updated(track);
|
||||
}
|
||||
audio :: next();
|
||||
audio :: seek_to(0);
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
|
||||
|
||||
static void no_op() {}
|
||||
static void no_op(unsigned int) {}
|
||||
static void no_op(bool, unsigned int) {}
|
||||
static void no_op(unsigned int id, Library *path) {}
|
||||
static void no_op(Queue *, unsigned int) {}
|
||||
static void no_op(Queue *) {}
|
||||
static void no_op(Track *) {}
|
||||
|
@ -22,10 +20,6 @@ static struct Callbacks callbacks = {
|
|||
.on_pq_created = no_op,
|
||||
.on_pq_removed = no_op,
|
||||
|
||||
.on_library_update = no_op,
|
||||
.on_library_track_add = no_op,
|
||||
.on_library_track_del = no_op,
|
||||
|
||||
.on_queue_track_add = no_op,
|
||||
.on_queue_track_del = no_op,
|
||||
.on_queue_track_changed = no_op,
|
||||
|
|
42
lib/deck.cpp
42
lib/deck.cpp
|
@ -10,35 +10,11 @@
|
|||
#include <list>
|
||||
|
||||
static std::list<Queue> playqueue_deck;
|
||||
static Queue library_playqueue(Q_ENABLED);
|
||||
static File deck_file("deck");
|
||||
|
||||
static void add_library_track(unsigned int id)
|
||||
{
|
||||
library_playqueue.add(tagdb :: lookup(id));
|
||||
}
|
||||
|
||||
static void del_library_track(unsigned int id)
|
||||
{
|
||||
library_playqueue.del(tagdb :: lookup(id));
|
||||
}
|
||||
|
||||
void deck :: change_library_track(unsigned int id)
|
||||
{
|
||||
library_playqueue.updated(tagdb :: lookup(id));
|
||||
}
|
||||
|
||||
void deck :: init()
|
||||
{
|
||||
library_playqueue.set_flag(Q_REPEAT);
|
||||
library_playqueue.set_flag(Q_DISABLE_CHANGED_SIZE);
|
||||
library_playqueue.sort(SORT_ARTIST, true);
|
||||
library_playqueue.sort(SORT_YEAR, false);
|
||||
library_playqueue.sort(SORT_TRACK, false);
|
||||
read();
|
||||
|
||||
get_callbacks()->on_library_track_add = add_library_track;
|
||||
get_callbacks()->on_library_track_del = del_library_track;
|
||||
get_callbacks()->on_queue_changed = write;
|
||||
}
|
||||
|
||||
|
@ -57,15 +33,12 @@ void deck :: read()
|
|||
deck_file >> random >> num;
|
||||
for (unsigned int i = 0; i < num; i++) {
|
||||
deck_file >> field >> ascending;
|
||||
library_playqueue.sort((sort_t)field, i == 0);
|
||||
if (!ascending)
|
||||
library_playqueue.sort((sort_t)field, false);
|
||||
//library_playqueue.sort((sort_t)field, i == 0);
|
||||
//if (!ascending)
|
||||
// library_playqueue.sort((sort_t)field, false);
|
||||
}
|
||||
|
||||
deck_file >> num;
|
||||
if (random)
|
||||
library_playqueue.set_flag(Q_RANDOM);
|
||||
|
||||
playqueue_deck.resize(num);
|
||||
|
||||
num = 0;
|
||||
|
@ -87,7 +60,7 @@ void deck :: write()
|
|||
|
||||
/* Save library playqueue */
|
||||
//sort_order = library_playqueue.get_sort_order();
|
||||
deck_file << library_playqueue.has_flag(Q_RANDOM) << " ";
|
||||
deck_file << false << " "; //library_playqueue.has_flag(Q_RANDOM) << " ";
|
||||
deck_file << 0 /* sort_order.size() */ << " ";
|
||||
//for (st = sort_order.begin(); st != sort_order.end(); st++)
|
||||
// deck_file << st->field << " " << st->ascending << " ";
|
||||
|
@ -195,12 +168,7 @@ Track *deck :: next()
|
|||
}
|
||||
}
|
||||
|
||||
return library_playqueue.next();
|
||||
}
|
||||
|
||||
Queue *deck :: get_library_pq()
|
||||
{
|
||||
return &library_playqueue;
|
||||
return library :: get_queue()->next();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TEST
|
||||
|
|
Loading…
Reference in New Issue