#include #include #include #include #include #include #include "display.h" #include "board.h" #include "application.h" #include "audio_codec.h" #include "settings.h" #include "assets/lang_config.h" #define TAG "Display" Display::Display() { } Display::~Display() { } void Display::SetStatus(const char* status) { ESP_LOGW(TAG, "SetStatus: %s", status); } void Display::ShowNotification(const std::string ¬ification, int duration_ms) { ShowNotification(notification.c_str(), duration_ms); } void Display::ShowNotification(const char* notification, int duration_ms) { ESP_LOGW(TAG, "ShowNotification: %s", notification); } void Display::UpdateStatusBar(bool update_all) { } void Display::SetEmotion(const char* emotion) { ESP_LOGW(TAG, "SetEmotion: %s", emotion); } void Display::SetChatMessage(const char* role, const char* content) { ESP_LOGW(TAG, "Role:%s", role); ESP_LOGW(TAG, " %s", content); } void Display::SetTheme(Theme* theme) { current_theme_ = theme; Settings settings("display", true); settings.SetString("theme", theme->name()); } void Display::SetPowerSaveMode(bool on) { ESP_LOGW(TAG, "SetPowerSaveMode: %d", on); } void Display::SetMusicInfo(const char* song_name) { // 默认实现:对于非微信模式,将歌名显示在聊天消息标签中 DisplayLockGuard lock(this); if (chat_message_label_ == nullptr) { return; } if (song_name != nullptr && strlen(song_name) > 0) { std::string music_text = ""; music_text += song_name; lv_label_set_text(chat_message_label_, music_text.c_str()); SetEmotion(FONT_AWESOME_MUSIC); } else { lv_label_set_text(chat_message_label_, ""); SetEmotion(FONT_AWESOME_NEUTRAL); } } void Display::SetMusicProgress(const char* song_name, int current_seconds, int total_seconds, float progress_percent) { // 默认实现:简化显示,只显示歌名和时间 char time_info[64]; int current_min = current_seconds / 60; int current_sec = current_seconds % 60; int total_min = total_seconds / 60; int total_sec = total_seconds % 60; snprintf(time_info, sizeof(time_info), "%s %02d:%02d / %02d:%02d", song_name ? song_name : "Unknown", current_min, current_sec, total_min, total_sec); DisplayLockGuard lock(this); if (chat_message_label_ != nullptr) { lv_label_set_text(chat_message_label_, time_info); SetEmotion(FONT_AWESOME_MUSIC); } } void Display::ClearMusicInfo() { DisplayLockGuard lock(this); if (chat_message_label_ != nullptr) { lv_label_set_text(chat_message_label_, ""); SetEmotion(FONT_AWESOME_NEUTRAL); } }