mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
PixelPaint: Add list of recently opened files to the file menu
This commit is contained in:
parent
4accc6a61f
commit
4fd12b6b79
2 changed files with 10 additions and 0 deletions
|
@ -264,6 +264,14 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
|
||||||
|
|
||||||
TRY(file_menu->try_add_separator());
|
TRY(file_menu->try_add_separator());
|
||||||
|
|
||||||
|
TRY(file_menu->add_recent_files_list([&](auto& action) {
|
||||||
|
auto path = action.text();
|
||||||
|
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(&window, path);
|
||||||
|
if (response.is_error())
|
||||||
|
return;
|
||||||
|
open_image(response.release_value());
|
||||||
|
}));
|
||||||
|
|
||||||
m_close_image_action = GUI::Action::create("&Close Image", { Mod_Ctrl, Key_W }, g_icon_bag.close_image, [&](auto&) {
|
m_close_image_action = GUI::Action::create("&Close Image", { Mod_Ctrl, Key_W }, g_icon_bag.close_image, [&](auto&) {
|
||||||
auto* active_widget = m_tab_widget->active_widget();
|
auto* active_widget = m_tab_widget->active_widget();
|
||||||
VERIFY(active_widget);
|
VERIFY(active_widget);
|
||||||
|
@ -1174,6 +1182,7 @@ void MainWidget::open_image(FileSystemAccessClient::File file)
|
||||||
editor.set_path(file.filename().to_deprecated_string());
|
editor.set_path(file.filename().to_deprecated_string());
|
||||||
editor.set_unmodified();
|
editor.set_unmodified();
|
||||||
m_layer_list_widget->set_image(&image);
|
m_layer_list_widget->set_image(&image);
|
||||||
|
GUI::Application::the()->set_most_recently_open_file(file.filename());
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<void> MainWidget::create_default_image()
|
ErrorOr<void> MainWidget::create_default_image()
|
||||||
|
|
|
@ -25,6 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
auto app = TRY(GUI::Application::try_create(arguments));
|
auto app = TRY(GUI::Application::try_create(arguments));
|
||||||
Config::pledge_domain("PixelPaint");
|
Config::pledge_domain("PixelPaint");
|
||||||
|
app->set_config_domain(TRY(String::from_utf8("PixelPaint"sv)));
|
||||||
|
|
||||||
StringView image_file;
|
StringView image_file;
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue