summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2021-04-11 18:00:05 -0400
committerAndreas Kling <kling@serenityos.org>2021-04-12 08:56:06 +0200
commit198c4fd7f245da9496db1943e392435b96bc1239 (patch)
tree7f64e3227f45a1d72b69e5b45bea8ac510bfe8b1
parent4366cb469b7a0064fdd6ce3f7284043081797bb1 (diff)
downloadserenity-198c4fd7f245da9496db1943e392435b96bc1239.zip
Serendipity: Paint theme agnostic banner
And remove temporary welcome-banner.png. Fixes invisible text in dark themes.
-rw-r--r--Base/res/graphics/welcome-serendipity.pngbin625 -> 0 bytes
-rw-r--r--Userland/Applications/Serendipity/SerendipityWidget.cpp17
-rw-r--r--Userland/Applications/Serendipity/SerendipityWidget.h2
-rw-r--r--Userland/Applications/Serendipity/SerendipityWindow.gml10
4 files changed, 15 insertions, 14 deletions
diff --git a/Base/res/graphics/welcome-serendipity.png b/Base/res/graphics/welcome-serendipity.png
deleted file mode 100644
index f86ba0cce7..0000000000
--- a/Base/res/graphics/welcome-serendipity.png
+++ /dev/null
Binary files differ
diff --git a/Userland/Applications/Serendipity/SerendipityWidget.cpp b/Userland/Applications/Serendipity/SerendipityWidget.cpp
index c18ba5395a..27ff445b3b 100644
--- a/Userland/Applications/Serendipity/SerendipityWidget.cpp
+++ b/Userland/Applications/Serendipity/SerendipityWidget.cpp
@@ -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());
+}
diff --git a/Userland/Applications/Serendipity/SerendipityWidget.h b/Userland/Applications/Serendipity/SerendipityWidget.h
index c4e5b1c781..ba70202ea7 100644
--- a/Userland/Applications/Serendipity/SerendipityWidget.h
+++ b/Userland/Applications/Serendipity/SerendipityWidget.h
@@ -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();
diff --git a/Userland/Applications/Serendipity/SerendipityWindow.gml b/Userland/Applications/Serendipity/SerendipityWindow.gml
index 4f6b167768..8e38cf8401 100644
--- a/Userland/Applications/Serendipity/SerendipityWindow.gml
+++ b/Userland/Applications/Serendipity/SerendipityWindow.gml
@@ -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 {