Skip to content

Commit

Permalink
Add 'Add to Favorites' to playlist entries
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Nov 16, 2017
1 parent 40bb1da commit 6f2efe7
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 2 deletions.
2 changes: 1 addition & 1 deletion command.c
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,7 @@ TODO: Add a setting for these tweaks */
case CMD_EVENT_ADD_TO_FAVORITES:
playlist_push(
g_defaults.content_favorites,
path_get(RARCH_PATH_CONTENT),
(const char*)data,
NULL,
file_path_str(FILE_PATH_DETECT),
file_path_str(FILE_PATH_DETECT),
Expand Down
4 changes: 4 additions & 0 deletions intl/msg_hash_de.h
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG,
"Rechter Analogstick")
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES,
"Zu Favoriten hinzufügen")
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST,
"Zu Favoriten hinzufügen")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN,
"Starten")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_MUSIC,
Expand Down Expand Up @@ -2820,6 +2822,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION,
"Zeige weiterführende Informationen über diesen Inhalt an.")
MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES,
"Füge diesen Eintrag zu deinen Favoriten hinzu.")
MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES_PLAYLIST,
"Füge diesen Eintrag zu deinen Favoriten hinzu.")
MSG_HASH(MENU_ENUM_SUBLABEL_RUN,
"Starte den Inhalt.")
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FILE_BROWSER_SETTINGS,
Expand Down
4 changes: 4 additions & 0 deletions intl/msg_hash_it.h
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG,
"Analogico Destro")
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES,
"Aggiungi a Preferiti")
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST,
"Aggiungi a Preferiti")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN,
"Avvia")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_MUSIC,
Expand Down Expand Up @@ -2818,6 +2820,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION,
"Visualizza ulteriori informazioni sul contenuto.")
MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES,
"Aggiunge il titolo ai tuoi preferiti.")
MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES_PLAYLIST,
"Aggiunge il titolo ai tuoi preferiti.")
MSG_HASH(MENU_ENUM_SUBLABEL_RUN,
"Avvia il contenuto.")
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FILE_BROWSER_SETTINGS,
Expand Down
2 changes: 2 additions & 0 deletions intl/msg_hash_ja.h
Original file line number Diff line number Diff line change
Expand Up @@ -3167,6 +3167,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_BGCOLOR_OPACITY,
"OSDメッセージ背景の不透明性")
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES,
"お気に入りに追加")
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST,
"お気に入りに追加")
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_DISABLE_KIOSK_MODE,
"キオスクモードを無効")
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_DISABLE_KIOSK_MODE,
Expand Down
2 changes: 2 additions & 0 deletions intl/msg_hash_lbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,8 @@ MSG_HASH(MENU_ENUM_LABEL_RGUI_SHOW_START_SCREEN,
"rgui_show_start_screen")
MSG_HASH(MENU_ENUM_LABEL_ADD_TO_FAVORITES,
"favorites_add")
MSG_HASH(MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST,
"favorites_add_playlist")
MSG_HASH(MENU_ENUM_LABEL_RUN,
"collection")
MSG_HASH(MENU_ENUM_LABEL_RUN_MUSIC,
Expand Down
6 changes: 6 additions & 0 deletions intl/msg_hash_pt_br.h
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG,
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES,
"Adicionar aos Favoritos"
)
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST,
"Adicionar aos Favoritos"
)
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN,
"Executar"
)
Expand Down Expand Up @@ -3556,6 +3559,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION,
MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES,
"Adicionar o item aos seus favoritos."
)
MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES_PLAYLIST,
"Adicionar o item aos seus favoritos."
)
MSG_HASH(MENU_ENUM_SUBLABEL_RUN,
"Iniciar o conteúdo."
)
Expand Down
4 changes: 4 additions & 0 deletions intl/msg_hash_us.h
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG,
"Right Analog")
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES,
"Add to Favorites")
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST,
"Add to Favorites")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN,
"Run")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_MUSIC,
Expand Down Expand Up @@ -2826,6 +2828,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_INFORMATION,
"View more information about the content.")
MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES,
"Add the entry to your favorites.")
MSG_HASH(MENU_ENUM_SUBLABEL_ADD_TO_FAVORITES_PLAYLIST,
"Add the entry to your favorites.")
MSG_HASH(MENU_ENUM_SUBLABEL_RUN,
"Start the content.")
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_FILE_BROWSER_SETTINGS,
Expand Down
32 changes: 31 additions & 1 deletion menu/cbs/menu_cbs_ok.c
Original file line number Diff line number Diff line change
Expand Up @@ -3209,7 +3209,34 @@ default_action_ok_cmd_func(action_ok_restart_content, CMD_EVENT_RESET)
default_action_ok_cmd_func(action_ok_screenshot, CMD_EVENT_TAKE_SCREENSHOT)
default_action_ok_cmd_func(action_ok_disk_cycle_tray_status, CMD_EVENT_DISK_EJECT_TOGGLE )
default_action_ok_cmd_func(action_ok_shader_apply_changes, CMD_EVENT_SHADERS_APPLY_CHANGES )
default_action_ok_cmd_func(action_ok_add_to_favorites, CMD_EVENT_ADD_TO_FAVORITES)

