Add list play mode
This commit is contained in:
parent
a5d1b3959c
commit
d541aa938c
|
@ -61,7 +61,7 @@ if(WIN32)
|
|||
set_property(SOURCE ../icon.rc APPEND PROPERTY
|
||||
OBJECT_DEPENDS ${PROJECT_SOURCE_DIR}/../icon.ico
|
||||
)
|
||||
add_executable(${PROJECT_NAME} WIN32 ${app_WINRC} ${SOURCE_FILE})
|
||||
add_executable(${PROJECT_NAME} ${app_WINRC} ${SOURCE_FILE})
|
||||
add_custom_command( TARGET ${PROJECT_NAME}
|
||||
COMMAND echo * > ${CMAKE_BINARY_DIR}/.gitignore
|
||||
COMMAND echo **/* > ${CMAKE_BINARY_DIR}/.hgignore)
|
||||
|
|
|
@ -363,12 +363,6 @@ static gboolean get_media_stream_status(MyMediaPlayer *player,
|
|||
update_lyrics(player);
|
||||
}
|
||||
|
||||
// The Media ended, reset the status
|
||||
// if (gtk_media_stream_get_ended(stream))
|
||||
// {
|
||||
// lyrics_loaded = FALSE;
|
||||
// }
|
||||
|
||||
if (get_media_playing(timestamp, stream, player))
|
||||
{
|
||||
// Reset status when the media playing
|
||||
|
@ -406,6 +400,14 @@ gboolean lyric_time_func(gpointer data)
|
|||
// Update lyrics and Check whether media stopped
|
||||
get_lyrics(timestamp_ms, get_media_stream_status(player, stream, timestamp_ms),
|
||||
player);
|
||||
|
||||
// The Media ended, reset the status
|
||||
if (gtk_media_stream_get_ended(stream) &&
|
||||
my_media_player_get_music_loaded(player))
|
||||
{
|
||||
my_media_player_set_music_loaded(player, FALSE);
|
||||
g_print("Media ended!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
|
|
@ -22,6 +22,7 @@ struct _MyMediaPlayer
|
|||
GtkWidget *scrolled_window, *scrolled_lyrics;
|
||||
GListStore *music_store;
|
||||
char current_filename[path_max_length];
|
||||
guint n_items;
|
||||
gboolean music_loaded;
|
||||
GtkSingleSelection *music_selection;
|
||||
GtkListItemFactory *filename_factory;
|
||||
|
@ -97,6 +98,9 @@ static void load_playlist(std::string filename, MyMediaPlayer *player)
|
|||
g_list_store_append(G_LIST_STORE(player->music_store),
|
||||
my_item_new(disp_name.c_str(), file_path.c_str()));
|
||||
}
|
||||
|
||||
player->n_items = g_list_model_get_n_items(
|
||||
G_LIST_MODEL(player->music_store));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,6 +263,12 @@ gboolean my_media_player_get_music_loaded(MyMediaPlayer *self)
|
|||
return self->music_loaded;
|
||||
}
|
||||
|
||||
void my_media_player_set_music_loaded(MyMediaPlayer *self, gboolean music_loaded)
|
||||
{
|
||||
// Set status of music loaded
|
||||
self->music_loaded = music_loaded;
|
||||
}
|
||||
|
||||
GtkWidget *my_media_player_get_video_widget(MyMediaPlayer *self)
|
||||
{
|
||||
// Get video widget
|
||||
|
|
|
@ -6,6 +6,8 @@ G_DECLARE_FINAL_TYPE(MyMediaPlayer, my_media_player, MYMEDIA, PLAYER, GtkApplica
|
|||
|
||||
gboolean my_media_player_get_music_loaded(MyMediaPlayer *self);
|
||||
|
||||
void my_media_player_set_music_loaded(MyMediaPlayer *self, gboolean music_loaded);
|
||||
|
||||
GtkWidget *my_media_player_get_video_widget(MyMediaPlayer *self);
|
||||
|
||||
GtkLabel *my_media_player_get_lyrics_widget(MyMediaPlayer *self);
|
||||
|
|
Loading…
Reference in New Issue