archive_i.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #pragma once
  2. #include "archive.h"
  3. #include <stdint.h>
  4. #include <furi.h>
  5. #include <gui/gui_i.h>
  6. #include <gui/view_dispatcher.h>
  7. #include <gui/scene_manager.h>
  8. #include <gui/modules/text_input.h>
  9. #include <loader/loader.h>
  10. #include <m-string.h>
  11. #include <m-array.h>
  12. #include <storage/storage.h>
  13. #include "applications.h"
  14. #include "file-worker.h"
  15. #include "views/archive_main_view.h"
  16. #include "scenes/archive_scene.h"
  17. #define MAX_FILE_SIZE 128
  18. typedef enum {
  19. ArchiveViewBrowser,
  20. ArchiveViewTextInput,
  21. ArchiveViewTotal,
  22. } ArchiveViewEnum;
  23. static const char* tab_default_paths[] = {
  24. [ArchiveTabFavorites] = "/any/favorites",
  25. [ArchiveTabIButton] = "/any/ibutton",
  26. [ArchiveTabNFC] = "/any/nfc",
  27. [ArchiveTabSubGhz] = "/any/subghz/saved",
  28. [ArchiveTabLFRFID] = "/any/lfrfid",
  29. [ArchiveTabIrda] = "/any/irda",
  30. [ArchiveTabBrowser] = "/any",
  31. };
  32. static inline const char* get_default_path(ArchiveFileTypeEnum type) {
  33. switch(type) {
  34. case ArchiveFileTypeIButton:
  35. return tab_default_paths[ArchiveTabIButton];
  36. case ArchiveFileTypeNFC:
  37. return tab_default_paths[ArchiveTabNFC];
  38. case ArchiveFileTypeSubGhz:
  39. return tab_default_paths[ArchiveTabSubGhz];
  40. case ArchiveFileTypeLFRFID:
  41. return tab_default_paths[ArchiveTabLFRFID];
  42. case ArchiveFileTypeIrda:
  43. return tab_default_paths[ArchiveTabIrda];
  44. default:
  45. return false;
  46. }
  47. }
  48. static inline const char* get_favorites_path() {
  49. return tab_default_paths[ArchiveTabFavorites];
  50. }
  51. typedef enum {
  52. EventTypeTick,
  53. EventTypeKey,
  54. EventTypeExit,
  55. } EventType;
  56. typedef struct {
  57. union {
  58. InputEvent input;
  59. } value;
  60. EventType type;
  61. } AppEvent;
  62. struct ArchiveApp {
  63. Gui* gui;
  64. ViewDispatcher* view_dispatcher;
  65. SceneManager* scene_manager;
  66. ArchiveMainView* main_view;
  67. TextInput* text_input;
  68. char text_store[MAX_NAME_LEN];
  69. };