1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Martin Scarratt 2006-09-27 21:28:47 +00:00
parent 84cbab18da
commit c06eadb572
4 changed files with 60 additions and 13 deletions

View file

@ -491,12 +491,8 @@ void adjust_cursor(void)
char *rec_create_filename(char *buffer) char *rec_create_filename(char *buffer)
{ {
if(global_settings.rec_directory) strncpy(buffer, global_settings.rec_path, MAX_PATH);
getcwd(buffer, MAX_PATH);
else
strncpy(buffer, rec_base_directory, MAX_PATH);
#ifdef CONFIG_RTC #ifdef CONFIG_RTC
create_datetime_filename(buffer, buffer, "R", create_datetime_filename(buffer, buffer, "R",
REC_FILE_ENDING(global_settings.rec_quality)); REC_FILE_ENDING(global_settings.rec_quality));
@ -510,7 +506,16 @@ char *rec_create_filename(char *buffer)
int rec_create_directory(void) int rec_create_directory(void)
{ {
int rc; int rc;
DIR* dir;
dir = opendir(global_settings.rec_path);
if (dir == NULL)
{
strncpy(global_settings.rec_path, rec_base_directory, MAX_PATH);
global_settings.rec_directory = false;
}
else
closedir(dir);
/* Try to create the base directory if needed */ /* Try to create the base directory if needed */
if(global_settings.rec_directory == 0) if(global_settings.rec_directory == 0)
{ {
@ -828,6 +833,10 @@ bool recording_screen(bool no_source)
global_settings.recscreen_on = true; global_settings.recscreen_on = true;
cursor = 0; cursor = 0;
if (strlen(global_settings.rec_path) == 0)
strncpy(global_settings.rec_path, rec_base_directory, MAX_PATH);
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
ata_set_led_enabled(false); ata_set_led_enabled(false);
#endif #endif
@ -1259,7 +1268,8 @@ bool recording_screen(bool no_source)
global_settings.rec_editable, global_settings.rec_editable,
global_settings.rec_prerecord_time); global_settings.rec_prerecord_time);
rec_create_directory(); if(rec_create_directory() > 0)
have_recorded = true;
#ifdef HAVE_AGC #ifdef HAVE_AGC
if (global_settings.rec_source == AUDIO_SRC_MIC) { if (global_settings.rec_source == AUDIO_SRC_MIC) {
agc_preset = global_settings.rec_agc_preset_mic; agc_preset = global_settings.rec_agc_preset_mic;
@ -1719,10 +1729,12 @@ bool recording_screen(bool no_source)
/* draw the trigger status */ /* draw the trigger status */
if (peak_meter_trigger_status() != TRIG_OFF) if (peak_meter_trigger_status() != TRIG_OFF)
{ {
peak_meter_draw_trig(LCD_WIDTH - TRIG_WIDTH, 4 * h); peak_meter_draw_trig(LCD_WIDTH - TRIG_WIDTH, filename_offset[0] +
PM_HEIGHT + line[0]);
for(i = 0; i < screen_update; i++){ for(i = 0; i < screen_update; i++){
screens[i].update_rect(LCD_WIDTH - (TRIG_WIDTH + 2), 4 * h, screens[i].update_rect(LCD_WIDTH - (TRIG_WIDTH + 2),
TRIG_WIDTH + 2, TRIG_HEIGHT); filename_offset[0] + PM_HEIGHT +
line[0], + 2, TRIG_HEIGHT);
} }
} }
} }

View file

@ -74,6 +74,7 @@
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
#include "backdrop.h" #include "backdrop.h"
#endif #endif
#include "tree.h"
#ifdef CONFIG_TUNER #ifdef CONFIG_TUNER
#include "radio.h" #include "radio.h"
@ -1013,6 +1014,11 @@ int settings_save( void )
MAX_FILENAME); MAX_FILENAME);
i+= MAX_FILENAME; i+= MAX_FILENAME;
#endif #endif
#ifdef HAVE_RECORDING
strncpy((char *)&config_block[i], (char *)global_settings.rec_path,
MAX_PATH);
i+= MAX_PATH;
#endif
if(save_config_buffer()) if(save_config_buffer())
{ {
@ -1409,6 +1415,11 @@ void settings_load(int which)
strncpy((char *)global_settings.kbd_file, (char *)&config_block[i], strncpy((char *)global_settings.kbd_file, (char *)&config_block[i],
MAX_FILENAME); MAX_FILENAME);
i+= MAX_FILENAME; i+= MAX_FILENAME;
#endif
#ifdef HAVE_RECORDING
strncpy((char *)global_settings.rec_path, (char *)&config_block[i],
MAX_PATH);
i+= MAX_PATH;
#endif #endif
} }
} }
@ -1769,6 +1780,11 @@ bool settings_save_config(void)
global_settings.kbd_file); global_settings.kbd_file);
#endif #endif
#ifdef HAVE_RECORDING
if (global_settings.rec_path[0] != 0)
fdprintf(fd, "recording path: %s\r\n", global_settings.rec_path);
#endif
/* here's the action: write values to file, specified via table */ /* here's the action: write values to file, specified via table */
save_cfg_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), fd); save_cfg_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), fd);
save_cfg_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), fd); save_cfg_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), fd);
@ -1862,6 +1878,9 @@ void settings_reset(void) {
#endif #endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
global_settings.kbd_file[0] = '\0'; global_settings.kbd_file[0] = '\0';
#endif
#ifdef HAVE_RECORDING
global_settings.rec_path[0] = '\0';
#endif #endif
global_settings.hold_lr_for_scroll_in_list = true; global_settings.hold_lr_for_scroll_in_list = true;
} }
@ -2148,3 +2167,12 @@ void settings_apply_trigger(void)
); );
} }
#endif #endif
#ifdef HAVE_RECORDING
void set_recpath(void)
{
if(global_settings.rec_directory)
getcwd(global_settings.rec_path, MAX_PATH);
else
strncpy(global_settings.rec_path, rec_base_directory, MAX_PATH);
}
#endif

