Merge branch 'master' into Ocarina-next
Conflicts: Sconstruct gui/collection_mgr.cpp
This commit is contained in:
commit
412dc67e1f
4
PKGBUILD
4
PKGBUILD
|
@ -1,6 +1,6 @@
|
|||
# Maintainer: Anna Schumaker <anna@ocarinaproject.net>
|
||||
pkgname=ocarina
|
||||
pkgver=6.1.1
|
||||
pkgver=6.1.3
|
||||
pkgrel=1
|
||||
pkgdesc="A simple GTK and gstreamer based music player."
|
||||
url="http://www.ocarinaproject.net/"
|
||||
|
@ -13,7 +13,7 @@ conflicts=()
|
|||
replaces=()
|
||||
backup=()
|
||||
source=("http://ocarinaproject.net/wp-content/ocarina/${pkgname}-${pkgver}.tar.gz")
|
||||
sha1sums=('7fa6275aeba85b86988b5a3c88bafc7c6e36ec88')
|
||||
sha1sums=('d54ba4ca864d988475337a8b44feec0f84cc46d1')
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
|
|
|
@ -90,14 +90,21 @@ std::string filter :: add(const std::string &text, unsigned int track_id)
|
|||
return reassemble_text(parsed);
|
||||
}
|
||||
|
||||
static void do_set_intersection(std::set<unsigned int> &a,
|
||||
std::set<unsigned int> &b,
|
||||
std::set<unsigned int> &res)
|
||||
{
|
||||
set_intersection(a.begin(), a.end(), b.begin(), b.end(),
|
||||
std::inserter<std::set<unsigned int> >(res, res.begin()));
|
||||
}
|
||||
|
||||
static void find_intersection(std::string &text, std::set<unsigned int> &res)
|
||||
{
|
||||
IndexEntry *it = filter_index.find(text);
|
||||
std::set<unsigned int> tmp;
|
||||
IndexEntry *it = filter_index.find(text);
|
||||
|
||||
set_intersection(it->values.begin(), it->values.end(),
|
||||
res.begin(), res.end(),
|
||||
std::inserter<std::set<unsigned int> >(tmp, tmp.begin()));
|
||||
if (it)
|
||||
do_set_intersection(res, it->values, tmp);
|
||||
res.swap(tmp);
|
||||
}
|
||||
|
||||
|
@ -107,6 +114,7 @@ void filter :: search(const std::string &text, std::set<unsigned int> &res)
|
|||
std::list<std::string>::iterator it;
|
||||
IndexEntry *found;
|
||||
|
||||
res.clear();
|
||||
parse_text(text, parsed);
|
||||
if (parsed.size() == 0)
|
||||
return;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/callback.h>
|
||||
#include <core/index.h>
|
||||
#include <core/library.h>
|
||||
#include <lib/colmgr.h>
|
||||
#include <gui/ocarina.h>
|
||||
|
|
|
@ -108,9 +108,10 @@ static void on_ban_toggled()
|
|||
{
|
||||
Gtk::ToggleButton *ban = lib :: get_widget<Gtk::ToggleButton>("o_ban");
|
||||
|
||||
if (ban->get_active() == true)
|
||||
if (ban->get_active() == true) {
|
||||
playlist :: add(audio :: current_track(), "Banned");
|
||||
else
|
||||
on_next();
|
||||
} else
|
||||
playlist :: del(audio::current_track(), "Banned");
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/library.h>
|
||||
#include <core/playlist.h>
|
||||
#include <core/tags.h>
|
||||
#include <lib/colmgr.h>
|
||||
#include <lib/lib.h>
|
||||
|
@ -48,6 +49,18 @@ static void list_path(Library *lib)
|
|||
row[c_cols.c_path] = lib->root_path;
|
||||
}
|
||||
|
||||
static void library_remove_banned()
|
||||
{
|
||||
std::set<unsigned int>::iterator it;
|
||||
IndexEntry *ent = playlist :: get_tracks("Banned");
|
||||
|
||||
if (!ent)
|
||||
return;
|
||||
|
||||
for (it = ent->values.begin(); it != ent->values.end(); it++)
|
||||
library :: get_queue()->del(tagdb :: lookup(*it));
|
||||
}
|
||||
|
||||
void colmgr :: init()
|
||||
{
|
||||
Database<Library>::iterator it;
|
||||
|
@ -103,4 +116,7 @@ void colmgr :: toggle_path_enabled(const Gtk::TreePath &path)
|
|||
Library *lib = find_library(row);
|
||||
row[c_cols.c_enabled] = !row[c_cols.c_enabled];
|
||||
library :: set_enabled(lib, row[c_cols.c_enabled]);
|
||||
|
||||
if (row[c_cols.c_enabled])
|
||||
library_remove_banned();
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@
|
|||
<object class="GtkWindow" id="o_window">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Ocarina 6.1.1</property>
|
||||
<property name="title" translatable="yes">Ocarina 6.1.3</property>
|
||||
<property name="default_width">1024</property>
|
||||
<property name="default_height">683</property>
|
||||
<child>
|
||||
|
|
|
@ -64,7 +64,8 @@ static void test_add()
|
|||
static void do_test_search(const std::string &text, unsigned int len,
|
||||
unsigned int *ids)
|
||||
{
|
||||
std::set<unsigned int> res;
|
||||
int init_values[] = { 1, 2, 3, 4, 5 };
|
||||
std::set<unsigned int> res(init_values, init_values + 5);
|
||||
std::set<unsigned int>::iterator it;
|
||||
|
||||
filter :: search(text, res);
|
||||
|
@ -96,6 +97,7 @@ static void test_search()
|
|||
|
||||
unsigned int res5[] = {};
|
||||
do_test_search("unknown terms", 0, res5);
|
||||
do_test_search("the chestZ", 0, res5);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
|
Loading…
Reference in New Issue