1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

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.
This commit is contained in:
sec05 2023-05-24 17:12:40 -04:00 committed by Andrew Kaster
parent 624f43c12b
commit 6a886e4aac

View file

@ -6,6 +6,7 @@
*/
#include "DownloadWidget.h"
#include <AK/LexicalPath.h>
#include <AK/NumberFormat.h>
#include <AK/StringBuilder.h>
#include <LibCore/Proxy.h>
@ -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<GUI::Label>(String::formatted("From: {}", url).release_value_but_fixme_should_propagate_errors());
auto& source_label = add<GUI::Label>(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<GUI::Progressbar>();
m_progressbar->set_fixed_height(20);
@ -79,10 +81,14 @@ DownloadWidget::DownloadWidget(const URL& url)
m_progress_label = add<GUI::Label>();
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<GUI::Label>(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<GUI::Label>(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<GUI::CheckBox>("Close when finished"_string.release_value_but_fixme_should_propagate_errors());
m_close_on_finish_checkbox->set_checked(close_on_finish);