FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.
C++ ai-agentsalgorithmic-tradingbloomberg-terminalcppfinancefinancial-marketsfintechgood-first-issueinvestmentinvestment-researchmachine-learningopensourcepythonqtquantitative-financestock-markettrading
#include "screens/ai_chat/ChatBubbleController.h"
#include "app/WindowFrame.h"
#include "core/logging/Logger.h"
#include "core/window/WindowRegistry.h"
namespace fincept::ai_chat {
namespace {
constexpr const char* kBubbleTag = "ChatBubble";
} // namespace
ChatBubbleController& ChatBubbleController::instance() {
static ChatBubbleController s;
return s;
}
void ChatBubbleController::initialise() {
if (initialised_)
return;
initialised_ = true;
auto& reg = WindowRegistry::instance();
connect(®, &WindowRegistry::frame_added, this, &ChatBubbleController::on_frame_added);
connect(®, &WindowRegistry::frame_removing, this, &ChatBubbleController::on_frame_removing);
for (auto* w : reg.frames())
on_frame_added(w);
LOG_INFO(kBubbleTag, QString("Initialised; tracking %1 frame(s)").arg(tracked_frames_.size()));
}
void ChatBubbleController::on_frame_added(fincept::WindowFrame* w) {
if (!w)
return;
tracked_frames_.insert(w, QPointer<fincept::WindowFrame>(w));
}
void ChatBubbleController::on_frame_removing(fincept::WindowFrame* w) {
if (!w)
return;
tracked_frames_.remove(w);
}
} // namespace fincept::ai_chat