diff options
author | Hüseyin ASLITÜRK <asliturk@hotmail.com> | 2020-06-18 00:25:57 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-18 23:18:11 +0200 |
commit | 79de1a33cf9b512211c818a23d791e4c38ffbf76 (patch) | |
tree | fe16cc3dab82ca26cc8ce46b8c64269adb433083 | |
parent | 12671e38e7e901f209038fcf3dc557e8023228cf (diff) | |
download | serenity-79de1a33cf9b512211c818a23d791e4c38ffbf76.zip |
QuickShow: Add a new "Set as desktop wallpaper" action under Image menu
-rw-r--r-- | Applications/QuickShow/main.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Applications/QuickShow/main.cpp b/Applications/QuickShow/main.cpp index 2146b92c4a..d1c1415d59 100644 --- a/Applications/QuickShow/main.cpp +++ b/Applications/QuickShow/main.cpp @@ -32,6 +32,7 @@ #include <LibGUI/Action.h> #include <LibGUI/Application.h> #include <LibGUI/BoxLayout.h> +#include <LibGUI/Desktop.h> #include <LibGUI/FilePicker.h> #include <LibGUI/Label.h> #include <LibGUI/Menu.h> @@ -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); |