1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

FontEditor: Add a "Save as..." menu item

This commit is contained in:
Nico Weber 2020-07-10 21:20:39 -04:00 committed by Andreas Kling
parent 03e722f664
commit 315dc8d81b
3 changed files with 25 additions and 6 deletions

View file

@ -105,6 +105,15 @@ int main(int argc, char** argv)
set_edited_font(open_path.value(), move(new_font), window->position());
}));
app_menu.add_action(GUI::Action::create("Save as...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"), [&](auto&) {
FontEditorWidget* editor = static_cast<FontEditorWidget*>(window->main_widget());
Optional<String> save_path = GUI::FilePicker::get_save_filepath(editor->path(), ".font");
if (!save_path.has_value())
return;
if (editor->save_as(save_path.value()))
window->set_title(String::format("%s - Font Editor", save_path.value().characters()));
}));
app_menu.add_separator();
app_menu.add_action(GUI::CommonActions::make_quit_action([&](auto&) {
app->quit();