mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38: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
|
@ -72,11 +72,11 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen
|
|||
case Mode::OpenMultiple:
|
||||
case Mode::OpenFolder:
|
||||
set_title("Open");
|
||||
set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"));
|
||||
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"));
|
||||
break;
|
||||
case Mode::Save:
|
||||
set_title("Save as");
|
||||
set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"));
|
||||
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png"));
|
||||
break;
|
||||
}
|
||||
resize(560, 320);
|
||||
|
@ -109,7 +109,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen
|
|||
};
|
||||
|
||||
auto open_parent_directory_action = Action::create(
|
||||
"Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"), [this](const Action&) {
|
||||
"Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png"), [this](const Action&) {
|
||||
set_path(String::formatted("{}/..", m_model->root_path()));
|
||||
},
|
||||
this);
|
||||
|
@ -123,7 +123,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen
|
|||
toolbar.add_separator();
|
||||
|
||||
auto mkdir_action = Action::create(
|
||||
"New directory...", Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"), [this](const Action&) {
|
||||
"New directory...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"), [this](const Action&) {
|
||||
String value;
|
||||
if (InputBox::show(this, value, "Enter name:", "New directory") == InputBox::ExecOK && !value.is_empty()) {
|
||||
auto new_dir_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", m_model->root_path(), value));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue