1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 Jonathan Gordon
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
31 #include "sound_menu.h"
32 #include "exported_menus.h"
38 #include "powermgmt.h"
39 #if CONFIG_CODEC == SWCODEC
45 #include "quickscreen.h"
51 #include "settings_list.h"
55 /***********************************/
59 static void tagcache_rebuild_with_splash(void)
62 splash(HZ
*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH
));
65 static void tagcache_update_with_splash(void)
68 splash(HZ
*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH
));
71 #ifdef HAVE_TC_RAMCACHE
72 MENUITEM_SETTING(tagcache_ram
, &global_settings
.tagcache_ram
, NULL
);
74 MENUITEM_SETTING(tagcache_autoupdate
, &global_settings
.tagcache_autoupdate
, NULL
);
75 MENUITEM_FUNCTION(tc_init
, 0, ID2P(LANG_TAGCACHE_FORCE_UPDATE
),
76 (int(*)(void))tagcache_rebuild_with_splash
,
77 NULL
, NULL
, Icon_NOICON
);
78 MENUITEM_FUNCTION(tc_update
, 0, ID2P(LANG_TAGCACHE_UPDATE
),
79 (int(*)(void))tagcache_update_with_splash
,
80 NULL
, NULL
, Icon_NOICON
);
81 MENUITEM_SETTING(runtimedb
, &global_settings
.runtimedb
, NULL
);
82 MENUITEM_FUNCTION(tc_export
, 0, ID2P(LANG_TAGCACHE_EXPORT
),
83 (int(*)(void))tagtree_export
, NULL
,
85 MENUITEM_FUNCTION(tc_import
, 0, ID2P(LANG_TAGCACHE_IMPORT
),
86 (int(*)(void))tagtree_import
, NULL
,
88 MAKE_MENU(tagcache_menu
, ID2P(LANG_TAGCACHE
), 0, Icon_NOICON
,
89 #ifdef HAVE_TC_RAMCACHE
92 &tagcache_autoupdate
, &tc_init
, &tc_update
, &runtimedb
,
93 &tc_export
, &tc_import
);
94 #endif /* HAVE_TAGCACHE */
96 /***********************************/
98 /***********************************/
100 static int fileview_callback(int action
,const struct menu_item_ex
*this_item
);
101 MENUITEM_SETTING(sort_case
, &global_settings
.sort_case
, NULL
);
102 MENUITEM_SETTING(sort_dir
, &global_settings
.sort_dir
, fileview_callback
);
103 MENUITEM_SETTING(sort_file
, &global_settings
.sort_file
, fileview_callback
);
104 MENUITEM_SETTING(interpret_numbers
, &global_settings
.interpret_numbers
, fileview_callback
);
105 MENUITEM_SETTING(dirfilter
, &global_settings
.dirfilter
, NULL
);
106 MENUITEM_SETTING(show_filename_ext
, &global_settings
.show_filename_ext
, NULL
);
107 MENUITEM_SETTING(browse_current
, &global_settings
.browse_current
, NULL
);
108 #ifdef HAVE_LCD_BITMAP
109 MENUITEM_SETTING(show_path_in_browser
, &global_settings
.show_path_in_browser
, NULL
);
111 static int fileview_callback(int action
,const struct menu_item_ex
*this_item
)
114 int *variable
= this_item
->variable
;
117 case ACTION_ENTER_MENUITEM
: /* on entering an item */
120 case ACTION_EXIT_MENUITEM
: /* on exit */
121 if (*variable
!= oldval
)
122 reload_directory(); /* force reload if this has changed */
128 MAKE_MENU(file_menu
, ID2P(LANG_FILE
), 0, Icon_file_view_menu
,
129 &sort_case
, &sort_dir
, &sort_file
, &interpret_numbers
,
130 &dirfilter
, &show_filename_ext
, &browse_current
,
131 #ifdef HAVE_LCD_BITMAP
132 &show_path_in_browser
136 /***********************************/
139 /***********************************/
143 #if BATTERY_CAPACITY_INC > 0
144 MENUITEM_SETTING(battery_capacity
, &global_settings
.battery_capacity
, NULL
);
146 #if BATTERY_TYPES_COUNT > 1
147 MENUITEM_SETTING(battery_type
, &global_settings
.battery_type
, NULL
);
149 #ifdef HAVE_USB_CHARGING_ENABLE
150 static int usbcharging_callback(int action
,const struct menu_item_ex
*this_item
)
155 case ACTION_EXIT_MENUITEM
: /* on exit */
156 usb_charging_enable(global_settings
.usb_charging
);
161 MENUITEM_SETTING(usb_charging
, &global_settings
.usb_charging
, usbcharging_callback
);
162 #endif /* HAVE_USB_CHARGING_ENABLE */
163 MAKE_MENU(battery_menu
, ID2P(LANG_BATTERY_MENU
), 0, Icon_NOICON
,
164 #if BATTERY_CAPACITY_INC > 0
167 #if BATTERY_TYPES_COUNT > 1
170 #ifdef HAVE_USB_CHARGING_ENABLE
175 #ifdef HAVE_DISK_STORAGE
176 MENUITEM_SETTING(disk_spindown
, &global_settings
.disk_spindown
, NULL
);
179 static int dircache_callback(int action
,const struct menu_item_ex
*this_item
)
184 case ACTION_EXIT_MENUITEM
: /* on exit */
185 switch (global_settings
.dircache
)
188 if (!dircache_is_enabled())
189 splash(HZ
*2, ID2P(LANG_PLEASE_REBOOT
));
192 if (dircache_is_enabled())
200 MENUITEM_SETTING(dircache
, &global_settings
.dircache
, dircache_callback
);
202 #if defined(HAVE_DIRCACHE) || defined(HAVE_DISK_STORAGE)
203 MAKE_MENU(disk_menu
, ID2P(LANG_DISK_MENU
), 0, Icon_NOICON
,
204 #ifdef HAVE_DISK_STORAGE
214 MENUITEM_SETTING(poweroff
, &global_settings
.poweroff
, NULL
);
217 MENUITEM_SETTING(max_files_in_dir
, &global_settings
.max_files_in_dir
, NULL
);
218 MENUITEM_SETTING(max_files_in_playlist
, &global_settings
.max_files_in_playlist
, NULL
);
219 MAKE_MENU(limits_menu
, ID2P(LANG_LIMITS_MENU
), 0, Icon_NOICON
,
220 &max_files_in_dir
, &max_files_in_playlist
);
224 #if CONFIG_CODEC == SWCODEC
225 MENUITEM_SETTING(keyclick
, &global_settings
.keyclick
, NULL
);
226 MENUITEM_SETTING(keyclick_repeats
, &global_settings
.keyclick_repeats
, NULL
);
227 MAKE_MENU(keyclick_menu
, ID2P(LANG_KEYCLICK
), 0, Icon_NOICON
,
228 &keyclick
, &keyclick_repeats
);
232 #if CONFIG_CODEC == MAS3507D
233 void dac_line_in(bool enable
);
234 static int linein_callback(int action
,const struct menu_item_ex
*this_item
)
239 case ACTION_EXIT_MENUITEM
: /* on exit */
241 dac_line_in(global_settings
.line_in
);
247 MENUITEM_SETTING(line_in
, &global_settings
.line_in
, linein_callback
);
250 MENUITEM_SETTING(car_adapter_mode
, &global_settings
.car_adapter_mode
, NULL
);
252 #ifdef IPOD_ACCESSORY_PROTOCOL
253 MENUITEM_SETTING(serial_bitrate
, &global_settings
.serial_bitrate
, NULL
);
255 #ifdef HAVE_ACCESSORY_SUPPLY
256 MENUITEM_SETTING(accessory_supply
, &global_settings
.accessory_supply
, NULL
);
258 #ifdef HAVE_LINEOUT_POWEROFF
259 MENUITEM_SETTING(lineout_onoff
, &global_settings
.lineout_active
, NULL
);
261 MENUITEM_SETTING(start_screen
, &global_settings
.start_in_screen
, NULL
);
262 #ifdef USB_ENABLE_HID
263 MENUITEM_SETTING(usb_hid
, &global_settings
.usb_hid
, NULL
);
264 MENUITEM_SETTING(usb_keypad_mode
, &global_settings
.usb_keypad_mode
, NULL
);
267 #ifdef HAVE_MORSE_INPUT
268 MENUITEM_SETTING(morse_input
, &global_settings
.morse_input
, NULL
);
271 #ifdef HAVE_BUTTON_LIGHT
272 MENUITEM_SETTING(buttonlight_timeout
, &global_settings
.buttonlight_timeout
, NULL
);
275 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
276 MENUITEM_SETTING(buttonlight_brightness
, &global_settings
.buttonlight_brightness
, NULL
);
279 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
280 MENUITEM_SETTING(touchpad_sensitivity
, &global_settings
.touchpad_sensitivity
, NULL
);
283 MAKE_MENU(system_menu
, ID2P(LANG_SYSTEM
),
286 #if (BATTERY_CAPACITY_INC > 0) || (BATTERY_TYPES_COUNT > 1)
289 #if defined(HAVE_DIRCACHE) || defined(HAVE_DISK_STORAGE)
294 #ifdef HAVE_MORSE_INPUT
297 #if CONFIG_CODEC == MAS3507D
303 #ifdef IPOD_ACCESSORY_PROTOCOL
306 #ifdef HAVE_ACCESSORY_SUPPLY
309 #ifdef HAVE_LINEOUT_POWEROFF
312 #ifdef HAVE_BUTTON_LIGHT
313 &buttonlight_timeout
,
315 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
316 &buttonlight_brightness
,
318 #if CONFIG_CODEC == SWCODEC
321 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
322 &touchpad_sensitivity
,
324 #ifdef USB_ENABLE_HID
331 /***********************************/
334 /***********************************/
336 static int bmark_callback(int action
,const struct menu_item_ex
*this_item
)
341 case ACTION_EXIT_MENUITEM
: /* on exit */
342 if(global_settings
.autocreatebookmark
== BOOKMARK_RECENT_ONLY_YES
||
343 global_settings
.autocreatebookmark
== BOOKMARK_RECENT_ONLY_ASK
)
345 if(global_settings
.usemrb
== BOOKMARK_NO
)
346 global_settings
.usemrb
= BOOKMARK_YES
;
353 MENUITEM_SETTING(autocreatebookmark
,
354 &global_settings
.autocreatebookmark
, bmark_callback
);
355 MENUITEM_SETTING(autoloadbookmark
, &global_settings
.autoloadbookmark
, NULL
);
356 MENUITEM_SETTING(usemrb
, &global_settings
.usemrb
, NULL
);
357 MAKE_MENU(bookmark_settings_menu
, ID2P(LANG_BOOKMARK_SETTINGS
), 0,
359 &autocreatebookmark
, &autoloadbookmark
, &usemrb
);
361 /***********************************/
363 /***********************************/
365 static int talk_callback(int action
,const struct menu_item_ex
*this_item
);
366 MENUITEM_SETTING(talk_menu_item
, &global_settings
.talk_menu
, NULL
);
367 MENUITEM_SETTING(talk_dir_item
, &global_settings
.talk_dir
, NULL
);
368 MENUITEM_SETTING(talk_dir_clip_item
, &global_settings
.talk_dir_clip
, talk_callback
);
369 MENUITEM_SETTING(talk_file_item
, &global_settings
.talk_file
, NULL
);
370 MENUITEM_SETTING(talk_file_clip_item
, &global_settings
.talk_file_clip
, talk_callback
);
371 static int talk_callback(int action
,const struct menu_item_ex
*this_item
)
373 static int oldval
= 0;
376 case ACTION_ENTER_MENUITEM
:
377 oldval
= global_settings
.talk_file_clip
;
379 case ACTION_EXIT_MENUITEM
:
380 #ifdef HAVE_CROSSFADE
381 audio_set_crossfade(global_settings
.crossfade
);
383 if (this_item
== &talk_dir_clip_item
)
385 if (!oldval
&& global_settings
.talk_file_clip
)
387 /* force reload if newly talking thumbnails,
388 because the clip presence is cached only if enabled */
395 MENUITEM_SETTING(talk_filetype_item
, &global_settings
.talk_filetype
, NULL
);
396 MENUITEM_SETTING(talk_battery_level_item
,
397 &global_settings
.talk_battery_level
, NULL
);
398 MAKE_MENU(voice_settings_menu
, ID2P(LANG_VOICE
), 0, Icon_Voice
,
399 &talk_menu_item
, &talk_dir_item
, &talk_dir_clip_item
,
400 &talk_file_item
, &talk_file_clip_item
, &talk_filetype_item
,
401 &talk_battery_level_item
);
403 /***********************************/
406 /***********************************/
409 static void view_hotkey_info(void)
411 struct simplelist_info info
;
412 simplelist_info_init(&info
, str(LANG_VIEW_HOTKEY
), 0, NULL
);
413 info
.hide_selection
= true;
414 info
.scroll_all
= true;
415 simplelist_addline(SIMPLELIST_ADD_LINE
, str(LANG_HOTKEY_VIEW_WPS
),
416 get_hotkey_desc(global_settings
.hotkey_wps
));
417 simplelist_addline(SIMPLELIST_ADD_LINE
, str(LANG_HOTKEY_VIEW_FILE_BROWSER
),
418 get_hotkey_desc(global_settings
.hotkey_tree
));
419 simplelist_show_list(&info
);
422 /* reset hotkey settings to their defaults */
423 static void reset_hotkey_settings(void)
426 const struct settings_list
*setting
=
427 find_setting(&global_settings
.hotkey_wps
, NULL
);
428 reset_setting(setting
, setting
->setting
);
431 const struct settings_list
*setting
=
432 find_setting(&global_settings
.hotkey_tree
, NULL
);
433 reset_setting(setting
, setting
->setting
);
436 splash(HZ
, str(LANG_RESET_DONE_CLEAR
));
439 MENUITEM_FUNCTION(hotkey_view
, 0, ID2P(LANG_VIEW_HOTKEY
),
440 (int(*)(void))view_hotkey_info
, NULL
,
442 MENUITEM_FUNCTION(hotkey_reset
, 0, ID2P(LANG_RESET
),
443 (int(*)(void))reset_hotkey_settings
, NULL
,
445 MAKE_MENU(hotkey_menu
, ID2P(LANG_HOTKEY
), 0, Icon_Hotkey
,
446 &hotkey_view
, &hotkey_reset
);
447 #endif /*have_hotkey */
449 /***********************************/
452 /***********************************/
454 static int language_browse(void)
456 return (int)rockbox_browse(LANG_DIR
, SHOW_LNG
);
458 MENUITEM_FUNCTION(browse_langs
, 0, ID2P(LANG_LANGUAGE
), language_browse
,
459 NULL
, NULL
, Icon_Language
);
461 MAKE_MENU(settings_menu_item
, ID2P(LANG_GENERAL_SETTINGS
), 0,
462 Icon_General_settings_menu
,
463 &playlist_settings
, &file_menu
,
467 &display_menu
, &system_menu
,
468 &bookmark_settings_menu
, &browse_langs
, &voice_settings_menu
,
474 /***********************************/