diff options
author | electrikmilk <brandonjordan124@gmail.com> | 2022-09-07 23:18:19 -0400 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-09-08 10:02:37 +0100 |
commit | 66758655826d597d126883d63d1c4b11b5e85db1 (patch) | |
tree | 50e409316132e8172004cce18fd3404a6526ba85 | |
parent | 6193fdb4778a1a3fe7ac40f61d234770fa4dd6ad (diff) | |
download | serenity-66758655826d597d126883d63d1c4b11b5e85db1.zip |
Browser: Add context menu icons
This adds two new icons for browser context menu items "Close Other
Tabs" and "Download".
This adds existing icons where they were missing in context menu items.
-rw-r--r-- | Base/res/icons/16x16/close-other-tabs.png | bin | 0 -> 7154 bytes | |||
-rw-r--r-- | Base/res/icons/16x16/download.png | bin | 0 -> 778 bytes | |||
-rw-r--r-- | Userland/Applications/Browser/BookmarksBarWidget.cpp | 6 | ||||
-rw-r--r-- | Userland/Applications/Browser/IconBag.cpp | 6 | ||||
-rw-r--r-- | Userland/Applications/Browser/IconBag.h | 6 | ||||
-rw-r--r-- | Userland/Applications/Browser/Tab.cpp | 20 |
6 files changed, 25 insertions, 13 deletions
diff --git a/Base/res/icons/16x16/close-other-tabs.png b/Base/res/icons/16x16/close-other-tabs.png Binary files differnew file mode 100644 index 0000000000..1f259ef61e --- /dev/null +++ b/Base/res/icons/16x16/close-other-tabs.png diff --git a/Base/res/icons/16x16/download.png b/Base/res/icons/16x16/download.png Binary files differnew file mode 100644 index 0000000000..7836d3c341 --- /dev/null +++ b/Base/res/icons/16x16/download.png diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp index 958720a02f..35d78c9b81 100644 --- a/Userland/Applications/Browser/BookmarksBarWidget.cpp +++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp @@ -124,7 +124,7 @@ BookmarksBarWidget::BookmarksBarWidget(String const& bookmarks_file, bool enable m_context_menu = GUI::Menu::construct(); auto default_action = GUI::Action::create( - "&Open", [this](auto&) { + "&Open", g_icon_bag.go_to, [this](auto&) { if (on_bookmark_click) on_bookmark_click(m_context_menu_url, OpenInNewTab::No); }, @@ -132,14 +132,14 @@ BookmarksBarWidget::BookmarksBarWidget(String const& bookmarks_file, bool enable m_context_menu_default_action = default_action; m_context_menu->add_action(default_action); m_context_menu->add_action(GUI::Action::create( - "Open in New &Tab", [this](auto&) { + "Open in New &Tab", g_icon_bag.new_tab, [this](auto&) { if (on_bookmark_click) on_bookmark_click(m_context_menu_url, OpenInNewTab::Yes); }, this)); m_context_menu->add_separator(); m_context_menu->add_action(GUI::Action::create( - "&Edit...", [this](auto&) { + "&Edit...", g_icon_bag.rename, [this](auto&) { edit_bookmark(m_context_menu_url); }, this)); diff --git a/Userland/Applications/Browser/IconBag.cpp b/Userland/Applications/Browser/IconBag.cpp index 05e738a9b6..4f80ac56d9 100644 --- a/Userland/Applications/Browser/IconBag.cpp +++ b/Userland/Applications/Browser/IconBag.cpp @@ -15,6 +15,7 @@ ErrorOr<IconBag> IconBag::try_create() icon_bag.filetype_html = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"sv)); icon_bag.filetype_text = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-text.png"sv)); icon_bag.filetype_javascript = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-javascript.png"sv)); + icon_bag.filetype_image = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-image.png"sv)); icon_bag.bookmark_contour = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-contour.png"sv)); icon_bag.bookmark_filled = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/bookmark-filled.png"sv)); icon_bag.inspector_object = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv)); @@ -24,6 +25,7 @@ ErrorOr<IconBag> IconBag::try_create() icon_bag.delete_icon = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv)); icon_bag.new_tab = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"sv)); icon_bag.duplicate_tab = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/duplicate-tab.png"sv)); + icon_bag.close_other_tabs = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/close-other-tabs.png"sv)); icon_bag.code = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/code.png"sv)); icon_bag.dom_tree = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/dom-tree.png"sv)); icon_bag.layout = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layout.png"sv)); @@ -36,6 +38,10 @@ ErrorOr<IconBag> IconBag::try_create() icon_bag.trash_can = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/trash-can.png"sv)); icon_bag.clear_cache = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/browser/clear-cache.png"sv)); icon_bag.spoof = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/spoof.png"sv)); + icon_bag.go_to = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv)); + icon_bag.download = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/download.png"sv)); + icon_bag.copy = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv)); + icon_bag.rename = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/rename.png"sv)); return icon_bag; } diff --git a/Userland/Applications/Browser/IconBag.h b/Userland/Applications/Browser/IconBag.h index 08a56c6a4a..b57e21cb08 100644 --- a/Userland/Applications/Browser/IconBag.h +++ b/Userland/Applications/Browser/IconBag.h @@ -16,6 +16,7 @@ struct IconBag final { RefPtr<Gfx::Bitmap> filetype_html { nullptr }; RefPtr<Gfx::Bitmap> filetype_text { nullptr }; RefPtr<Gfx::Bitmap> filetype_javascript { nullptr }; + RefPtr<Gfx::Bitmap> filetype_image { nullptr }; RefPtr<Gfx::Bitmap> bookmark_contour { nullptr }; RefPtr<Gfx::Bitmap> bookmark_filled { nullptr }; RefPtr<Gfx::Bitmap> inspector_object { nullptr }; @@ -25,6 +26,7 @@ struct IconBag final { RefPtr<Gfx::Bitmap> delete_icon { nullptr }; RefPtr<Gfx::Bitmap> new_tab { nullptr }; RefPtr<Gfx::Bitmap> duplicate_tab { nullptr }; + RefPtr<Gfx::Bitmap> close_other_tabs { nullptr }; RefPtr<Gfx::Bitmap> code { nullptr }; RefPtr<Gfx::Bitmap> dom_tree { nullptr }; RefPtr<Gfx::Bitmap> layout { nullptr }; @@ -37,5 +39,9 @@ struct IconBag final { RefPtr<Gfx::Bitmap> trash_can { nullptr }; RefPtr<Gfx::Bitmap> clear_cache { nullptr }; RefPtr<Gfx::Bitmap> spoof { nullptr }; + RefPtr<Gfx::Bitmap> go_to { nullptr }; + RefPtr<Gfx::Bitmap> download { nullptr }; + RefPtr<Gfx::Bitmap> copy { nullptr }; + RefPtr<Gfx::Bitmap> rename { nullptr }; }; } diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index d2d9ca2c26..d9a335da4e 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -247,20 +247,20 @@ Tab::Tab(BrowserWindow& window) }; m_link_context_menu = GUI::Menu::construct(); - auto link_default_action = GUI::Action::create("&Open", [this](auto&) { + auto link_default_action = GUI::Action::create("&Open", g_icon_bag.go_to, [this](auto&) { view().on_link_click(m_link_context_menu_url, "", 0); }); m_link_context_menu->add_action(link_default_action); m_link_context_menu_default_action = link_default_action; - m_link_context_menu->add_action(GUI::Action::create("Open in New &Tab", [this](auto&) { + m_link_context_menu->add_action(GUI::Action::create("Open in New &Tab", g_icon_bag.new_tab, [this](auto&) { view().on_link_click(m_link_context_menu_url, "_blank", 0); })); m_link_context_menu->add_separator(); - m_link_context_menu->add_action(GUI::Action::create("&Copy URL", [this](auto&) { + m_link_context_menu->add_action(GUI::Action::create("&Copy URL", g_icon_bag.copy, [this](auto&) { GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_string()); })); m_link_context_menu->add_separator(); - m_link_context_menu->add_action(GUI::Action::create("&Download", [this](auto&) { + m_link_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) { start_download(m_link_context_menu_url); })); m_link_context_menu->add_separator(); @@ -272,22 +272,22 @@ Tab::Tab(BrowserWindow& window) }; m_image_context_menu = GUI::Menu::construct(); - m_image_context_menu->add_action(GUI::Action::create("&Open Image", [this](auto&) { + m_image_context_menu->add_action(GUI::Action::create("&Open Image", g_icon_bag.filetype_image, [this](auto&) { view().on_link_click(m_image_context_menu_url, "", 0); })); - m_image_context_menu->add_action(GUI::Action::create("Open Image in New &Tab", [this](auto&) { + m_image_context_menu->add_action(GUI::Action::create("Open Image in New &Tab", g_icon_bag.new_tab, [this](auto&) { view().on_link_click(m_image_context_menu_url, "_blank", 0); })); m_image_context_menu->add_separator(); - m_image_context_menu->add_action(GUI::Action::create("&Copy Image", [this](auto&) { + m_image_context_menu->add_action(GUI::Action::create("&Copy Image", g_icon_bag.copy, [this](auto&) { if (m_image_context_menu_bitmap.is_valid()) GUI::Clipboard::the().set_bitmap(*m_image_context_menu_bitmap.bitmap()); })); - m_image_context_menu->add_action(GUI::Action::create("Copy Image &URL", [this](auto&) { + m_image_context_menu->add_action(GUI::Action::create("Copy Image &URL", g_icon_bag.copy, [this](auto&) { GUI::Clipboard::the().set_plain_text(m_image_context_menu_url.to_string()); })); m_image_context_menu->add_separator(); - m_image_context_menu->add_action(GUI::Action::create("&Download", [this](auto&) { + m_image_context_menu->add_action(GUI::Action::create("&Download", g_icon_bag.download, [this](auto&) { start_download(m_image_context_menu_url); })); m_image_context_menu->add_separator(); @@ -386,7 +386,7 @@ Tab::Tab(BrowserWindow& window) m_tab_context_menu->add_action(GUI::Action::create("&Duplicate Tab", g_icon_bag.duplicate_tab, [this](auto&) { on_tab_open_request(url()); })); - m_tab_context_menu->add_action(GUI::Action::create("Close &Other Tabs", [this](auto&) { + m_tab_context_menu->add_action(GUI::Action::create("Close &Other Tabs", g_icon_bag.close_other_tabs, [this](auto&) { on_tab_close_other_request(*this); })); |