mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 20:49:49 +04:00
@@ -1,29 +1,5 @@
|
|||||||
#include "archive_i.h"
|
#include "archive_i.h"
|
||||||
|
|
||||||
static const NotificationSequence sequence_blink_set_yellow = {
|
|
||||||
&message_blink_set_color_yellow,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const NotificationSequence sequence_blink_set_magenta = {
|
|
||||||
&message_blink_set_color_magenta,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const NotificationSequence* archive_notification_sequences[] = {
|
|
||||||
&sequence_error,
|
|
||||||
&sequence_success,
|
|
||||||
&sequence_blink_start_cyan,
|
|
||||||
&sequence_blink_start_magenta,
|
|
||||||
&sequence_blink_set_yellow,
|
|
||||||
&sequence_blink_set_magenta,
|
|
||||||
&sequence_set_red_255,
|
|
||||||
&sequence_reset_red,
|
|
||||||
&sequence_set_green_255,
|
|
||||||
&sequence_reset_green,
|
|
||||||
&sequence_blink_stop,
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool archive_custom_event_callback(void* context, uint32_t event) {
|
static bool archive_custom_event_callback(void* context, uint32_t event) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
ArchiveApp* archive = context;
|
ArchiveApp* archive = context;
|
||||||
@@ -51,7 +27,6 @@ static ArchiveApp* archive_alloc() {
|
|||||||
archive->view_dispatcher = view_dispatcher_alloc();
|
archive->view_dispatcher = view_dispatcher_alloc();
|
||||||
|
|
||||||
archive->gui = furi_record_open(RECORD_GUI);
|
archive->gui = furi_record_open(RECORD_GUI);
|
||||||
archive->notifications = furi_record_open(RECORD_NOTIFICATION);
|
|
||||||
|
|
||||||
ViewDispatcher* view_dispatcher = archive->view_dispatcher;
|
ViewDispatcher* view_dispatcher = archive->view_dispatcher;
|
||||||
view_dispatcher_enable_queue(view_dispatcher);
|
view_dispatcher_enable_queue(view_dispatcher);
|
||||||
@@ -97,9 +72,6 @@ void archive_free(ArchiveApp* archive) {
|
|||||||
view_dispatcher_remove_view(view_dispatcher, ArchiveViewWidget);
|
view_dispatcher_remove_view(view_dispatcher, ArchiveViewWidget);
|
||||||
widget_free(archive->widget);
|
widget_free(archive->widget);
|
||||||
|
|
||||||
view_dispatcher_remove_view(view_dispatcher, ArchiveViewStack);
|
|
||||||
view_stack_free(archive->view_stack);
|
|
||||||
|
|
||||||
view_dispatcher_remove_view(view_dispatcher, ArchiveViewBrowser);
|
view_dispatcher_remove_view(view_dispatcher, ArchiveViewBrowser);
|
||||||
|
|
||||||
view_dispatcher_free(archive->view_dispatcher);
|
view_dispatcher_free(archive->view_dispatcher);
|
||||||
@@ -108,9 +80,6 @@ void archive_free(ArchiveApp* archive) {
|
|||||||
browser_free(archive->browser);
|
browser_free(archive->browser);
|
||||||
string_clear(archive->fav_move_str);
|
string_clear(archive->fav_move_str);
|
||||||
|
|
||||||
furi_record_close(RECORD_NOTIFICATION);
|
|
||||||
archive->notifications = NULL;
|
|
||||||
|
|
||||||
furi_record_close(RECORD_DIALOGS);
|
furi_record_close(RECORD_DIALOGS);
|
||||||
archive->dialogs = NULL;
|
archive->dialogs = NULL;
|
||||||
|
|
||||||
@@ -136,24 +105,6 @@ void archive_show_loading_popup(ArchiveApp* context, bool show) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void archive_text_store_set(ArchiveApp* context, const char* text, ...) {
|
|
||||||
va_list args;
|
|
||||||
va_start(args, text);
|
|
||||||
|
|
||||||
vsnprintf(context->text_store, MAX_NAME_LEN, text, args);
|
|
||||||
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void archive_text_store_clear(ArchiveApp* context) {
|
|
||||||
memset(context->text_store, 0, MAX_NAME_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
void archive_notification_message(ArchiveApp* context, uint32_t message) {
|
|
||||||
furi_assert(message < sizeof(archive_notification_sequences) / sizeof(NotificationSequence*));
|
|
||||||
notification_message(context->notifications, archive_notification_sequences[message]);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t archive_app(void* p) {
|
int32_t archive_app(void* p) {
|
||||||
UNUSED(p);
|
UNUSED(p);
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ struct ArchiveApp {
|
|||||||
Widget* widget;
|
Widget* widget;
|
||||||
DialogsApp* dialogs;
|
DialogsApp* dialogs;
|
||||||
Loading* loading;
|
Loading* loading;
|
||||||
NotificationApp* notifications;
|
|
||||||
|
|
||||||
FuriPubSubSubscription* loader_stop_subscription;
|
FuriPubSubSubscription* loader_stop_subscription;
|
||||||
|
|
||||||
string_t fav_move_str;
|
string_t fav_move_str;
|
||||||
@@ -43,7 +41,4 @@ struct ArchiveApp {
|
|||||||
char file_extension[MAX_EXT_LEN + 1];
|
char file_extension[MAX_EXT_LEN + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
void archive_text_store_set(iButton* ibutton, const char* text, ...);
|
|
||||||
void archive_text_store_clear(iButton* ibutton);
|
|
||||||
void archive_notification_message(iButton* ibutton, uint32_t message);
|
|
||||||
void archive_show_loading_popup(ArchiveApp* context, bool show);
|
void archive_show_loading_popup(ArchiveApp* context, bool show);
|
||||||
@@ -64,7 +64,7 @@ void archive_scene_info_on_enter(void* context) {
|
|||||||
|
|
||||||
// This one to return and cursor select this file
|
// This one to return and cursor select this file
|
||||||
path_extract_filename_no_ext(string_get_cstr(current->path), filename);
|
path_extract_filename_no_ext(string_get_cstr(current->path), filename);
|
||||||
archive_text_store_set(instance, instance->text_store);
|
strlcpy(instance->text_store, string_get_cstr(filename), MAX_NAME_LEN);
|
||||||
|
|
||||||
string_clear(filename);
|
string_clear(filename);
|
||||||
string_clear(dirname);
|
string_clear(dirname);
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ void archive_scene_rename_on_enter(void* context) {
|
|||||||
|
|
||||||
if(current->type == ArchiveFileTypeFolder) {
|
if(current->type == ArchiveFileTypeFolder) {
|
||||||
path_extract_basename(string_get_cstr(current->path), path_name);
|
path_extract_basename(string_get_cstr(current->path), path_name);
|
||||||
archive_text_store_set(archive, string_get_cstr(path_name));
|
strlcpy(archive->text_store, string_get_cstr(path_name), MAX_NAME_LEN);
|
||||||
text_input_set_header_text(text_input, "Rename directory:");
|
text_input_set_header_text(text_input, "Rename directory:");
|
||||||
} else /*if(current->type != ArchiveFileTypeUnknown) */ {
|
} else /*if(current->type != ArchiveFileTypeUnknown) */ {
|
||||||
path_extract_filename(current->path, path_name, true);
|
path_extract_filename(current->path, path_name, true);
|
||||||
archive_text_store_set(archive, string_get_cstr(path_name));
|
strlcpy(archive->text_store, string_get_cstr(path_name), MAX_NAME_LEN);
|
||||||
|
|
||||||
path_extract_extension(current->path, archive->file_extension, MAX_EXT_LEN);
|
path_extract_extension(current->path, archive->file_extension, MAX_EXT_LEN);
|
||||||
text_input_set_header_text(text_input, "Rename file:");
|
text_input_set_header_text(text_input, "Rename file:");
|
||||||
|
|||||||
Reference in New Issue
Block a user