mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:27:35 +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
|
@ -25,19 +25,19 @@ namespace HackStudio {
|
|||
|
||||
void DebugInfoWidget::init_toolbar()
|
||||
{
|
||||
m_continue_action = GUI::Action::create("Continue", Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-continue.png"), [](auto&) {
|
||||
m_continue_action = GUI::Action::create("Continue", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-continue.png"), [](auto&) {
|
||||
Debugger::the().set_requested_debugger_action(Debugger::DebuggerAction::Continue);
|
||||
});
|
||||
|
||||
m_singlestep_action = GUI::Action::create("Step Over", { Mod_None, Key_F10 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-step-over.png"), [](auto&) {
|
||||
m_singlestep_action = GUI::Action::create("Step Over", { Mod_None, Key_F10 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-step-over.png"), [](auto&) {
|
||||
Debugger::the().set_requested_debugger_action(Debugger::DebuggerAction::SourceStepOver);
|
||||
});
|
||||
|
||||
m_step_in_action = GUI::Action::create("Step In", { Mod_None, Key_F11 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-step-in.png"), [](auto&) {
|
||||
m_step_in_action = GUI::Action::create("Step In", { Mod_None, Key_F11 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-step-in.png"), [](auto&) {
|
||||
Debugger::the().set_requested_debugger_action(Debugger::DebuggerAction::SourceSingleStep);
|
||||
});
|
||||
|
||||
m_step_out_action = GUI::Action::create("Step Out", { Mod_Shift, Key_F11 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-step-out.png"), [](auto&) {
|
||||
m_step_out_action = GUI::Action::create("Step Out", { Mod_Shift, Key_F11 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-step-out.png"), [](auto&) {
|
||||
Debugger::the().set_requested_debugger_action(Debugger::DebuggerAction::SourceStepOut);
|
||||
});
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ private:
|
|||
: m_variables(move(variables))
|
||||
, m_regs(regs)
|
||||
{
|
||||
m_variable_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
|
||||
m_variable_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"));
|
||||
}
|
||||
NonnullOwnPtrVector<Debug::DebugInfo::VariableInfo> m_variables;
|
||||
PtraceRegisters m_regs;
|
||||
|
|
|
@ -429,13 +429,13 @@ void Editor::clear_execution_position()
|
|||
|
||||
const Gfx::Bitmap& Editor::breakpoint_icon_bitmap()
|
||||
{
|
||||
static auto bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/breakpoint.png");
|
||||
static auto bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/breakpoint.png");
|
||||
return *bitmap;
|
||||
}
|
||||
|
||||
const Gfx::Bitmap& Editor::current_position_icon_bitmap()
|
||||
{
|
||||
static auto bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png");
|
||||
static auto bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png");
|
||||
return *bitmap;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ GitWidget::GitWidget(const LexicalPath& repo_root)
|
|||
unstaged_header.set_layout<GUI::HorizontalBoxLayout>();
|
||||
|
||||
auto& refresh_button = unstaged_header.add<GUI::Button>();
|
||||
refresh_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"));
|
||||
refresh_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"));
|
||||
refresh_button.set_fixed_size(16, 16);
|
||||
refresh_button.set_tooltip("refresh");
|
||||
refresh_button.on_click = [this](int) { refresh(); };
|
||||
|
@ -43,7 +43,7 @@ GitWidget::GitWidget(const LexicalPath& repo_root)
|
|||
unstaged_header.set_fixed_height(20);
|
||||
m_unstaged_files = unstaged.add<GitFilesView>(
|
||||
[this](const auto& file) { stage_file(file); },
|
||||
Gfx::Bitmap::load_from_file("/res/icons/16x16/plus.png").release_nonnull());
|
||||
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/plus.png").release_nonnull());
|
||||
m_unstaged_files->on_selection_change = [this] {
|
||||
const auto& index = m_unstaged_files->selection().first();
|
||||
const auto& selected = index.data().as_string();
|
||||
|
@ -57,7 +57,7 @@ GitWidget::GitWidget(const LexicalPath& repo_root)
|
|||
staged_header.set_layout<GUI::HorizontalBoxLayout>();
|
||||
|
||||
auto& commit_button = staged_header.add<GUI::Button>();
|
||||
commit_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/commit.png"));
|
||||
commit_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/commit.png"));
|
||||
commit_button.set_fixed_size(16, 16);
|
||||
commit_button.set_tooltip("commit");
|
||||
commit_button.on_click = [this](int) { commit(); };
|
||||
|
@ -68,7 +68,7 @@ GitWidget::GitWidget(const LexicalPath& repo_root)
|
|||
staged_header.set_fixed_height(20);
|
||||
m_staged_files = staged.add<GitFilesView>(
|
||||
[this](const auto& file) { unstage_file(file); },
|
||||
Gfx::Bitmap::load_from_file("/res/icons/16x16/minus.png").release_nonnull());
|
||||
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/minus.png").release_nonnull());
|
||||
}
|
||||
|
||||
bool GitWidget::initialize()
|
||||
|
|
|
@ -331,7 +331,7 @@ NonnullRefPtr<GUI::Menu> HackStudioWidget::create_project_tree_view_context_menu
|
|||
|
||||
NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_file_action()
|
||||
{
|
||||
return GUI::Action::create("New &File...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [this](const GUI::Action&) {
|
||||
return GUI::Action::create("New &File...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"), [this](const GUI::Action&) {
|
||||
String filename;
|
||||
if (GUI::InputBox::show(window(), filename, "Enter name of new file:", "Add new file to project") != GUI::InputBox::ExecOK)
|
||||
return;
|
||||
|
@ -368,7 +368,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_file_action()
|
|||
|
||||
NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_directory_action()
|
||||
{
|
||||
return GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"), [this](const GUI::Action&) {
|
||||
return GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"), [this](const GUI::Action&) {
|
||||
String directory_name;
|
||||
if (GUI::InputBox::show(window(), directory_name, "Enter name of new directory:", "Add new folder to project") != GUI::InputBox::ExecOK)
|
||||
return;
|
||||
|
@ -478,7 +478,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action()
|
|||
|
||||
NonnullRefPtr<GUI::Action> HackStudioWidget::create_new_project_action()
|
||||
{
|
||||
return GUI::Action::create("&New Project...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/hackstudio-project.png"), [this](const GUI::Action&) {
|
||||
return GUI::Action::create("&New Project...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/hackstudio-project.png"), [this](const GUI::Action&) {
|
||||
auto dialog = NewProjectDialog::construct(window());
|
||||
dialog->set_icon(window()->icon());
|
||||
auto result = dialog->exec();
|
||||
|
@ -560,7 +560,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_remove_current_editor_action
|
|||
|
||||
NonnullRefPtr<GUI::Action> HackStudioWidget::create_open_action()
|
||||
{
|
||||
return GUI::Action::create("&Open Project...", { Mod_Ctrl | Mod_Shift, Key_O }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"), [this](auto&) {
|
||||
return GUI::Action::create("&Open Project...", { Mod_Ctrl | Mod_Shift, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"), [this](auto&) {
|
||||
auto open_path = GUI::FilePicker::get_open_filepath(window(), "Open project", Core::StandardPaths::home_directory(), true);
|
||||
if (!open_path.has_value())
|
||||
return;
|
||||
|
@ -601,7 +601,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_remove_current_terminal_acti
|
|||
NonnullRefPtr<GUI::Action> HackStudioWidget::create_add_editor_action()
|
||||
{
|
||||
return GUI::Action::create("Add New &Editor", { Mod_Ctrl | Mod_Alt, Key_E },
|
||||
Gfx::Bitmap::load_from_file("/res/icons/16x16/app-text-editor.png"),
|
||||
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-text-editor.png"),
|
||||
[this](auto&) {
|
||||
add_new_editor(*m_editors_splitter);
|
||||
update_actions();
|
||||
|
@ -611,7 +611,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_add_editor_action()
|
|||
NonnullRefPtr<GUI::Action> HackStudioWidget::create_add_terminal_action()
|
||||
{
|
||||
return GUI::Action::create("Add New &Terminal", { Mod_Ctrl | Mod_Alt, Key_T },
|
||||
Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"),
|
||||
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"),
|
||||
[this](auto&) {
|
||||
auto& terminal_wrapper = m_action_tab_widget->add_tab<TerminalWrapper>("Terminal");
|
||||
reveal_action_tab(terminal_wrapper);
|
||||
|
@ -629,7 +629,7 @@ void HackStudioWidget::reveal_action_tab(GUI::Widget& widget)
|
|||
|
||||
NonnullRefPtr<GUI::Action> HackStudioWidget::create_debug_action()
|
||||
{
|
||||
return GUI::Action::create("&Debug", Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-run.png"), [this](auto&) {
|
||||
return GUI::Action::create("&Debug", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-run.png"), [this](auto&) {
|
||||
if (!Core::File::exists(get_project_executable_path())) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Could not find file: {}. (did you build the project?)", get_project_executable_path()), "Error", GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
|
@ -850,7 +850,7 @@ void HackStudioWidget::create_toolbar(GUI::Widget& parent)
|
|||
|
||||
NonnullRefPtr<GUI::Action> HackStudioWidget::create_build_action()
|
||||
{
|
||||
return GUI::Action::create("&Build", { Mod_Ctrl, Key_B }, Gfx::Bitmap::load_from_file("/res/icons/16x16/build.png"), [this](auto&) {
|
||||
return GUI::Action::create("&Build", { Mod_Ctrl, Key_B }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/build.png"), [this](auto&) {
|
||||
if (warn_unsaved_changes("There are unsaved changes, do you want to save before building?") == ContinueDecision::No)
|
||||
return;
|
||||
|
||||
|
@ -862,7 +862,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_build_action()
|
|||
|
||||
NonnullRefPtr<GUI::Action> HackStudioWidget::create_run_action()
|
||||
{
|
||||
return GUI::Action::create("&Run", { Mod_Ctrl, Key_R }, Gfx::Bitmap::load_from_file("/res/icons/16x16/program-run.png"), [this](auto&) {
|
||||
return GUI::Action::create("&Run", { Mod_Ctrl, Key_R }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/program-run.png"), [this](auto&) {
|
||||
reveal_action_tab(*m_terminal_wrapper);
|
||||
run(*m_terminal_wrapper);
|
||||
m_stop_action->set_enabled(true);
|
||||
|
@ -944,7 +944,7 @@ void HackStudioWidget::create_project_menubar(GUI::Menubar& menubar)
|
|||
void HackStudioWidget::create_edit_menubar(GUI::Menubar& menubar)
|
||||
{
|
||||
auto& edit_menu = menubar.add_menu("&Edit");
|
||||
edit_menu.add_action(GUI::Action::create("&Find in Files...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"), [this](auto&) {
|
||||
edit_menu.add_action(GUI::Action::create("&Find in Files...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"), [this](auto&) {
|
||||
reveal_action_tab(*m_find_in_files_widget);
|
||||
m_find_in_files_widget->focus_textbox_and_select_all();
|
||||
}));
|
||||
|
@ -1026,7 +1026,7 @@ void HackStudioWidget::create_help_menubar(GUI::Menubar& menubar)
|
|||
|
||||
NonnullRefPtr<GUI::Action> HackStudioWidget::create_stop_action()
|
||||
{
|
||||
auto action = GUI::Action::create("&Stop", Gfx::Bitmap::load_from_file("/res/icons/16x16/program-stop.png"), [this](auto&) {
|
||||
auto action = GUI::Action::create("&Stop", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/program-stop.png"), [this](auto&) {
|
||||
if (!Debugger::the().session()) {
|
||||
m_terminal_wrapper->kill_running_command();
|
||||
return;
|
||||
|
|
|
@ -186,7 +186,7 @@ void ServerConnectionWrapper::on_crash()
|
|||
void ServerConnectionWrapper::show_frequenct_crashes_notification() const
|
||||
{
|
||||
auto notification = GUI::Notification::construct();
|
||||
notification->set_icon(Gfx::Bitmap::load_from_file("/res/icons/32x32/app-hack-studio.png"));
|
||||
notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png"));
|
||||
notification->set_title("LanguageServer Crashes too much!");
|
||||
notification->set_text("LanguageServer aided features will not be available in this session");
|
||||
notification->show();
|
||||
|
@ -194,7 +194,7 @@ void ServerConnectionWrapper::show_frequenct_crashes_notification() const
|
|||
void ServerConnectionWrapper::show_crash_notification() const
|
||||
{
|
||||
auto notification = GUI::Notification::construct();
|
||||
notification->set_icon(Gfx::Bitmap::load_from_file("/res/icons/32x32/app-hack-studio.png"));
|
||||
notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png"));
|
||||
notification->set_title("Oops!");
|
||||
notification->set_text(String::formatted("LanguageServer has crashed"));
|
||||
notification->show();
|
||||
|
|
|
@ -20,13 +20,13 @@ void HackStudio::ProjectDeclarations::set_declared_symbols(const String& filenam
|
|||
|
||||
Optional<GUI::Icon> HackStudio::ProjectDeclarations::get_icon_for(GUI::AutocompleteProvider::DeclarationType type)
|
||||
{
|
||||
static GUI::Icon struct_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Struct.png"));
|
||||
static GUI::Icon class_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Class.png"));
|
||||
static GUI::Icon function_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Function.png"));
|
||||
static GUI::Icon variable_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Variable.png"));
|
||||
static GUI::Icon preprocessor_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Preprocessor.png"));
|
||||
static GUI::Icon member_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Member.png"));
|
||||
static GUI::Icon namespace_icon(Gfx::Bitmap::load_from_file("/res/icons/hackstudio/Namespace.png"));
|
||||
static GUI::Icon struct_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Struct.png"));
|
||||
static GUI::Icon class_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Class.png"));
|
||||
static GUI::Icon function_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Function.png"));
|
||||
static GUI::Icon variable_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Variable.png"));
|
||||
static GUI::Icon preprocessor_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Preprocessor.png"));
|
||||
static GUI::Icon member_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Member.png"));
|
||||
static GUI::Icon namespace_icon(Gfx::Bitmap::try_load_from_file("/res/icons/hackstudio/Namespace.png"));
|
||||
switch (type) {
|
||||
case GUI::AutocompleteProvider::DeclarationType::Struct:
|
||||
return struct_icon;
|
||||
|
|
|
@ -50,7 +50,7 @@ RefPtr<ProjectTemplate> ProjectTemplate::load_from_manifest(const String& manife
|
|||
auto bitmap_path_32 = String::formatted("/res/icons/hackstudio/templates-32x32/{}.png", config->read_entry("HackStudioTemplate", "IconName32x"));
|
||||
|
||||
if (Core::File::exists(bitmap_path_32)) {
|
||||
auto bitmap32 = Gfx::Bitmap::load_from_file(bitmap_path_32);
|
||||
auto bitmap32 = Gfx::Bitmap::try_load_from_file(bitmap_path_32);
|
||||
icon = GUI::Icon(move(bitmap32));
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ int main(int argc, char** argv)
|
|||
|
||||
s_window = GUI::Window::construct();
|
||||
s_window->resize(840, 600);
|
||||
s_window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-hack-studio.png"));
|
||||
s_window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-hack-studio.png"));
|
||||
|
||||
update_path_environment_variable();
|
||||
|
||||
|
@ -105,7 +105,7 @@ static bool make_is_available()
|
|||
static void notify_make_not_available()
|
||||
{
|
||||
auto notification = GUI::Notification::construct();
|
||||
notification->set_icon(Gfx::Bitmap::load_from_file("/res/icons/32x32/app-hack-studio.png"));
|
||||
notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png"));
|
||||
notification->set_title("'make' Not Available");
|
||||
notification->set_text("You probably want to install the binutils, gcc, and make ports from the root of the Serenity repository");
|
||||
notification->show();
|
||||
|
|
|
@ -17,10 +17,10 @@ namespace Inspector {
|
|||
RemoteObjectGraphModel::RemoteObjectGraphModel(RemoteProcess& process)
|
||||
: m_process(process)
|
||||
{
|
||||
m_object_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
|
||||
m_window_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png"));
|
||||
m_layout_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/layout.png"));
|
||||
m_timer_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/timer.png"));
|
||||
m_object_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"));
|
||||
m_window_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"));
|
||||
m_layout_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layout.png"));
|
||||
m_timer_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/timer.png"));
|
||||
}
|
||||
|
||||
RemoteObjectGraphModel::~RemoteObjectGraphModel()
|
||||
|
|
|
@ -155,7 +155,7 @@ int main(int argc, char** argv)
|
|||
|
||||
auto properties_tree_view_context_menu = GUI::Menu::construct("Properties Tree View");
|
||||
|
||||
auto copy_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png");
|
||||
auto copy_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png");
|
||||
auto copy_property_name_action = GUI::Action::create("Copy Property Name", copy_bitmap, [&](auto&) {
|
||||
GUI::Clipboard::the().set_plain_text(properties_tree_view.selection().first().data().to_string());
|
||||
});
|
||||
|
|
|
@ -20,7 +20,7 @@ static const Gfx::Bitmap& heat_gradient()
|
|||
{
|
||||
static RefPtr<Gfx::Bitmap> bitmap;
|
||||
if (!bitmap) {
|
||||
bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { 101, 1 });
|
||||
bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { 101, 1 });
|
||||
GUI::Painter painter(*bitmap);
|
||||
painter.fill_rect_with_gradient(Orientation::Horizontal, bitmap->rect(), Color::from_rgb(0xffc080), Color::from_rgb(0xff3000));
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace Profiler {
|
|||
ProfileModel::ProfileModel(Profile& profile)
|
||||
: m_profile(profile)
|
||||
{
|
||||
m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
|
||||
m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object-red.png"));
|
||||
m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"));
|
||||
m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object-red.png"));
|
||||
}
|
||||
|
||||
ProfileModel::~ProfileModel()
|
||||
|
|
|
@ -14,8 +14,8 @@ namespace Profiler {
|
|||
SamplesModel::SamplesModel(Profile& profile)
|
||||
: m_profile(profile)
|
||||
{
|
||||
m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
|
||||
m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object-red.png"));
|
||||
m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"));
|
||||
m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object-red.png"));
|
||||
}
|
||||
|
||||
SamplesModel::~SamplesModel()
|
||||
|
|
|
@ -149,7 +149,7 @@ int main(int argc, char** argv)
|
|||
disassembly_view.set_model(profile->disassembly_model());
|
||||
};
|
||||
|
||||
auto disassembly_action = GUI::Action::create_checkable("Show &Disassembly", { Mod_Ctrl, Key_D }, Gfx::Bitmap::load_from_file("/res/icons/16x16/x86.png"), [&](auto& action) {
|
||||
auto disassembly_action = GUI::Action::create_checkable("Show &Disassembly", { Mod_Ctrl, Key_D }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/x86.png"), [&](auto& action) {
|
||||
disassembly_view.set_visible(action.is_checked());
|
||||
});
|
||||
|
||||
|
@ -235,7 +235,7 @@ static bool prompt_to_stop_profiling(pid_t pid, const String& process_name)
|
|||
auto window = GUI::Window::construct();
|
||||
window->set_title(String::formatted("Profiling {}({})", process_name, pid));
|
||||
window->resize(240, 100);
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"));
|
||||
window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"));
|
||||
window->center_on_screen();
|
||||
|
||||
auto& widget = window->set_main_widget<GUI::Widget>();
|
||||
|
@ -263,7 +263,7 @@ static bool prompt_to_stop_profiling(pid_t pid, const String& process_name)
|
|||
bool generate_profile(pid_t& pid)
|
||||
{
|
||||
if (!pid) {
|
||||
auto process_chooser = GUI::ProcessChooser::construct("Profiler", "Profile", Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"));
|
||||
auto process_chooser = GUI::ProcessChooser::construct("Profiler", "Profile", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"));
|
||||
if (process_chooser->exec() == GUI::Dialog::ExecCancel)
|
||||
return false;
|
||||
pid = process_chooser->pid();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue