visual improvements (todo: figure out a way to deal with large file names)

This commit is contained in:
hippoz 2022-07-28 19:36:46 +03:00
parent 96cd01bc77
commit ba2f22b221
Signed by: hippoz
GPG key ID: 7C52899193467641
4 changed files with 10 additions and 9 deletions

View file

@ -6,7 +6,7 @@
void AppWidget::on_init() {
auto layout = set_layout<Raven::BoxLayout>(Raven::Direction::Vertical);
layout->slot_pixel(32); // TopBar
layout->slot_pixel(38); // TopBar
layout->slot_percent(100); // DirectoryView
auto top_bar = add<TopBar>();

View file

@ -8,7 +8,7 @@ void DirectoryView::set_current_path(std::filesystem::path path) {
m_current_path = path;
// microtasks defer execution of the callback until all external events are processed.
// if they're not used here and update() is called in a click or hover handler,
// if they're not used here and set_current_path() is called in a click or hover handler,
// chaos will ensue, as the widget tree will be updated during event propagation
window()->queue_microtask([this]() {
target()->clear_children();
@ -33,7 +33,7 @@ void DirectoryView::on_init() {
};
m_target = make_target();
m_target->set_layout<Raven::DocumentLayout>(12.0);
m_target->set_layout<Raven::DocumentLayout>(16.0);
navigate_home();
set_did_init(true);
}

View file

@ -13,8 +13,8 @@ Raven::GenericStyle FileButton::style = Raven::GenericStyle {
};
void FileButton::on_init() {
rect().set_width(96);
rect().set_height(118);
rect().set_width(64);
rect().set_height(88);
set_style(&style);
@ -22,7 +22,7 @@ void FileButton::on_init() {
layout->slot_percent(100); // icon
layout->slot_pixel(24); // name (text)
add<Raven::SvgWidget>("/usr/share/icons/Papirus/128x128/places/folder-adwaita.svg");
add<Raven::SvgWidget>("/usr/share/icons/Papirus/64x64/places/folder-adwaita.svg");
auto label = add<Raven::Label>(m_name, Raven::PaintTextAlign::Center);
label->rect().set_max_width(rect().width());
label->rect().set_max_height(24);

View file

@ -10,8 +10,8 @@ void TopBar::on_init() {
auto layout = set_layout<Raven::BoxLayout>(Raven::Direction::Horizontal);
layout->slot_pixel(24, 4);
layout->set_margin(4);
layout->set_spacing(8);
layout->set_margin(7);
layout->set_spacing(11);
auto back_button = add<Raven::SvgWidget>("/usr/share/icons/Papirus/24x24/actions/back.svg");
back_button->set_style(&Raven::default_button_style);
@ -22,7 +22,8 @@ void TopBar::on_init() {
auto home_button = add<Raven::SvgWidget>("/usr/share/icons/Papirus/24x24/actions/go-home.svg");
home_button->set_style(&Raven::default_button_style);
back_button->on_click = [this]() {
back_button->on_click = [this, back_button]() {
std::cout << back_button->rect().width() << ", " << back_button->rect().height() << std::endl;
on_action(Action::Back);
};
forward_button->on_click = [this]() {