Commit Graph

597 Commits

Author SHA1 Message Date
Anna Schumaker 0c8bcfa552 gui/window: Switch to C-style gtk widgets
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker 066d27a240 gui/window: Move keyboard shortcut handling into tabs.cpp
I handle the Escape key through gtkbuilder, so let's move the
tab-changing keys into the tabs source file.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-29 13:04:45 -04:00
Anna Schumaker c01561831c gui/audio: Remove "By:" and "From:"
I replaced these with images that have similar meanings.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-25 11:38:20 -04:00
Anna Schumaker 6aa64f0bc1 gui/audio: Block accelerators when a gtk entry is focused
Otherwise pressing the spacebar while searching could toggle the play /
pause status.

Fixes #36: Button accelerators always triggered
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-12 11:25:49 -04:00
Anna Schumaker 2097f63f3d gui: Update playlists to say Hidden instead of Banned
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-11 15:34:21 -04:00
Anna Schumaker 627619c391 gui/audio: Convert o_progress widget to use seconds
This feels better than using units of nanoseconds.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:39:43 -04:00
Anna Schumaker 5e96f40cf8 gui/audio: Unit test can simulate button presses
This is better than calling audio_*() functions directly, since we can
make sure signals are wired up properly in glade.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:39:39 -04:00
Anna Schumaker d8754e9a45 gui/audio: Control keyboard shortcuts from GtkBuilder
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:16:30 -04:00
Anna Schumaker f95a6d02ed gui/audio: Redesign some of the interface
I moved the location of buttons and text boxes, and also resized some of
the widgets.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:16:27 -04:00
Anna Schumaker 286085d248 gui/audio: Configure pause-after-N through glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:16:25 -04:00
Anna Schumaker 2d45e9e5c4 gui/audio: Pass the progress bar to __audio_timeout
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:16:24 -04:00
Anna Schumaker 36b8b29b0b gui/audio: Add __audio prefix to internal functions
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:16:22 -04:00
Anna Schumaker e5e2c87a86 gui/audio: Define seek controls completely in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:16:20 -04:00
Anna Schumaker 50a7c83d61 gui/audio: Convert gst.cpp to audio.c
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:16:10 -04:00
Anna Schumaker c48e128d0a gui/gst: Configure timeout with the C interface
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:12:36 -04:00
Anna Schumaker 5368208a37 gui/gst: Remove gst :: pre_init() and rename gst_init()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 13:12:19 -04:00
Anna Schumaker dee8b948b0 gui/gst: Remove gst :: toggle()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker bf39724a40 gui/gst: Set ban and favorite buttons through the C interface
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 71c4e6a1aa gui/gst: Completely define the positon and duration labels in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 15da6b4249 gui/gst: Completely define title, artist, and album widgets in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker aacc1f876a gui/gst: Completely define the play button in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 6723ef88c7 gui/gst: Completely define the pause button in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 8ae31ed483 gui/gst: Completely define the stop button in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 00899873bd gui/gst: Completely define the previous button in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 6680cdbd0e gui/gst: Completely define the next button in glade
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker f31a67f644 gui/gst: Use C-style gtk widgets
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 44d7f9a853 core/gst: Set ban / favorite status when tracks are loaded
It's easier to do this from the audio code than the plalist code.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 61436d5ccd gui: Switch over to the new gui_builder system
Glib::wrap() all the things!

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 0eb8521094 gui/builder: Get a widget from the GTK builder
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker d4b27316c0 gui/builder: Get an object from the builder
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 961659bc66 gui/builder: Add a test UI file
This file creates a button that calls the test_builder_activated()
function when clicked.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 3bc5b1db9e gui/builder: Add new file for accessing the GtkBuilder
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 27e09f47a6 gui/ocarina: Initialize settings on startup
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker c479042a86 gui/settings: Add gui_settings_has() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker d292879837 gui/settings: Read settings file on startup
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker a5f0da7a60 gui/settings: Store settings when changed
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker 92c1b64b1a gui/settings: Add functions for setting and getting values
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker f23fb9e0f5 gui/settings: Add new settings file
The settings layer will track various configuration options set by the
user.  This belongs in the gui, and not core, because it controls
settings specific to this gui implementation.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-04-08 12:03:08 -04:00
Anna Schumaker ece432bb22 core/audio: audio_{load, next, prev}() should start playback
The GUI needed an extra function to do this manually, which means it's
something that core should do instead.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 0cf5187867 core/audio: Add on_state_change() audio operation
Called to notify when playback state has changed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 2586348921 core/audio: Convert file to C
I also convert core/core.c so the audio test can be converted at the
same time.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker a59a71eb38 core/core: Move core_deinit() out of the core namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 04291f4296 core/core: Move core_init() out of the core namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 03196c3efa core/audio: Set up the gstreamer bus for the gui
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker a5556ac10a core/audio: Move audio_eos() out of the AudioDriver
This change lets me remove the AudioDriver, too.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 276c56406a core/audio: Move audio_pause_after() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker d18d3dd214 core/audio: Move audio_prev() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 3f25369444 core/audio: Move audio_next() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 2511db3a08 core/audio: Add audio_cur_state() function
This replaces the is_playing() function of the AudioDriver class.  I can
also make the GUIs GstDriver static.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 0a1a9f1394 core/audio: Move audio_cur_track() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker d1d722a163 core/audio: Move audio_stop() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker e1abe94b28 core/audio: Move audio_duration() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 20bb01ef4e core/audio: Move audio_position() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:30 -04:00
Anna Schumaker 566ef3bb50 core/audio: Move audio_seek() out of the audio namespace 2016-03-28 08:01:30 -04:00
Anna Schumaker 9097bd0ffc core/audio: Move audio_pause() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker 16c4c23a42 core/audio: Move audio_play() out of the audio namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker e5c3d8f02e core/audio: Move audio_load() out of the audio namespace
And add the on_load() audio operation.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker e0c89556ed core/audio: Add audio_deinit() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker d9540b29d6 core/audio: Move audio_init() out of the audio namespace
I also move the gstreamer playbin back into core/

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-28 08:01:29 -04:00
Anna Schumaker 6358124ce8 gui: Check the return code from collection_check_library()
If the library isn't valid, then we shouldn't try to pick another track
until the user fixes things.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-23 09:58:17 -04:00
Anna Schumaker 08bf842767 gui: Don't update gui if zero tracks were cleared
I'm seeing Ocarina crash when a tempq finishes and gets removed.  For
now, let's only have the gui handle queue clearing if tracks were
actually removed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-22 16:04:25 -04:00
Anna Schumaker 76985c8842 gui: Fix setting Q_RANDOM flag
I had the condition reversed for enabling random on temporary queues, so
the flag was getting set whenever I didn't want it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-22 09:36:32 -04:00
Anna Schumaker 5979d1dcaf core/collection: Handle -EIO errors coming from the filesystem
One of my disks frequently returns this error, and has wiped out my
track database on more than one occasion.  Let's handle this error by
disabling the library until the user tells us it is safe to use again.

