summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/settings_menu.c171
-rw-r--r--apps/settings_menu.h24
2 files changed, 195 insertions, 0 deletions
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
new file mode 100644
index 0000000000..35c25117e7
--- /dev/null
+++ b/apps/settings_menu.c
@@ -0,0 +1,171 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 Robert Hak
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdbool.h>
+#include "lcd.h"
+#include "menu.h"
+#include "mpeg.h"
+#include "button.h"
+#include "kernel.h"
+#include "sprintf.h"
+
+#include "settings.h"
+#include "settings_menu.h"
+#include "backlight.h"
+#include "playlist.h" /* for playlist_shuffle */
+
+enum { Shuffle, Backlight, Scroll, numsettings };
+
+static void shuffle(void)
+{
+ bool done = false;
+
+ lcd_clear_display();
+ lcd_puts(0,0,"[Shuffle]");
+
+ while ( !done ) {
+ lcd_puts(0, 1, playlist_shuffle ? "on " : "off");
+ lcd_update();
+
+ switch ( button_get(true) ) {
+#ifdef HAVE_RECORDER_KEYPAD
+ case BUTTON_LEFT:
+#else
+ case BUTTON_STOP:
+#endif
+ done = true;
+ break;
+
+ default:
+ playlist_shuffle = !playlist_shuffle;
+ break;
+ }
+ }
+}
+
+static void backlight_timer(void)
+{
+ bool done = false;
+ int timer = global_settings.backlight;
+ char str[16];
+
+ lcd_clear_display();
+ lcd_puts_scroll(0,0,"Backlight");
+
+ while (!done) {
+ snprintf(str,sizeof str,"Timeout: %d s ", timer);
+ lcd_puts(0,1,str);
+ lcd_update();
+ switch( button_get(true) ) {
+#ifdef HAVE_RECORDER_KEYPAD
+ case BUTTON_UP:
+#else
+ case BUTTON_RIGHT:
+#endif
+ timer++;
+ if(timer > 60)
+ timer = 60;
+ break;
+
+#ifdef HAVE_RECORDER_KEYPAD
+ case BUTTON_DOWN:
+#else
+ case BUTTON_LEFT:
+#endif
+ timer--;
+ if ( timer < 0 )
+ timer = 0;
+ break;
+
+#ifdef HAVE_RECORDER_KEYPAD
+ case BUTTON_LEFT:
+#else
+ case BUTTON_STOP:
+ case BUTTON_MENU:
+#endif
+ done = true;
+ global_settings.backlight = timer;
+ backlight_on();
+ break;
+ }
+ }
+}
+
+static void scroll_speed(void)
+{
+ bool done=false;
+ int speed=10;
+ char str[16];
+
+ lcd_clear_display();
+ lcd_puts_scroll(0,0,"Scroll speed indicator");
+
+ while (!done) {
+ snprintf(str,sizeof str,"Speed: %d ",speed);
+ lcd_puts(0,1,str);
+ lcd_update();
+ lcd_scroll_speed(speed);
+ switch( button_get(true) ) {
+#ifdef HAVE_RECORDER_KEYPAD
+ case BUTTON_UP:
+#else
+ case BUTTON_RIGHT:
+#endif
+ speed++;
+ break;
+
+#ifdef HAVE_RECORDER_KEYPAD
+ case BUTTON_DOWN:
+#else
+ case BUTTON_LEFT:
+#endif
+ speed--;
+ if ( speed < 1 )
+ speed = 1;
+ break;
+
+#ifdef HAVE_RECORDER_KEYPAD
+ case BUTTON_LEFT:
+#else
+ case BUTTON_STOP:
+ case BUTTON_MENU:
+#endif
+ done = true;
+ lcd_stop_scroll();
+ break;
+ }
+ }
+}
+
+void settings_menu(void)
+{
+ int m;
+ struct menu_items items[] = {
+ { Shuffle, "Shuffle", shuffle },
+ { Backlight, "Backlight Timer", backlight_timer },
+ { Scroll, "Scroll speed", scroll_speed },
+ };
+
+ m=menu_init( items, sizeof items / sizeof(struct menu_items) );
+ menu_run(m);
+ menu_exit(m);
+}
diff --git a/apps/settings_menu.h b/apps/settings_menu.h
new file mode 100644
index 0000000000..00227c08fa
--- /dev/null
+++ b/apps/settings_menu.h
@@ -0,0 +1,24 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 Robert Hak
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef _SETTINGS_MENU_H
+#define _SETTINGS_MENU_H
+
+void settings_menu(void);
+
+#endif