mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
This commit is contained in:
parent
f0409081f5
commit
c7d891765c
131 changed files with 422 additions and 421 deletions
|
@ -58,7 +58,7 @@ void PDFViewerWidget::create_toolbar()
|
|||
auto& toolbar = toolbar_container.add<GUI::Toolbar>();
|
||||
|
||||
auto open_outline_action = GUI::Action::create(
|
||||
"Open &Sidebar", { Mod_Ctrl, Key_O }, Gfx::Bitmap::load_from_file("/res/icons/16x16/sidebar.png"), [&](auto& action) {
|
||||
"Open &Sidebar", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/sidebar.png"), [&](auto& action) {
|
||||
m_sidebar_open = !m_sidebar_open;
|
||||
m_sidebar->set_fixed_width(m_sidebar_open ? 0 : 200);
|
||||
action.set_text(m_sidebar_open ? "Open &Sidebar" : "Close &Sidebar");
|
||||
|
@ -70,13 +70,13 @@ void PDFViewerWidget::create_toolbar()
|
|||
toolbar.add_action(*open_outline_action);
|
||||
toolbar.add_separator();
|
||||
|
||||
m_go_to_prev_page_action = GUI::Action::create("Go to &Previous Page", Gfx::Bitmap::load_from_file("/res/icons/16x16/go-up.png"), [&](auto&) {
|
||||
m_go_to_prev_page_action = GUI::Action::create("Go to &Previous Page", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-up.png"), [&](auto&) {
|
||||
VERIFY(m_viewer->current_page() > 0);
|
||||
m_page_text_box->set_current_number(m_viewer->current_page());
|
||||
});
|
||||
m_go_to_prev_page_action->set_enabled(false);
|
||||
|
||||
m_go_to_next_page_action = GUI::Action::create("Go to &Next Page", Gfx::Bitmap::load_from_file("/res/icons/16x16/go-down.png"), [&](auto&) {
|
||||
m_go_to_next_page_action = GUI::Action::create("Go to &Next Page", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-down.png"), [&](auto&) {
|
||||
VERIFY(m_viewer->current_page() < m_viewer->document()->get_page_count() - 1);
|
||||
m_page_text_box->set_current_number(m_viewer->current_page() + 2);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue