summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2005-01-19 15:01:31 +0000
committerBjörn Stenberg <bjorn@haxx.se>2005-01-19 15:01:31 +0000
commitcb7a3d27e2f036d90a5c359cf850d18ab20c4d5c (patch)
tree960b89a3a300dc83a67796120677a9902291cb8a
parentf44a519119df2a48e9edf562c7736a4c2fee9e63 (diff)
downloadrockbox-cb7a3d27e2f036d90a5c359cf850d18ab20c4d5c.tar.gz
rockbox-cb7a3d27e2f036d90a5c359cf850d18ab20c4d5c.tar.bz2
rockbox-cb7a3d27e2f036d90a5c359cf850d18ab20c4d5c.zip
Added a virtual 'Artists,Albums,Songs' root folder in ID3 browser
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5606 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/dbtree.c55
-rw-r--r--apps/dbtree.h2
-rw-r--r--apps/lang/english.lang18
-rw-r--r--apps/tree.c2
4 files changed, 58 insertions, 19 deletions
diff --git a/apps/dbtree.c b/apps/dbtree.c
index 6f78e02ca2..46acfff3d5 100644
--- a/apps/dbtree.c
+++ b/apps/dbtree.c
@@ -39,6 +39,7 @@
#include "applimits.h"
#include "dbtree.h"
#include "icons.h"
+#include "lang.h"
#ifdef LITTLE_ENDIAN
#include <netinet/in.h>
@@ -148,11 +149,29 @@ int db_load(struct tree_context* c)
DEBUGF("db_load(%d, %x, %d)\n", table, extra, c->firstpos);
if (!table) {
- table = allartists;
+ table = root;
c->currtable = table;
}
switch (table) {
+ case root: {
+ static const int tables[] = {allartists, allalbums, allsongs};
+ char* nbuf = (char*)nptr;
+ char* labels[3] = { str(LANG_ID3DB_ARTISTS),
+ str(LANG_ID3DB_ALBUMS),
+ str(LANG_ID3DB_SONGS)};
+
+ for (i=0; i < 3; i++) {
+ strcpy(nbuf, labels[i]);
+ dptr[0] = (unsigned int)nbuf;
+ dptr[1] = tables[i];
+ nbuf += strlen(nbuf) + 1;
+ dptr += 2;
+ }
+ c->dirlength = c->filesindir = i;
+ return i;
+ }
+
case allsongs:
offset = songstart + c->firstpos * (songlen + 12);
itemcount = songcount;
@@ -303,34 +322,36 @@ int db_load(struct tree_context* c)
void db_enter(struct tree_context* c)
{
+ int newextra = ((int*)c->dircache)[(c->dircursor + c->dirstart)*2 + 1];
+
+ c->dirpos[c->dirlevel] = c->dirstart;
+ c->cursorpos[c->dirlevel] = c->dircursor;
+ c->table_history[c->dirlevel] = c->currtable;
+ c->extra_history[c->dirlevel] = c->currextra;
+ c->pos_history[c->dirlevel] = c->firstpos;
+ c->dirlevel++;
+
switch (c->currtable) {
- case allartists:
- case albums4artist:
- c->dirpos[c->dirlevel] = c->dirstart;
- c->cursorpos[c->dirlevel] = c->dircursor;
- c->table_history[c->dirlevel] = c->currtable;
- c->extra_history[c->dirlevel] = c->currextra;
- c->pos_history[c->dirlevel] = c->firstpos;
- c->dirlevel++;
+ case root:
+ c->currtable = newextra;
+ c->currextra = newextra;
break;
-
- default:
- break;
- }
-
- switch (c->currtable) {
+
case allartists:
c->currtable = albums4artist;
- c->currextra = ((int*)c->dircache)[(c->dircursor + c->dirstart)*2 + 1];
+ c->currextra = newextra;
break;
+ case allalbums:
case albums4artist:
c->currtable = songs4album;
- c->currextra = ((int*)c->dircache)[(c->dircursor + c->dirstart)*2 + 1];
+ c->currextra = newextra;
break;
case songs4album:
+ case allsongs:
splash(HZ,true,"No playing implemented yet");
+ c->dirlevel--;
#if 0
/* find filenames, build playlist, play */
playlist_create(NULL,NULL);
diff --git a/apps/dbtree.h b/apps/dbtree.h
index 5fa09b0eaf..43c903ccf3 100644
--- a/apps/dbtree.h
+++ b/apps/dbtree.h
@@ -21,7 +21,7 @@
#include "tree.h"
-enum table { invalid, allsongs, allalbums, allartists,
+enum table { invalid, root, allsongs, allalbums, allartists,
albums4artist, songs4album };
int db_init(void);
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 6cbe2c469b..e43e43d615 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -2877,3 +2877,21 @@ desc: show ID3 database
eng: "ID3 database"
voice: "ID3 database"
new:
+
+id: LANG_ID3DB_ARTISTS
+desc: ID3 virtual folder name
+eng: "Artists"
+voice: "Artists"
+new:
+
+id: LANG_ID3DB_ALBUMS
+desc: ID3 virtual folder name
+eng: "Albums"
+voice: "Albums"
+new:
+
+id: LANG_ID3DB_SONGS
+desc: ID3 virtual folder name
+eng: "Songs"
+voice: "Songs"
+new:
diff --git a/apps/tree.c b/apps/tree.c
index 438e2f5ff1..61dd12c006 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -1389,7 +1389,7 @@ void tree_init(void)
/* We copy the settings value in case it is changed by the user. We can't
use it until the next reboot. */
max_files = global_settings.max_files_in_dir;
-
+
/* initialize tree context struct */
memset(&tc, 0, sizeof(tc));
tc.dirfilter = &global_settings.dirfilter;