Improved enum naming.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15286 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Steve Bavin 2007-10-24 13:54:04 +00:00
parent d5b02467de
commit 7c95e5e6a6

View file

@ -119,7 +119,8 @@ static bool show_credits(void)
#else #else
#define SIZE_FMT "%s %s" #define SIZE_FMT "%s %s"
#endif #endif
struct info_data { struct info_data
{
bool new_data; bool new_data;
unsigned long size; unsigned long size;
unsigned long free; unsigned long free;
@ -128,19 +129,20 @@ struct info_data {
unsigned long free2; unsigned long free2;
#endif #endif
}; };
enum InfoScreenOrder { enum infoscreenorder
Order_SVN_revision = 0, {
Order_GAP1, INFO_VERSION = 0,
INFO_GAP1,
#if CONFIG_RTC #if CONFIG_RTC
Order_Time, INFO_TIME,
Order_Date, INFO_DATE,
Order_GAP2, INFO_GAP2,
#endif #endif
Order_Buffer, INFO_BUFFER,
Order_Batt, INFO_BATTERY,
Order_Disk1, /* capacity or internal capacity/free on hotswap */ INFO_DISK1, /* capacity or internal capacity/free on hotswap */
Order_Disk2,/* free space or external capacity/free on hotswap */ INFO_DISK2, /* free space or external capacity/free on hotswap */
Order_Count INFO_COUNT
}; };
#if CONFIG_RTC #if CONFIG_RTC
const int dayname[] = { const int dayname[] = {
@ -196,17 +198,17 @@ static char* info_getname(int selected_item, void * data, char *buffer)
} }
switch (selected_item) switch (selected_item)
{ {
case Order_SVN_revision: case INFO_VERSION:
snprintf(buffer, MAX_PATH, "%s: %s", snprintf(buffer, MAX_PATH, "%s: %s",
str(LANG_VERSION), appsversion); str(LANG_VERSION), appsversion);
break; break;
case Order_GAP1: case INFO_GAP1:
#if CONFIG_RTC #if CONFIG_RTC
case Order_GAP2: case INFO_GAP2:
#endif #endif
return ""; return "";
#if CONFIG_RTC #if CONFIG_RTC
case Order_Time: case INFO_TIME:
tm = get_time(); tm = get_time();
snprintf(buffer, MAX_PATH, "%02d:%02d:%02d %s", snprintf(buffer, MAX_PATH, "%02d:%02d:%02d %s",
global_settings.timeformat == 0 global_settings.timeformat == 0
@ -215,7 +217,7 @@ static char* info_getname(int selected_item, void * data, char *buffer)
global_settings.timeformat == 0 global_settings.timeformat == 0
?"":tm->tm_hour>11?"P":"A"); ?"":tm->tm_hour>11?"P":"A");
break; break;
case Order_Date: case INFO_DATE:
tm = get_time(); tm = get_time();
snprintf(buffer, MAX_PATH, "%s %d %s %d", str(dayname[tm->tm_wday]), snprintf(buffer, MAX_PATH, "%s %d %s %d", str(dayname[tm->tm_wday]),
tm->tm_year+1900, tm->tm_year+1900,
@ -223,7 +225,7 @@ static char* info_getname(int selected_item, void * data, char *buffer)
tm->tm_mday); tm->tm_mday);
break; break;
#endif #endif
case Order_Buffer: /* buffer */ case INFO_BUFFER: /* buffer */
{ {
long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */ long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */
int integer = buflen / 1000; int integer = buflen / 1000;
@ -233,7 +235,7 @@ static char* info_getname(int selected_item, void * data, char *buffer)
integer, decimal); integer, decimal);
} }
break; break;
case Order_Batt: /* battery */ case INFO_BATTERY: /* battery */
#if CONFIG_CHARGING == CHARGING_CONTROL #if CONFIG_CHARGING == CHARGING_CONTROL
if (charge_state == CHARGING) if (charge_state == CHARGING)
snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_CHARGE)); snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_CHARGE));
@ -249,7 +251,7 @@ static char* info_getname(int selected_item, void * data, char *buffer)
else else
strcpy(buffer, "(n/a)"); strcpy(buffer, "(n/a)");
break; break;
case Order_Disk1: /* disc usage 1 */ case INFO_DISK1: /* disc usage 1 */
#ifdef HAVE_MULTIVOLUME #ifdef HAVE_MULTIVOLUME
output_dyn_value(s1, sizeof s1, info->free, kbyte_units, true); output_dyn_value(s1, sizeof s1, info->free, kbyte_units, true);
output_dyn_value(s2, sizeof s2, info->size, kbyte_units, true); output_dyn_value(s2, sizeof s2, info->size, kbyte_units, true);
@ -260,7 +262,7 @@ static char* info_getname(int selected_item, void * data, char *buffer)
snprintf(buffer, MAX_PATH, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1); snprintf(buffer, MAX_PATH, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1);
#endif #endif
break; break;
case Order_Disk2: /* disc usage 2 */ case INFO_DISK2: /* disc usage 2 */
#ifdef HAVE_MULTIVOLUME #ifdef HAVE_MULTIVOLUME
if (info->size2) if (info->size2)
{ {
@ -289,27 +291,27 @@ static int info_speak_item(int selected_item, void * data)
}; };
switch (selected_item) switch (selected_item)
{ {
case Order_SVN_revision: /* version */ case INFO_VERSION: /* version */
talk_id(LANG_VERSION, false); talk_id(LANG_VERSION, false);
talk_spell(appsversion, true); talk_spell(appsversion, true);
break; break;
#if CONFIG_RTC #if CONFIG_RTC
case Order_Time: case INFO_TIME:
talk_id(LANG_CURRENT_TIME, false); talk_id(LANG_CURRENT_TIME, false);
talk_time(get_time(), true); talk_time(get_time(), true);
break; break;
case Order_Date: case INFO_DATE:
talk_date(get_time(), true); talk_date(get_time(), true);
break; break;
#endif #endif
case Order_Buffer: /* buffer, not spoken */ case INFO_BUFFER: /* buffer */
{ {
talk_id(LANG_BUFFER_STAT, false); talk_id(LANG_BUFFER_STAT, false);
long buflen = (audiobufend - audiobuf) / 1024L; long buflen = (audiobufend - audiobuf) / 1024L;
output_dyn_value(NULL, 0, buflen, kbyte_units, true); output_dyn_value(NULL, 0, buflen, kbyte_units, true);
break; break;
} }
case Order_Batt: /* battery */ case INFO_BATTERY: /* battery */
if (battery_level() >= 0) if (battery_level() >= 0)
{ {
talk_id(LANG_BATTERY_TIME, false); talk_id(LANG_BATTERY_TIME, false);
@ -330,7 +332,7 @@ static int info_speak_item(int selected_item, void * data)
#endif #endif
} }
break; break;
case Order_Disk1: /* disk 1 */ case INFO_DISK1: /* disk 1 */
#ifdef HAVE_MULTIVOLUME #ifdef HAVE_MULTIVOLUME
talk_id(LANG_DISK_FREE_INFO, false); talk_id(LANG_DISK_FREE_INFO, false);
talk_id(LANG_DISK_NAME_INTERNAL, true); talk_id(LANG_DISK_NAME_INTERNAL, true);
@ -340,7 +342,7 @@ static int info_speak_item(int selected_item, void * data)
output_dyn_value(NULL, 0, info->size, kbyte_units, true); output_dyn_value(NULL, 0, info->size, kbyte_units, true);
#endif #endif
break; break;
case Order_Disk2: /* disk 2 */ case INFO_DISK2: /* disk 2 */
#ifdef HAVE_MULTIVOLUME #ifdef HAVE_MULTIVOLUME
if (info->size2) if (info->size2)
{ {
@ -382,9 +384,9 @@ static int info_action_callback(int action, struct gui_synclist *lists)
} }
else if (lists->gui_list[SCREEN_MAIN].show_selection_marker == true) else if (lists->gui_list[SCREEN_MAIN].show_selection_marker == true)
{ {
if (lists->gui_list[SCREEN_MAIN].selected_item == Order_GAP1 if (lists->gui_list[SCREEN_MAIN].selected_item == INFO_GAP1
#if CONFIG_RTC #if CONFIG_RTC
|| lists->gui_list[SCREEN_MAIN].selected_item == Order_GAP2 || lists->gui_list[SCREEN_MAIN].selected_item == INFO_GAP2
#endif #endif
) )
{ {
@ -406,7 +408,7 @@ static bool show_info(void)
{ {
struct info_data data = {.new_data = true }; struct info_data data = {.new_data = true };
struct simplelist_info info; struct simplelist_info info;
simplelist_info_init(&info, str(LANG_ROCKBOX_INFO), Order_Count, (void*)&data); simplelist_info_init(&info, str(LANG_ROCKBOX_INFO), INFO_COUNT, (void*)&data);
info.hide_selection = !global_settings.talk_menu; info.hide_selection = !global_settings.talk_menu;
info.get_name = info_getname; info.get_name = info_getname;
if(global_settings.talk_menu) if(global_settings.talk_menu)