mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-15 17:18:01 +00:00
b9a766d909
* Added support for running applications from SD card (FAPs - Flipper Application Packages) * Added plugin_dist target for fbt to build FAPs * All apps of type FlipperAppType.EXTERNAL and FlipperAppType.PLUGIN are built as FAPs by default * Updated VSCode configuration for new fbt features - re-deploy stock configuration to use them * Added debugging support for FAPs with fbt debug & VSCode * Added public firmware API with automated versioning Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: SG <who.just.the.doctor@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
109 lines
2.5 KiB
C
109 lines
2.5 KiB
C
#pragma once
|
|
|
|
#include <gui/gui_i.h>
|
|
#include <gui/view.h>
|
|
#include <gui/canvas.h>
|
|
#include <gui/elements.h>
|
|
#include <furi.h>
|
|
#include <storage/storage.h>
|
|
#include "../helpers/archive_files.h"
|
|
#include "../helpers/archive_favorites.h"
|
|
#include "gui/modules/file_browser_worker.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,
|
|
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;
|
|
string_t path;
|
|
InputKey last_tab_switch_dir;
|
|
bool is_root;
|
|
};
|
|
|
|
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;
|
|
} 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);
|