summaryrefslogtreecommitdiff
path: root/apps/main_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/main_menu.c')
-rw-r--r--apps/main_menu.c252
1 files changed, 0 insertions, 252 deletions
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 078e7669f2..de4c9a6263 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -56,231 +56,6 @@
56#include "recording.h" 56#include "recording.h"
57#endif 57#endif
58 58
59static bool show_credits(void)
60{
61 plugin_load("/.rockbox/rocks/credits.rock",NULL);
62 return false;
63}
64
65#ifdef SIMULATOR
66extern bool simulate_usb(void);
67#endif
68
69#ifdef HAVE_LCD_CHARCELLS
70#define SIZE_FMT "%s%s"
71#else
72#define SIZE_FMT "%s %s"
73#endif
74
75static bool show_info(void)
76{
77 char s[64], s1[32];
78 unsigned long size, free;
79 long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */
80 int key;
81 int i;
82 bool done = false;
83 bool new_info = true;
84#ifdef HAVE_MULTIVOLUME
85 char s2[32];
86 unsigned long size2, free2;
87#endif
88#ifdef HAVE_LCD_CHARCELLS
89 int page = 0;
90#endif
91
92 const unsigned char *kbyte_units[] = {
93 ID2P(LANG_KILOBYTE),
94 ID2P(LANG_MEGABYTE),
95 ID2P(LANG_GIGABYTE)
96 };
97
98 while (!done)
99 {
100 int y=0;
101
102 if (new_info)
103 {
104 fat_size( IF_MV2(0,) &size, &free );
105#ifdef HAVE_MULTIVOLUME
106 if (fat_ismounted(1))
107 fat_size( 1, &size2, &free2 );
108 else
109 size2 = 0;
110#endif
111
112 if (global_settings.talk_menu)
113 { /* say whatever is reasonable, no real connection to the screen */
114 bool enqueue = false; /* enqueue all but the first */
115 if (battery_level() >= 0)
116 {
117 talk_id(LANG_BATTERY_TIME, enqueue);
118 enqueue = true;
119 talk_value(battery_level(), UNIT_PERCENT, true);
120#if CONFIG_CHARGING >= CHARGING_MONITOR
121 if (charge_state == CHARGING)
122 talk_id(LANG_BATTERY_CHARGE, true);
123 else if (charge_state == TOPOFF)
124 talk_id(LANG_BATTERY_TOPOFF_CHARGE, true);
125 else if (charge_state == TRICKLE)
126 talk_id(LANG_BATTERY_TRICKLE_CHARGE, true);
127#endif
128 }
129
130 talk_id(LANG_DISK_FREE_INFO, enqueue);
131#ifdef HAVE_MULTIVOLUME
132 talk_id(LANG_DISK_NAME_INTERNAL, true);
133 output_dyn_value(NULL, 0, free, kbyte_units, true);
134 if (size2)
135 {
136 talk_id(LANG_DISK_NAME_MMC, true);
137 output_dyn_value(NULL, 0, free2, kbyte_units, true);
138 }
139#else
140 output_dyn_value(NULL, 0, free, kbyte_units, true);
141#endif
142
143#ifdef CONFIG_RTC
144 {
145 struct tm* tm = get_time();
146 talk_id(VOICE_CURRENT_TIME, true);
147 talk_value(tm->tm_hour, UNIT_HOUR, true);
148 talk_value(tm->tm_min, UNIT_MIN, true);
149 talk_value(tm->tm_sec, UNIT_SEC, true);
150 talk_id(LANG_MONTH_JANUARY + tm->tm_mon, true);
151 talk_number(tm->tm_mday, true);
152 talk_number(1900 + tm->tm_year, true);
153 }
154#endif
155 }
156 new_info = false;
157 }
158
159 FOR_NB_SCREENS(i)
160 {
161 screens[i].clear_display();
162#ifdef HAVE_LCD_BITMAP
163 screens[i].puts(0, y, str(LANG_ROCKBOX_INFO));
164#endif
165 }
166#ifdef HAVE_LCD_BITMAP
167 y += 2;
168#endif
169
170#ifdef HAVE_LCD_CHARCELLS
171 if (page == 0)
172#endif
173 {
174 int integer = buflen / 1000;
175 int decimal = buflen % 1000;
176
177#ifdef HAVE_LCD_CHARCELLS
178 snprintf(s, sizeof(s), (char *)str(LANG_BUFFER_STAT_PLAYER),
179 integer, decimal);
180#else
181 snprintf(s, sizeof(s), (char *)str(LANG_BUFFER_STAT_RECORDER),
182 integer, decimal);
183#endif
184 FOR_NB_SCREENS(i)
185 screens[i].puts_scroll(0, y, (unsigned char *)s);
186 y++;
187#if CONFIG_CHARGING == CHARGING_CONTROL
188 if (charge_state == CHARGING)
189 snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_CHARGE));
190 else if (charge_state == TOPOFF)
191 snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_TOPOFF_CHARGE));
192 else if (charge_state == TRICKLE)
193 snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_TRICKLE_CHARGE));
194 else
195#endif
196 if (battery_level() >= 0)
197 snprintf(s, sizeof(s), (char *)str(LANG_BATTERY_TIME), battery_level(),
198 battery_time() / 60, battery_time() % 60);
199 else
200 strncpy(s, "(n/a)", sizeof(s));
201 FOR_NB_SCREENS(i)
202 screens[i].puts_scroll(0, y, (unsigned char *)s);
203 y++;
204 }
205
206#ifdef HAVE_LCD_CHARCELLS
207 if (page == 1)
208#endif
209 {
210#ifdef HAVE_MULTIVOLUME
211 output_dyn_value(s1, sizeof s1, free, kbyte_units, true);
212 output_dyn_value(s2, sizeof s2, size, kbyte_units, true);
213 snprintf(s, sizeof s, "%s %s/%s", str(LANG_DISK_NAME_INTERNAL),
214 s1, s2);
215 FOR_NB_SCREENS(i)
216 screens[i].puts_scroll(0, y, (unsigned char *)s);
217 y++;
218
219 if (size2) {
220 output_dyn_value(s1, sizeof s1, free2, kbyte_units, true);
221 output_dyn_value(s2, sizeof s2, size2, kbyte_units, true);
222 snprintf(s, sizeof s, "%s %s/%s", str(LANG_DISK_NAME_MMC),
223 s1, s2);
224 FOR_NB_SCREENS(i)
225 screens[i].puts_scroll(0, y, (unsigned char *)s);
226 y++;
227 }
228#else
229 output_dyn_value(s1, sizeof s1, size, kbyte_units, true);
230 snprintf(s, sizeof s, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1);
231 FOR_NB_SCREENS(i)
232 screens[i].puts_scroll(0, y, (unsigned char *)s);
233 y++;
234 output_dyn_value(s1, sizeof s1, free, kbyte_units, true);
235 snprintf(s, sizeof s, SIZE_FMT, str(LANG_DISK_FREE_INFO), s1);
236 FOR_NB_SCREENS(i)
237 screens[i].puts_scroll(0, y, (unsigned char *)s);
238 y++;
239#endif
240 }
241
242#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
243 FOR_NB_SCREENS(i)
244 screens[i].update();
245#endif
246
247 /* Wait for a key to be pushed */
248 key = get_action(CONTEXT_MAINMENU,HZ*5);
249 switch(key) {
250
251 case ACTION_STD_CANCEL:
252 done = true;
253 break;
254
255#ifdef HAVE_LCD_CHARCELLS
256 case ACTION_STD_NEXT:
257 case ACTION_STD_PREV:
258 page = (page == 0) ? 1 : 0;
259 break;
260#endif
261
262#ifndef SIMULATOR
263 case ACTION_STD_OK:
264 gui_syncsplash(0, true, str(LANG_DIRCACHE_BUILDING));
265 fat_recalc_free(IF_MV(0));
266#ifdef HAVE_MULTIVOLUME
267 if (fat_ismounted(1))
268 fat_recalc_free(1);
269#endif
270 new_info = true;
271 break;
272#endif
273
274 default:
275 if (default_event_handler(key) == SYS_USB_CONNECTED)
276 return true;
277 break;
278 }
279 }
280 action_signalscreenchange();
281 return false;
282}
283
284#ifdef HAVE_RECORDING 59#ifdef HAVE_RECORDING
285 60
286static bool rec_menu_recording_screen(void) 61static bool rec_menu_recording_screen(void)
@@ -330,33 +105,6 @@ bool rec_menu(void)
330} 105}
331#endif 106#endif
332 107
333bool info_menu(void)
334{
335 int m;
336 bool result;
337
338 /* info menu */
339 static const struct menu_item items[] = {
340 { ID2P(LANG_INFO_MENU), show_info },
341 { ID2P(LANG_VERSION), show_credits },
342 { ID2P(LANG_RUNNING_TIME), view_runtime },
343 { ID2P(LANG_DEBUG), debug_menu },
344#ifdef SIMULATOR
345 { ID2P(LANG_USB), simulate_usb },
346#ifdef ROCKBOX_HAS_LOGF
347 {"logf", logfdisplay },
348 {"logfdump", logfdump },
349#endif
350#endif
351 };
352
353 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
354 NULL, NULL, NULL);
355 result = menu_run(m);
356 menu_exit(m);
357
358 return result;
359}
360 108
361#if 0 109#if 0
362#ifdef HAVE_LCD_CHARCELLS 110#ifdef HAVE_LCD_CHARCELLS