From ba2f22b221a60e269cae932ebcbfbdc8d88c5a68 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Thu, 28 Jul 2022 19:36:46 +0300 Subject: [PATCH] visual improvements (todo: figure out a way to deal with large file names) --- src/AppWidget.cpp | 2 +- src/DirectoryView.cpp | 4 ++-- src/FileButton.cpp | 6 +++--- src/TopBar.cpp | 7 ++++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/AppWidget.cpp b/src/AppWidget.cpp index caaff3d..3c3a640 100644 --- a/src/AppWidget.cpp +++ b/src/AppWidget.cpp @@ -6,7 +6,7 @@ void AppWidget::on_init() { auto layout = set_layout(Raven::Direction::Vertical); - layout->slot_pixel(32); // TopBar + layout->slot_pixel(38); // TopBar layout->slot_percent(100); // DirectoryView auto top_bar = add(); diff --git a/src/DirectoryView.cpp b/src/DirectoryView.cpp index 3609c22..4cf3129 100644 --- a/src/DirectoryView.cpp +++ b/src/DirectoryView.cpp @@ -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(12.0); + m_target->set_layout(16.0); navigate_home(); set_did_init(true); } diff --git a/src/FileButton.cpp b/src/FileButton.cpp index 00f1346..6743c98 100644 --- a/src/FileButton.cpp +++ b/src/FileButton.cpp @@ -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("/usr/share/icons/Papirus/128x128/places/folder-adwaita.svg"); + add("/usr/share/icons/Papirus/64x64/places/folder-adwaita.svg"); auto label = add(m_name, Raven::PaintTextAlign::Center); label->rect().set_max_width(rect().width()); label->rect().set_max_height(24); diff --git a/src/TopBar.cpp b/src/TopBar.cpp index 00caf0a..5d507bc 100644 --- a/src/TopBar.cpp +++ b/src/TopBar.cpp @@ -10,8 +10,8 @@ void TopBar::on_init() { auto layout = set_layout(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("/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("/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]() {