implement sfw_mode for infrared

This commit is contained in:
jbohack
2023-01-08 15:13:13 -05:00
parent 23bb77c80f
commit 46aa2f7c81
4 changed files with 30 additions and 3 deletions

View File

@@ -1,10 +1,18 @@
#include "../infrared_i.h"
#include "../../../settings/desktop_settings/desktop_settings_app.h"
void infrared_scene_edit_rename_done_on_enter(void* context) {
Infrared* infrared = context;
Popup* popup = infrared->popup;
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
if (settings->sfw_mode) {
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw);
}
else {
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
}
popup_set_header(popup, "Saved!", 5, 7, AlignLeft, AlignTop);
popup_set_callback(popup, infrared_popup_closed_callback);
@@ -13,6 +21,7 @@ void infrared_scene_edit_rename_done_on_enter(void* context) {
popup_enable_timeout(popup);
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup);
free(settings);
}
bool infrared_scene_edit_rename_done_on_event(void* context, SceneManagerEvent event) {

View File

@@ -1,10 +1,18 @@
#include "../infrared_i.h"
#include "../../../settings/desktop_settings/desktop_settings_app.h"
void infrared_scene_learn_done_on_enter(void* context) {
Infrared* infrared = context;
Popup* popup = infrared->popup;
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
if (settings->sfw_mode) {
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59_sfw);
}
else {
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
}
if(infrared->app_state.is_learning_new_remote) {
popup_set_header(popup, "New remote\ncreated!", 0, 0, AlignLeft, AlignTop);
@@ -18,6 +26,7 @@ void infrared_scene_learn_done_on_enter(void* context) {
popup_enable_timeout(popup);
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup);
free(settings);
}
bool infrared_scene_learn_done_on_event(void* context, SceneManagerEvent event) {

View File

@@ -1,4 +1,5 @@
#include "../infrared_i.h"
#include "../../../settings/desktop_settings/desktop_settings_app.h"
static void
infrared_scene_learn_success_dialog_result_callback(DialogExResult result, void* context) {
@@ -10,6 +11,8 @@ void infrared_scene_learn_success_on_enter(void* context) {
Infrared* infrared = context;
DialogEx* dialog_ex = infrared->dialog_ex;
InfraredSignal* signal = infrared->received_signal;
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
infrared_play_notification_message(infrared, InfraredNotificationMessageGreenOn);
@@ -47,12 +50,18 @@ void infrared_scene_learn_success_on_enter(void* context) {
dialog_ex_set_left_button_text(dialog_ex, "Retry");
dialog_ex_set_right_button_text(dialog_ex, "Save");
dialog_ex_set_center_button_text(dialog_ex, "Send");
dialog_ex_set_icon(dialog_ex, 0, 1, &I_DolphinReadingSuccess_59x63);
if (settings->sfw_mode) {
dialog_ex_set_icon(dialog_ex, 0, 1, &I_DolphinReadingSuccess_59x63_sfw);
}
else {
dialog_ex_set_icon(dialog_ex, 0, 1, &I_DolphinReadingSuccess_59x63);
}
dialog_ex_set_result_callback(dialog_ex, infrared_scene_learn_success_dialog_result_callback);
dialog_ex_set_context(dialog_ex, context);
dialog_ex_enable_extended_events(dialog_ex);
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewDialogEx);
free(settings);
}
bool infrared_scene_learn_success_on_event(void* context, SceneManagerEvent event) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB