From 6a886e4aac134c73f54257290e7f07eef5a190b7 Mon Sep 17 00:00:00 2001 From: sec05 Date: Wed, 24 May 2023 17:12:40 -0400 Subject: [PATCH] Browser: Download Widget file and directory text changes fixes #18678 This is because the "From:" URL regularly overflows the line, leading to an unreadable mess. Make sure that the labels for the widget don't wrap as well, as the widget is fixed height and width. --- Userland/Applications/Browser/DownloadWidget.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp index 2c06e5aa32..f7c120de9b 100644 --- a/Userland/Applications/Browser/DownloadWidget.cpp +++ b/Userland/Applications/Browser/DownloadWidget.cpp @@ -6,6 +6,7 @@ */ #include "DownloadWidget.h" +#include #include #include #include @@ -69,9 +70,10 @@ DownloadWidget::DownloadWidget(const URL& url) m_browser_image->load_from_file("/res/graphics/download-animation.gif"sv); animation_container.add_spacer().release_value_but_fixme_should_propagate_errors(); - auto& source_label = add(String::formatted("From: {}", url).release_value_but_fixme_should_propagate_errors()); + auto& source_label = add(String::formatted("File: {}", m_url.basename()).release_value_but_fixme_should_propagate_errors()); source_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); source_label.set_fixed_height(16); + source_label.set_text_wrapping(Gfx::TextWrapping::DontWrap); m_progressbar = add(); m_progressbar->set_fixed_height(20); @@ -79,10 +81,14 @@ DownloadWidget::DownloadWidget(const URL& url) m_progress_label = add(); m_progress_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); m_progress_label->set_fixed_height(16); + m_progress_label->set_text_wrapping(Gfx::TextWrapping::DontWrap); - auto& destination_label = add(String::formatted("To: {}", m_destination_path).release_value_but_fixme_should_propagate_errors()); + auto destination_label_path = LexicalPath(m_destination_path).dirname().to_deprecated_string(); + + auto& destination_label = add(String::formatted("To: {}", destination_label_path).release_value_but_fixme_should_propagate_errors()); destination_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); destination_label.set_fixed_height(16); + destination_label.set_text_wrapping(Gfx::TextWrapping::DontWrap); m_close_on_finish_checkbox = add("Close when finished"_string.release_value_but_fixme_should_propagate_errors()); m_close_on_finish_checkbox->set_checked(close_on_finish);