mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-09 04:37:52 +03:00
Welcome: Add icons to welcome entries
This commit is contained in:
parent
bc28e55d61
commit
7a3bdf3563
Notes:
sideshowbarker
2024-07-19 17:40:51 +09:00
Author: https://github.com/thatlittlegit Commit: https://github.com/SerenityOS/serenity/commit/7a3bdf3563b Pull-request: https://github.com/SerenityOS/serenity/pull/1221 Reviewed-by: https://github.com/shannonbooth
@ -49,6 +49,7 @@
|
||||
struct ContentPage {
|
||||
String menu_name;
|
||||
String title;
|
||||
String icon = String::empty();
|
||||
Vector<String> content;
|
||||
};
|
||||
|
||||
@ -89,6 +90,10 @@ Optional<Vector<ContentPage>> parse_welcome_file(const String& path)
|
||||
current = {};
|
||||
current.menu_name = line.substring(2, line.length() - 2);
|
||||
break;
|
||||
case '$':
|
||||
dbg() << "icon line: \t" << line;
|
||||
current.icon = line.substring(2, line.length() - 2);
|
||||
break;
|
||||
case '>':
|
||||
dbg() << "title line:\t" << line;
|
||||
current.title = line.substring(2, line.length() - 2);
|
||||
@ -203,7 +208,20 @@ int main(int argc, char** argv)
|
||||
content->layout()->set_spacing(8);
|
||||
content->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fill);
|
||||
|
||||
auto content_title = GUI::Label::construct(content);
|
||||
auto title_box = GUI::Widget::construct(content.ptr());
|
||||
title_box->set_layout(make<GUI::HorizontalBoxLayout>());
|
||||
title_box->layout()->set_spacing(4);
|
||||
title_box->set_preferred_size(0, 16);
|
||||
title_box->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
|
||||
if (page.icon != String::empty()) {
|
||||
auto icon = GUI::Label::construct(title_box);
|
||||
icon->set_icon(Gfx::Bitmap::load_from_file(page.icon));
|
||||
icon->set_preferred_size(16, 16);
|
||||
icon->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed);
|
||||
}
|
||||
|
||||
auto content_title = GUI::Label::construct(title_box);
|
||||
content_title->set_font(Gfx::Font::default_bold_font());
|
||||
content_title->set_text(page.title);
|
||||
content_title->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
@ -1,4 +1,5 @@
|
||||
* Welcome
|
||||
$ /res/icons/16x16/ladybug.png
|
||||
> Welcome to SerenityOS!
|
||||
Welcome to the exciting new world of Serenity, where the year is 1998 and the
|
||||
leading OS vendor has decided to merge their flagship product with a Unix-like
|
||||
@ -10,6 +11,7 @@ screen.
|
||||
If you want to explore an option, just click it.
|
||||
|
||||
* Registration
|
||||
$ /res/icons/16x16/book.png
|
||||
> Register now!
|
||||
Registering your copy of Serenity opens the doors to full integration of
|
||||
Serenity into your life, your being, and your soul.
|
||||
@ -21,6 +23,7 @@ To register, simply write your contact details on a piece of paper and hold it
|
||||
up to your monitor.
|
||||
|
||||
* Internet
|
||||
$ /res/icons/16x16/filetype-html.png
|
||||
> Connect to the Internet!
|
||||
On the Internet, you can correspond through electronic mail (e-mail), get the
|
||||
latest news and financial information, and visit Web sites around the world,
|
||||
@ -32,6 +35,7 @@ chat) client, 4chan browser, telnet server, and basic utilities like ping.
|
||||
Come chat with us today! How bad can it be?
|
||||
|
||||
* Fun & Games
|
||||
$ /res/icons/16x16/app-snake.png
|
||||
> Play some games!
|
||||
Serenity includes several games built right into the base system. These include
|
||||
the classic game Snake and the anti-productivity mainstay Minesweeper.
|
||||
|
Loading…
Reference in New Issue
Block a user