flipperzero-firmware/applications/main/archive/views/archive_browser_view.h
hedger 224d0aefe4
[FL-2733] multitarget support for fbt (#2209)
* First part of multitarget porting
* Delete firmware/targets/f7/Inc directory
* Delete firmware/targets/f7/Src directory
* gpio: cli fixes; about: using version from HAL
* sdk: path fixes
* gui: include fixes
* applications: more include fixes
* gpio: ported to new apis
* hal: introduced furi_hal_target_hw.h; libs: added one_wire
* hal: f18 target
* github: also build f18 by default
* typo fix
* fbt: removed extra checks on app list
* api: explicitly bundling select mlib headers with sdk
* hal: f18: changed INPUT_DEBOUNCE_TICKS to match f7
* cleaned up commented out code
* docs: added info on hw targets
* docs: targets: formatting fixes
* f18: fixed link error
* f18: fixed API version to match f7
* docs: hardware: minor wording fixes
* faploader: added fw target check
* docs: typo fixes
* github: not building komi target by default
* fbt: support for `targets` field for built-in apps
* github: reworked build flow to exclude app_set; fbt: removed komi-specific appset; added additional target buildset check
* github: fixed build; nfc: fixed pvs warnings
* attempt to fix target id
* f7, f18: removed certain HAL function from public API
* apps: debug: enabled bt_debug_app for f18
* Targets: backport input pins configuration routine from F7 to F18

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2023-02-08 01:33:05 +09:00

114 lines
2.6 KiB
C

#pragma once
#include "../helpers/archive_files.h"
#include "../helpers/archive_favorites.h"
#include <gui/gui_i.h>
#include <gui/view.h>
#include <gui/canvas.h>
#include <gui/elements.h>
#include <gui/modules/file_browser_worker.h>
#include <storage/storage.h>
#include <furi.h>
#define MAX_LEN_PX 110
#define MAX_NAME_LEN 255
#define MAX_EXT_LEN 6
#define FRAME_HEIGHT 12
#define MENU_ITEMS 4u
#define MOVE_OFFSET 5u
typedef enum {
ArchiveTabFavorites,
ArchiveTabSubGhz,
ArchiveTabLFRFID,
ArchiveTabNFC,
ArchiveTabInfrared,
ArchiveTabIButton,
ArchiveTabBadUsb,
ArchiveTabU2f,
ArchiveTabApplications,
ArchiveTabBrowser,
ArchiveTabTotal,
} ArchiveTabEnum;
typedef enum {
ArchiveBrowserEventFileMenuOpen,
ArchiveBrowserEventFileMenuClose,
ArchiveBrowserEventFileMenuRun,
ArchiveBrowserEventFileMenuPin,
ArchiveBrowserEventFileMenuRename,
ArchiveBrowserEventFileMenuDelete,
ArchiveBrowserEventEnterDir,
ArchiveBrowserEventFavMoveUp,
ArchiveBrowserEventFavMoveDown,
ArchiveBrowserEventEnterFavMove,
ArchiveBrowserEventExitFavMove,
ArchiveBrowserEventSaveFavMove,
ArchiveBrowserEventLoadPrevItems,
ArchiveBrowserEventLoadNextItems,
ArchiveBrowserEventListRefresh,
ArchiveBrowserEventExit,
} ArchiveBrowserEvent;
static const uint8_t file_menu_actions[MENU_ITEMS] = {
[0] = ArchiveBrowserEventFileMenuRun,
[1] = ArchiveBrowserEventFileMenuPin,
[2] = ArchiveBrowserEventFileMenuRename,
[3] = ArchiveBrowserEventFileMenuDelete,
};
typedef struct ArchiveBrowserView ArchiveBrowserView;
typedef void (*ArchiveBrowserViewCallback)(ArchiveBrowserEvent event, void* context);
typedef enum {
BrowserActionBrowse,
BrowserActionItemMenu,
BrowserActionTotal,
} BrowserActionEnum;
struct ArchiveBrowserView {
View* view;
BrowserWorker* worker;
bool worker_running;
ArchiveBrowserViewCallback callback;
void* context;
FuriString* path;
InputKey last_tab_switch_dir;
bool is_root;
FuriTimer* scroll_timer;
};
typedef struct {
ArchiveTabEnum tab_idx;
files_array_t files;
uint8_t menu_idx;
bool menu;
bool move_fav;
bool list_loading;
bool folder_loading;
uint32_t item_cnt;
int32_t item_idx;
int32_t array_offset;
int32_t list_offset;
size_t scroll_counter;
} ArchiveBrowserViewModel;
void archive_browser_set_callback(
ArchiveBrowserView* browser,
ArchiveBrowserViewCallback callback,
void* context);
View* archive_browser_get_view(ArchiveBrowserView* browser);
ArchiveBrowserView* browser_alloc();
void browser_free(ArchiveBrowserView* browser);