mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
Welcome: Add icons to welcome entries
This commit is contained in:
parent
bc28e55d61
commit
7a3bdf3563
2 changed files with 23 additions and 1 deletions
|
@ -49,6 +49,7 @@
|
||||||
struct ContentPage {
|
struct ContentPage {
|
||||||
String menu_name;
|
String menu_name;
|
||||||
String title;
|
String title;
|
||||||
|
String icon = String::empty();
|
||||||
Vector<String> content;
|
Vector<String> content;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -89,6 +90,10 @@ Optional<Vector<ContentPage>> parse_welcome_file(const String& path)
|
||||||
current = {};
|
current = {};
|
||||||
current.menu_name = line.substring(2, line.length() - 2);
|
current.menu_name = line.substring(2, line.length() - 2);
|
||||||
break;
|
break;
|
||||||
|
case '$':
|
||||||
|
dbg() << "icon line: \t" << line;
|
||||||
|
current.icon = line.substring(2, line.length() - 2);
|
||||||
|
break;
|
||||||
case '>':
|
case '>':
|
||||||
dbg() << "title line:\t" << line;
|
dbg() << "title line:\t" << line;
|
||||||
current.title = line.substring(2, line.length() - 2);
|
current.title = line.substring(2, line.length() - 2);
|
||||||
|
@ -203,7 +208,20 @@ int main(int argc, char** argv)
|
||||||
content->layout()->set_spacing(8);
|
content->layout()->set_spacing(8);
|
||||||
content->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fill);
|
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_font(Gfx::Font::default_bold_font());
|
||||||
content_title->set_text(page.title);
|
content_title->set_text(page.title);
|
||||||
content_title->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
content_title->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
* Welcome
|
* Welcome
|
||||||
|
$ /res/icons/16x16/ladybug.png
|
||||||
> Welcome to SerenityOS!
|
> Welcome to SerenityOS!
|
||||||
Welcome to the exciting new world of Serenity, where the year is 1998 and the
|
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
|
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.
|
If you want to explore an option, just click it.
|
||||||
|
|
||||||
* Registration
|
* Registration
|
||||||
|
$ /res/icons/16x16/book.png
|
||||||
> Register now!
|
> Register now!
|
||||||
Registering your copy of Serenity opens the doors to full integration of
|
Registering your copy of Serenity opens the doors to full integration of
|
||||||
Serenity into your life, your being, and your soul.
|
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.
|
up to your monitor.
|
||||||
|
|
||||||
* Internet
|
* Internet
|
||||||
|
$ /res/icons/16x16/filetype-html.png
|
||||||
> Connect to the Internet!
|
> Connect to the Internet!
|
||||||
On the Internet, you can correspond through electronic mail (e-mail), get the
|
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,
|
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?
|
Come chat with us today! How bad can it be?
|
||||||
|
|
||||||
* Fun & Games
|
* Fun & Games
|
||||||
|
$ /res/icons/16x16/app-snake.png
|
||||||
> Play some games!
|
> Play some games!
|
||||||
Serenity includes several games built right into the base system. These include
|
Serenity includes several games built right into the base system. These include
|
||||||
the classic game Snake and the anti-productivity mainstay Minesweeper.
|
the classic game Snake and the anti-productivity mainstay Minesweeper.
|
||||||
|
|
Loading…
Add table
Reference in a new issue