mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Add File Naming setting for more detailed naming (#3002)
* added filename mode setting * added furi_flag checks for when filename_mode is set * changed naming for ibutton, lfrfid and subghz * requested changes from PR * Lib: gather all naming bits and pieces under name generator module. Properly bump api version. FuriHal: fix RTC flag enum. * PR requested changes * bug fix for arg type * added functionality for other application scenes * Lib: cleanup name generator API, simplify usage. Sync API symbols. * Lib: proper size type in name_generator. Cleanup. * FuriHal: cleanup rtc api usage across firmware Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#include "../subghz_i.h"
|
||||
#include "subghz/types.h"
|
||||
#include <lib/toolbox/random_name.h>
|
||||
#include "../helpers/subghz_custom_event.h"
|
||||
#include <lib/subghz/protocols/raw.h>
|
||||
#include <gui/modules/validators.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <toolbox/name_generator.h>
|
||||
|
||||
#define MAX_TEXT_INPUT_LEN 22
|
||||
|
||||
@@ -40,7 +40,9 @@ void subghz_scene_save_name_on_enter(void* context) {
|
||||
|
||||
if(!subghz_path_is_file(subghz->file_path)) {
|
||||
char file_name_buf[SUBGHZ_MAX_LEN_NAME] = {0};
|
||||
set_random_name(file_name_buf, SUBGHZ_MAX_LEN_NAME);
|
||||
|
||||
name_generator_make_auto(file_name_buf, SUBGHZ_MAX_LEN_NAME, SUBGHZ_APP_FILENAME_PREFIX);
|
||||
|
||||
furi_string_set(file_name, file_name_buf);
|
||||
furi_string_set(subghz->file_path, SUBGHZ_APP_FOLDER);
|
||||
//highlighting the entire filename by default
|
||||
@@ -71,7 +73,7 @@ void subghz_scene_save_name_on_enter(void* context) {
|
||||
dev_name_empty);
|
||||
|
||||
ValidatorIsFile* validator_is_file = validator_is_file_alloc_init(
|
||||
furi_string_get_cstr(subghz->file_path), SUBGHZ_APP_EXTENSION, "");
|
||||
furi_string_get_cstr(subghz->file_path), SUBGHZ_APP_FILENAME_EXTENSION, "");
|
||||
text_input_set_validator(text_input, validator_is_file_callback, validator_is_file);
|
||||
|
||||
furi_string_free(file_name);
|
||||
@@ -94,7 +96,10 @@ bool subghz_scene_save_name_on_event(void* context, SceneManagerEvent event) {
|
||||
if(event.event == SubGhzCustomEventSceneSaveName) {
|
||||
if(strcmp(subghz->file_name_tmp, "") != 0) {
|
||||
furi_string_cat_printf(
|
||||
subghz->file_path, "/%s%s", subghz->file_name_tmp, SUBGHZ_APP_EXTENSION);
|
||||
subghz->file_path,
|
||||
"/%s%s",
|
||||
subghz->file_name_tmp,
|
||||
SUBGHZ_APP_FILENAME_EXTENSION);
|
||||
if(subghz_path_is_file(subghz->file_path_tmp)) {
|
||||
if(!subghz_rename_file(subghz)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user