Compare commits

...

3 Commits

Author SHA1 Message Date
fc994ab758 fix wrongly serialized comp 2024-04-23 15:43:52 +02:00
605a730b59 add status text to tooltip, contact as a single item (group) 2024-04-23 11:57:56 +02:00
3e15798afc more spacing tuning 2024-04-23 11:24:24 +02:00
3 changed files with 21 additions and 8 deletions

View File

@ -133,6 +133,7 @@ bool renderContactBig(
const bool selectable, const bool selectable,
const bool selected const bool selected
) { ) {
ImGui::BeginGroup();
if (line_height < 1) { if (line_height < 1) {
line_height = 1; line_height = 1;
} }
@ -185,8 +186,18 @@ bool renderContactBig(
ImGui::TextUnformatted("Connection state: unknown"); ImGui::TextUnformatted("Connection state: unknown");
} }
// TODO: add a whole bunch more info if (
const auto* slt = c.try_get<Contact::Components::StatusText>();
slt != nullptr &&
!slt->text.empty()
) {
ImGui::SeparatorText("Status Text");
//ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyle().Colors[ImGuiCol_TextDisabled]);
ImGui::TextUnformatted(slt->text.c_str());
//ImGui::PopStyleColor();
}
// TODO: add a whole bunch more info
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
@ -203,7 +214,8 @@ bool renderContactBig(
renderAvatar(th, contact_tc, c, {img_y, img_y}); renderAvatar(th, contact_tc, c, {img_y, img_y});
ImGui::SameLine(); const float same_line_spacing = ImGui::GetStyle().ItemSpacing.x*0.5f;
ImGui::SameLine(0.f, same_line_spacing);
ImGui::BeginGroup(); ImGui::BeginGroup();
{ {
{ // line 1 { // line 1
@ -230,7 +242,7 @@ bool renderContactBig(
); );
} }
ImGui::Dummy(p1_o); ImGui::Dummy(p1_o);
ImGui::SameLine(0.f, ImGui::GetStyle().ItemSpacing.x*0.5f); ImGui::SameLine(0.f, same_line_spacing);
} }
ImGui::Text("%s%s", unread?"* ":"", (c.all_of<Contact::Components::Name>() ? c.get<Contact::Components::Name>().name.c_str() : "<unk>")); ImGui::Text("%s%s", unread?"* ":"", (c.all_of<Contact::Components::Name>() ? c.get<Contact::Components::Name>().name.c_str() : "<unk>"));
@ -267,7 +279,7 @@ bool renderContactBig(
); );
} }
ImGui::Dummy(p1_o); ImGui::Dummy(p1_o);
ImGui::SameLine(0.f, ImGui::GetStyle().ItemSpacing.x*0.5f); ImGui::SameLine(0.f, same_line_spacing);
} }
if ( if (
@ -296,6 +308,7 @@ bool renderContactBig(
ImGui::SetCursorPos(post_curser_pos); ImGui::SetCursorPos(post_curser_pos);
ImGui::EndGroup();
return got_selected; return got_selected;
} }

View File

@ -227,7 +227,7 @@ float ChatGui4::render(float time_delta) {
if (sub_contacts != nullptr && !_cr.all_of<Contact::Components::TagPrivate>(*_selected_contact) && _cr.all_of<Contact::Components::TagGroup>(*_selected_contact)) { if (sub_contacts != nullptr && !_cr.all_of<Contact::Components::TagPrivate>(*_selected_contact) && _cr.all_of<Contact::Components::TagGroup>(*_selected_contact)) {
if (!sub_contacts->empty()) { if (!sub_contacts->empty()) {
if (ImGui::BeginChild("subcontacts", {175, -100}, true)) { if (ImGui::BeginChild("subcontacts", {TEXT_BASE_WIDTH * 18.f, -100.f}, true)) {
ImGui::Text("subs: %zu", sub_contacts->size()); ImGui::Text("subs: %zu", sub_contacts->size());
ImGui::Separator(); ImGui::Separator();
for (const auto& c : *sub_contacts) { for (const auto& c : *sub_contacts) {
@ -298,7 +298,7 @@ float ChatGui4::render(float time_delta) {
ImGuiTableFlags_SizingFixedFit ImGuiTableFlags_SizingFixedFit
; ;
if (msg_reg_ptr != nullptr && ImGui::BeginTable("chat_table", 5, table_flags)) { if (msg_reg_ptr != nullptr && ImGui::BeginTable("chat_table", 5, table_flags)) {
ImGui::TableSetupColumn("name", 0, TEXT_BASE_WIDTH * 15.f); ImGui::TableSetupColumn("name", 0, TEXT_BASE_WIDTH * 16.f);
ImGui::TableSetupColumn("message", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("message", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableSetupColumn("delivered/read"); ImGui::TableSetupColumn("delivered/read");
ImGui::TableSetupColumn("timestamp"); ImGui::TableSetupColumn("timestamp");
@ -388,7 +388,7 @@ float ChatGui4::render(float time_delta) {
if (ImGui::TableNextColumn()) { if (ImGui::TableNextColumn()) {
const float img_y {TEXT_BASE_HEIGHT - ImGui::GetStyle().FramePadding.y*2}; const float img_y {TEXT_BASE_HEIGHT - ImGui::GetStyle().FramePadding.y*2};
renderAvatar(_theme, _contact_tc, {_cr, c_from.c}, {img_y, img_y}); renderAvatar(_theme, _contact_tc, {_cr, c_from.c}, {img_y, img_y});
ImGui::SameLine(); ImGui::SameLine(0.f, ImGui::GetStyle().ItemSpacing.x*0.5f);
if (_cr.all_of<Contact::Components::Name>(c_from.c)) { if (_cr.all_of<Contact::Components::Name>(c_from.c)) {
ImGui::TextUnformatted(_cr.get<Contact::Components::Name>(c_from.c).name.c_str()); ImGui::TextUnformatted(_cr.get<Contact::Components::Name>(c_from.c).name.c_str());