diff options
author | Andreas Kling <kling@serenityos.org> | 2021-04-10 10:19:25 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-10 10:19:25 +0200 |
commit | 27b2c6f440544fa0c6c4801eaf1067e58e11e9b5 (patch) | |
tree | f7ae442043aa7c3c1b9a278cd383bb4237a51fbb | |
parent | 392d9e94f0211f1025e67ee467c3ac0b53f6abf9 (diff) | |
download | serenity-27b2c6f440544fa0c6c4801eaf1067e58e11e9b5.zip |
HackStudio: Alt shortcuts and book title capitalization in menus
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index ff6d9e26b6..9529edb9d8 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -325,7 +325,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::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; @@ -362,7 +362,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::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; @@ -461,7 +461,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::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(); @@ -486,7 +486,7 @@ void HackStudioWidget::add_new_editor(GUI::Widget& parent) NonnullRefPtr<GUI::Action> HackStudioWidget::create_switch_to_next_editor_action() { - return GUI::Action::create("Switch to next editor", { Mod_Ctrl, Key_E }, [this](auto&) { + return GUI::Action::create("Switch to &Next Editor", { Mod_Ctrl, Key_E }, [this](auto&) { if (m_all_editor_wrappers.size() <= 1) return; Vector<EditorWrapper*> wrappers; @@ -507,7 +507,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_switch_to_next_editor_action NonnullRefPtr<GUI::Action> HackStudioWidget::create_switch_to_previous_editor_action() { - return GUI::Action::create("Switch to previous editor", { Mod_Ctrl | Mod_Shift, Key_E }, [this](auto&) { + return GUI::Action::create("Switch to &Previous Editor", { Mod_Ctrl | Mod_Shift, Key_E }, [this](auto&) { if (m_all_editor_wrappers.size() <= 1) return; Vector<EditorWrapper*> wrappers; @@ -528,7 +528,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_switch_to_previous_editor_ac NonnullRefPtr<GUI::Action> HackStudioWidget::create_remove_current_editor_action() { - return GUI::Action::create("Remove current editor", { Mod_Alt | Mod_Shift, Key_E }, [this](auto&) { + return GUI::Action::create("&Remove Current Editor", { Mod_Alt | Mod_Shift, Key_E }, [this](auto&) { if (m_all_editor_wrappers.size() <= 1) return; auto wrapper = m_current_editor_wrapper; @@ -541,7 +541,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::load_from_file("/res/icons/16x16/open.png"), [this](auto&) { auto open_path = GUI::FilePicker::get_open_filepath(window(), "Open project"); if (!open_path.has_value()) return; @@ -552,7 +552,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_open_action() NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_action() { - return GUI::Action::create("Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"), [this](auto&) { + return GUI::CommonActions::make_save_action([&](auto&) { if (m_currently_open_file.is_empty()) return; @@ -565,7 +565,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_action() NonnullRefPtr<GUI::Action> HackStudioWidget::create_remove_current_terminal_action() { - return GUI::Action::create("Remove current Terminal", { Mod_Alt | Mod_Shift, Key_T }, [this](auto&) { + return GUI::Action::create("&Remove Current Terminal", { Mod_Alt | Mod_Shift, Key_T }, [this](auto&) { auto widget = m_action_tab_widget->active_widget(); if (!widget) return; @@ -581,7 +581,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 }, + 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"), [this](auto&) { add_new_editor(*m_editors_splitter); @@ -591,7 +591,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 }, + return GUI::Action::create("Add New &Terminal", { Mod_Ctrl | Mod_Alt, Key_T }, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"), [this](auto&) { auto& terminal_wrapper = m_action_tab_widget->add_tab<TerminalWrapper>("Terminal"); @@ -610,7 +610,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::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; @@ -894,7 +894,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::load_from_file("/res/icons/16x16/build.png"), [this](auto&) { reveal_action_tab(*m_terminal_wrapper); build(*m_terminal_wrapper); m_stop_action->set_enabled(true); @@ -903,7 +903,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::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); @@ -937,19 +937,19 @@ void HackStudioWidget::create_action_tab(GUI::Widget& parent) void HackStudioWidget::create_app_menubar(GUI::MenuBar& menubar) { - auto& app_menu = menubar.add_menu("File"); - app_menu.add_action(*m_new_project_action); - app_menu.add_action(*m_open_action); - app_menu.add_action(*m_save_action); - app_menu.add_separator(); - app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) { + auto& file_menu = menubar.add_menu("&File"); + file_menu.add_action(*m_new_project_action); + file_menu.add_action(*m_open_action); + file_menu.add_action(*m_save_action); + file_menu.add_separator(); + file_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) { GUI::Application::the()->quit(); })); } void HackStudioWidget::create_project_menubar(GUI::MenuBar& menubar) { - auto& project_menu = menubar.add_menu("Project"); + auto& project_menu = menubar.add_menu("&Project"); project_menu.add_action(*m_new_file_action); project_menu.add_action(*m_new_directory_action); project_menu.add_separator(); @@ -958,15 +958,15 @@ 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&) { + 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&) { reveal_action_tab(*m_find_in_files_widget); m_find_in_files_widget->focus_textbox_and_select_all(); })); edit_menu.add_separator(); - auto vim_emulation_setting_action = GUI::Action::create_checkable("Vim emulation", { Mod_Ctrl | Mod_Shift | Mod_Alt, Key_V }, [this](auto& action) { + auto vim_emulation_setting_action = GUI::Action::create_checkable("&Vim Emulation", { Mod_Ctrl | Mod_Shift | Mod_Alt, Key_V }, [this](auto& action) { if (action.is_checked()) current_editor().set_editing_engine(make<GUI::VimEditingEngine>()); else @@ -978,7 +978,7 @@ void HackStudioWidget::create_edit_menubar(GUI::MenuBar& menubar) void HackStudioWidget::create_build_menubar(GUI::MenuBar& menubar) { - auto& build_menu = menubar.add_menu("Build"); + auto& build_menu = menubar.add_menu("&Build"); build_menu.add_action(*m_build_action); build_menu.add_separator(); build_menu.add_action(*m_run_action); @@ -989,29 +989,29 @@ void HackStudioWidget::create_build_menubar(GUI::MenuBar& menubar) void HackStudioWidget::create_view_menubar(GUI::MenuBar& menubar) { - auto hide_action_tabs_action = GUI::Action::create("Hide action tabs", { Mod_Ctrl | Mod_Shift, Key_X }, [this](auto&) { + auto hide_action_tabs_action = GUI::Action::create("&Hide Action Tabs", { Mod_Ctrl | Mod_Shift, Key_X }, [this](auto&) { hide_action_tabs(); }); - auto open_locator_action = GUI::Action::create("Open locator", { Mod_Ctrl, Key_K }, [this](auto&) { + auto open_locator_action = GUI::Action::create("Open &Locator", { Mod_Ctrl, Key_K }, [this](auto&) { m_locator->open(); }); - auto& view_menu = menubar.add_menu("View"); + auto& view_menu = menubar.add_menu("&View"); view_menu.add_action(hide_action_tabs_action); view_menu.add_action(open_locator_action); view_menu.add_separator(); m_wrapping_mode_actions.set_exclusive(true); - auto& wrapping_mode_menu = view_menu.add_submenu("Wrapping mode"); - m_no_wrapping_action = GUI::Action::create_checkable("No wrapping", [&](auto&) { + auto& wrapping_mode_menu = view_menu.add_submenu("&Wrapping Mode"); + m_no_wrapping_action = GUI::Action::create_checkable("&No Wrapping", [&](auto&) { for (auto& wrapper : m_all_editor_wrappers) wrapper.editor().set_wrapping_mode(GUI::TextEditor::WrappingMode::NoWrap); }); - m_wrap_anywhere_action = GUI::Action::create_checkable("Wrap anywhere", [&](auto&) { + m_wrap_anywhere_action = GUI::Action::create_checkable("Wrap &Anywhere", [&](auto&) { for (auto& wrapper : m_all_editor_wrappers) wrapper.editor().set_wrapping_mode(GUI::TextEditor::WrappingMode::WrapAnywhere); }); - m_wrap_at_words_action = GUI::Action::create_checkable("Wrap at words", [&](auto&) { + m_wrap_at_words_action = GUI::Action::create_checkable("Wrap at &Words", [&](auto&) { for (auto& wrapper : m_all_editor_wrappers) wrapper.editor().set_wrapping_mode(GUI::TextEditor::WrappingMode::WrapAtWords); }); @@ -1041,7 +1041,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::load_from_file("/res/icons/16x16/program-stop.png"), [this](auto&) { m_terminal_wrapper->kill_running_command(); }); @@ -1051,7 +1051,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_stop_action() NonnullRefPtr<GUI::Action> HackStudioWidget::create_set_autocomplete_mode_action() { - auto action = GUI::Action::create_checkable("AutoComplete C++ with Parser", [this](auto& action) { + auto action = GUI::Action::create_checkable("AutoComplete C++ with &Parser", [this](auto& action) { get_language_client<LanguageClients::Cpp::ServerConnection>(project().root_path())->set_autocomplete_mode(action.is_checked() ? "Parser" : "Lexer"); }); action->set_checked(true); |