mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-08 12:56:23 +03:00
Serendipity: Paint theme agnostic banner
And remove temporary welcome-banner.png. Fixes invisible text in dark themes.
This commit is contained in:
parent
4366cb469b
commit
198c4fd7f2
Notes:
sideshowbarker
2024-07-18 20:30:10 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/198c4fd7f24 Pull-request: https://github.com/SerenityOS/serenity/pull/6255 Issue: https://github.com/SerenityOS/serenity/issues/5996
Binary file not shown.
Before Width: | Height: | Size: 625 B |
@ -31,7 +31,8 @@
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/CheckBox.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/BitmapFont.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibMarkdown/Document.h>
|
||||
#include <LibWeb/OutOfProcessWebView.h>
|
||||
@ -43,9 +44,6 @@ SerendipityWidget::SerendipityWidget()
|
||||
{
|
||||
load_from_gml(serendipity_window_gml);
|
||||
|
||||
auto& banner_label = *find_descendant_of_type_named<GUI::Label>("banner_label");
|
||||
banner_label.set_icon(Gfx::Bitmap::load_from_file("/res/graphics/welcome-serendipity.png"));
|
||||
|
||||
auto& tip_frame = *find_descendant_of_type_named<GUI::Frame>("tip_frame");
|
||||
tip_frame.set_background_role(Gfx::ColorRole::Base);
|
||||
tip_frame.set_fill_with_background_color(true);
|
||||
@ -153,3 +151,14 @@ void SerendipityWidget::set_random_tip()
|
||||
m_initial_tip_index = n;
|
||||
m_tip_label->set_text(m_tips[n]);
|
||||
}
|
||||
|
||||
void SerendipityWidget::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
GUI::Painter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
|
||||
static auto font = Gfx::BitmapFont::load_from_file("/res/fonts/MarietaRegular24.font");
|
||||
painter.draw_text({ 12, 4, 1, 30 }, "Welcome to ", *font, Gfx::TextAlignment::CenterLeft, palette().base_text());
|
||||
painter.draw_text({ 12 + font->width("Welcome to "), 4, 1, 30 }, "Serenity", font->bold_variant(), Gfx::TextAlignment::CenterLeft, palette().base_text());
|
||||
painter.draw_text({ 12 + font->width("Welcome to ") + font->bold_variant().width("Serenity"), 4, 1, 30 }, "OS", font->bold_variant(), Gfx::TextAlignment::CenterLeft, palette().base() == palette().window() ? palette().base_text() : palette().base());
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
private:
|
||||
SerendipityWidget();
|
||||
|
||||
virtual void paint_event(GUI::PaintEvent&) override;
|
||||
|
||||
void set_random_tip();
|
||||
void open_and_parse_tips_file();
|
||||
void open_and_parse_readme_file();
|
||||
|
@ -6,16 +6,6 @@
|
||||
|
||||
@GUI::Widget {
|
||||
fixed_height: 30
|
||||
layout: @GUI::HorizontalBoxLayout {
|
||||
margins: [4, 0, 0, 0]
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
name: "banner_label"
|
||||
fixed_width: 251
|
||||
}
|
||||
|
||||
@GUI::Widget
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
|
Loading…
Reference in New Issue
Block a user