diff options
author | Martin Scarratt <mmmm@rockbox.org> | 2006-09-18 10:06:03 +0000 |
---|---|---|
committer | Martin Scarratt <mmmm@rockbox.org> | 2006-09-18 10:06:03 +0000 |
commit | 7ef47ed87614d6100b491b2c0eb9f75d1fdc1f01 (patch) | |
tree | 6367eca3de5fcb0bbe165026b5658ef391b62fb7 /apps/settings.c | |
parent | 28546a6530f97a9f58937731ad477246a6baaa32 (diff) | |
download | rockbox-7ef47ed87614d6100b491b2c0eb9f75d1fdc1f01.tar.gz rockbox-7ef47ed87614d6100b491b2c0eb9f75d1fdc1f01.zip |
Recording countdown timer: set timer in recording settings screen (max 1 week countdown), start/pause timer in recording screen by pressing the pause button. If you have a separate record button then this will override the timer and start to record. Icon at bottom right of screen indicates timer is ticking. If you are in the recording screen when the countdown is over, recording will start automatically, if not then the icon will flash to indicate you should return to the recording screen to begin recording.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10990 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.c')
-rw-r--r-- | apps/settings.c | 168 |
1 files changed, 167 insertions, 1 deletions
diff --git a/apps/settings.c b/apps/settings.c index 3dc4ee1530..b2f7888a22 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -96,7 +96,7 @@ const char rec_base_directory[] = REC_BASE_DIR; | |||
96 | #include "eq_menu.h" | 96 | #include "eq_menu.h" |
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | #define CONFIG_BLOCK_VERSION 52 | 99 | #define CONFIG_BLOCK_VERSION 53 |
100 | #define CONFIG_BLOCK_SIZE 512 | 100 | #define CONFIG_BLOCK_SIZE 512 |
101 | #define RTC_BLOCK_SIZE 44 | 101 | #define RTC_BLOCK_SIZE 44 |
102 | 102 | ||
@@ -477,6 +477,11 @@ static const struct bit_entry hd_bits[] = | |||
477 | {1, S_O(rec_channels), 0, "rec channels", "stereo,mono" }, | 477 | {1, S_O(rec_channels), 0, "rec channels", "stereo,mono" }, |
478 | {1, S_O(rec_split_type), 0, "rec split type", "Split, Stop" }, | 478 | {1, S_O(rec_split_type), 0, "rec split type", "Split, Stop" }, |
479 | {1, S_O(rec_split_method), 0, "rec split method", "Time,Filesize" }, | 479 | {1, S_O(rec_split_method), 0, "rec split method", "Time,Filesize" }, |
480 | {6, S_O(ctdn_mins), 0, "countdown timer minutes", NULL }, /* 0 - 59 */ | ||
481 | {5, S_O(ctdn_hrs), 0, "countdown timer hours", NULL }, /* 0 - 23 */ | ||
482 | {6, S_O(ctdn_secs), 0, "countdown timer seconds", NULL }, /* 0 - 59 */ | ||
483 | {3, S_O(ctdn_days), 0, "countdown timer days", NULL }, /* 0 - 6 */ | ||
484 | |||
480 | 485 | ||
481 | { | 486 | { |
482 | #if defined(HAVE_SPDIF_IN) || defined(HAVE_FMRADIO_IN) | 487 | #if defined(HAVE_SPDIF_IN) || defined(HAVE_FMRADIO_IN) |
@@ -2032,6 +2037,167 @@ bool set_int(const unsigned char* string, | |||
2032 | (max-*variable)/step, &data,function); | 2037 | (max-*variable)/step, &data,function); |
2033 | } | 2038 | } |
2034 | 2039 | ||
2040 | /* Useful for time and other multi integer settings */ | ||
2041 | bool set_multi_int(const char* string, const struct opt_items * names, | ||
2042 | struct opt_settings * variable, int varcount) | ||
2043 | { | ||
2044 | int i, j; | ||
2045 | char buf[32]; | ||
2046 | long button; | ||
2047 | int cursor = 0; | ||
2048 | bool done = false; | ||
2049 | int oldvalue[varcount]; | ||
2050 | int pos = 0; | ||
2051 | |||
2052 | for(j = 0; j < varcount; j++) | ||
2053 | oldvalue[j] = *(int*)variable[j].setting; | ||
2054 | |||
2055 | FOR_NB_SCREENS(i) | ||
2056 | { | ||
2057 | screens[i].clear_display(); | ||
2058 | #ifdef HAVE_LCD_BITMAP | ||
2059 | screens[i].setmargins(0, 8); | ||
2060 | #endif | ||
2061 | } | ||
2062 | |||
2063 | snprintf(buf, sizeof(buf), "%s", string); | ||
2064 | FOR_NB_SCREENS(i) | ||
2065 | screens[i].puts(0, 0, buf); | ||
2066 | |||
2067 | /* print variable names */ | ||
2068 | for(j = 0; j < varcount ; j++) | ||
2069 | { | ||
2070 | if (j > 0) | ||
2071 | { | ||
2072 | snprintf(buf, sizeof(buf), ":"); | ||
2073 | FOR_NB_SCREENS(i) | ||
2074 | screens[i].puts(pos - 2, 1, buf); | ||
2075 | } | ||
2076 | |||
2077 | snprintf(buf, sizeof(buf), "%s", P2STR(names[j].string)); | ||
2078 | FOR_NB_SCREENS(i) | ||
2079 | screens[i].puts(pos, 1, buf); | ||
2080 | |||
2081 | pos += strlen(buf) + 3; | ||
2082 | } | ||
2083 | |||
2084 | snprintf(buf, sizeof(buf), "%s", str(LANG_TIMER_CONFIRM)); | ||
2085 | FOR_NB_SCREENS(i) | ||
2086 | screens[i].puts(0, 5, buf); | ||
2087 | |||
2088 | gui_syncstatusbar_draw(&statusbars, true); | ||
2089 | |||
2090 | while(!done) | ||
2091 | { | ||
2092 | pos = 0; | ||
2093 | |||
2094 | /* print variables */ | ||
2095 | for(j = 0; j < varcount; j++) | ||
2096 | { | ||
2097 | if (j > 0) | ||
2098 | { | ||
2099 | snprintf(buf, sizeof(buf), " :"); | ||
2100 | FOR_NB_SCREENS(i) | ||
2101 | screens[i].puts(pos - 3, 3, buf); | ||
2102 | } | ||
2103 | |||
2104 | snprintf(buf, sizeof(buf), "%d", *(int*)variable[j].setting); | ||
2105 | |||
2106 | #ifdef HAVE_LCD_BITMAP | ||
2107 | if (cursor == j) | ||
2108 | { | ||
2109 | FOR_NB_SCREENS(i) | ||
2110 | screens[i].puts_style_offset(pos, 3, buf, STYLE_INVERT, 0); | ||
2111 | } | ||
2112 | else | ||
2113 | #endif | ||
2114 | { | ||
2115 | FOR_NB_SCREENS(i) | ||
2116 | screens[i].puts(pos, 3, buf); | ||
2117 | } | ||
2118 | |||
2119 | snprintf(buf, sizeof(buf), "%d", variable[j].setting_max); | ||
2120 | pos += strlen(buf) + 3; | ||
2121 | } | ||
2122 | |||
2123 | /* print empty char to terminate invert style */ | ||
2124 | snprintf(buf, sizeof(buf), " "); | ||
2125 | FOR_NB_SCREENS(i) | ||
2126 | screens[i].puts(pos - 3, 3, buf); | ||
2127 | |||
2128 | #ifdef HAVE_LCD_BITMAP | ||
2129 | FOR_NB_SCREENS(i) | ||
2130 | screens[i].update(); | ||
2131 | #endif | ||
2132 | |||
2133 | button = get_action(CONTEXT_SETTINGS, TIMEOUT_BLOCK); | ||
2134 | |||
2135 | switch (button) | ||
2136 | { | ||
2137 | case ACTION_STD_NEXT: | ||
2138 | cursor ++; | ||
2139 | if (cursor >= varcount) | ||
2140 | cursor = varcount - 1; | ||
2141 | if (global_settings.talk_menu) | ||
2142 | talk_id(names[cursor].voice_id, false); | ||
2143 | break; | ||
2144 | |||
2145 | case ACTION_STD_PREV: | ||
2146 | if (cursor == 0) | ||
2147 | { | ||
2148 | /* cancel if pressing left when cursor | ||
2149 | is already at the far left */ | ||
2150 | for(j = 0; j < varcount; j++) | ||
2151 | *(int*)variable[j].setting = oldvalue[j]; | ||
2152 | gui_syncsplash(HZ/2, true, str(LANG_MENU_SETTING_CANCEL)); | ||
2153 | done = true; | ||
2154 | } | ||
2155 | else | ||
2156 | cursor --; | ||
2157 | if (cursor < 0) | ||
2158 | cursor = 0; | ||
2159 | if (global_settings.talk_menu) | ||
2160 | talk_id(names[cursor].voice_id, false); | ||
2161 | break; | ||
2162 | |||
2163 | case ACTION_SETTINGS_INC: | ||
2164 | case ACTION_SETTINGS_INCREPEAT: | ||
2165 | *(int*)variable[cursor].setting += 1; | ||
2166 | if (*(int*)variable[cursor].setting > | ||
2167 | variable[cursor].setting_max) | ||
2168 | *(int*)variable[cursor].setting = 0; | ||
2169 | if (global_settings.talk_menu) | ||
2170 | talk_unit(INT, *(int*)variable[cursor].setting); | ||
2171 | break; | ||
2172 | |||
2173 | case ACTION_SETTINGS_DEC: | ||
2174 | case ACTION_SETTINGS_DECREPEAT: | ||
2175 | *(int*)variable[cursor].setting -= 1; | ||
2176 | if (*(int*)variable[cursor].setting < 0) | ||
2177 | *(int*)variable[cursor].setting = | ||
2178 | variable[cursor].setting_max; | ||
2179 | if (global_settings.talk_menu) | ||
2180 | talk_unit(INT, *(int*)variable[cursor].setting); | ||
2181 | break; | ||
2182 | |||
2183 | case ACTION_STD_OK: | ||
2184 | done = true; | ||
2185 | break; | ||
2186 | |||
2187 | case ACTION_STD_CANCEL: | ||
2188 | for(j = 0; j < varcount; j++) | ||
2189 | *(int*)variable[j].setting = oldvalue[j]; | ||
2190 | gui_syncsplash(HZ/2, true, str(LANG_MENU_SETTING_CANCEL)); | ||
2191 | return false; | ||
2192 | |||
2193 | default: | ||
2194 | if (default_event_handler(button) == SYS_USB_CONNECTED) | ||
2195 | return true; | ||
2196 | } | ||
2197 | } | ||
2198 | return false; | ||
2199 | } | ||
2200 | |||
2035 | /* NOTE: the 'type' parameter specifies the actual type of the variable | 2201 | /* NOTE: the 'type' parameter specifies the actual type of the variable |
2036 | that 'variable' points to. not the value within. Only variables with | 2202 | that 'variable' points to. not the value within. Only variables with |
2037 | type 'bool' should use parameter BOOL. | 2203 | type 'bool' should use parameter BOOL. |