summaryrefslogtreecommitdiffstats
path: root/apps/wps.c
diff options
context:
space:
mode:
authorJustin Heiner <jheiner@rockbox.org>2002-08-31 04:58:35 +0000
committerJustin Heiner <jheiner@rockbox.org>2002-08-31 04:58:35 +0000
commitb5025a8c40ada463ff2e0c0e1ec15328670b4fa8 (patch)
tree13803997be280176868a782bb9a6c415b9381690 /apps/wps.c
parentae17b526ff69cfa3c02078cd5b6cfc1c6aa61de7 (diff)
downloadrockbox-b5025a8c40ada463ff2e0c0e1ec15328670b4fa8.tar.gz
rockbox-b5025a8c40ada463ff2e0c0e1ec15328670b4fa8.tar.bz2
rockbox-b5025a8c40ada463ff2e0c0e1ec15328670b4fa8.zip
USB Related:
Consolidated some more of the USB code in the WPS. Have backlight turn offf when USB Connected. menu.c: LINE_X was set wrong for player. settings_menu.c / wps-display.c: Added 1 Line ID3+. Has progress bar & Kbps. Renamed some of the WPS options to be more readable. wps.c / wps-display.c Fixed problem with FF/REW when 'Remaining Time' is on. Added %pb to the WPS mix. Player progress bar thingy. Thanks to whoever fixed my PLAYER_PROGRESS function :-) Changed how volume changes on player (works better now). General cleanup of Custom WPS code. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2091 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/wps.c')
-rw-r--r--apps/wps.c100
1 files changed, 63 insertions, 37 deletions
diff --git a/apps/wps.c b/apps/wps.c
index 5115b79d81..b95931337a 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -22,6 +22,7 @@
#include "file.h"
#include "lcd.h"
+#include "backlight.h"
#include "button.h"
#include "kernel.h"
#include "tree.h"
@@ -59,23 +60,56 @@ static bool paused = false;
static struct mp3entry* id3 = NULL;
static int old_release_mask;
-
-void display_volume_level(int vol_level)
+#ifdef HAVE_PLAYER_KEYPAD
+void player_change_volume(void)
{
+ int button;
+ bool fun_done = false;
char buffer[32];
lcd_stop_scroll();
- snprintf(buffer,sizeof(buffer),"Vol: %d %% ", vol_level * 2);
+ while(!fun_done)
+ {
+ snprintf(buffer,sizeof(buffer),"Vol: %d %% ", global_settings.volume * 2);
#ifdef HAVE_LCD_CHARCELLS
- lcd_puts(0, 0, buffer);
+ lcd_puts(0, 0, buffer);
#else
- lcd_puts(2, 3, buffer);
- lcd_update();
+ lcd_puts(2, 3, buffer);
+ lcd_update();
#endif
- sleep(HZ/6);
+ button = button_get(false);
+ switch(button)
+ {
+ case BUTTON_MENU | BUTTON_RIGHT:
+ case BUTTON_MENU | BUTTON_RIGHT | BUTTON_REPEAT:
+ global_settings.volume++;
+ if(global_settings.volume > mpeg_sound_max(SOUND_VOLUME))
+ global_settings.volume = mpeg_sound_max(SOUND_VOLUME);
+ mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
+ wps_refresh(id3,0,false);
+ settings_save();
+ break;
+ case BUTTON_MENU | BUTTON_LEFT:
+ case BUTTON_MENU | BUTTON_LEFT | BUTTON_REPEAT:
+ global_settings.volume--;
+ if(global_settings.volume < mpeg_sound_min(SOUND_VOLUME))
+ global_settings.volume = mpeg_sound_min(SOUND_VOLUME);
+ mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
+ wps_refresh(id3,0,false);
+ settings_save();
+ break;
+ case BUTTON_MENU | BUTTON_REL:
+ fun_done = true;
+ break;
+ }
+ yield();
+ }
+ status_draw();
+ wps_refresh(id3,0,true);
}
+#endif
void display_keylock_text(bool locked)
{
@@ -133,6 +167,9 @@ static void handle_usb(void)
#ifdef HAVE_LCD_BITMAP
bool laststate=statusbar(false);
#endif
+
+ backlight_time(4);
+
/* Tell the USB thread that we are safe */
DEBUGF("wps got SYS_USB_CONNECTED\n");
usb_acknowledge(SYS_USB_CONNECTED_ACK);
@@ -140,6 +177,8 @@ static void handle_usb(void)
/* Wait until the USB cable is extracted again */
usb_wait_for_disconnect(&button_queue);
+ backlight_time(global_settings.backlight);
+
#ifdef HAVE_LCD_BITMAP
statusbar(laststate);
#endif
@@ -195,14 +234,7 @@ int player_id3_show(void)
#ifndef SIMULATOR
case SYS_USB_CONNECTED:
- /* Tell the USB thread that we are safe */
- DEBUGF("wps got SYS_USB_CONNECTED\n");
- usb_acknowledge(SYS_USB_CONNECTED_ACK);
-
- /* Wait until the USB cable is extracted again */
- usb_wait_for_disconnect(&button_queue);
-
- /* Signal to our caller that we have been in USB mode */
+ handle_usb();
return SYS_USB_CONNECTED;
break;
#endif
@@ -316,7 +348,10 @@ static bool ffwd_rew(int button)
if ((int)(id3->elapsed + ff_rewind_count) < 0)
ff_rewind_count = -id3->elapsed;
- wps_refresh(id3, ff_rewind_count, false);
+ if(wps_time_countup == false)
+ wps_refresh(id3, -ff_rewind_count, false);
+ else
+ wps_refresh(id3, ff_rewind_count, false);
break;
case BUTTON_RIGHT | BUTTON_REPEAT:
@@ -360,7 +395,10 @@ static bool ffwd_rew(int button)
if ((id3->elapsed + ff_rewind_count) > id3->length)
ff_rewind_count = id3->length - id3->elapsed;
- wps_refresh(id3, ff_rewind_count, false);
+ if(wps_time_countup == false)
+ wps_refresh(id3, -ff_rewind_count, false);
+ else
+ wps_refresh(id3, ff_rewind_count, false);
break;
case BUTTON_LEFT | BUTTON_REL:
@@ -524,10 +562,10 @@ static bool menu(void)
button_set_release(old_release_mask);
main_menu();
#ifdef HAVE_LCD_BITMAP
- if(global_settings.statusbar)
- lcd_setmargins(0, STATUSBAR_HEIGHT);
- else
- lcd_setmargins(0, 0);
+ if(global_settings.statusbar)
+ lcd_setmargins(0, STATUSBAR_HEIGHT);
+ else
+ lcd_setmargins(0, 0);
#endif
old_release_mask = button_set_release(RELEASE_MASK);
}
@@ -565,27 +603,15 @@ static bool menu(void)
/* change volume */
case BUTTON_MENU | BUTTON_LEFT:
case BUTTON_MENU | BUTTON_LEFT | BUTTON_REPEAT:
- global_settings.volume--;
- if(global_settings.volume < mpeg_sound_min(SOUND_VOLUME))
- global_settings.volume = mpeg_sound_min(SOUND_VOLUME);
- mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
- display_volume_level(global_settings.volume);
- wps_display(id3);
- status_draw();
- settings_save();
+ player_change_volume();
+ exit = true;
break;
/* change volume */
case BUTTON_MENU | BUTTON_RIGHT:
case BUTTON_MENU | BUTTON_RIGHT | BUTTON_REPEAT:
- global_settings.volume++;
- if(global_settings.volume > mpeg_sound_max(SOUND_VOLUME))
- global_settings.volume = mpeg_sound_max(SOUND_VOLUME);
- mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
- display_volume_level(global_settings.volume);
- wps_display(id3);
- status_draw();
- settings_save();
+ player_change_volume();
+ exit = true;
break;
/* show id3 tags */