From 8396d07d9e7c8a3b7d7942694bd82c433eda99b4 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Mon, 25 Jul 2022 00:26:04 -0400 Subject: [PATCH] try to align stuff a little better --- src/components/chatinput.cpp | 19 +++++++++++++++---- src/constants.hpp | 3 ++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/components/chatinput.cpp b/src/components/chatinput.cpp index 04ba0d9..77757cf 100644 --- a/src/components/chatinput.cpp +++ b/src/components/chatinput.cpp @@ -135,8 +135,10 @@ bool ChatInputAttachmentContainer::AddImage(const Glib::RefPtr &pb) } auto *item = Gtk::make_managed(Gio::File::create_for_path(path), pb); + item->set_valign(Gtk::ALIGN_FILL); + item->set_vexpand(true); + item->set_margin_bottom(5); item->show(); - item->set_valign(Gtk::ALIGN_CENTER); m_box.add(*item); m_attachments.push_back(item); @@ -161,8 +163,10 @@ bool ChatInputAttachmentContainer::AddFile(const Glib::RefPtr &file, item = Gtk::make_managed(file, pb, true); else item = Gtk::make_managed(file); + item->set_valign(Gtk::ALIGN_FILL); + item->set_vexpand(true); + item->set_margin_bottom(5); item->show(); - item->set_valign(Gtk::ALIGN_CENTER); m_box.add(*item); m_attachments.push_back(item); @@ -202,18 +206,21 @@ ChatInputAttachmentItem::ChatInputAttachmentItem(const Glib::RefPtr & set_size_request(AttachmentItemSize, AttachmentItemSize); set_halign(Gtk::ALIGN_START); m_box.set_hexpand(true); + m_box.set_vexpand(true); m_box.set_halign(Gtk::ALIGN_FILL); - m_box.set_valign(Gtk::ALIGN_CENTER); + m_box.set_valign(Gtk::ALIGN_FILL); m_box.add(*m_img); m_box.add(m_label); add(m_box); show_all_children(); + m_label.set_valign(Gtk::ALIGN_END); m_label.set_max_width_chars(0); // will constrain to given size m_label.set_ellipsize(Pango::ELLIPSIZE_MIDDLE); m_label.set_margin_start(7); m_label.set_margin_end(7); + m_img->set_vexpand(true); m_img->property_icon_name() = "document-send-symbolic"; m_img->property_icon_size() = Gtk::ICON_SIZE_DIALOG; // todo figure out how to not use this weird property??? i dont know how icons work (screw your theme) @@ -239,18 +246,22 @@ ChatInputAttachmentItem::ChatInputAttachmentItem(const Glib::RefPtr & set_size_request(AttachmentItemSize, AttachmentItemSize); set_halign(Gtk::ALIGN_START); m_box.set_hexpand(true); + m_box.set_vexpand(true); m_box.set_halign(Gtk::ALIGN_FILL); - m_box.set_valign(Gtk::ALIGN_CENTER); + m_box.set_valign(Gtk::ALIGN_FILL); m_box.add(*m_img); m_box.add(m_label); add(m_box); show_all_children(); + m_label.set_valign(Gtk::ALIGN_END); m_label.set_max_width_chars(0); // will constrain to given size m_label.set_ellipsize(Pango::ELLIPSIZE_MIDDLE); m_label.set_margin_start(7); m_label.set_margin_end(7); + m_img->set_vexpand(true); + if (is_extant) SetFilenameFromFile(); diff --git a/src/constants.hpp b/src/constants.hpp index 14fa076..b1ef82b 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -1,8 +1,9 @@ +#pragma once #include constexpr static uint64_t SnowflakeSplitDifference = 600; constexpr static int MaxMessagesForChatCull = 50; // this has to be 50 (for now) cuz that magic number is used in a couple other places and i dont feel like replacing them -constexpr static int AttachmentItemSize = 128; +constexpr static int AttachmentItemSize = 120; constexpr static int BaseAttachmentSizeLimit = 8 * 1024 * 1024; constexpr static int NitroClassicAttachmentSizeLimit = 50 * 1024 * 1024; constexpr static int NitroAttachmentSizeLimit = 100 * 1024 * 1024;