Fixes #33: Handle music directories disappearing better
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-21 08:36:48 -04:00
Anna Schumaker 2dd4f93bd0 gui: Don't call tempq_save() in the qop_cleared() handler
The first thing queue_deinit() does is clear the queue, so calling
tempq_save() here will overwrite any tempq state currently on disk.
This seems reasonable at first, but ends up erasing any temporary queues
during Ocarina shutdown.

Fixes #34: Temporary queues not saving
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-17 12:17:11 -04:00
Anna Schumaker 882ee6e1e7 core/tempq: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 2102b1bfc9 core/tempq: Move tempq_save() out of the deck namespace
And remove the deck :: write() and TempQueue :: write() functions while
we're at it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker b3d95a06d4 core/tempq: Move tempq_next() out of the deck namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker ecda136015 core/tempq: Move tempq_move() out of the deck namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker c22b93b2cf core/tempq: Move tempq_get() out of the deck namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 06d62240bb core/tempq: Move tempq_free() out of the deck namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker bce2ba33f7 core/tempq: Move tempq_alloc() out of the deck namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker 77d4815eb6 core/history: Move history queue into a new file
I think managing this separately from temporary queues will make the
code simpler.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-11 10:40:34 -05:00
Anna Schumaker b191a7f22c gui/ocarina: Deinitialize core first
This fixes a segfault I was getting when closing ocarina before the
directory scan finishes.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-09 09:59:06 -05:00
Anna Schumaker 8c8ab2a9eb core/idle: Add idle_cancel() function
This function is used to cancel all idle tasks and free the memory
allocated for them.  This needs to be called when Ocarina is shutting
down to prevent a possible hang with the gtk idle callback continuing to
process tasks.

