try to align stuff a little better

This commit is contained in:
ouwou 2022-07-25 00:26:04 -04:00
parent 59acd0f82f
commit 8396d07d9e
2 changed files with 17 additions and 5 deletions

View File

@ -135,8 +135,10 @@ bool ChatInputAttachmentContainer::AddImage(const Glib::RefPtr<Gdk::Pixbuf> &pb)
}
auto *item = Gtk::make_managed<ChatInputAttachmentItem>(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<Gio::File> &file,
item = Gtk::make_managed<ChatInputAttachmentItem>(file, pb, true);
else
item = Gtk::make_managed<ChatInputAttachmentItem>(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<Gio::File> &
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<Gio::File> &
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();

View File

@ -1,8 +1,9 @@
#pragma once
#include <cstdint>
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;