Commit Graph

662 Commits

Author SHA1 Message Date
Anna Schumaker 9f54c23995 database: don't iterate if there are no entries
Checking the valid bit could lead to a segmentation fault.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2014-04-06 19:57:06 -04:00
Anna Schumaker b75d13838f database: Properly test for double-removal
I found that databases were always decrementing _size when remove() was
called.  This patch fixes the bug by checking if the entry is valid
before removal.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2014-04-06 19:57:06 -04:00
Anna Schumaker 1e09406730 library: Don't attach artist_id to albums
This was an unnecessary field, and might potentally result in album
duplication.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2014-04-06 19:57:06 -04:00
Anna Schumaker 2960b72967 audio: Save and load current trackid
Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2014-04-06 19:57:06 -04:00
Anna Schumaker 81f3ef458f database: Each DatabaseEntry should know its id
This will let me set up a Track class that has pointers to the
corresponding artist, album and genre information without needing to
know their IDs directly.  Having this information available means I
won't need to keep a "join struct" when doing lookups - instead I can
return a pointer to a Track class that already knows everything.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:06 -04:00
Anna Schumaker 14879b03fd idle: Update design and unit test
I didn't have any changes to make to the IdleQueue itself, but I did
need to update the unit test and reword a few things in the design.

Signed-off-by: Anna Schuamker <schumaker.anna@gmail.com>
2014-04-06 19:57:06 -04:00
Anna Schumaker 58ed47b37c filter: Update design and rewrite the unit test
- filter :: add() now returns the lowercased text
- Don't cache lowercased strings
- Remove functions depending on CONFIG_TEST

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:06 -04:00
Anna Schumaker 1b34a9a8a0 index: Update the index design
I updated the design and rewrote the unit tests.  This creates something
more consistent with how I ended up using the index.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker fc8dc9d55e database: Design and test updates
I add:
- Autosaving option
- Real iterators
- Better accessor functions

The new design and unit test also allows me to remove the 300,000+ line
"database.good" file that the old tests were based on.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker b251f27bb5 file: Don't use throw / catch to report errors
Needing to use throw / catch was getting in the way.  Instead, check for
a boolean return value.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker 959cac0fe1 Database: Update design for database entries
I changed primary_key() into a function since it is only called once,
and there is no point in using more mmemory than I need to.  I also
created a basic unit test for everything that database entries are
supposed to do.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker 336024bae9 file: Update design and create a new unit test
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker 73d3c68e9f error: Update design
To make sure all the info is up to date.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00
Anna Schumaker a529d569f6 gui: Implement add to {favorites, banned} menu items
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:04 -04:00
Anna Schumaker 2abc498fde gui: Rename wires.cpp
I think gui.cpp is a better name, since this file controls most of the
random gui components.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:04 -04:00
Anna Schumaker 5b34b11dd8 gui: Move ocarina6.glade to share/ocarina/
This directory will be copied directly into /usr/ during an install.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:04 -04:00
Anna Schumaker ff925cf573 gui: Add songs to favorite playlist
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:04 -04:00
Anna Schumaker d83609bc21 gui: Delete key removes tracks from queues
This was the behavior before I started my rewrite.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:04 -04:00
Anna Schumaker 6c8ef37b2a gui: Ban tracks with the "delete" key
Press the delete key on the collection tab to ban all selected tracks.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:04 -04:00
Anna Schumaker cb59febd1c gui: Reenable sorting
This time I don't keep a global "sorting count".  Instead, this count
belongs to individual tabs so flipping between them quickly could
display different sorting fields.

Signed-off-by: Anna Schumaker <schuamker.anna@gmail.com>
2014-04-06 19:57:04 -04:00
Anna Schumaker 58423c92e5 gui: Use common code for adding tracks to queue
Called both for adding and for creating a new queue

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:04 -04:00
Anna Schumaker f0006873b6 gui: Use number keys to add tracks to a queue
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:04 -04:00
Anna Schumaker 871914ea90 Clean up the build system
I'm taking a break from gui code to clean up the build system and update
my unit tests.  This patch updates how code is built, and reworks my
"print" test to test version number instead.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker bfcc94de21 gui: Generic toggle button function
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 73c4de13be gui: Update the repeat button
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 587eacfdd4 gui: Reactivate the close queue tab button
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker d465c2e894 gui: Begin creating playqueue tabs
I've been putting this off for a while since it seemed like a lot of
work.  Time to get it done!

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 6ecb8f6b7f gui: Reactivate the "slash" keyboard shortcut
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 697c07e2df gui: Update the track changed callback
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 3654644b1c gui: Update the row_activated signal
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 99e849a106 gui: Set the runtime label for each tab
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 4ce08ef22e gui: Begin yet another tab framework
This one is based on inheritance, and I think it will be the best way to
create several tab types that do things just slightly differently.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker e3612b6e38 gui: Create a register_tab_type() function
Rather than returning tab types from init functions.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker f68f03c057 gui: Create generic filtering functions
I need to create a FilterDesc struct with needed widgets and then
filtering can happen generically on all tabs!

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 1d4ba1474d gui: Begin the new playlist tab
The list of playlists is now created in glade, too =)

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 4104a4cede gui: Begin the redesigned history tab
This code will be in its own self-contained file: history.cpp

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 97511f82a9 gui: Begin a tab redesign
I'm creating as many "static tabs" as I can using GtkBuilder, and
splitting their code out of tabs.cpp.  This should help to contain the
growth of this file and make all the code easier to work with.

This patch begins the redesign and adds beginning code for a new
collection tab.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker be60f9bff3 gui: Split out collection manager tab
This makes the code a little bit cleaner, since this tab is self
contained.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 480cf92519 gui: Improve functions for accessing widgets
I made a couple of templated functions to get widgets and objects out of
the Gtk::Builder easier.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 38c0009acd gui: Configure more keyboard shortcuts
- Number keys to switch pages
- c, h, p, m to switch to collection, history, playlist and collection
  manager tabs.
- Slash key to focus on the search entry

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:03 -04:00
Anna Schumaker 5f582e639b playqueue: Add a path_selected function
This is called by the GUI to tell the playqueue that a track has been
selected.  This gives the PQ a chance to (possibly) remove it.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker 21c80ea1f9 lib: Import ban status from Ocarina 5.x
Now that I have a banned playlist working I can remember the ban status
easier.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker a474712a22 lib: Remove track from library pq if banned
Put it back when unbanned.

Signed-off-by: Anna Schumaker <schumaker.ann@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker 3894c4ac97 playlist: Create a playqueue to store the current playlist
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker 82243cfdd1 gui: Add tracks to playqueue
I added tab numbers to make it easier to specify what playqueue to add
tracks to.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker 2f2b01100e gui: Add playqueue filtering!
I love tis feature, and I've been missing it the last few days of
Ocarina 6.0 preview testing.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker 444e48f93b gui: Custom model fixes
- Initialize stamp with a random integer (this is how a Gtk::ListStore
  works)
- Increment the stamp in a way that it will never be 0 (AKA: invalid)
- iter_n_root_children() does not take any arguments, so fix up my
  function.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker 0e4c05350a gui: Implement tab reordering
And prevent tabs from being moved into the perma-tab area.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker 7dc57572aa deck: Pass a random-enabled flag when creating playqueues
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker 7ce3c4268f gui: Create new playqueue tabs
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00