Fixes #30: Closing Ocarina should cancel idle tasks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-03-01 08:27:13 -05:00
Anna Schumaker b3592e40c0 core/playlist: Rename PL_BANNED -> PL_HIDDEN
"Banning" a track is a bit harsh.  Let's talking about hiding tracks
instead, so that it sounds friendlier.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-29 13:22:31 -05:00
Anna Schumaker fef3ef3353 core: Initialize the playlist before the collection
I think it makes more sense to have the collection manage if banned
tracks are displayed or not, rather than doing this from the playlist
layer.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 20825613e9 core/playlist: playlist_add() can return a boolean
There is at least one place in the gui where it needs to know if a track
was actually added to a playlist.  Adding a return value is the best way
to know what happened.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 02c82c182e core/playlist: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker b7a4bb3872 core/playlist: Use playlist_t enum to access playlists
Using strings is pretty tedious, so let's restrict restrict playlist
access to known values.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 88f6fc526c core/playlist: Add a function to remove banned tracks
This replaces the get_tracks() function.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 4e6028cf6e core/playlist: Move playlist_remove() out of the playlist namespace
I also remove redundant unit tests.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 0e3d6251d3 core/playlist: Move playlist_add() out of the playlist namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 82ed2f2dc0 core/playlist: Move playlist_get_queue() out of the playlist namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 6f0b95608a core/playlist: Move playlist_select() out of the playlist namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 1d3a762936 core/playlist: Move playlist_has() out of the playlist namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-26 11:04:42 -05:00
Anna Schumaker 219f8fa119 core/collection: Update collection on startup
This is much more convenient to users, since they don't need to update
the collection manually.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-23 07:55:56 -05:00
Anna Schumaker 7065b6312e core/collection: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:47:16 -05:00
Anna Schumaker f413d14720 core/collection: Move collection_save() out of the collection namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker 295a4424ed core/collection: Move collection_get_queue() out of the collection
namespace

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker 62f0606cd6 core/collection: move collection_set_enabled() out of the collection
namespace

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker 8a1f5403d0 core/collection: Move collection_update() out of the collection namespace
And bring collection_update_all() along with it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker 0cb16f5c64 core/collection: Move collection_remove() out of the collection
namespace

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker 6e39e17060 core/collection: Move collection_add() out of the collection namespace
This patch breaks later tests, since I needed to remove the old ogg
files.  This will be fixed in a few more patches.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-02-12 09:37:26 -05:00
Anna Schumaker e47540a84e core/queue: Add queue_clear()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 10:12:09 -05:00
Anna Schumaker 6a8e73375e gui/collection: Check for collection_q in on_track_removed()
So we don't segfault while removing banned tracks.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 0a331a44f5 core/queue: Replace on_track_updated() with qop_updated()
This patch also removes the now-unused queue notifier class.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker da0c96ac51 core/queue: Replace on_track_removed() with qop_removed()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker df06b444cf core/queue: Replace on_track_added() with qop_added()
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker acc78a6667 core/queue: Move queue_remove_all() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker ea00b406e5 core/queue: Move queue_remove() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 8fe85b9782 core/queue: Move queue_add() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 4c4d0ab6ce core/queue: Move queue_sort() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 13723856fc core/queue: Move queue_{set|unset}_flag() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker be5d028fcf core/deck: Wire up the qop_save() function
So temporary queues can save when flags change or when sorted.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 9451a41ff1 core/collection: Wire up the qop_save() operation
This will be triggered both when queue flags are changed and when the
queue is sorted.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker ce55ef2421 core/queue: Add queue operations vector
And a function to help with saving queues.  This patch also adds the
Q_SAVE_FLAGS and Q_SAVE_SORT queue flags to control if the queue should
be saved when flags are changed or when the queue is sorted.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker b3a8fa293b core/queue: Move queue_has_flag() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker ff0c2a09a8 core/queue: Move queue_at() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker c259177dde core/queue: Move queue_size() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 6bd625f65b core/queue: Move queue_selected() out of the queue struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker d6ae61d915 core/queue: Remove queue :: set_notifier()
Let's just set the q_notify variable directly, rather than going through
a function.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker a721a95604 core/queue: Remove queue :: length()
Let's just access the q_length variable directly.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 281947aded core/queue: Convert from class to struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-29 08:22:10 -05:00
Anna Schumaker 08c7323dfc core/tags/track: Move comparison fields into track.h
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker 58a983efd1 core/containers: Move index into the containers/ directory
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker c34f0c160d core/containers: Move database into the containers/ directory
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-15 15:10:44 -05:00
Anna Schumaker ad5726b542 core: Add core :: deinit() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker b5caf6faed core/tags/track: Convert std::string to gchar *
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 9e3e3e514c core/tags/track: Replace constructor with a backwards pointer
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 5cc4efb6ac core/tags/library: Replace constructor with a backwards pointer
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 6c3d708576 core/tags/genre: Replace std::string with gchar *
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker c07d1e9024 core/tags/artist: Replace std:string with gchar *
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker ad48d24533 core/tags/album: Replace std::string with gchar *
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker ab837b1a18 core/idle: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 8e25c4d89e core/idle: Move idle_run_task() out of the idle queue
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker f17a19fe57 core/idle: Move idle_progress() out of the idle namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker cfd8ca8d43 core/filter: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker f2664aa8f2 core/filter: Move filter_search() out of the filter namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-11 09:35:59 -05:00
Anna Schumaker 8e02001373 gui/queue: Stop space bar from selecting new tracks
From Josh: Single-clicking a track in the collection queue and pressing the
space bar loads the selected track, but users would expect this to
toggle the play / pause state instead.

