forked from len0rd/rockbox
Theme Editor: Changed playlist rendering to match new syntax
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27819 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
18a6f42f26
commit
b413169b2e
3 changed files with 5 additions and 60 deletions
|
@ -255,69 +255,15 @@ void RBViewport::write(QString text)
|
||||||
}
|
}
|
||||||
|
|
||||||
void RBViewport::showPlaylist(const RBRenderInfo &info, int start,
|
void RBViewport::showPlaylist(const RBRenderInfo &info, int start,
|
||||||
skin_element *id3, skin_element *noId3)
|
ParseTreeNode* lines)
|
||||||
{
|
{
|
||||||
/* Determining whether ID3 info is available */
|
|
||||||
skin_element* root = id3;
|
|
||||||
|
|
||||||
/* The line will be a linked list */
|
|
||||||
if(root->children_count > 0)
|
|
||||||
root = root->children[0];
|
|
||||||
|
|
||||||
int song = start + info.device()->data("pp").toInt();
|
int song = start + info.device()->data("pp").toInt();
|
||||||
int numSongs = info.device()->data("pe").toInt();
|
int numSongs = info.device()->data("pe").toInt();
|
||||||
int halfWay = (numSongs - song) / 2 + 1 + song;
|
|
||||||
|
|
||||||
while(song <= numSongs && textOffset.y() + lineHeight < size.height())
|
while(song <= numSongs && textOffset.y() + lineHeight < size.height())
|
||||||
{
|
{
|
||||||
if(song == halfWay)
|
lines->render(info, this);
|
||||||
{
|
|
||||||
root = noId3;
|
|
||||||
if(root->children_count > 0)
|
|
||||||
root = root->children[0];
|
|
||||||
}
|
|
||||||
skin_element* current = root;
|
|
||||||
while(current)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(current->type == TEXT)
|
|
||||||
{
|
|
||||||
write(QString((char*)current->data));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(current->type == TAG)
|
|
||||||
{
|
|
||||||
QString tag(current->tag->name);
|
|
||||||
if(tag == "pp")
|
|
||||||
{
|
|
||||||
write(QString::number(song));
|
|
||||||
}
|
|
||||||
else if(tag == "pt")
|
|
||||||
{
|
|
||||||
write(QObject::tr("00:00"));
|
|
||||||
}
|
|
||||||
else if(tag[0] == 'i' || tag[0] == 'f')
|
|
||||||
{
|
|
||||||
if(song == info.device()->data("pp").toInt())
|
|
||||||
{
|
|
||||||
write(info.device()->data(tag).toString());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* If we're not on the current track, use the next
|
|
||||||
* track info
|
|
||||||
*/
|
|
||||||
if(tag[0] == 'i')
|
|
||||||
tag = QString("I") + tag.right(1);
|
|
||||||
else
|
|
||||||
tag = QString("F") + tag.right(1);
|
|
||||||
write(info.device()->data(tag).toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
current = current->next;
|
|
||||||
}
|
|
||||||
newLine();
|
newLine();
|
||||||
song++;
|
song++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,8 +78,8 @@ public:
|
||||||
|
|
||||||
void enableStatusBar(){ showStatusBar = true; }
|
void enableStatusBar(){ showStatusBar = true; }
|
||||||
|
|
||||||
void showPlaylist(const RBRenderInfo& info, int start, skin_element* id3,
|
void showPlaylist(const RBRenderInfo& info, int start,
|
||||||
skin_element* noId3);
|
ParseTreeNode* lines);
|
||||||
|
|
||||||
void makeFullScreen();
|
void makeFullScreen();
|
||||||
|
|
||||||
|
|
|
@ -918,8 +918,7 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport)
|
||||||
case 'p':
|
case 'p':
|
||||||
/* %Vp */
|
/* %Vp */
|
||||||
viewport->showPlaylist(info, element->params[0].data.number,
|
viewport->showPlaylist(info, element->params[0].data.number,
|
||||||
element->params[1].data.code,
|
children[1]);
|
||||||
element->params[2].data.code);
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 'I':
|
case 'I':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue