Quellcode durchsuchen

New naming fixes part 1

thanks @Willy-JL !
MX vor 2 Jahren
Ursprung
Commit
b4452cc9b9

+ 1 - 1
base_pack/nfc_maker/nfc_maker.h

@@ -13,7 +13,7 @@
 #include <gui/modules/popup.h>
 #include <gui/modules/popup.h>
 #include "scenes/nfc_maker_scene.h"
 #include "scenes/nfc_maker_scene.h"
 #include <lib/flipper_format/flipper_format.h>
 #include <lib/flipper_format/flipper_format.h>
-#include <lib/toolbox/random_name.h>
+#include <toolbox/name_generator.h>
 #include <applications/main/nfc/nfc_i.h>
 #include <applications/main/nfc/nfc_i.h>
 #include <furi_hal_bt.h>
 #include <furi_hal_bt.h>
 #include "strnlen.h"
 #include "strnlen.h"

+ 1 - 1
base_pack/nfc_maker/scenes/nfc_maker_scene_save.c

@@ -16,7 +16,7 @@ void nfc_maker_scene_save_on_enter(void* context) {
 
 
     nfc_maker_text_input_set_header_text(text_input, "Save the NFC tag:");
     nfc_maker_text_input_set_header_text(text_input, "Save the NFC tag:");
 
 
-    set_random_name(app->save_buf, BIG_INPUT_LEN);
+    name_generator_make_auto(app->save_buf, BIG_INPUT_LEN, "NFC");
 
 
     nfc_maker_text_input_set_result_callback(
     nfc_maker_text_input_set_result_callback(
         text_input,
         text_input,

+ 0 - 1
base_pack/picopass/scenes/picopass_scene_key_input.c

@@ -1,5 +1,4 @@
 #include "../picopass_i.h"
 #include "../picopass_i.h"
-#include <lib/toolbox/random_name.h>
 #include <gui/modules/validators.h>
 #include <gui/modules/validators.h>
 #include <toolbox/path.h>
 #include <toolbox/path.h>
 
 

+ 2 - 2
base_pack/picopass/scenes/picopass_scene_save_name.c

@@ -1,5 +1,5 @@
 #include "../picopass_i.h"
 #include "../picopass_i.h"
-#include <lib/toolbox/random_name.h>
+#include <toolbox/name_generator.h>
 #include <gui/modules/validators.h>
 #include <gui/modules/validators.h>
 #include <toolbox/path.h>
 #include <toolbox/path.h>
 
 
@@ -16,7 +16,7 @@ void picopass_scene_save_name_on_enter(void* context) {
     TextInput* text_input = picopass->text_input;
     TextInput* text_input = picopass->text_input;
     bool dev_name_empty = false;
     bool dev_name_empty = false;
     if(!strcmp(picopass->dev->dev_name, "")) {
     if(!strcmp(picopass->dev->dev_name, "")) {
-        set_random_name(picopass->text_store, sizeof(picopass->text_store));
+        name_generator_make_auto(picopass->text_store, sizeof(picopass->text_store), "PicoPass");
         dev_name_empty = true;
         dev_name_empty = true;
     } else {
     } else {
         picopass_text_store_set(picopass, picopass->dev->dev_name);
         picopass_text_store_set(picopass, picopass->dev->dev_name);

+ 2 - 7
base_pack/protoview/view_info.c

@@ -3,7 +3,7 @@
 
 
 #include "app.h"
 #include "app.h"
 #include <gui/view.h>
 #include <gui/view.h>
-#include <lib/toolbox/random_name.h>
+#include <toolbox/name_generator.h>
 
 
 /* This view has subviews accessible navigating up/down. This
 /* This view has subviews accessible navigating up/down. This
  * enumaration is used to track the currently active subview. */
  * enumaration is used to track the currently active subview. */
@@ -166,12 +166,7 @@ void str_replace(char* buf, char c1, char c2) {
 
 
 /* Set a random filename the user can edit. */
 /* Set a random filename the user can edit. */
 void set_signal_random_filename(ProtoViewApp* app, char* buf, size_t buflen) {
 void set_signal_random_filename(ProtoViewApp* app, char* buf, size_t buflen) {
-    char suffix[6];
-    set_random_name(suffix, sizeof(suffix));
-    snprintf(buf, buflen, "%.10s-%s-%d", app->msg_info->decoder->name, suffix, rand() % 1000);
-    str_replace(buf, ' ', '_');
-    str_replace(buf, '-', '_');
-    str_replace(buf, '/', '_');
+    name_generator_make_auto(buf, buflen, app->msg_info->decoder->name);
 }
 }
 
 
 /* ========================== Signal transmission =========================== */
 /* ========================== Signal transmission =========================== */

+ 1 - 1
base_pack/spi_mem_manager/scenes/spi_mem_scene_read_filename.c

@@ -11,7 +11,7 @@ void spi_mem_scene_read_set_random_filename(SPIMemApp* app) {
         size_t filename_start = furi_string_search_rchar(app->file_path, '/');
         size_t filename_start = furi_string_search_rchar(app->file_path, '/');
         furi_string_left(app->file_path, filename_start);
         furi_string_left(app->file_path, filename_start);
     }
     }
-    set_random_name(app->text_buffer, SPI_MEM_TEXT_BUFFER_SIZE);
+    name_generator_make_auto(app->text_buffer, SPI_MEM_TEXT_BUFFER_SIZE, TAG);
 }
 }
 
 
 void spi_mem_scene_read_filename_on_enter(void* context) {
 void spi_mem_scene_read_filename_on_enter(void* context) {

+ 1 - 1
base_pack/spi_mem_manager/spi_mem_app_i.h

@@ -15,7 +15,7 @@
 #include <gui/modules/text_input.h>
 #include <gui/modules/text_input.h>
 #include <storage/storage.h>
 #include <storage/storage.h>
 #include <toolbox/path.h>
 #include <toolbox/path.h>
-#include <toolbox/random_name.h>
+#include <toolbox/name_generator.h>
 #include "scenes/spi_mem_scene.h"
 #include "scenes/spi_mem_scene.h"
 #include "lib/spi/spi_mem_worker.h"
 #include "lib/spi/spi_mem_worker.h"
 #include "spi_mem_manager_icons.h"
 #include "spi_mem_manager_icons.h"

+ 2 - 2
non_catalog_apps/magspoof_flipper/scenes/mag_scene_input_name.c

@@ -1,4 +1,4 @@
-#include <lib/toolbox/random_name.h>
+#include <toolbox/name_generator.h>
 #include "../mag_i.h"
 #include "../mag_i.h"
 
 
 void mag_scene_input_name_on_enter(void* context) {
 void mag_scene_input_name_on_enter(void* context) {
@@ -13,7 +13,7 @@ void mag_scene_input_name_on_enter(void* context) {
 
 
     if(name_is_empty) {
     if(name_is_empty) {
         furi_string_set(mag->file_path, MAG_APP_FOLDER);
         furi_string_set(mag->file_path, MAG_APP_FOLDER);
-        set_random_name(mag->text_store, MAG_TEXT_STORE_SIZE);
+        name_generator_make_auto(mag->text_store, MAG_TEXT_STORE_SIZE, "Mag");
         furi_string_set(folder_path, MAG_APP_FOLDER);
         furi_string_set(folder_path, MAG_APP_FOLDER);
     } else {
     } else {
         // TODO: compatible types etc
         // TODO: compatible types etc

+ 2 - 2
non_catalog_apps/seader/scenes/seader_scene_save_name.c

@@ -1,5 +1,5 @@
 #include "../seader_i.h"
 #include "../seader_i.h"
-#include <lib/toolbox/random_name.h>
+#include <toolbox/name_generator.h>
 #include <gui/modules/validators.h>
 #include <gui/modules/validators.h>
 #include <toolbox/path.h>
 #include <toolbox/path.h>
 
 
@@ -16,7 +16,7 @@ void seader_scene_save_name_on_enter(void* context) {
     TextInput* text_input = seader->text_input;
     TextInput* text_input = seader->text_input;
     bool cred_name_empty = false;
     bool cred_name_empty = false;
     if(!strcmp(seader->credential->name, "")) {
     if(!strcmp(seader->credential->name, "")) {
-        set_random_name(seader->text_store, sizeof(seader->text_store));
+        name_generator_make_auto(seader->text_store, sizeof(seader->text_store), "Seader");
         cred_name_empty = true;
         cred_name_empty = true;
     } else {
     } else {
         seader_text_store_set(seader, seader->credential->name);
         seader_text_store_set(seader, seader->credential->name);

+ 4 - 2
non_catalog_apps/uhf_rfid/scenes/uhf_scene_save_name.c

@@ -1,5 +1,5 @@
 #include "../uhf_app_i.h"
 #include "../uhf_app_i.h"
-#include <lib/toolbox/random_name.h>
+#include <toolbox/name_generator.h>
 #include <gui/modules/validators.h>
 #include <gui/modules/validators.h>
 #include <toolbox/path.h>
 #include <toolbox/path.h>
 
 
@@ -14,7 +14,9 @@ void uhf_scene_save_name_on_enter(void* context) {
 
 
     // Setup view
     // Setup view
     TextInput* text_input = uhf_app->text_input;
     TextInput* text_input = uhf_app->text_input;
-    set_random_name(uhf_app->text_store, sizeof(uhf_app->text_store));
+
+    name_generator_make_auto(uhf_app->text_store, sizeof(uhf_app->text_store), "UHF");
+
     text_input_set_header_text(text_input, "Name the tag");
     text_input_set_header_text(text_input, "Name the tag");
     text_input_set_result_callback(
     text_input_set_result_callback(
         text_input,
         text_input,

+ 2 - 1
non_catalog_apps/wiegand/scenes/wiegand_save.c

@@ -66,7 +66,8 @@ void wiegand_save(void* context) {
 void wiegand_save_scene_on_enter(void* context) {
 void wiegand_save_scene_on_enter(void* context) {
     App* app = context;
     App* app = context;
     text_input_reset(app->text_input);
     text_input_reset(app->text_input);
-    set_random_name(app->file_name, WIEGAND_KEY_NAME_SIZE);
+    
+    name_generator_make_auto(app->file_name, WIEGAND_KEY_NAME_SIZE, "WiegandKey");
 
 
     text_input_set_header_text(app->text_input, "Name the key");
     text_input_set_header_text(app->text_input, "Name the key");
     text_input_set_result_callback(
     text_input_set_result_callback(

+ 1 - 1
non_catalog_apps/wiegand/wiegand.h

@@ -7,7 +7,7 @@
 #include <gui/modules/widget.h>
 #include <gui/modules/widget.h>
 #include <gui/modules/submenu.h>
 #include <gui/modules/submenu.h>
 #include <gui/modules/text_input.h>
 #include <gui/modules/text_input.h>
-#include <lib/toolbox/random_name.h>
+#include <toolbox/name_generator.h>
 #include <notification/notification.h>
 #include <notification/notification.h>
 #include <notification/notification_messages.h>
 #include <notification/notification_messages.h>
 #include <dialogs/dialogs.h>
 #include <dialogs/dialogs.h>