summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2006-12-19 12:26:03 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2006-12-19 12:26:03 +0000
commitd152b6492a2371c261c195494864c3744609cf3c (patch)
treef0f6212b42ff5608eaa6b156342bf1939a9edd21
parent6efad93713a67ab21caf8be8c167c730912e8b86 (diff)
downloadrockbox-d152b6492a2371c261c195494864c3744609cf3c.tar.gz
rockbox-d152b6492a2371c261c195494864c3744609cf3c.zip
update the runtime screen and move it to the inf menu instead of debug
menu git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11817 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/debug_menu.c86
-rw-r--r--apps/lang/english.lang55
-rw-r--r--apps/main_menu.c1
-rw-r--r--apps/misc.c1
-rw-r--r--apps/screens.c96
-rw-r--r--apps/screens.h1
6 files changed, 153 insertions, 87 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 7d1e1c18cf..e21d203f7a 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1484,91 +1484,6 @@ static bool view_battery(void)
1484#endif /* HAVE_LCD_BITMAP */ 1484#endif /* HAVE_LCD_BITMAP */
1485#endif 1485#endif
1486 1486
1487static bool view_runtime(void)
1488{
1489 char s[32];
1490 bool done = false;
1491 int state = 1;
1492
1493 while(!done)
1494 {
1495 int y=0;
1496 int t;
1497 int key;
1498 lcd_clear_display();
1499#ifdef HAVE_LCD_BITMAP
1500 lcd_puts(0, y++, "Running time:");
1501 y++;
1502#endif
1503
1504 if (state & 1) {
1505#ifdef CONFIG_CHARGING
1506 if (charger_inserted()
1507#ifdef HAVE_USB_POWER
1508 || usb_powered()
1509#endif
1510 )
1511 {
1512 global_settings.runtime = 0;
1513 }
1514 else
1515#endif
1516 {
1517 global_settings.runtime += ((current_tick - lasttime) / HZ);
1518 }
1519 lasttime = current_tick;
1520
1521 t = global_settings.runtime;
1522 lcd_puts(0, y++, "Current time");
1523 }
1524 else {
1525 t = global_settings.topruntime;
1526 lcd_puts(0, y++, "Top time");
1527 }
1528
1529 snprintf(s, sizeof(s), "%dh %dm %ds",
1530 t / 3600, (t % 3600) / 60, t % 60);
1531 lcd_puts(0, y++, s);
1532 lcd_update();
1533
1534 /* Wait for a key to be pushed */
1535 key = get_action(CONTEXT_SETTINGS,HZ);
1536 switch(key) {
1537 case ACTION_STD_CANCEL:
1538 done = true;
1539 break;
1540
1541 case ACTION_SETTINGS_INC:
1542 case ACTION_SETTINGS_DEC:
1543 if (state == 1)
1544 state = 2;
1545 else
1546 state = 1;
1547 break;
1548
1549 case ACTION_STD_OK:
1550 lcd_clear_display();
1551 /*NOTE: this needs to be changed to sync splash! */
1552 lcd_puts(0,0,"Clear time?");
1553 lcd_puts(0,1,"PLAY = Yes");
1554 lcd_update();
1555 while (1) {
1556 key = get_action(CONTEXT_STD,TIMEOUT_BLOCK);
1557 if ( key == ACTION_STD_OK ) {
1558 if ( state == 1 )
1559 global_settings.runtime = 0;
1560 else
1561 global_settings.topruntime = 0;
1562 break;
1563 }
1564 }
1565 break;
1566 }
1567 }
1568 action_signalscreenchange();
1569 return false;
1570}
1571
1572#ifndef SIMULATOR 1487#ifndef SIMULATOR
1573#ifdef HAVE_MMC 1488#ifdef HAVE_MMC
1574static bool dbg_mmc_info(void) 1489static bool dbg_mmc_info(void)
@@ -2192,7 +2107,6 @@ bool debug_menu(void)
2192 { "pm histogram", peak_meter_histogram}, 2107 { "pm histogram", peak_meter_histogram},
2193#endif /* PM_DEBUG */ 2108#endif /* PM_DEBUG */
2194#endif /* HAVE_LCD_BITMAP */ 2109#endif /* HAVE_LCD_BITMAP */
2195 { "View runtime", view_runtime },
2196#ifndef SIMULATOR 2110#ifndef SIMULATOR
2197#ifdef CONFIG_TUNER 2111#ifdef CONFIG_TUNER
2198 { "FM Radio", dbg_fm_radio }, 2112 { "FM Radio", dbg_fm_radio },
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index bca55f116c..6681639aaa 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -10387,3 +10387,58 @@
10387 </voice> 10387 </voice>
10388</phrase> 10388</phrase>
10389<phrase> 10389<phrase>
10390 id: LANG_RUNNING_TIME
10391 desc: in run time screen
10392 user:
10393 <source>
10394 *: "Running Time"
10395 </source>
10396 <dest>
10397 *: "Running Time"
10398 </dest>
10399 <voice>
10400 *: "Running Time"
10401 </voice>
10402</phrase>
10403<phrase>
10404 id: LANG_CURRENT_TIME
10405 desc: in run time screen
10406 user:
10407 <source>
10408 *: "Current Time"
10409 </source>
10410 <dest>
10411 *: "Current Time"
10412 </dest>
10413 <voice>
10414 *: "Current Time"
10415 </voice>
10416</phrase>
10417<phrase>
10418 id: LANG_TOP_TIME
10419 desc: in run time screen
10420 user:
10421 <source>
10422 *: "Top Time"
10423 </source>
10424 <dest>
10425 *: "Top Time"
10426 </dest>
10427 <voice>
10428 *: "Top Time"
10429 </voice>
10430</phrase>
10431<phrase>
10432 id: LANG_CLEAR_TIME
10433 desc: in run time screen
10434 user:
10435 <source>
10436 *: "Clear Time?"
10437 </source>
10438 <dest>
10439 *: "Clear Time?"
10440 </dest>
10441 <voice>
10442 *: "Clear Time?"
10443 </voice>
10444</phrase>
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 952586465f..7e20656dc9 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -349,6 +349,7 @@ static bool info_menu(void)
349 static const struct menu_item items[] = { 349 static const struct menu_item items[] = {
350 { ID2P(LANG_INFO_MENU), show_info }, 350 { ID2P(LANG_INFO_MENU), show_info },
351 { ID2P(LANG_VERSION), show_credits }, 351 { ID2P(LANG_VERSION), show_credits },
352 { ID2P(LANG_RUNNING_TIME), view_runtime },
352 { ID2P(LANG_DEBUG), debug_menu }, 353 { ID2P(LANG_DEBUG), debug_menu },
353#ifdef SIMULATOR 354#ifdef SIMULATOR
354 { ID2P(LANG_USB), simulate_usb }, 355 { ID2P(LANG_USB), simulate_usb },
diff --git a/apps/misc.c b/apps/misc.c
index 02faec821a..155027b1bf 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -556,7 +556,6 @@ bool settings_parseline(char* line, char** name, char** value)
556static void system_flush(void) 556static void system_flush(void)
557{ 557{
558 tree_flush(); 558 tree_flush();
559 /*settings_save();*/
560 call_ata_idle_notifys(true); /*doesnt work on usb and shutdown from ata thread */ 559 call_ata_idle_notifys(true); /*doesnt work on usb and shutdown from ata thread */
561} 560}
562 561
diff --git a/apps/screens.c b/apps/screens.c
index 032fd0b60d..5cc3cc15ec 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -56,6 +56,7 @@
56#include "quickscreen.h" 56#include "quickscreen.h"
57#include "pcmbuf.h" 57#include "pcmbuf.h"
58#include "list.h" 58#include "list.h"
59#include "yesno.h"
59 60
60#ifdef HAVE_LCD_BITMAP 61#ifdef HAVE_LCD_BITMAP
61#include <bitmaps/usblogo.h> 62#include <bitmaps/usblogo.h>
@@ -1300,3 +1301,98 @@ bool set_rating(void)
1300 action_signalscreenchange(); 1301 action_signalscreenchange();
1301 return false; 1302 return false;
1302} 1303}
1304
1305
1306bool view_runtime(void)
1307{
1308 char s[32];
1309 bool done = false;
1310 int state = 1;
1311 int i;
1312 int key;
1313 unsigned char *lines[]={str(LANG_CLEAR_TIME)};
1314 struct text_message message={(char **)lines, 1};
1315
1316 while(!done)
1317 {
1318 int y[NB_SCREENS]={0};
1319 int t;
1320
1321 FOR_NB_SCREENS(i)
1322 {
1323 screens[i].clear_display();
1324#ifdef HAVE_LCD_BITMAP
1325 if (screens[i].nb_lines >4)
1326 {
1327 screens[i].puts(0, y[i]++, str(LANG_RUNNING_TIME));
1328 }
1329#endif
1330 }
1331
1332 if (state & 1) {
1333#ifdef CONFIG_CHARGING
1334 if (charger_inserted()
1335#ifdef HAVE_USB_POWER
1336 || usb_powered()
1337#endif
1338 )
1339 {
1340 global_settings.runtime = 0;
1341 }
1342 else
1343#endif
1344 {
1345 global_settings.runtime += ((current_tick - lasttime) / HZ);
1346 }
1347 lasttime = current_tick;
1348
1349 t = global_settings.runtime;
1350 FOR_NB_SCREENS(i)
1351 screens[i].puts(0, y[i]++, str(LANG_CURRENT_TIME));
1352 }
1353 else {
1354 t = global_settings.topruntime;
1355 FOR_NB_SCREENS(i)
1356 screens[i].puts(0, y[i]++, str(LANG_TOP_TIME));
1357 }
1358 snprintf(s, sizeof(s), "%dh %dm %ds",
1359 t / 3600, (t % 3600) / 60, t % 60);
1360 gui_syncstatusbar_draw(&statusbars, true);
1361 FOR_NB_SCREENS(i)
1362 {
1363 screens[i].puts(0, y[i]++, s);
1364#if defined(HAVE_LCD_BITMAP)
1365 screens[i].update();
1366#endif
1367 }
1368
1369 /* Wait for a key to be pushed */
1370 key = get_action(CONTEXT_STD,HZ);
1371 switch(key) {
1372 case ACTION_STD_CANCEL:
1373 done = true;
1374 break;
1375
1376 case ACTION_STD_NEXT:
1377 case ACTION_STD_PREV:
1378 state = (state==1)?2:1;
1379 break;
1380
1381 case ACTION_STD_OK:
1382 if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES)
1383 {
1384 if ( state == 1 )
1385 global_settings.runtime = 0;
1386 else
1387 global_settings.topruntime = 0;
1388 }
1389 break;
1390 default:
1391 if(default_event_handler(key) == SYS_USB_CONNECTED)
1392 return true;
1393 break;
1394 }
1395 }
1396 action_signalscreenchange();
1397 return false;
1398}
diff --git a/apps/screens.h b/apps/screens.h
index c34f612ded..2bf2b32819 100644
--- a/apps/screens.h
+++ b/apps/screens.h
@@ -49,6 +49,7 @@ bool set_time_screen(const char* string, struct tm *tm);
49bool shutdown_screen(void); 49bool shutdown_screen(void);
50bool browse_id3(void); 50bool browse_id3(void);
51bool set_rating(void); 51bool set_rating(void);
52bool view_runtime(void);
52 53
53#endif 54#endif
54 55