summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Scarratt <mmmm@rockbox.org>2006-09-27 21:28:47 +0000
committerMartin Scarratt <mmmm@rockbox.org>2006-09-27 21:28:47 +0000
commitc06eadb572a7314fb42f59c33060c6b148fdef8a (patch)
tree2a8d10488700814a26f198724a21d5c26ff756ce
parent84cbab18da4b986e8bd3427cc9d3a5e9296fd4a5 (diff)
downloadrockbox-c06eadb572a7314fb42f59c33060c6b148fdef8a.tar.gz
rockbox-c06eadb572a7314fb42f59c33060c6b148fdef8a.zip
If a directory is created in the recording screen, the dir browser needs refreshing
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11080 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/recorder/recording.c34
-rw-r--r--apps/settings.c28
-rw-r--r--apps/settings.h5
-rw-r--r--apps/sound_menu.c6
4 files changed, 60 insertions, 13 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index e98730b582..fd9ea34be5 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -491,12 +491,8 @@ void adjust_cursor(void)
491 491
492char *rec_create_filename(char *buffer) 492char *rec_create_filename(char *buffer)
493{ 493{
494 if(global_settings.rec_directory) 494 strncpy(buffer, global_settings.rec_path, MAX_PATH);
495 getcwd(buffer, MAX_PATH); 495
496 else
497 strncpy(buffer, rec_base_directory, MAX_PATH);
498
499
500#ifdef CONFIG_RTC 496#ifdef CONFIG_RTC
501 create_datetime_filename(buffer, buffer, "R", 497 create_datetime_filename(buffer, buffer, "R",
502 REC_FILE_ENDING(global_settings.rec_quality)); 498 REC_FILE_ENDING(global_settings.rec_quality));
@@ -510,7 +506,16 @@ char *rec_create_filename(char *buffer)
510int rec_create_directory(void) 506int rec_create_directory(void)
511{ 507{
512 int rc; 508 int rc;
513 509 DIR* dir;
510
511 dir = opendir(global_settings.rec_path);
512 if (dir == NULL)
513 {
514 strncpy(global_settings.rec_path, rec_base_directory, MAX_PATH);
515 global_settings.rec_directory = false;
516 }
517 else
518 closedir(dir);
514 /* Try to create the base directory if needed */ 519 /* Try to create the base directory if needed */
515 if(global_settings.rec_directory == 0) 520 if(global_settings.rec_directory == 0)
516 { 521 {
@@ -828,6 +833,10 @@ bool recording_screen(bool no_source)
828 833
829 global_settings.recscreen_on = true; 834 global_settings.recscreen_on = true;
830 cursor = 0; 835 cursor = 0;
836
837 if (strlen(global_settings.rec_path) == 0)
838 strncpy(global_settings.rec_path, rec_base_directory, MAX_PATH);
839
831#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) 840#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
832 ata_set_led_enabled(false); 841 ata_set_led_enabled(false);
833#endif 842#endif
@@ -1259,7 +1268,8 @@ bool recording_screen(bool no_source)
1259 global_settings.rec_editable, 1268 global_settings.rec_editable,
1260 global_settings.rec_prerecord_time); 1269 global_settings.rec_prerecord_time);
1261 1270
1262 rec_create_directory(); 1271 if(rec_create_directory() > 0)
1272 have_recorded = true;
1263#ifdef HAVE_AGC 1273#ifdef HAVE_AGC
1264 if (global_settings.rec_source == AUDIO_SRC_MIC) { 1274 if (global_settings.rec_source == AUDIO_SRC_MIC) {
1265 agc_preset = global_settings.rec_agc_preset_mic; 1275 agc_preset = global_settings.rec_agc_preset_mic;
@@ -1719,10 +1729,12 @@ bool recording_screen(bool no_source)
1719 /* draw the trigger status */ 1729 /* draw the trigger status */
1720 if (peak_meter_trigger_status() != TRIG_OFF) 1730 if (peak_meter_trigger_status() != TRIG_OFF)
1721 { 1731 {
1722 peak_meter_draw_trig(LCD_WIDTH - TRIG_WIDTH, 4 * h); 1732 peak_meter_draw_trig(LCD_WIDTH - TRIG_WIDTH, filename_offset[0] +
1733 PM_HEIGHT + line[0]);
1723 for(i = 0; i < screen_update; i++){ 1734 for(i = 0; i < screen_update; i++){
1724 screens[i].update_rect(LCD_WIDTH - (TRIG_WIDTH + 2), 4 * h, 1735 screens[i].update_rect(LCD_WIDTH - (TRIG_WIDTH + 2),
1725 TRIG_WIDTH + 2, TRIG_HEIGHT); 1736 filename_offset[0] + PM_HEIGHT +
1737 line[0], + 2, TRIG_HEIGHT);
1726 } 1738 }
1727 } 1739 }
1728 } 1740 }
diff --git a/apps/settings.c b/apps/settings.c
index ee7fa36d39..87d0724b48 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -74,6 +74,7 @@
74#ifdef HAVE_LCD_COLOR 74#ifdef HAVE_LCD_COLOR
75#include "backdrop.h" 75#include "backdrop.h"
76#endif 76#endif
77#include "tree.h"
77 78
78#ifdef CONFIG_TUNER 79#ifdef CONFIG_TUNER
79#include "radio.h" 80#include "radio.h"
@@ -1013,6 +1014,11 @@ int settings_save( void )
1013 MAX_FILENAME); 1014 MAX_FILENAME);
1014 i+= MAX_FILENAME; 1015 i+= MAX_FILENAME;
1015#endif 1016#endif
1017#ifdef HAVE_RECORDING
1018 strncpy((char *)&config_block[i], (char *)global_settings.rec_path,
1019 MAX_PATH);
1020 i+= MAX_PATH;
1021#endif
1016 1022
1017 if(save_config_buffer()) 1023 if(save_config_buffer())
1018 { 1024 {
@@ -1410,6 +1416,11 @@ void settings_load(int which)
1410 MAX_FILENAME); 1416 MAX_FILENAME);
1411 i+= MAX_FILENAME; 1417 i+= MAX_FILENAME;
1412#endif 1418#endif
1419#ifdef HAVE_RECORDING
1420 strncpy((char *)global_settings.rec_path, (char *)&config_block[i],
1421 MAX_PATH);
1422 i+= MAX_PATH;
1423#endif
1413 } 1424 }
1414} 1425}
1415 1426
@@ -1769,6 +1780,11 @@ bool settings_save_config(void)
1769 global_settings.kbd_file); 1780 global_settings.kbd_file);
1770#endif 1781#endif
1771 1782
1783#ifdef HAVE_RECORDING
1784 if (global_settings.rec_path[0] != 0)
1785 fdprintf(fd, "recording path: %s\r\n", global_settings.rec_path);
1786#endif
1787
1772 /* here's the action: write values to file, specified via table */ 1788 /* here's the action: write values to file, specified via table */
1773 save_cfg_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), fd); 1789 save_cfg_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), fd);
1774 save_cfg_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), fd); 1790 save_cfg_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), fd);
@@ -1863,6 +1879,9 @@ void settings_reset(void) {
1863#ifdef HAVE_LCD_BITMAP 1879#ifdef HAVE_LCD_BITMAP
1864 global_settings.kbd_file[0] = '\0'; 1880 global_settings.kbd_file[0] = '\0';
1865#endif 1881#endif
1882#ifdef HAVE_RECORDING
1883 global_settings.rec_path[0] = '\0';
1884#endif
1866 global_settings.hold_lr_for_scroll_in_list = true; 1885 global_settings.hold_lr_for_scroll_in_list = true;
1867} 1886}
1868 1887
@@ -2148,3 +2167,12 @@ void settings_apply_trigger(void)
2148 ); 2167 );
2149} 2168}
2150#endif 2169#endif
2170#ifdef HAVE_RECORDING
2171void set_recpath(void)
2172{
2173 if(global_settings.rec_directory)
2174 getcwd(global_settings.rec_path, MAX_PATH);
2175 else
2176 strncpy(global_settings.rec_path, rec_base_directory, MAX_PATH);
2177}
2178#endif
diff --git a/apps/settings.h b/apps/settings.h
index 3e0b8fcd11..59de1642e7 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -242,7 +242,9 @@ struct user_settings
242 unsigned char font_file[MAX_FILENAME+1]; /* last font */ 242 unsigned char font_file[MAX_FILENAME+1]; /* last font */
243 unsigned char wps_file[MAX_FILENAME+1]; /* last wps */ 243 unsigned char wps_file[MAX_FILENAME+1]; /* last wps */
244 unsigned char lang_file[MAX_FILENAME+1]; /* last language */ 244 unsigned char lang_file[MAX_FILENAME+1]; /* last language */
245 245#ifdef HAVE_RECORDING
246 unsigned char rec_path[MAX_PATH+1]; /* path for recorded files */
247#endif
246 /* misc options */ 248 /* misc options */
247 249
248 int repeat_mode; /* 0=off 1=repeat all 2=repeat one 3=shuffle 4=ab */ 250 int repeat_mode; /* 0=off 1=repeat all 2=repeat one 3=shuffle 4=ab */
@@ -532,6 +534,7 @@ void set_file(char* filename, char* setting, int maxlen);
532unsigned int rec_timesplit_seconds(void); 534unsigned int rec_timesplit_seconds(void);
533unsigned long rec_sizesplit_bytes(void); 535unsigned long rec_sizesplit_bytes(void);
534void settings_apply_trigger(void); 536void settings_apply_trigger(void);
537void set_recpath(void);
535 538
536/* global settings */ 539/* global settings */
537extern struct user_settings global_settings; 540extern struct user_settings global_settings;
diff --git a/apps/sound_menu.c b/apps/sound_menu.c
index e80c2c0a3b..da779d9a30 100644
--- a/apps/sound_menu.c
+++ b/apps/sound_menu.c
@@ -520,13 +520,17 @@ static bool recprerecord(void)
520 520
521static bool recdirectory(void) 521static bool recdirectory(void)
522{ 522{
523 bool ret;
523 static const struct opt_items names[] = { 524 static const struct opt_items names[] = {
524 { rec_base_directory, -1 }, 525 { rec_base_directory, -1 },
525 { STR(LANG_RECORD_CURRENT_DIR) } 526 { STR(LANG_RECORD_CURRENT_DIR) }
526 }; 527 };
527 return set_option(str(LANG_RECORD_DIRECTORY), 528 ret = set_option(str(LANG_RECORD_DIRECTORY),
528 &global_settings.rec_directory, INT, 529 &global_settings.rec_directory, INT,
529 names, 2, NULL ); 530 names, 2, NULL );
531 set_recpath();
532
533 return ret;
530} 534}
531 535
532static bool reconstartup(void) 536static bool reconstartup(void)