summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/gwps-common.c36
-rw-r--r--apps/gui/gwps-common.h1
2 files changed, 9 insertions, 28 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 2037ad57a5..d533e33f9c 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -371,24 +371,6 @@ static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force)
371 gui_statusbar_draw((wps)->statusbar, (force)) 371 gui_statusbar_draw((wps)->statusbar, (force))
372#endif 372#endif
373 373
374/* Format time into buf.
375 *
376 * buf - buffer to format to.
377 * buf_size - size of buffer.
378 * time - time to format, in milliseconds.
379 */
380void gui_wps_format_time(char* buf, int buf_size, long time)
381{
382 if ( time < 3600000 ) {
383 snprintf(buf, buf_size, "%d:%02d",
384 (int) (time % 3600000 / 60000), (int) (time % 60000 / 1000));
385 } else {
386 snprintf(buf, buf_size, "%d:%02d:%02d",
387 (int) (time / 3600000), (int) (time % 3600000 / 60000),
388 (int) (time % 60000 / 1000));
389 }
390}
391
392/* Extract a part from a path. 374/* Extract a part from a path.
393 * 375 *
394 * buf - buffer extract part to. 376 * buf - buffer extract part to.
@@ -688,20 +670,20 @@ static char* get_tag(struct wps_data* wps_data,
688 670
689 case 'c': /* Current Time in Song */ 671 case 'c': /* Current Time in Song */
690 *flags |= WPS_REFRESH_DYNAMIC; 672 *flags |= WPS_REFRESH_DYNAMIC;
691 gui_wps_format_time(buf, buf_size, 673 format_time(buf, buf_size,
692 id3->elapsed + wps_state.ff_rewind_count); 674 id3->elapsed + wps_state.ff_rewind_count);
693 return buf; 675 return buf;
694 676
695 case 'r': /* Remaining Time in Song */ 677 case 'r': /* Remaining Time in Song */
696 *flags |= WPS_REFRESH_DYNAMIC; 678 *flags |= WPS_REFRESH_DYNAMIC;
697 gui_wps_format_time(buf, buf_size, 679 format_time(buf, buf_size,
698 id3->length - id3->elapsed - 680 id3->length - id3->elapsed -
699 wps_state.ff_rewind_count); 681 wps_state.ff_rewind_count);
700 return buf; 682 return buf;
701 683
702 case 't': /* Total Time */ 684 case 't': /* Total Time */
703 *flags |= WPS_REFRESH_STATIC; 685 *flags |= WPS_REFRESH_STATIC;
704 gui_wps_format_time(buf, buf_size, id3->length); 686 format_time(buf, buf_size, id3->length);
705 return buf; 687 return buf;
706 688
707#ifdef HAVE_LCD_BITMAP 689#ifdef HAVE_LCD_BITMAP
@@ -835,8 +817,8 @@ static char* get_tag(struct wps_data* wps_data,
835 } 817 }
836 else 818 else
837 { 819 {
838 gui_wps_format_time(buf, buf_size, \ 820 format_time(buf, buf_size, \
839 get_sleep_timer() * 1000); 821 get_sleep_timer() * 1000);
840 return buf; 822 return buf;
841 } 823 }
842 } 824 }
@@ -2252,7 +2234,7 @@ static void draw_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size)
2252 time=(state->id3->elapsed + state->ff_rewind_count); 2234 time=(state->id3->elapsed + state->ff_rewind_count);
2253 2235
2254 memset(timestr, 0, sizeof(timestr)); 2236 memset(timestr, 0, sizeof(timestr));
2255 gui_wps_format_time(timestr, sizeof(timestr), time); 2237 format_time(timestr, sizeof(timestr), time);
2256 for(lcd_char_pos=0; lcd_char_pos<6; lcd_char_pos++) { 2238 for(lcd_char_pos=0; lcd_char_pos<6; lcd_char_pos++) {
2257 digits[lcd_char_pos] = map_fullbar_char(timestr[lcd_char_pos]); 2239 digits[lcd_char_pos] = map_fullbar_char(timestr[lcd_char_pos]);
2258 } 2240 }
diff --git a/apps/gui/gwps-common.h b/apps/gui/gwps-common.h
index b4d6df589a..77bec83951 100644
--- a/apps/gui/gwps-common.h
+++ b/apps/gui/gwps-common.h
@@ -23,7 +23,6 @@
23 23
24#include "gwps.h" 24#include "gwps.h"
25 25
26void gui_wps_format_time(char* buf, int buf_size, long time);
27void fade(bool fade_in); 26void fade(bool fade_in);
28void gui_wps_format(struct wps_data *data); 27void gui_wps_format(struct wps_data *data);
29bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, 28bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,