static int action_ok_add_to_favorites(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
void *new_path = (void*)path_get(RARCH_PATH_CONTENT);
if (!command_event(CMD_EVENT_ADD_TO_FAVORITES, new_path))
return menu_cbs_exit();
return 0;
}

static int action_ok_add_to_favorites_playlist(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
const char *tmp_path = NULL;
playlist_t *tmp_playlist = NULL;

menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist);

if (!tmp_playlist)
return 0;

playlist_get_index(tmp_playlist,
rpl_entry_selection_ptr, &tmp_path, NULL, NULL, NULL, NULL, NULL);

if (!command_event(CMD_EVENT_ADD_TO_FAVORITES, (void*)tmp_path))
return menu_cbs_exit();
return 0;
}

static int action_ok_rename_entry(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
Expand Down Expand Up @@ -4401,6 +4428,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_RESUME_CONTENT:
BIND_ACTION_OK(cbs, action_ok_resume_content);
break;
case MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST:
BIND_ACTION_OK(cbs, action_ok_add_to_favorites_playlist);
break;
case MENU_ENUM_LABEL_ADD_TO_FAVORITES:
BIND_ACTION_OK(cbs, action_ok_add_to_favorites);
break;
Expand Down
8 changes: 8 additions & 0 deletions menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -3035,6 +3035,14 @@ static int menu_displaylist_parse_horizontal_content_actions(
msg_hash_to_str(MENU_ENUM_LABEL_DELETE_ENTRY),
MENU_ENUM_LABEL_DELETE_ENTRY,
MENU_SETTING_ACTION_DELETE_ENTRY, 0, 0);

if (settings->bools.quick_menu_show_add_to_favorites)
{
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST),
msg_hash_to_str(MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST),
MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST, FILE_TYPE_PLAYLIST_ENTRY, 0, 0);
}
}

if (!string_is_empty(db_name) && (!content_loaded ||
Expand Down
1 change: 1 addition & 0 deletions msg_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@ enum msg_hash_enums
MENU_LABEL(GOTO_IMAGES),
MENU_LABEL(GOTO_VIDEO),
MENU_LABEL(ADD_TO_FAVORITES),
MENU_LABEL(ADD_TO_FAVORITES_PLAYLIST),
MENU_LABEL(MENU_THROTTLE_FRAMERATE),
MENU_LABEL(NO_ACHIEVEMENTS_TO_DISPLAY),
MENU_LABEL(NO_ENTRIES_TO_DISPLAY),
Expand Down

0 comments on commit 6f2efe7

Please sign in to comment.