Profiler: Add a "Show Disassembly" action (and hide it by default)

This commit is contained in:
Andreas Kling 2021-05-22 22:48:48 +02:00
parent 863ac3af97
commit 29e00cda2e
Notes: sideshowbarker 2024-07-18 17:31:51 +09:00
2 changed files with 7 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

View File

@ -141,12 +141,17 @@ int main(int argc, char** argv)
tree_view.set_model(profile->model()); tree_view.set_model(profile->model());
auto& disassembly_view = bottom_splitter.add<GUI::TableView>(); auto& disassembly_view = bottom_splitter.add<GUI::TableView>();
disassembly_view.set_visible(false);
tree_view.on_selection = [&](auto& index) { tree_view.on_selection = [&](auto& index) {
profile->set_disassembly_index(index); profile->set_disassembly_index(index);
disassembly_view.set_model(profile->disassembly_model()); 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) {
disassembly_view.set_visible(action.is_checked());
});
auto& samples_tab = tab_widget.add_tab<GUI::Widget>("Samples"); auto& samples_tab = tab_widget.add_tab<GUI::Widget>("Samples");
samples_tab.set_layout<GUI::VerticalBoxLayout>(); samples_tab.set_layout<GUI::VerticalBoxLayout>();
samples_tab.layout()->set_margins({ 4, 4, 4, 4 }); samples_tab.layout()->set_margins({ 4, 4, 4, 4 });
@ -209,6 +214,8 @@ int main(int argc, char** argv)
percent_action->set_checked(false); percent_action->set_checked(false);
view_menu.add_action(percent_action); view_menu.add_action(percent_action);
view_menu.add_action(disassembly_action);
auto& help_menu = menubar->add_menu("&Help"); auto& help_menu = menubar->add_menu("&Help");
help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) { help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) {
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/Profiler.md"), "/bin/Help"); Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/Profiler.md"), "/bin/Help");