mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-30 08:20:21 +00:00
c8180747db
* Do not load all signals at once (Draft) * Minor cleanup * Refactor remote renaming * Improve function signatures * Rename infrared_remote functions * Optimise signal loading * Implement adding signals to remote * Add read_name() method * Deprecate a function * Partially implement deleting signals (draft) * Use m-array instead of m-list for signal name directory * Use plain C strings instead of furi_string * Implement deleting signals * Implement deleting signals via generalised callback * Implement renaming signals * Rename some types * Some more renaming * Remove unused type * Implement inserting signals (internal use) * Improve InfraredMoveView * Send an event to move a signal * Remove unused type * Implement moving signals * Implement creating new remotes with one signal * Un-deprecate and rename a function * Add InfraredRemote API docs * Add InfraredSignal API docs * Better error messages * Show progress pop-up when moving buttons in a remote * Copy labels to the InfraredMoveView to avoid pointer invalidation * Improve file selection scene * Show progress pop-up when renaming buttons in a remote * Refactor a scene * Show progress when deleting a button from remote * Use a random name for temp files * Add docs to infrared_brute_force.h * Rename Infrared type to InfraredApp * Add docs to infrared_app_i.h Co-authored-by: あく <alleteam@gmail.com>
48 lines
1.8 KiB
C
48 lines
1.8 KiB
C
#include "../infrared_app_i.h"
|
|
|
|
static void infrared_scene_dialog_result_callback(DialogExResult result, void* context) {
|
|
InfraredApp* infrared = context;
|
|
view_dispatcher_send_custom_event(infrared->view_dispatcher, result);
|
|
}
|
|
|
|
void infrared_scene_ask_retry_on_enter(void* context) {
|
|
InfraredApp* infrared = context;
|
|
DialogEx* dialog_ex = infrared->dialog_ex;
|
|
|
|
dialog_ex_set_header(dialog_ex, "Retry Reading?", 64, 11, AlignCenter, AlignTop);
|
|
dialog_ex_set_text(
|
|
dialog_ex, "All unsaved data\nwill be lost!", 64, 25, AlignCenter, AlignTop);
|
|
dialog_ex_set_icon(dialog_ex, 0, 0, NULL);
|
|
dialog_ex_set_left_button_text(dialog_ex, "Exit");
|
|
dialog_ex_set_center_button_text(dialog_ex, NULL);
|
|
dialog_ex_set_right_button_text(dialog_ex, "Stay");
|
|
dialog_ex_set_result_callback(dialog_ex, infrared_scene_dialog_result_callback);
|
|
dialog_ex_set_context(dialog_ex, context);
|
|
|
|
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewDialogEx);
|
|
}
|
|
|
|
bool infrared_scene_ask_retry_on_event(void* context, SceneManagerEvent event) {
|
|
InfraredApp* infrared = context;
|
|
SceneManager* scene_manager = infrared->scene_manager;
|
|
bool consumed = false;
|
|
|
|
if(event.type == SceneManagerEventTypeBack) {
|
|
consumed = true;
|
|
} else if(event.type == SceneManagerEventTypeCustom) {
|
|
if(event.event == DialogExResultLeft) {
|
|
scene_manager_search_and_switch_to_previous_scene(scene_manager, InfraredSceneLearn);
|
|
consumed = true;
|
|
} else if(event.event == DialogExResultRight) {
|
|
scene_manager_previous_scene(scene_manager);
|
|
consumed = true;
|
|
}
|
|
}
|
|
|
|
return consumed;
|
|
}
|
|
|
|
void infrared_scene_ask_retry_on_exit(void* context) {
|
|
InfraredApp* infrared = context;
|
|
dialog_ex_reset(infrared->dialog_ex);
|
|
}
|