summaryrefslogtreecommitdiff
path: root/apps
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 /apps
parent84cbab18da4b986e8bd3427cc9d3a5e9296fd4a5 (diff)
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
Diffstat (limited to 'apps')
-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)
char *rec_create_filename(char *buffer)
{
- if(global_settings.rec_directory)
- getcwd(buffer, MAX_PATH);
- else
- strncpy(buffer, rec_base_directory, MAX_PATH);
-
-
+ strncpy(buffer, global_settings.rec_path, MAX_PATH);
+
#ifdef CONFIG_RTC
create_datetime_filename(buffer, buffer, "R",
REC_FILE_ENDING(global_settings.rec_quality));
@@ -510,7 +506,16 @@ char *rec_create_filename(char *buffer)
int rec_create_directory(void)
{
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 */
if(global_settings.rec_directory == 0)
{
@@ -828,6 +833,10 @@ bool recording_screen(bool no_source)
global_settings.recscreen_on = true;
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)
ata_set_led_enabled(false);
#endif
@@ -1259,7 +1268,8 @@ bool recording_screen(bool no_source)
global_settings.rec_editable,
global_settings.rec_prerecord_time);
- rec_create_directory();
+ if(rec_create_directory() > 0)
+ have_recorded = true;
#ifdef HAVE_AGC
if (global_settings.rec_source == AUDIO_SRC_MIC) {
agc_preset = global_settings.rec_agc_preset_mic;
@@ -1719,10 +1729,12 @@ bool recording_screen(bool no_source)
/* draw the trigger status */
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++){
- screens[i].update_rect(LCD_WIDTH - (TRIG_WIDTH + 2), 4 * h,
- TRIG_WIDTH + 2, TRIG_HEIGHT);
+ screens[i].update_rect(LCD_WIDTH - (TRIG_WIDTH + 2),
+ filename_offset[0] + PM_HEIGHT +
+ line[0], + 2, TRIG_HEIGHT);
}
}
}
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 @@
#ifdef HAVE_LCD_COLOR
#include "backdrop.h"
#endif
+#include "tree.h"
#ifdef CONFIG_TUNER
#include "radio.h"
@@ -1013,6 +1014,11 @@ int settings_save( void )
MAX_FILENAME);
i+= MAX_FILENAME;
#endif
+#ifdef HAVE_RECORDING
+ strncpy((char *)&config_block[i], (char *)global_settings.rec_path,
+ MAX_PATH);
+ i+= MAX_PATH;
+#endif
if(save_config_buffer())
{
@@ -1410,6 +1416,11 @@ void settings_load(int which)
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
}
}
@@ -1769,6 +1780,11 @@ bool settings_save_config(void)
global_settings.kbd_file);
#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 */
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);
@@ -1863,6 +1879,9 @@ void settings_reset(void) {
#ifdef HAVE_LCD_BITMAP
global_settings.kbd_file[0] = '\0';
#endif
+#ifdef HAVE_RECORDING
+ global_settings.rec_path[0] = '\0';
+#endif
global_settings.hold_lr_for_scroll_in_list = true;
}
@@ -2148,3 +2167,12 @@ void settings_apply_trigger(void)
);
}
#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
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
unsigned char font_file[MAX_FILENAME+1]; /* last font */
unsigned char wps_file[MAX_FILENAME+1]; /* last wps */
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 */
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 long rec_sizesplit_bytes(void);
void settings_apply_trigger(void);
+void set_recpath(void);
/* global settings */
extern 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)
static bool recdirectory(void)
{
+ bool ret;
static const struct opt_items names[] = {
{ rec_base_directory, -1 },
{ STR(LANG_RECORD_CURRENT_DIR) }
};
- return set_option(str(LANG_RECORD_DIRECTORY),
+ ret = set_option(str(LANG_RECORD_DIRECTORY),
&global_settings.rec_directory, INT,
names, 2, NULL );
+ set_recpath();
+
+ return ret;
}
static bool reconstartup(void)