Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,9 @@ add_custom_command(
add_custom_target(lang_header ALL
DEPENDS ${LANG_HEADER}
)

if(CONFIG_USE_QUAGSIRE_THEME)
#lvgl_port_create_c_image("assets/theme/quagsire/thinking.png" "assets/theme/quagsire/gen/" "I4" "NONE")
#lvgl_port_create_c_image("assets/theme/quagsire/background.png" "assets/theme/quagsire/gen/" "RGB565" "NONE")
lvgl_port_add_images(${COMPONENT_LIB} "assets/theme/quagsire/gen/")
endif()
7 changes: 6 additions & 1 deletion main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,10 @@ config USE_REALTIME_CHAT
depends on USE_AUDIO_PROCESSOR && (BOARD_TYPE_ESP_BOX_3 || BOARD_TYPE_ESP_BOX || BOARD_TYPE_ESP_BOX_LITE || BOARD_TYPE_LICHUANG_DEV || BOARD_TYPE_ESP32S3_KORVO2_V3)
help
需要 ESP32 S3 与 AEC 开启,因为性能不够,不建议和微信聊天界面风格同时开启


config USE_QUAGSIRE_THEME
bool "Quagsire Theme"
default n
help
Best theme ever!
endmenu
241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/angry.c

Large diffs are not rendered by default.

176 changes: 176 additions & 0 deletions main/assets/theme/quagsire/gen/background.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/confused.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/crying.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/delicious.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/embarrassed.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/funny.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/happy.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/laughing.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/loving.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/neutral.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/relaxed.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/sad.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/shocked.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/sleepy.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/surprised.c

Large diffs are not rendered by default.

241 changes: 241 additions & 0 deletions main/assets/theme/quagsire/gen/thinking.c

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions main/display/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@

#include <string>

#ifdef CONFIG_USE_QUAGSIRE_THEME
extern const lv_image_dsc_t angry;
extern const lv_image_dsc_t background;
extern const lv_image_dsc_t confused;
extern const lv_image_dsc_t delicious;
extern const lv_image_dsc_t embarrassed;
extern const lv_image_dsc_t funny;
extern const lv_image_dsc_t happy;
extern const lv_image_dsc_t laughing;
extern const lv_image_dsc_t loving;
extern const lv_image_dsc_t neutral;
extern const lv_image_dsc_t relaxed;
extern const lv_image_dsc_t sad;
extern const lv_image_dsc_t shocked;
extern const lv_image_dsc_t sleepy;
extern const lv_image_dsc_t surprised;
extern const lv_image_dsc_t thinking;
extern const lv_image_dsc_t crying;
#endif

struct DisplayFonts {
const lv_font_t* text_font = nullptr;
const lv_font_t* icon_font = nullptr;
Expand Down
76 changes: 72 additions & 4 deletions main/display/lcd_display.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ SpiLcdDisplay::SpiLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_h

ESP_LOGI(TAG, "Initialize LVGL library");
lv_init();

ESP_LOGI(TAG, "Initialize LVGL port");
lvgl_port_cfg_t port_cfg = ESP_LVGL_PORT_INIT_CONFIG();
port_cfg.task_priority = 1;
Expand Down Expand Up @@ -544,6 +544,24 @@ void LcdDisplay::SetupUI() {
lv_obj_set_style_text_color(screen, current_theme.text, 0);
lv_obj_set_style_bg_color(screen, current_theme.background, 0);

#ifdef CONFIG_USE_QUAGSIRE_THEME
lv_obj_set_style_bg_color(screen, lv_color_black(), 0);

background_ = lv_img_create(screen);
lv_img_set_antialias(background_, false);
lv_img_set_zoom(background_, LV_HOR_RES * 2.56);
lv_img_set_src(background_, &background);
lv_obj_align(background_, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_border_width(background_, 0, 0);

/* New Style */
auto textcolor = lv_color_make(0x9c, 0x8a, 0xaa);
static lv_style_t style_transparent_bg;
lv_style_init(&style_transparent_bg);
lv_style_set_bg_opa(&style_transparent_bg, LV_OPA_0); // 背景完全透明
lv_style_set_text_color(&style_transparent_bg,textcolor);
lv_style_set_border_width(&style_transparent_bg, 0);
#endif
/* Container */
container_ = lv_obj_create(screen);
lv_obj_set_size(container_, LV_HOR_RES, LV_VER_RES);
Expand Down Expand Up @@ -573,11 +591,26 @@ void LcdDisplay::SetupUI() {

lv_obj_set_flex_flow(content_, LV_FLEX_FLOW_COLUMN); // 垂直布局(从上到下)
lv_obj_set_flex_align(content_, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_SPACE_EVENLY); // 子对象居中对齐,等距分布

#ifdef CONFIG_USE_QUAGSIRE_THEME
lv_obj_add_style(container_, &style_transparent_bg, 0);
lv_obj_add_style(status_bar_, &style_transparent_bg, 0);
lv_obj_add_style(content_, &style_transparent_bg, 0);
/* Change to black color to prevent unclear display. */
lv_obj_set_style_text_color(status_bar_, lv_color_make(0x02, 0x06, 0x36), 0);

lv_obj_set_style_translate_y(content_, -25, 0); // move content up 25 pixel
lv_obj_set_style_translate_y(status_bar_, 10, 0); // move down status_bar_ 10 pixel

emotion_label_ = lv_img_create(content_);
lv_img_set_src(emotion_label_, &neutral);
lv_obj_align(emotion_label_, LV_ALIGN_CENTER, 0, -50);
lv_obj_set_size(emotion_label_, 200, 200);
#else
emotion_label_ = lv_label_create(content_);
lv_obj_set_style_text_font(emotion_label_, &font_awesome_30_4, 0);
lv_obj_set_style_text_color(emotion_label_, current_theme.text, 0);
lv_label_set_text(emotion_label_, FONT_AWESOME_AI_CHIP);
#endif

chat_message_label_ = lv_label_create(content_);
lv_label_set_text(chat_message_label_, "");
Expand Down Expand Up @@ -637,6 +670,30 @@ void LcdDisplay::SetupUI() {
#endif

void LcdDisplay::SetEmotion(const char* emotion) {
#ifdef CONFIG_USE_QUAGSIRE_THEME
struct Emotion {
const lv_image_dsc_t* icon;
const char* text;
};
static const std::vector<Emotion> emotions = {
{&neutral, "neutral"},
{&happy, "happy"},
{&laughing, "laughing"},
{&funny, "funny"},
{&sad, "sad"},
{&angry, "angry"},
{&crying, "crying"},
{&loving, "loving"},
{&embarrassed, "embarrassed"},
{&surprised, "surprised"},
{&shocked, "shocked"},
{&thinking, "thinking"},
{&relaxed, "relaxed"},
{&delicious, "delicious"},
{&sleepy, "sleepy"},
{&confused, "confused"}
};
#else
struct Emotion {
const char* icon;
const char* text;
Expand Down Expand Up @@ -665,7 +722,7 @@ void LcdDisplay::SetEmotion(const char* emotion) {
{"😜", "silly"},
{"🙄", "confused"}
};
#endif
// 查找匹配的表情
std::string_view emotion_view(emotion);
auto it = std::find_if(emotions.begin(), emotions.end(),
Expand All @@ -675,23 +732,34 @@ void LcdDisplay::SetEmotion(const char* emotion) {
if (emotion_label_ == nullptr) {
return;
}

#ifdef CONFIG_USE_QUAGSIRE_THEME
if (it != emotions.end()) {
lv_image_set_src(emotion_label_, it->icon);
} else {
lv_image_set_src(emotion_label_, &neutral);
}
#else
// 如果找到匹配的表情就显示对应图标,否则显示默认的neutral表情
lv_obj_set_style_text_font(emotion_label_, fonts_.emoji_font, 0);
if (it != emotions.end()) {
lv_label_set_text(emotion_label_, it->icon);
} else {
lv_label_set_text(emotion_label_, "😶");
}
#endif
}

void LcdDisplay::SetIcon(const char* icon) {
DisplayLockGuard lock(this);
if (emotion_label_ == nullptr) {
return;
}
#ifdef CONFIG_USE_QUAGSIRE_THEME
lv_image_set_src(emotion_label_, &neutral);
#else
lv_obj_set_style_text_font(emotion_label_, &font_awesome_30_4, 0);
lv_label_set_text(emotion_label_, icon);
#endif
}

void LcdDisplay::SetTheme(const std::string& theme_name) {
Expand Down
4 changes: 4 additions & 0 deletions main/display/lcd_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class LcdDisplay : public Display {
lv_obj_t* content_ = nullptr;
lv_obj_t* container_ = nullptr;
lv_obj_t* side_bar_ = nullptr;
#ifdef CONFIG_USE_QUAGSIRE_THEME
lv_obj_t* background_ = nullptr;
#endif


DisplayFonts fonts_;

Expand Down