summaryrefslogtreecommitdiff
path: root/apps/screens.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/screens.c')
-rw-r--r--apps/screens.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/apps/screens.c b/apps/screens.c
index 19caf96cc9..e188d341d8 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -1417,3 +1417,53 @@ bool browse_id3(void)
1417 return false; 1417 return false;
1418} 1418}
1419 1419
1420bool set_rating(void)
1421{
1422 struct mp3entry* id3 = audio_current_track();
1423 int button;
1424 bool exit = false;
1425 char rating_text[20];
1426
1427 if (!(audio_status() & AUDIO_STATUS_PLAY))
1428 return false;
1429 while (!exit)
1430 {
1431 lcd_clear_display();
1432 lcd_puts(0, 0, str(LANG_RATING));
1433 snprintf(rating_text,sizeof(rating_text),"%d",id3->rating);
1434 lcd_puts(0,1,rating_text);
1435 lcd_update();
1436 button = button_get(true);
1437
1438 switch(button)
1439 {
1440 case SETTINGS_DEC:
1441 if (id3->rating > 0)
1442 id3->rating--;
1443 else
1444 id3->rating = 10;
1445 break;
1446
1447 case SETTINGS_INC:
1448 if (id3->rating < 10)
1449 id3->rating++;
1450 else
1451 id3->rating = 0;
1452 break;
1453 case SETTINGS_CANCEL:
1454#ifdef SETTINGS_OK2
1455 case SETTINGS_OK2:
1456#endif
1457 /* eat release event */
1458 button_get(true);
1459 exit = true;
1460 break;
1461
1462 default:
1463 if(default_event_handler(button) == SYS_USB_CONNECTED)
1464 return true;
1465 break;
1466 }
1467 }
1468 return false;
1469}