Create new "Zoom to 100%" action
ClosedPublic

Authored by ngraham on Oct 21 2018, 4:03 AM.

Details

Summary

This patch implements a "Zoom to 100%" action and sticks it in the View menu. Since it's a KStandardAction with a KStandardShortcut, we automatically get the correct icon and keyboard shortcut, but we do override the name to be "Zoom to 100%" since that's clearer for Okular's use case.

FEATURE: 400048
FIXED-IN: 18.12.0

Test Plan
  • Action works to zoom the document to 100% scale when invoked
  • Action is disabled when document is opened at 100% scale or is manually zoomed to 100% scale after being opened
  • All other zoom modes and action still work

Diff Detail

Repository
R223 Okular
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ngraham created this revision.Oct 21 2018, 4:03 AM
Restricted Application added a project: Okular. · View Herald TranscriptOct 21 2018, 4:03 AM
Restricted Application added a subscriber: okular-devel. · View Herald Transcript
ngraham requested review of this revision.Oct 21 2018, 4:03 AM
ngraham edited the test plan for this revision. (Show Details)Oct 21 2018, 4:04 AM
aacid added a subscriber: aacid.Oct 21 2018, 8:53 AM

I would argue we should leave this out of the menus, if people want to use the mouse to activate this they probably will just use the zoom combo in the toolbar.

ui/pageview.cpp
488

Please use the new connect syntax

ngraham updated this revision to Diff 44028.Oct 21 2018, 3:42 PM
ngraham marked an inline comment as done.

Use new slot syntax

ngraham added a comment.EditedOct 21 2018, 4:23 PM

I would prefer to leave it in the main menu. The whole purpose of an app's main menu is to expose all functionality in a visible manner--especially if that functionality has a keyboard shortcut, since the menu becomes the only way for the user to see and learn the shortcut. In this way, menus aren't just for mouse only-use; they're actually teaching tools that help people become proficient at using the keyboard for faster use. See the relevant HIG page: https://hig.kde.org/components/navigation/menubar.html

  • Assign shortcut keys to the most frequently used menu items. Use KStandardAction and KStandardShortcut items for common functions, which will result in menu items automatically receiving consistent names, icons, and shortcut keys.
  • Any tool or function that is accessible using a keyboard shortcut must have an item in the menu bar so that people can discover the shortcut.
aacid added a comment.Oct 21 2018, 4:49 PM

I would prefer to leave it in the main menu. The whole purpose of an app's main menu is to expose all functionality in a visible manner--especially if that functionality has a keyboard shortcut, since the menu becomes the only way for the user to see and learn the shortcut.

What is the configure shortcuts dialog for? to configure how well done you want your hamburgers?

I would prefer to leave it in the main menu. The whole purpose of an app's main menu is to expose all functionality in a visible manner--especially if that functionality has a keyboard shortcut, since the menu becomes the only way for the user to see and learn the shortcut.

What is the configure shortcuts dialog for? to configure how well done you want your hamburgers?

It's for configuring shortcuts, not for learning them through use. That's a feature of the main menu bar.

I don't appreciate the attitude here, Albert. Let's try to keep it technical.

aacid added a comment.Oct 21 2018, 5:22 PM

I would prefer to leave it in the main menu. The whole purpose of an app's main menu is to expose all functionality in a visible manner--especially if that functionality has a keyboard shortcut, since the menu becomes the only way for the user to see and learn the shortcut.

What is the configure shortcuts dialog for? to configure how well done you want your hamburgers?

It's for configuring shortcuts, not for learning them through use. That's a feature of the main menu bar.

I disagree.

Let's try to keep it technical.

There's nothing technical in "i think this action should be/not be on the menu bar", we can call it philosophical if you want.

FWIW we have already quite some shorcuts that are not in the menubar because they only would clutter it, normal people don't need to know about them and if you're and advanced user you can learn them either in the handbook or in the configure shortcuts dialog.

ngraham added a reviewer: VDG.Oct 21 2018, 5:55 PM

One of the purposes of a menu bar is to teach users keyboard shortcuts. That's the reason why menu items have shortcuts listed next to them, and why tools with shortcuts have menu items. This isn't a philosophical position, it's a statement of fact regarding what menu bars are for.

I really don't see what's such a big problem with this. Adding VDG, since one of the reasons why that group exists is to help us resolve disputes of this nature.

abetts added a subscriber: abetts.Oct 21 2018, 8:36 PM

+1

I think there "could' be variations of this like

Show original size

Maybe?

veqz added a subscriber: veqz.Oct 22 2018, 9:57 PM

I'm in favour of adding this. I'm generally a fan of «completeness», and often like to know I have «reset» the zoom level. I'd think that as a standard, if the menu contains «Zoom In» and «Zoom Out» options, it really should include a «reset»/«Zoom to 100%» option as well.

Furthermore, I just played around with Okular, and found that there is no hint whatsoever of which keyboard shortcuts to use to Zoom except for looking in the menu. So a «Zoom to 100%» would be a good thing to add for that reason as well.

One thing though: Has any thought been put into whether «Zoom to 100%» should be located below «Zoom In» and «Zoom Out», or between those two?

I maintain that it is useful to have items in the main menu so that users can always discover functionality irrespective of the toolbar state, and learn keyboard shortcuts without having to show a separate window.

How do we proceed here? Any other Okular or VDG folks want to weigh in? @sander and/or @tobiasdeiminger? Any thoughts?

In D16345#347365, @veqz wrote:

One thing though: Has any thought been put into whether «Zoom to 100%» should be located below «Zoom In» and «Zoom Out», or between those two?

No objection to either one; I'll go with the consensus view. However I do note that Konsole does puts the equivalent option in between:

I think, this action should be in the menu, under “Zoom in” and “Zoom out”. That’s the way I learn about available actions, when I customize my toolbars.

I think, “Zoom in” and “Zoom out” are more related than “Zoom in” and “Reset zoom*, so I wouldn’t expect it to be in between.

Okay, we now have two people personally confirming my assertion that users look in the menus to find functionality and learn keyboard shortcuts. I would like to land this feature for Okular 18.12.0 if there are no blocking objections.

This revision is now accepted and ready to land.Oct 27 2018, 2:41 PM
This revision was automatically updated to reflect the committed changes.