From 79de1a33cf9b512211c818a23d791e4c38ffbf76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20ASLIT=C3=9CRK?= Date: Thu, 18 Jun 2020 00:25:57 +0300 Subject: [PATCH] QuickShow: Add a new "Set as desktop wallpaper" action under Image menu --- Applications/QuickShow/main.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Applications/QuickShow/main.cpp b/Applications/QuickShow/main.cpp index 2146b92c4a1fb8..d1c1415d5924a7 100644 --- a/Applications/QuickShow/main.cpp +++ b/Applications/QuickShow/main.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -47,14 +48,14 @@ int main(int argc, char** argv) { - if (pledge("stdio shared_buffer accept cpath rpath unix cpath fattr proc exec thread", nullptr) < 0) { + if (pledge("stdio shared_buffer accept cpath rpath wpath unix cpath fattr proc exec thread", nullptr) < 0) { perror("pledge"); return 1; } GUI::Application app(argc, argv); - if (pledge("stdio shared_buffer accept cpath rpath proc exec thread", nullptr) < 0) { + if (pledge("stdio shared_buffer accept cpath rpath wpath proc exec thread", nullptr) < 0) { perror("pledge"); return 1; } @@ -174,6 +175,11 @@ int main(int argc, char** argv) widget.flip(Gfx::Orientation::Horizontal); }); + auto desktop_wallpaper_action = GUI::Action::create("Set as desktop wallpaper", + [&](auto&) { + GUI::Desktop::the().set_wallpaper(widget.path()); + }); + auto go_first_action = GUI::Action::create("First", { Mod_None, Key_Home }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-first.png"), [&](auto&) { widget.navigate(QSWidget::Directions::First); @@ -249,6 +255,8 @@ int main(int argc, char** argv) image_menu.add_action(rotate_right_action); image_menu.add_action(vertical_flip_action); image_menu.add_action(horizontal_flip_action); + image_menu.add_separator(); + image_menu.add_action(desktop_wallpaper_action); auto& navigate_menu = menubar->add_menu("Navigate"); navigate_menu.add_action(go_first_action);