SystemMenu: Add icons for categories
This commit is contained in:
parent
404981a892
commit
a9d30a59d9
Notes:
sideshowbarker
2024-07-19 04:31:12 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/a9d30a59d97 Pull-request: https://github.com/SerenityOS/serenity/pull/2898
2 changed files with 15 additions and 0 deletions
9
Base/res/icons/SystemMenu.ini
Normal file
9
Base/res/icons/SystemMenu.ini
Normal file
|
@ -0,0 +1,9 @@
|
|||
[16x16]
|
||||
Demos=/res/icons/16x16/app-demo.png
|
||||
#Development=
|
||||
#Games=
|
||||
#Graphics=
|
||||
#Internet=
|
||||
Settings=/res/icons/gear16.png
|
||||
Sound=/res/icons/16x16/filetype-music.png
|
||||
#Utilities=
|
|
@ -132,10 +132,16 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
|
|||
|
||||
// First we construct all the necessary app category submenus.
|
||||
HashMap<String, NonnullRefPtr<GUI::Menu>> app_category_menus;
|
||||
auto category_icons = Core::ConfigFile::open("/res/icons/SystemMenu.ini");
|
||||
for (const auto& category : sorted_app_categories) {
|
||||
if (app_category_menus.contains(category))
|
||||
continue;
|
||||
auto& category_menu = system_menu->add_submenu(category);
|
||||
auto category_icon_path = category_icons->read_entry("16x16", category);
|
||||
if (!category_icon_path.is_empty()) {
|
||||
auto icon = Gfx::Bitmap::load_from_file(category_icon_path);
|
||||
category_menu.set_icon(icon);
|
||||
}
|
||||
app_category_menus.set(category, category_menu);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue