summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-08-15 02:04:06 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-08-15 02:04:06 +0000
commitb413169b2ef5d94b2574afe0122c476ad703f4ff (patch)
tree39b68f635f19a15fae36a77b542c310bc5849add
parent18a6f42f2622d27967c3ad83b27a1de4f713dff2 (diff)
downloadrockbox-b413169b2ef5d94b2574afe0122c476ad703f4ff.tar.gz
rockbox-b413169b2ef5d94b2574afe0122c476ad703f4ff.zip
Theme Editor: Changed playlist rendering to match new syntax
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27819 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--utils/themeeditor/graphics/rbviewport.cpp58
-rw-r--r--utils/themeeditor/graphics/rbviewport.h4
-rw-r--r--utils/themeeditor/models/parsetreenode.cpp3
3 files changed, 5 insertions, 60 deletions
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp
index f646d830dd..fea1055935 100644
--- a/utils/themeeditor/graphics/rbviewport.cpp
+++ b/utils/themeeditor/graphics/rbviewport.cpp
@@ -255,69 +255,15 @@ void RBViewport::write(QString text)
255} 255}
256 256
257void RBViewport::showPlaylist(const RBRenderInfo &info, int start, 257void RBViewport::showPlaylist(const RBRenderInfo &info, int start,
258 skin_element *id3, skin_element *noId3) 258 ParseTreeNode* lines)
259{ 259{
260 /* Determining whether ID3 info is available */
261 skin_element* root = id3;
262
263 /* The line will be a linked list */
264 if(root->children_count > 0)
265 root = root->children[0];
266 260
267 int song = start + info.device()->data("pp").toInt(); 261 int song = start + info.device()->data("pp").toInt();
268 int numSongs = info.device()->data("pe").toInt(); 262 int numSongs = info.device()->data("pe").toInt();
269 int halfWay = (numSongs - song) / 2 + 1 + song;
270 263
271 while(song <= numSongs && textOffset.y() + lineHeight < size.height()) 264 while(song <= numSongs && textOffset.y() + lineHeight < size.height())
272 { 265 {
273 if(song == halfWay) 266 lines->render(info, this);
274 {
275 root = noId3;
276 if(root->children_count > 0)
277 root = root->children[0];
278 }
279 skin_element* current = root;
280 while(current)
281 {
282
283 if(current->type == TEXT)
284 {
285 write(QString((char*)current->data));
286 }
287
288 if(current->type == TAG)
289 {
290 QString tag(current->tag->name);
291 if(tag == "pp")
292 {
293 write(QString::number(song));
294 }
295 else if(tag == "pt")
296 {
297 write(QObject::tr("00:00"));
298 }
299 else if(tag[0] == 'i' || tag[0] == 'f')
300 {
301 if(song == info.device()->data("pp").toInt())
302 {
303 write(info.device()->data(tag).toString());
304 }
305 else
306 {
307 /* If we're not on the current track, use the next
308 * track info
309 */
310 if(tag[0] == 'i')
311 tag = QString("I") + tag.right(1);
312 else
313 tag = QString("F") + tag.right(1);
314 write(info.device()->data(tag).toString());
315 }
316 }
317 }
318
319 current = current->next;
320 }
321 newLine(); 267 newLine();
322 song++; 268 song++;
323 } 269 }
diff --git a/utils/themeeditor/graphics/rbviewport.h b/utils/themeeditor/graphics/rbviewport.h
index cc47e41666..8e17ac15de 100644
--- a/utils/themeeditor/graphics/rbviewport.h
+++ b/utils/themeeditor/graphics/rbviewport.h
@@ -78,8 +78,8 @@ public:
78 78
79 void enableStatusBar(){ showStatusBar = true; } 79 void enableStatusBar(){ showStatusBar = true; }
80 80
81 void showPlaylist(const RBRenderInfo& info, int start, skin_element* id3, 81 void showPlaylist(const RBRenderInfo& info, int start,
82 skin_element* noId3); 82 ParseTreeNode* lines);
83 83
84 void makeFullScreen(); 84 void makeFullScreen();
85 85
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp
index 9d23428349..f15fa8e31a 100644
--- a/utils/themeeditor/models/parsetreenode.cpp
+++ b/utils/themeeditor/models/parsetreenode.cpp
@@ -918,8 +918,7 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport)
918 case 'p': 918 case 'p':
919 /* %Vp */ 919 /* %Vp */
920 viewport->showPlaylist(info, element->params[0].data.number, 920 viewport->showPlaylist(info, element->params[0].data.number,
921 element->params[1].data.code, 921 children[1]);
922 element->params[2].data.code);
923 return true; 922 return true;
924 923
925 case 'I': 924 case 'I':