feat: Refactor agent chat widget handling and remove unused state variable
This commit is contained in:
@@ -713,7 +713,10 @@ void EditorManager::Initialize(const std::string& filename) {
|
|||||||
[&]() { proposal_drawer_.Toggle(); }},
|
[&]() { proposal_drawer_.Toggle(); }},
|
||||||
#ifdef YAZE_WITH_GRPC
|
#ifdef YAZE_WITH_GRPC
|
||||||
{absl::StrCat(ICON_MD_CHAT, " Agent Chat"), "",
|
{absl::StrCat(ICON_MD_CHAT, " Agent Chat"), "",
|
||||||
[&]() { show_agent_chat_widget_ = !show_agent_chat_widget_; }},
|
[this]() {
|
||||||
|
agent_chat_widget_.set_active(!agent_chat_widget_.is_active());
|
||||||
|
},
|
||||||
|
[this]() { return agent_chat_widget_.is_active(); }},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{gui::kSeparator, "", nullptr, []() { return true; }},
|
{gui::kSeparator, "", nullptr, []() { return true; }},
|
||||||
@@ -932,13 +935,11 @@ absl::Status EditorManager::Update() {
|
|||||||
proposal_drawer_.Draw();
|
proposal_drawer_.Draw();
|
||||||
}
|
}
|
||||||
#ifdef YAZE_WITH_GRPC
|
#ifdef YAZE_WITH_GRPC
|
||||||
if (show_agent_chat_widget_) {
|
Rom* rom_context =
|
||||||
Rom* rom_context =
|
(current_rom_ != nullptr && current_rom_->is_loaded()) ? current_rom_
|
||||||
(current_rom_ != nullptr && current_rom_->is_loaded()) ? current_rom_
|
: nullptr;
|
||||||
: nullptr;
|
agent_chat_widget_.SetRomContext(rom_context);
|
||||||
agent_chat_widget_.SetRomContext(rom_context);
|
agent_chat_widget_.Draw();
|
||||||
agent_chat_widget_.Draw();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
|
|||||||
@@ -185,7 +185,6 @@ class EditorManager {
|
|||||||
#ifdef YAZE_WITH_GRPC
|
#ifdef YAZE_WITH_GRPC
|
||||||
// Agent chat widget
|
// Agent chat widget
|
||||||
AgentChatWidget agent_chat_widget_;
|
AgentChatWidget agent_chat_widget_;
|
||||||
bool show_agent_chat_widget_ = false;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string version_ = "";
|
std::string version_ = "";
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class AgentChatWidget {
|
|||||||
void SetRomContext(Rom* rom);
|
void SetRomContext(Rom* rom);
|
||||||
|
|
||||||
bool* active() { return &active_; }
|
bool* active() { return &active_; }
|
||||||
|
bool is_active() const { return active_; }
|
||||||
void set_active(bool active) { active_ = active; }
|
void set_active(bool active) { active_ = active; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user