diff options
-rw-r--r-- | apps/onplay.c | 64 |
1 files changed, 14 insertions, 50 deletions
diff --git a/apps/onplay.c b/apps/onplay.c index cd93afbe78..72b1d02f3a 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -951,48 +951,22 @@ static bool clipboard_paste(void) | |||
951 | 951 | ||
952 | static int onplaymenu_callback(int action,const struct menu_item_ex *this_item); | 952 | static int onplaymenu_callback(int action,const struct menu_item_ex *this_item); |
953 | #ifdef HAVE_TAGCACHE | 953 | #ifdef HAVE_TAGCACHE |
954 | char *rating_name(int selected_item, void * data, char *buffer) | 954 | static int set_rating_inline(void) |
955 | { | 955 | { |
956 | (void)selected_item; (void)data; | ||
957 | struct mp3entry* id3 = audio_current_track(); | 956 | struct mp3entry* id3 = audio_current_track(); |
958 | if(id3) | 957 | if (id3 && id3->tagcache_idx && global_settings.runtimedb) |
959 | snprintf(buffer, MAX_PATH, | ||
960 | "%s: %d", str(LANG_MENU_SET_RATING), id3->rating); | ||
961 | else | ||
962 | snprintf(buffer, MAX_PATH, | ||
963 | "%s: -", str(LANG_MENU_SET_RATING)); | ||
964 | return buffer; | ||
965 | } | ||
966 | |||
967 | static bool set_rating_inline(void) | ||
968 | { | ||
969 | struct mp3entry* id3 = audio_current_track(); | ||
970 | if (id3 && id3->tagcache_idx) | ||
971 | { | 958 | { |
972 | if (id3->rating<10) | 959 | set_int_ex(str(LANG_MENU_SET_RATING), "", UNIT_INT, (void*)(&id3->rating), |
973 | id3->rating++; | 960 | NULL, 1, 0, 10, NULL, NULL); |
974 | else | ||
975 | id3->rating=0; | ||
976 | |||
977 | tagcache_update_numeric(id3->tagcache_idx, tag_rating, id3->rating); | 961 | tagcache_update_numeric(id3->tagcache_idx, tag_rating, id3->rating); |
978 | } | 962 | } |
979 | return false; | 963 | else |
980 | } | 964 | gui_syncsplash(HZ*2, ID2P(LANG_ID3_NO_INFO)); |
981 | static int ratingitem_callback(int action,const struct menu_item_ex *this_item) | 965 | return 0; |
982 | { | ||
983 | (void)this_item; | ||
984 | switch (action) | ||
985 | { | ||
986 | case ACTION_REQUEST_MENUITEM: | ||
987 | if (!selected_file || !global_settings.runtimedb) | ||
988 | return ACTION_EXIT_MENUITEM; | ||
989 | break; | ||
990 | } | ||
991 | return action; | ||
992 | } | 966 | } |
993 | MENUITEM_FUNCTION_DYNTEXT(rating_item, 0, set_rating_inline, | 967 | MENUITEM_FUNCTION(rating_item, 0, ID2P(LANG_MENU_SET_RATING), |
994 | NULL, rating_name, NULL, NULL, | 968 | set_rating_inline, NULL, |
995 | ratingitem_callback, Icon_Questionmark); | 969 | NULL, Icon_Questionmark); |
996 | #endif | 970 | #endif |
997 | 971 | ||
998 | static bool view_cue(void) | 972 | static bool view_cue(void) |
@@ -1201,26 +1175,16 @@ static int onplaymenu_callback(int action,const struct menu_item_ex *this_item) | |||
1201 | } | 1175 | } |
1202 | int onplay(char* file, int attr, int from) | 1176 | int onplay(char* file, int attr, int from) |
1203 | { | 1177 | { |
1204 | int menu_result; | 1178 | const struct menu_item_ex *menu; |
1205 | int selected_item = 0; /* this is a bit of a hack to reopen | ||
1206 | the menu if certain items are selected */ | ||
1207 | onplay_result = ONPLAY_OK; | 1179 | onplay_result = ONPLAY_OK; |
1208 | context = from; | 1180 | context = from; |
1209 | selected_file = file; | 1181 | selected_file = file; |
1210 | selected_file_attr = attr; | 1182 | selected_file_attr = attr; |
1211 | if (context == CONTEXT_WPS) | 1183 | if (context == CONTEXT_WPS) |
1212 | { | 1184 | menu = &wps_onplay_menu; |
1213 | #ifdef HAVE_TAGCACHE | ||
1214 | do { | ||
1215 | #endif | ||
1216 | menu_result = do_menu(&wps_onplay_menu, &selected_item); | ||
1217 | #ifdef HAVE_TAGCACHE | ||
1218 | } while ((wps_onplay_menu_[selected_item] == &rating_item)); | ||
1219 | #endif | ||
1220 | } | ||
1221 | else | 1185 | else |
1222 | menu_result = do_menu(&tree_onplay_menu, NULL); | 1186 | menu = &tree_onplay_menu; |
1223 | switch (menu_result) | 1187 | switch (do_menu(menu, NULL)) |
1224 | { | 1188 | { |
1225 | case GO_TO_WPS: | 1189 | case GO_TO_WPS: |
1226 | return ONPLAY_START_PLAY; | 1190 | return ONPLAY_START_PLAY; |