The solution is to watch for the on_key_press signal and tell GTK that
we have handled it if we see that the space bar was pressed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2016-01-06 10:27:28 -05:00
Anna Schumaker 55a688cdcc core/index: Convert file to C
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:19 -05:00
Anna Schumaker 1c22ecfda4 core/database: De-templatize the database
We now have an interface for controlling everything through struct
db_entry, so let's just have the database store a db_entry directly.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker 1bef380ba7 core/database: Introduce the dbe_key() database operation
And store the result in the db_entry struct for use later.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker 847e4c1925 core/database: Remove db_entry::index() function
Let's just access the dbe_index variable directly.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker 33e20989fa core/tags/track: Directly inherit from DatabaseEntry
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker ee71786c09 core/tags/track: Move track_last_play() out of the track struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 90cdfd4cbd core/tags/track: Move track_path() out of the track struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 24d5c37a6c core/tags/track: Remove variable accessor functions
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 9c1cbbf8cb core/tags/track: Remove tag accessor functions
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker c8061e2868 core/tags/track: Move track_get() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 765079df94 core/tags/track: Convert Track class into a struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 24504c7de8 core/tags/library: Remove library size() and {inc|dec}_size() functions
We can just access this variable directly instead.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker ac2b4ad52c core/tags/library: Remove library enabled() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker f41235e5b2 core/tags/library: Replace tags :: library_size() with library_db_get()
It's easier to just pass off the library database rather than forcing
higher layers to iterate over the entire thing (including possible
invalid entries).

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker e1093f7eab core/tags/library: Move library_get() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker ffa5e65ba7 core/tags/library: Convert Library class to a struct
I also have to replace the "library" namespace with the "collection"
namespace to avoid naming collisions.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker cc3becd566 core/tags/genre: Directly inherit from DatabaseEntry
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker fe3d7867d1 core/tags/artist: Directly inherit from DatabaseEntry
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker e5b0047812 core/tags/album: Directly inherit from DatabaseEntry
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker a7746cf901 core/tags/album: Remove album::year() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 45207ebd2e core/index: Replace index_entry iterators with struct set_iter
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker a91326551f core/index: Convert IndexEntry class to a struct
In addition, I added the prefix "ie_" to all member names.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker 60678d1ddb core/string: Convert file to C
And convert the unit test while we're at it.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:56:19 -04:00
Anna Schumaker 83fe822dc7 core/string: Move sec2str_detailed() out of "string" namespace
I also take the opportunity to rename the function to
string_sec2str_long().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:46:30 -04:00
Anna Schumaker a314ee03ca core/string: Move sec2str() out of "string" namespace
And I replace it with a simple call to g_strdup_printf() that does the
exact same thing.  Note that callers are now required to free the
returned string with g_free().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:33:50 -04:00
Anna Schumaker 82d1da491b core/string: Remove string :: utos()
I replace it with calls to g_strdup_printf().  This has the additional
benefit that I can do uint conversions at the same time as other
formatting options, so this seems like a win.  The only downside is that
I have to manually free the memory that glib allocates, but that's easy
enough.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 09:31:28 -04:00
Anna Schumaker 1d0f392835 gui: Give tab labels a set_size() function
This lets them set themselves whenever values change.  Additionally, I
update the Tab class to take a QueueLabel instead of the "size label"

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-09-02 14:24:42 -04:00
Anna Schumaker 2c45cf3972 gui: Remove tab_finish_init()
It is no longer needed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-09-02 14:24:42 -04:00
Anna Schumaker 9ddae1275f gui: Set up QueueWindow from a single place
I can't pack it directly into the tab_vbox because playlists need a way
to pack in their special window.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-09-02 14:24:42 -04:00
Anna Schumaker d0212d47aa gui: Create QueueToolbar from a single place
Derived classes should already have this available to configure as they
see fit.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-09-02 14:24:42 -04:00
Anna Schumaker 319838138a gui: Set up tab builder from a single place
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-09-02 14:24:42 -04:00
Anna Schumaker 682dca2339 gui: Set up each tab page vbox from a single place
This is better than having the same code in 4 places.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-09-02 14:24:42 -04:00
Anna Schumaker c9ca2604ee gui: Move on_row_activated() into the QueueWindow
And out of the Tab class.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-08-25 10:06:58 -04:00
Anna Schumaker 83414ca3ad gui: Trigger refiltering from the QueueToolbar
I also modify the QueueWindow to do the actual filtering.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-08-25 10:06:58 -04:00
Anna Schumaker 8c3b1489bd gui: Set up queue model and filter inside the QueueWindow
This lets me move functions affecting the treeview into the QueueWindow
class.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-08-25 10:06:58 -04:00
Anna Schumaker 5bf861b9f3 gui: Remove Tab post_init() function
Nothing uses this anymore.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-08-25 10:06:58 -04:00
Anna Schumaker 3d89bf2563 gui: Set up the switch from inside the toolbar
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-08-25 10:06:58 -04:00
Anna Schumaker 343426ddc3 gui: Tab labels should inherit from common type
This allows me to pass a pointer to the generic type to be used by other
classes.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-08-25 10:06:58 -04:00
Anna Schumaker 1423fe2b6e gui: Set up the repeat button from inside the toolbar
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-08-25 10:06:58 -04:00
Anna Schumaker fa2bf4637a gui: Set up the random button from inside the toolbar
This lets me change this variable to be completely internal to the
QueueToolbar.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-08-25 10:06:58 -04:00
Anna Schumaker acbafd2361 gui: Give the QueueToolbar an init() function
GtkBuilder doesn't let me pass additional parameters to classes
constructed with get_widget_derived(), so I have to use an init()
function for flags and other parameters.