View file

@ -242,7 +242,9 @@ struct user_settings
unsigned char font_file[MAX_FILENAME+1]; /* last font */ unsigned char font_file[MAX_FILENAME+1]; /* last font */
unsigned char wps_file[MAX_FILENAME+1]; /* last wps */ unsigned char wps_file[MAX_FILENAME+1]; /* last wps */
unsigned char lang_file[MAX_FILENAME+1]; /* last language */ unsigned char lang_file[MAX_FILENAME+1]; /* last language */
#ifdef HAVE_RECORDING
unsigned char rec_path[MAX_PATH+1]; /* path for recorded files */
#endif
/* misc options */ /* misc options */
int repeat_mode; /* 0=off 1=repeat all 2=repeat one 3=shuffle 4=ab */ 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);
unsigned int rec_timesplit_seconds(void); unsigned int rec_timesplit_seconds(void);
unsigned long rec_sizesplit_bytes(void); unsigned long rec_sizesplit_bytes(void);
void settings_apply_trigger(void); void settings_apply_trigger(void);
void set_recpath(void);
/* global settings */ /* global settings */
extern struct user_settings global_settings; extern struct user_settings global_settings;

View file

@ -520,13 +520,17 @@ static bool recprerecord(void)
static bool recdirectory(void) static bool recdirectory(void)
{ {
bool ret;
static const struct opt_items names[] = { static const struct opt_items names[] = {
{ rec_base_directory, -1 }, { rec_base_directory, -1 },
{ STR(LANG_RECORD_CURRENT_DIR) } { STR(LANG_RECORD_CURRENT_DIR) }
}; };
return set_option(str(LANG_RECORD_DIRECTORY), ret = set_option(str(LANG_RECORD_DIRECTORY),
&global_settings.rec_directory, INT, &global_settings.rec_directory, INT,
names, 2, NULL ); names, 2, NULL );
set_recpath();
return ret;
} }
static bool reconstartup(void) static bool reconstartup(void)