MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / createSettingsPanel

Method createSettingsPanel

Tactility/Source/app/chat/ChatView.cpp:65–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void ChatView::createSettingsPanel(lv_obj_t* parent) {
66 settingsPanel = lv_obj_create(parent);
67 lv_obj_set_width(settingsPanel, LV_PCT(100));
68 lv_obj_set_flex_grow(settingsPanel, 1);
69 lv_obj_set_flex_flow(settingsPanel, LV_FLEX_FLOW_COLUMN);
70 lv_obj_set_style_pad_all(settingsPanel, 8, 0);
71 lv_obj_set_style_pad_row(settingsPanel, 6, 0);
72 lv_obj_add_flag(settingsPanel, LV_OBJ_FLAG_HIDDEN);
73
74 // Nickname
75 auto* nickLabel = lv_label_create(settingsPanel);
76 lv_label_set_text(nickLabel, "Nickname (max 23):");
77
78 nicknameInput = lv_textarea_create(settingsPanel);
79 lv_obj_set_width(nicknameInput, LV_PCT(100));
80 lv_textarea_set_one_line(nicknameInput, true);
81 lv_textarea_set_max_length(nicknameInput, MAX_NICKNAME_LEN);
82
83 // Encryption key
84 auto* keyLabel = lv_label_create(settingsPanel);
85 lv_label_set_text(keyLabel, "Key (32 hex chars):");
86
87 keyInput = lv_textarea_create(settingsPanel);
88 lv_obj_set_width(keyInput, LV_PCT(100));
89 lv_textarea_set_one_line(keyInput, true);
90 lv_textarea_set_max_length(keyInput, ESP_NOW_KEY_LEN * 2);
91 lv_textarea_set_placeholder_text(keyInput, "empty = all zeros");
92
93 // Buttons
94 auto* btnRow = lv_obj_create(settingsPanel);
95 lv_obj_set_flex_flow(btnRow, LV_FLEX_FLOW_ROW);
96 lv_obj_set_size(btnRow, LV_PCT(100), LV_SIZE_CONTENT);
97 lv_obj_set_style_pad_all(btnRow, 0, 0);
98 lv_obj_set_style_pad_column(btnRow, 8, 0);
99 lv_obj_set_style_border_opa(btnRow, 0, 0);
100
101 auto* saveBtn = lv_button_create(btnRow);
102 lv_obj_add_event_cb(saveBtn, onSettingsSave, LV_EVENT_CLICKED, this);
103 auto* saveLbl = lv_label_create(saveBtn);
104 lv_label_set_text(saveLbl, "Save");
105
106 auto* cancelBtn = lv_button_create(btnRow);
107 lv_obj_add_event_cb(cancelBtn, onSettingsCancel, LV_EVENT_CLICKED, this);
108 auto* cancelLbl = lv_label_create(cancelBtn);
109 lv_label_set_text(cancelLbl, "Cancel");
110}
111
112void ChatView::createChannelPanel(lv_obj_t* parent) {
113 channelPanel = lv_obj_create(parent);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected