diff options
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/statusbar.c | 104 | ||||
-rw-r--r-- | apps/gui/statusbar.h | 8 |
2 files changed, 3 insertions, 109 deletions
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index 157224f77d..e082063a6f 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include "action.h" /* for keys_locked */ | 33 | #include "action.h" /* for keys_locked */ |
34 | #include "statusbar.h" | 34 | #include "statusbar.h" |
35 | #ifdef HAVE_RECORDING | 35 | #ifdef HAVE_RECORDING |
36 | #include "recording.h" | ||
37 | #include "audio.h" | 36 | #include "audio.h" |
38 | #include "recording.h" | 37 | #include "recording.h" |
39 | #endif | 38 | #endif |
@@ -114,11 +113,7 @@ | |||
114 | #define STATUSBAR_LOCKR_WIDTH 5 | 113 | #define STATUSBAR_LOCKR_WIDTH 5 |
115 | 114 | ||
116 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | 115 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) |
117 | #ifdef HAVE_MMC | ||
118 | #define STATUSBAR_DISK_WIDTH 12 | 116 | #define STATUSBAR_DISK_WIDTH 12 |
119 | #else | ||
120 | #define STATUSBAR_DISK_WIDTH 7 | ||
121 | #endif | ||
122 | #define STATUSBAR_DISK_X_POS(statusbar_width) statusbar_width - \ | 117 | #define STATUSBAR_DISK_X_POS(statusbar_width) statusbar_width - \ |
123 | STATUSBAR_DISK_WIDTH | 118 | STATUSBAR_DISK_WIDTH |
124 | #else | 119 | #else |
@@ -126,15 +121,6 @@ | |||
126 | #endif | 121 | #endif |
127 | #define STATUSBAR_TIME_X_END(statusbar_width) statusbar_width - 1 - \ | 122 | #define STATUSBAR_TIME_X_END(statusbar_width) statusbar_width - 1 - \ |
128 | STATUSBAR_DISK_WIDTH | 123 | STATUSBAR_DISK_WIDTH |
129 | #ifdef HAVE_RECORDING | ||
130 | #define TIMER_ICON_WIDTH 7 | ||
131 | #if CONFIG_RTC | ||
132 | #define CLOCK_WIDTH 35 | ||
133 | #else | ||
134 | #define CLOCK_WIDTH 0 | ||
135 | #endif | ||
136 | #endif | ||
137 | |||
138 | struct gui_syncstatusbar statusbars; | 124 | struct gui_syncstatusbar statusbars; |
139 | 125 | ||
140 | /* Prototypes */ | 126 | /* Prototypes */ |
@@ -154,11 +140,9 @@ static void gui_statusbar_led(struct screen * display); | |||
154 | #endif | 140 | #endif |
155 | #ifdef HAVE_RECORDING | 141 | #ifdef HAVE_RECORDING |
156 | static void gui_statusbar_icon_recording_info(struct screen * display); | 142 | static void gui_statusbar_icon_recording_info(struct screen * display); |
157 | static void gui_statusbar_timer(struct screen * display, int dy, int hr, int mn, int sc, bool recscreen); | ||
158 | static void gui_statusbar_timer_rep(struct screen * display); | ||
159 | #endif | 143 | #endif |
160 | #if CONFIG_RTC | 144 | #if CONFIG_RTC |
161 | static void gui_statusbar_time(struct screen * display, int hour, int minute, bool timer_display); | 145 | static void gui_statusbar_time(struct screen * display, int hour, int minute); |
162 | #endif | 146 | #endif |
163 | #endif | 147 | #endif |
164 | 148 | ||
@@ -261,21 +245,6 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
261 | bar->info.minute = tm->tm_min; | 245 | bar->info.minute = tm->tm_min; |
262 | } | 246 | } |
263 | #endif /* CONFIG_RTC */ | 247 | #endif /* CONFIG_RTC */ |
264 | #ifdef HAVE_RECORDING | ||
265 | struct timer* timer = get_timerstat(); | ||
266 | bar->info.timer_day = timer->days; | ||
267 | bar->info.timer_hour = timer->hrs; | ||
268 | bar->info.timer_min = timer->mins; | ||
269 | /* avoid an update every second unless less than one | ||
270 | minute remains on the timer */ | ||
271 | if (!bar->info.timer_day && !bar->info.timer_hour && !bar->info.timer_min) | ||
272 | bar->info.timer_sec = timer->secs; | ||
273 | else | ||
274 | bar->info.timer_sec = 0; | ||
275 | |||
276 | bar->info.timer_display = timer->timer_display; | ||
277 | bar->info.timer_repeat = timer->repeater; | ||
278 | #endif | ||
279 | 248 | ||
280 | /* only redraw if forced to, or info has changed */ | 249 | /* only redraw if forced to, or info has changed */ |
281 | if (force_redraw || bar->redraw_volume || | 250 | if (force_redraw || bar->redraw_volume || |
@@ -347,16 +316,8 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
347 | if (bar->info.keylockremote) | 316 | if (bar->info.keylockremote) |
348 | gui_statusbar_icon_lock_remote(display); | 317 | gui_statusbar_icon_lock_remote(display); |
349 | #endif | 318 | #endif |
350 | #ifdef HAVE_RECORDING | ||
351 | if (bar->info.timer_display) | ||
352 | gui_statusbar_timer(display, bar->info.timer_day, bar->info.timer_hour, | ||
353 | bar->info.timer_min, bar->info.timer_sec, recscreen_on); | ||
354 | else if ((bar->info.timer_repeat) && (recscreen_on)) | ||
355 | gui_statusbar_timer_rep(display); | ||
356 | #endif | ||
357 | #if CONFIG_RTC | 319 | #if CONFIG_RTC |
358 | gui_statusbar_time(display, bar->info.hour, bar->info.minute, | 320 | gui_statusbar_time(display, bar->info.hour, bar->info.minute); |
359 | bar->info.timer_display); | ||
360 | #endif /* CONFIG_RTC */ | 321 | #endif /* CONFIG_RTC */ |
361 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | 322 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) |
362 | if(!display->has_disk_led && bar->info.led) | 323 | if(!display->has_disk_led && bar->info.led) |
@@ -616,8 +577,7 @@ static void gui_statusbar_led(struct screen * display) | |||
616 | /* | 577 | /* |
617 | * Print time to status bar | 578 | * Print time to status bar |
618 | */ | 579 | */ |
619 | static void gui_statusbar_time(struct screen * display, int hour, int minute, | 580 | static void gui_statusbar_time(struct screen * display, int hour, int minute) |
620 | bool timer_display) | ||
621 | { | 581 | { |
622 | unsigned char buffer[6]; | 582 | unsigned char buffer[6]; |
623 | unsigned int width, height; | 583 | unsigned int width, height; |
@@ -639,73 +599,15 @@ static void gui_statusbar_time(struct screen * display, int hour, int minute, | |||
639 | display->setfont(FONT_SYSFIXED); | 599 | display->setfont(FONT_SYSFIXED); |
640 | display->getstringsize(buffer, &width, &height); | 600 | display->getstringsize(buffer, &width, &height); |
641 | if (height <= STATUSBAR_HEIGHT) { | 601 | if (height <= STATUSBAR_HEIGHT) { |
642 | #ifdef HAVE_RECORDING | ||
643 | if (timer_display) | ||
644 | display->set_drawmode(DRMODE_INVERSEVID); | ||
645 | #else | ||
646 | (void)timer_display; | ||
647 | #endif | ||
648 | display->putsxy(STATUSBAR_TIME_X_END(display->width) - width, | 602 | display->putsxy(STATUSBAR_TIME_X_END(display->width) - width, |
649 | STATUSBAR_Y_POS, buffer); | 603 | STATUSBAR_Y_POS, buffer); |
650 | } | 604 | } |
651 | display->set_drawmode(DRMODE_SOLID); | ||
652 | display->setfont(FONT_UI); | 605 | display->setfont(FONT_UI); |
653 | 606 | ||
654 | } | 607 | } |
655 | #endif | 608 | #endif |
656 | 609 | ||
657 | #ifdef HAVE_RECORDING | 610 | #ifdef HAVE_RECORDING |
658 | static void gui_statusbar_timer(struct screen * display, int dy, int hr, int mn, | ||
659 | int sc, bool recscreen) | ||
660 | { | ||
661 | unsigned char buffer[8]; | ||
662 | int width, height; | ||
663 | |||
664 | /* vary the display depending on the remaining time to save space */ | ||
665 | if (dy) | ||
666 | snprintf(buffer, sizeof(buffer), " %dd%02dh", hr > 58 ? dy + 1 : dy, | ||
667 | hr > 58 ? 0 : hr + 1); | ||
668 | else if (!hr && !mn) | ||
669 | snprintf(buffer, sizeof(buffer), "%02ds", sc); | ||
670 | else | ||
671 | snprintf(buffer, sizeof(buffer), "%02dh%02dm", mn > 58 ? hr + 1: hr, | ||
672 | mn > 58 ? 0 : mn + 1); | ||
673 | |||
674 | display->setfont(FONT_SYSFIXED); | ||
675 | display->getstringsize(buffer, &width, &height); | ||
676 | |||
677 | if (height <= STATUSBAR_HEIGHT) | ||
678 | { | ||
679 | if(((display->width) >= (STATUSBAR_LOCKR_X_POS + STATUSBAR_LOCKR_WIDTH + | ||
680 | STATUSBAR_DISK_WIDTH + width + CLOCK_WIDTH + 1)) | ||
681 | && !recscreen) | ||
682 | display->putsxy(STATUSBAR_TIME_X_END(display->width) - width - | ||
683 | CLOCK_WIDTH, STATUSBAR_Y_POS, buffer); | ||
684 | /* display only an icon for small screens or when in recording screen*/ | ||
685 | else if ((display->width) >= (STATUSBAR_LOCKR_X_POS + | ||
686 | STATUSBAR_LOCKR_WIDTH + | ||
687 | STATUSBAR_DISK_WIDTH + | ||
688 | TIMER_ICON_WIDTH + CLOCK_WIDTH + 1)) | ||
689 | display->mono_bitmap(bitmap_icons_7x7[Icon_Timer], | ||
690 | STATUSBAR_TIME_X_END(display->width) - | ||
691 | TIMER_ICON_WIDTH - CLOCK_WIDTH, | ||
692 | STATUSBAR_Y_POS, | ||
693 | TIMER_ICON_WIDTH, STATUSBAR_HEIGHT); | ||
694 | } | ||
695 | |||
696 | display->setfont(FONT_UI); | ||
697 | |||
698 | } | ||
699 | |||
700 | static void gui_statusbar_timer_rep(struct screen * display) | ||
701 | { | ||
702 | display->mono_bitmap(bitmap_icons_7x7[Icon_Timer_rep], | ||
703 | STATUSBAR_TIME_X_END(display->width) - | ||
704 | TIMER_ICON_WIDTH - CLOCK_WIDTH, | ||
705 | STATUSBAR_Y_POS, | ||
706 | TIMER_ICON_WIDTH, STATUSBAR_HEIGHT); | ||
707 | } | ||
708 | |||
709 | #if CONFIG_CODEC == SWCODEC | 611 | #if CONFIG_CODEC == SWCODEC |
710 | /** | 612 | /** |
711 | * Write a number to the display using bitmaps and return new position | 613 | * Write a number to the display using bitmaps and return new position |
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index 660c657f29..21f98336d0 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h | |||
@@ -37,14 +37,6 @@ struct status_info { | |||
37 | int hour; | 37 | int hour; |
38 | int minute; | 38 | int minute; |
39 | #endif | 39 | #endif |
40 | #ifdef HAVE_RECORDING | ||
41 | int timer_day; | ||
42 | int timer_hour; | ||
43 | int timer_min; | ||
44 | int timer_sec; | ||
45 | int timer_repeat; | ||
46 | #endif | ||
47 | int timer_display; | ||
48 | 40 | ||
49 | #if CONFIG_CHARGING | 41 | #if CONFIG_CHARGING |
50 | bool inserted; | 42 | bool inserted; |