This patch adds flags for which buttons to show on the queue toolbar.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-08-25 10:06:58 -04:00
Anna Schumaker 3ed32813da gui: Force playing on GST_MESSAGE_ERROR
I frequently hit a problem where playback stops when a track has an
error.  My gstreamer code was written assuming that the pipeline stayed
in GST_STATE_PLAYING if there was an error, but I think this assumption
is wrong.  For now, let's always restart playing on error.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-08-25 10:06:58 -04:00
Anna Schumaker 8f570f1f24 gui: Convert the playlist tab to use the new template files
I also created a new PlaylistWindow class for displaying the names of
each playlist.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-17 08:51:31 -04:00
Anna Schumaker b2b23bec46 gui: Convert the history tab to use the new template files
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-17 08:51:31 -04:00
Anna Schumaker 3dd123fbfd gui: History tab cleanups
This is a statically defined class, so we don't need to separate out the
function definitions.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-17 08:51:31 -04:00
Anna Schumaker a581b42649 gui: Convert the collection tab use the new template files
I expect most of the new constructor code to disappear once I start
using the .ui files in the parent class.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-17 08:51:31 -04:00
Anna Schumaker 2f1d0a3bb8 gui: Collection tab cleanups
This is a statically defined class, so we don't need to separate the
class and function code.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-17 08:51:31 -04:00
Anna Schumaker d746db6624 gui: Add a scrolled window around the treeview
I'm going to want this on all tab pages, so let's just add this to the
treeview widget definition.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-17 08:51:31 -04:00
Anna Schumaker d9a9b2b9ca gui: Set queue scale factor using GtkBuilder
Now I don't need to keep resetting the label's markup.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-17 08:51:31 -04:00
Anna Schumaker 494ef04e67 gui: Build TempLabel from a .ui file
This is better than needing to hard code in all of the widgets.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-17 08:51:31 -04:00
Anna Schumaker da89012c7b gui: Build QueueToolbar from a separate file
This should help clean up the code a bit, especially once I convert all
queues to load with the template files.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-17 08:51:31 -04:00
Anna Schumaker 1e29ba8cc6 gui: Create a custom Gtk::TreeView for queues
The QueueView doesn't contain too much in terms of code, but the
corresponding QueueView.ui file lets me remove a lot of unnecessary
stuff from temporary queue creation!

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-17 08:51:31 -04:00
Anna Schumaker 6dfb3c31e2 gui: Rename model.cpp -> queue/model.cpp
I'm going to have a lot of queue-related files soon, so let's make
things easier by keeping everything in a new directory.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-17 08:51:30 -04:00
Anna Schumaker 9edce54571 gui: xalign is deprecated
Remove references to it, fixing up the code where necessary.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-14 10:24:50 -04:00
Anna Schumaker 4a6c0dbaa5 gui: The treeview rules_hint property is deprecated
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-14 10:23:34 -04:00
Anna Schumaker 3375e921c4 gui: Use the search entry's "search_changed" signal
This greatly improves usability while searching, since we no longer have
to refilter the song list for every key press.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2015-04-14 09:06:45 -04:00
Anna Schumaker ec4d3b945e audio: Fix seeking on ARM
The on_seek() function needs to take an int64_t to avoid truncating on
ARM.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2015-04-14 09:05:09 -04:00
Anna Schumaker 657ce8f0f4 audio: Ensure position and duration results are 64 bits
A long int is shorter on ARM than x86, which could cause position and
duration values to get truncated.  Additionally, quering gstreamer with
a long int causes a compile error on ARM.  Let's just do the right thing
and make this value an int64_t.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2015-04-14 09:05:05 -04:00
Anna Schumaker 1ec9d830cc gui: Remove references to the on_remove() notification
It no longer exists.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-09 09:28:32 -04:00
Anna Schumaker 9ebb31e09b gui: Remove usage of Q_NOTIFY_REMOVE
The notification no longer exists, and the flag will soon be removed.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-09 09:27:32 -04:00
Anna Schumaker f15ed8635a gui: Disable Q_NOTIFY_REMOVED for temporary queues
Using this notification was causing segmentation faults when Ocarina was
closed with at least one temporary queue.  I can handle everything I
need directly in the GUI without problems, so this notification really
isn't necessary.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-09 09:26:26 -04:00
Anna Schumaker c80468a739 callback: Remove all references to callbacks
Callbacks have no remaining users and can safely be removed :)

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-04 10:21:31 -04:00
Anna Schumaker e4ea994728 gui: QueueTabs should implement the on_remove() notification
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-04 10:21:15 -04:00
Anna Schumaker 44c702a302 gui: Implement on_track_updated() in the Tab class
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-03 20:59:01 -04:00
Anna Schumaker 3b206948e1 gui: Implement on_track_removed() in the Tab class
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-03 12:27:32 -04:00
Anna Schumaker 67228ef8b1 gui: Turn the Tab class into a QNotifier
Now we can respond to notifications directly.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-04-03 12:19:18 -04:00
Anna Schumaker 5026e80eab gui: Fix setting autopause count
Once the check box was enabled, we were never setting the count again.
This means that changing pause count from 1 to 2 did not change the
count in the backend.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-02-04 08:39:40 -05:00
Anna Schumaker cc6f4c9293 string: Add a function for creating a detailed time string
I use this to display the total running time of queues in the gui.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-29 08:27:25 -05:00
Anna Schumaker ed43fd3689 More utos() cleanups
I found a few other places where I can use utos() instead of
stringstreams.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-27 14:03:12 -05:00
Anna Schumaker 12260a3de9 string: Add a function for converting seconds to string
This is used to get a string representation of the number of seconds
passed in.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-27 09:23:14 -05:00
Anna Schumaker 6c6437c2bd string: Create a utos() function
This function converts unsigned ints into strings.  This allows me to
replace several almost identical functions with one function call.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-01-27 08:37:27 -05:00