summaryrefslogtreecommitdiff
path: root/Userland/Applications/ImageViewer/main.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-05-15 20:35:52 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-15 20:36:41 +0200
commit19a696e397f12e3b2e346b32d24131fa3b165bcd (patch)
treeb85dfbaa09b02400a5b7a0d5faef81262eb16091 /Userland/Applications/ImageViewer/main.cpp
parentc6b44e215a98bc2de8f155d2441a870b722bc7ed (diff)
downloadserenity-19a696e397f12e3b2e346b32d24131fa3b165bcd.zip
ImageViewer: Use GUI::CommonActions for zoom related actions
Diffstat (limited to 'Userland/Applications/ImageViewer/main.cpp')
-rw-r--r--Userland/Applications/ImageViewer/main.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp
index 9bd88b618d..6475590927 100644
--- a/Userland/Applications/ImageViewer/main.cpp
+++ b/Userland/Applications/ImageViewer/main.cpp
@@ -210,20 +210,23 @@ int main(int argc, char** argv)
widget.on_doubleclick();
});
- auto zoom_in_action = GUI::Action::create("Zoom &In", { Mod_None, Key_Plus }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-in.png"),
+ auto zoom_in_action = GUI::CommonActions::make_zoom_in_action(
[&](auto&) {
widget.set_scale(widget.scale() + 10);
- });
+ },
+ window);
- auto zoom_reset_action = GUI::Action::create("Zoom to &100%", { Mod_None, Key_0 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-reset.png"),
+ auto reset_zoom_action = GUI::CommonActions::make_reset_zoom_action(
[&](auto&) {
widget.set_scale(100);
- });
+ },
+ window);
- auto zoom_out_action = GUI::Action::create("Zoom &Out", { Mod_None, Key_Minus }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-out.png"),
+ auto zoom_out_action = GUI::CommonActions::make_zoom_out_action(
[&](auto&) {
widget.set_scale(widget.scale() - 10);
- });
+ },
+ window);
auto hide_show_toolbar_action = GUI::Action::create("Hide/Show &Toolbar", { Mod_Ctrl, Key_T },
[&](auto&) {
@@ -244,7 +247,7 @@ int main(int argc, char** argv)
main_toolbar.add_action(go_last_action);
main_toolbar.add_separator();
main_toolbar.add_action(zoom_in_action);
- main_toolbar.add_action(zoom_reset_action);
+ main_toolbar.add_action(reset_zoom_action);
main_toolbar.add_action(zoom_out_action);
auto menubar = GUI::Menubar::construct();
@@ -273,7 +276,7 @@ int main(int argc, char** argv)
view_menu.add_action(full_sceen_action);
view_menu.add_separator();
view_menu.add_action(zoom_in_action);
- view_menu.add_action(zoom_reset_action);
+ view_menu.add_action(reset_zoom_action);
view_menu.add_action(zoom_out_action);
view_menu.add_separator();
view_menu.add_action(hide_show_toolbar_action);