mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
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.
This commit is contained in:
parent
6193fdb477
commit
6675865582
Notes:
sideshowbarker
2024-07-17 07:21:52 +09:00
Author: https://github.com/electrikmilk Commit: https://github.com/SerenityOS/serenity/commit/6675865582 Pull-request: https://github.com/SerenityOS/serenity/pull/15164
6 changed files with 25 additions and 13 deletions
BIN
Base/res/icons/16x16/close-other-tabs.png
Normal file
BIN
Base/res/icons/16x16/close-other-tabs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7 KiB |
BIN
Base/res/icons/16x16/download.png
Normal file
BIN
Base/res/icons/16x16/download.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 778 B |
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 };
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}));
|
||||
|
||||
|
|
Loading…
Reference in a new issue