show contact ID in tooltip

This commit is contained in:
Green Sky 2024-07-01 14:00:00 +02:00
parent 1d212c5fab
commit 21243ea979
No known key found for this signature in database

View File

@ -1,6 +1,7 @@
#include "./contact_list.hpp" #include "./contact_list.hpp"
#include <solanaceae/contact/components.hpp> #include <solanaceae/contact/components.hpp>
#include <solanaceae/util/utils.hpp>
#include <imgui/imgui.h> #include <imgui/imgui.h>
//#include <imgui/imgui_internal.h> //#include <imgui/imgui_internal.h>
@ -96,6 +97,11 @@ bool renderContactBig(
const auto* cstate = c.try_get<Contact::Components::ConnectionState>(); const auto* cstate = c.try_get<Contact::Components::ConnectionState>();
if (ImGui::BeginItemTooltip()) { if (ImGui::BeginItemTooltip()) {
if (c.all_of<Contact::Components::ID>()) {
const auto id_str = bin2hex(c.get<Contact::Components::ID>().data);
ImGui::Text("ID: %s", id_str.c_str());
}
if (cstate != nullptr) { if (cstate != nullptr) {
ImGui::Text("Connection state: %s", ImGui::Text("Connection state: %s",
(cstate->state == Contact::Components::ConnectionState::disconnected) (cstate->state == Contact::Components::ConnectionState::disconnected)