summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichiel Van Der Kolk <not.valid@email.address>2005-07-04 22:01:31 +0000
committerMichiel Van Der Kolk <not.valid@email.address>2005-07-04 22:01:31 +0000
commitafe0941ae5ae8f5e69d7b3935db1b168da8c14fd (patch)
tree0180cfdeaa362ef4e7cfb57fe0d575a8d88ffc48
parent55819b7859bf99ac7960e5100eed6fcaa1909f67 (diff)
song rating support.. should probably be moved with browse id3 to a "song options" submenu in the wps context menu...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7013 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/database.c3
-rw-r--r--apps/lang/english.lang12
-rw-r--r--apps/onplay.c3
-rw-r--r--apps/screens.c50
-rw-r--r--apps/screens.h1
5 files changed, 69 insertions, 0 deletions
diff --git a/apps/database.c b/apps/database.c
index 0d0caebdc2..0e2a53b317 100644
--- a/apps/database.c
+++ b/apps/database.c
@@ -382,6 +382,7 @@ int rundb_init(void)
audio_set_track_buffer_event(&rundb_buffer_track);
audio_set_track_changed_event(&rundb_track_change);
audio_set_track_unbuffer_event(&rundb_unbuffer_track);
+ logf("rundb inited.");
#endif
rundbsize=lseek(rundb_fd,0,SEEK_END);
return 0;
@@ -451,6 +452,7 @@ void writerundbentry(struct mp3entry *id)
}
void writeruntimeinfo(struct mp3entry *id) {
+ logf("rundb write");
if(!id->rundbhash)
addrundbentry(id);
else
@@ -474,6 +476,7 @@ void clearruntimeinfo(struct mp3entry *id) {
void loadruntimeinfo(struct mp3entry *id)
{
+ logf("rundb load");
clearruntimeinfo(id);
clearfileentryinfo(id);
if(!getfentrybyfilename(id)) {
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index fb0da889cd..b7c829f4b8 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -3154,3 +3154,15 @@ desc: in settings_menu.
eng: "Gather runtime data (experimental)"
voice: "Gather runtime data"
new:
+
+id: LANG_MENU_SET_RATING
+desc: in wps context menu
+eng: "Set song rating"
+voice: "Set song rating"
+new:
+
+id: LANG_RATING
+desc: in set_rating
+eng: "Rating:"
+voice "Rating"
+new:
diff --git a/apps/onplay.c b/apps/onplay.c
index d1b5285faa..af35824c1e 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -556,6 +556,9 @@ int onplay(char* file, int attr, int from)
items[i].desc = ID2P(LANG_MENU_SHOW_ID3_INFO);
items[i].function = browse_id3;
i++;
+ items[i].desc = ID2P(LANG_MENU_SET_RATING);
+ items[i].function = set_rating;
+ i++;
}
#ifdef HAVE_MULTIVOLUME
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)
return false;
}
+bool set_rating(void)
+{
+ struct mp3entry* id3 = audio_current_track();
+ int button;
+ bool exit = false;
+ char rating_text[20];
+
+ if (!(audio_status() & AUDIO_STATUS_PLAY))
+ return false;
+ while (!exit)
+ {
+ lcd_clear_display();
+ lcd_puts(0, 0, str(LANG_RATING));
+ snprintf(rating_text,sizeof(rating_text),"%d",id3->rating);
+ lcd_puts(0,1,rating_text);
+ lcd_update();
+ button = button_get(true);
+
+ switch(button)
+ {
+ case SETTINGS_DEC:
+ if (id3->rating > 0)
+ id3->rating--;
+ else
+ id3->rating = 10;
+ break;
+
+ case SETTINGS_INC:
+ if (id3->rating < 10)
+ id3->rating++;
+ else
+ id3->rating = 0;
+ break;
+ case SETTINGS_CANCEL:
+#ifdef SETTINGS_OK2
+ case SETTINGS_OK2:
+#endif
+ /* eat release event */
+ button_get(true);
+ exit = true;
+ break;
+
+ default:
+ if(default_event_handler(button) == SYS_USB_CONNECTED)
+ return true;
+ break;
+ }
+ }
+ return false;
+}
diff --git a/apps/screens.h b/apps/screens.h
index 8648f4fb50..7a1b3f32bb 100644
--- a/apps/screens.h
+++ b/apps/screens.h
@@ -55,6 +55,7 @@ bool set_time_screen(const char* string, struct tm *tm);
bool shutdown_screen(void);
bool browse_id3(void);
+bool set_rating(void);
#endif