Start implementing Playlist functionality via KotoCurrentPlaylist and KotoPlaylist.

Implement functionality for gracefully showing the play button on top of KotoAlbumArt images. Implemented a new koto_indexed_album_set_as_current_playlist function for setting an album as the current playlist, useful when clicking to play an album via its artwork.
This commit is contained in:
Joshua Strobl 2021-03-10 13:44:08 +02:00
parent 35762ca233
commit cf81682f8c
13 changed files with 551 additions and 7 deletions

59
src/playlist/playlist.h Normal file
View file

@ -0,0 +1,59 @@
/* playlist.h
*
* Copyright 2021 Joshua Strobl
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <glib-2.0/glib-object.h>
#include "../indexer/structs.h"
G_BEGIN_DECLS
/**
* Type Definition
**/
#define KOTO_TYPE_PLAYLIST koto_playlist_get_type()
G_DECLARE_FINAL_TYPE(KotoPlaylist, koto_playlist, KOTO, PLAYLIST, GObject);
#define KOTO_IS_PLAYLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), KOTO_TYPE_PLAYLIST))
/**
* Playlist Functions
**/
KotoPlaylist* koto_playlist_new();
KotoPlaylist* koto_playlist_new_with_uuid(const gchar *uuid);
void koto_playlist_add_track(KotoPlaylist *self, KotoIndexedFile *file);
void koto_playlist_add_track_by_uuid(KotoPlaylist *self, const gchar *uuid);
void koto_playlist_debug(KotoPlaylist *self);
void koto_playlist_debug_foreach(gpointer data, gpointer user_data);
gchar* koto_playlist_get_artwork(KotoPlaylist *self);
guint koto_playlist_get_current_position(KotoPlaylist *self);
gchar* koto_playlist_get_current_uuid(KotoPlaylist *self);
guint koto_playlist_get_length(KotoPlaylist *self);
gchar* koto_playlist_get_name(KotoPlaylist *self);
GQueue* koto_playlist_get_tracks(KotoPlaylist *self);
gchar* koto_playlist_get_uuid(KotoPlaylist *self);
gchar* koto_playlist_go_to_next(KotoPlaylist *self);
gchar* koto_playlist_go_to_previous(KotoPlaylist *self);
void koto_playlist_remove_track(KotoPlaylist *self, KotoIndexedFile *file);
void koto_playlist_remove_track_by_uuid(KotoPlaylist *self, gchar *uuid);
void koto_playlist_set_artwork(KotoPlaylist *self, const gchar *path);
void koto_playlist_save_state(KotoPlaylist *self);
void koto_playlist_set_name(KotoPlaylist *self, const gchar *name);
void koto_playlist_set_position(KotoPlaylist *self, guint pos);
void koto_playlist_set_uuid(KotoPlaylist *self, const gchar *uuid);
G_END_DECLS