feat(file_explorer): remove '.' and rename '..' to '< Back' (#7270)

Co-authored-by: Liam <30486941+liamHowatt@users.noreply.github.com>
This commit is contained in:
André Costa
2024-12-03 14:26:30 +01:00
committed by GitHub
parent 4d32e8595b
commit 9ba60f037b
2 changed files with 3 additions and 7 deletions

View File

@@ -25,7 +25,7 @@
#define quick_access_list_button_style (LV_GLOBAL_DEFAULT()->fe_list_button_style)
#define LV_FILE_NAVIGATION_CURRENT_DIR "."
#define LV_FILE_NAVIGATION_PARENT_DIR ".."
#define LV_FILE_NAVIGATION_PARENT_DIR "Back"
/**********************
* TYPEDEFS
@@ -489,7 +489,6 @@ static void browser_file_event_handler(lv_event_t * e)
const char * selected_text = NULL;
uint32_t row;
uint32_t col;
uint8_t navigate_to_current_dir = 0;
uint8_t navigate_to_parent_dir = 0;
uint8_t navigate_to_child = 0;
@@ -503,11 +502,9 @@ static void browser_file_event_handler(lv_event_t * e)
* - Navigate to current directory
* - Navigate to parent directory
* - Navigate to (current directory) child */
navigate_to_current_dir = (lv_strcmp(selected_text, LV_FILE_NAVIGATION_CURRENT_DIR) == 0);
navigate_to_parent_dir = (lv_strcmp(selected_text, LV_FILE_NAVIGATION_PARENT_DIR) == 0);
navigate_to_child = !navigate_to_parent_dir;
if(navigate_to_current_dir) return; /* Do nothing */
if((navigate_to_parent_dir) && (lv_strlen(explorer->current_path) > 3)) {
strip_ext(explorer->current_path);
@@ -560,8 +557,7 @@ static void show_dir(lv_obj_t * obj, const char * path)
return;
}
lv_table_set_cell_value_fmt(explorer->file_table, index++, 0, LV_SYMBOL_DIRECTORY " %s", ".");
lv_table_set_cell_value_fmt(explorer->file_table, index++, 0, LV_SYMBOL_DIRECTORY " %s", "..");
lv_table_set_cell_value(explorer->file_table, index++, 0, LV_SYMBOL_LEFT " " LV_FILE_NAVIGATION_PARENT_DIR);
lv_table_set_cell_value(explorer->file_table, 0, 1, "0");
lv_table_set_cell_value(explorer->file_table, 1, 1, "0");

View File

@@ -40,7 +40,7 @@ void test_file_explorer_read_dir(void)
lv_file_explorer_get_current_path(file_explorer_obj));
for(uint8_t i = 0; i < file_table->row_cnt; i++) {
if(lv_strcmp(lv_table_get_cell_value(file_explorer->file_table, i, 0), LV_SYMBOL_DIRECTORY " ..") == 0) {
if(lv_strcmp(lv_table_get_cell_value(file_explorer->file_table, i, 0), LV_SYMBOL_LEFT " Back") == 0) {
back_row = i;
}
if(lv_strcmp(lv_table_get_cell_value(file_explorer->file_table, i, 0), LV_SYMBOL_DIRECTORY " dev") == 0) {