Hotkeys, Seeking & GUI preferences

Started by butterw, January 28, 2021, 02:43:54 PM

Previous topic - Next topic

butterw

Hotkeys
configured in settings/config3 file in json format (use_alternate_kbd_shortcuts and swap_up_down_keys are displayed in Edit > Preferences GUI> user Interface)
   "keyboard_shortcuts" : {
      "use_alternate_kbd_shortcuts" : true,
      "swap_up_down_keys" : false,
      "alt_mark_a" : "I",
      "alt_mark_b" : "O",
      "alt_reset_markers" : "R",
      "alt_goto_mark_a" : "A",
      "alt_goto_mark_b" : "B",
      "alt_begin" : "S",
      "alt_end" : "E",
      "alt_delete" : "Delete"
   }

Hotkey configuration and display
- It should be possible to set/clear shortcuts for every (or at least most) Avidemux command (via config3).
- Shortcuts for commands not displayed in the menu are currently hard to discover by the user (seek 1-2-4s hotkeys).

GUI preferences
- It should be possible to configure which toolbars are displayed on startup (ex: do not display Volume toolbar)
- It should be possible to customize toolbar commands/icons without having to recompile Avidemux.

butterw

#1
Most commands have hotkeys and the current configuration system does work.

1) Hotkeys should be added for some commands which do not currently have any:
- Tools > Scripting Shell
- Preferences
- Audio > Select Track, Save Audio
- Project Script: Run, SaveAs

2) The next step would be to make all hotkeys user-configurable.

3) It should be possible to disable a built-in hotkey (by setting it to an empty string, or a special value like None).

4) Finally, if there is a way to do it, it would nice to be able to define hotkeys for scripts in the Auto and Custom Menus.


butterw

#2
# Seeking :
basic seeks
- Frame:         Left/Right
- Keyframe seek: Down/Up (with option to swap to Up/Down)

Time-based jumps/frame seeks :
- 1s seek: Shift+    Left/Right
- 2s seek: Ctrl+       Left/Right
- 4s seek : Ctrl+Shift+   Left/Right
- 60s seek: Ctrl+       Down/Up
The 1 minute seek appears in the GUI (navigation toolbar button), but is defined in the file for the main menu.


1) if possible some rounding should be implemented so that a backwards/forward operation brings back to the same frame. 
2) The seek distances should be user configurable instead of being fixed.
3) It should be possible to disable these hotkeys.
4) there should be an option for longer seeks to be (approximate) keyframe-based.

Go To time (Ctrl+T)
- The interface should allow direct pasting a copied timecode value or a tinyPy pts.

butterw

#3
It seems the main menu shortcuts are defined as Qt Actions in this file:
https://github.com/mean00/avidemux2/blob/cd5833c38d80e6b1890a51000ef3cb2886da00b3/avidemux/common/ADM_commonUI/myOwnMenu.h

On Windows, you can use Alt+Accelerator key to open Menus with, ex: Alt+A for Audio Menu
The limitation of this approach is that it reserves the use of the Alt+A shortcut.
- There is also an Auto Menu: should be changed to "Aut&o"
- Custom Menu: could be changed to "C&ustom"
Based on this, it is maybe not indispensable to define hotkeys for each command. This approach however does not allow the command hotkeys to be customized by the user . It also blocks the use of Alt+key shortcuts.

Alt+T > Scripting Shell
Audio (Alt+A) > "Select Track", "Save audio"


"Pr&eferences" (Alt+E then E) and "Open Application &Log" should have a dedicated shortcuts.
About" could be Ctrl+Shift+F1 if function keys are OK ?
Hotkeys would still be required for the Project Script > Run, SaveAs. The Project menu isn't defined in this file for some reason ?
 

butterw

#4
#User customization of Hotkeys

There was a commit in july 2020 to add support for custom delete hotkey:
https://github.com/mean00/avidemux2/commit/4a14701dab79192df134a5a61e886cfb4e63053a

It doesn't seem difficult to add support for customization of all defined menu hotkeys, is it OK to go ahead with this in v2.8 ?

All the GUI Actions names seem to be listed here.

eumagga0x2a

Quote from: butterw on March 04, 2021, 03:25:05 PMOn Windows, you can use Alt+Accelerator key to open Menus with, ex: Alt+A for Audio Menu
The limitation of this approach is that it reserves the use of the Alt+A shortcut.
- There is also an Auto Menu: should be changed to "Aut&o"
- Custom Menu: could be changed to "C&ustom"

You could submit a patch for the English translation. Fixing this in the source means changing all translations.

Keyboard shortcuts are a scarce resource and changing them turns mostly into a going to Jerusalem game.

Quote from: butterw on March 04, 2021, 03:25:05 PM"Pr&eferences" (Alt+E then E) and "Open Application &Log" should have a dedicated shortcuts.

By the way, the former have a dedicated shortcut on macOS following macOS HIGs (COMMAND + ,).

eumagga0x2a

Quote from: butterw on March 04, 2021, 03:53:34 PMIt doesn't seem difficult to add support for customization of all defined menu hotkeys, is it OK to go ahead with this in v2.7.8 ?

Avidemux is pretty open to contributions, so yes, as long a change is cleanly implemented and can be considered an improvement, if I understood your post correctly.

butterw

#7
A motivation in making all menu hotkeys customizable would be to be able to disable some of them and reuse the key combination.
ex: Save as Image > Save As Bmp (CTRL+M)
This isn't a command I need a hotkey for.
 
Setting a hotkey to "" in config3 seems to just resets it to default. Is there a way for the user to disable an existing hotkey ?

If so, all current menu hotkeys could quite easily be copied to config3 file and made user configurable.

Quote from: eumagga0x2a
Quote from: butterw on March 04, 2021, 03:25:05 PM"Pr&eferences" (Alt+E then E) and "Open Application &Log" should have a dedicated shortcuts.

By the way, the former have a dedicated shortcut on macOS following macOS HIGs (COMMAND + ,).
On windows, Alt+H A L would be required to open "Open Application &Log", so a streamlined user-customizable hotkey is more useful.

The Project Script menu commands are not defined in the same file as the rest:
https://github.com/mean00/avidemux2/blob/39cb241d8e62d20d64ea359a69eb4bbb47749d6a/avidemux/qt4/ADM_userInterfaces/ADM_gui/Q_gui2_menu.cpp
These commands need to have hotkeys by default.

It turns out the correction "&Auto" to "A&uto" actually already exists in English i18n.
https://github.com/mean00/avidemux2_i18n/blob/master/avidemux_en.ts




eumagga0x2a

#8
Quote from: butterw on March 04, 2021, 05:58:15 PMThe Project Script menu commands are not defined in the same file as the rest:
https://github.com/mean00/avidemux2/blob/39cb241d8e62d20d64ea359a69eb4bbb47749d6a/avidemux/qt4/ADM_userInterfaces/ADM_gui/Q_gui2_menu.cpp
These commands need to have hotkeys by default.

The architecture of Avidemux was designed to deal with multiple script engines and also with a complete absence of any as script engines are plugins, which can be missing. For this reason it was impossible to cover script functionality in myOwnMenu.h as all these entries needed to be dynamic.

Quote from: butterw on March 04, 2021, 05:58:15 PMIt turns out the correction "&Auto" to "A&uto" actually already exists in English i18n.
https://github.com/mean00/avidemux2_i18n/blob/master/avidemux_en.ts

Indeed, and I have "Auto" with underscore below "u" when launching Avidemux as

LANG=en_GB.utf8 avidemux
("avidemux" is my custom wrapper for avidemux3_qt5).

Quote from: butterw on March 04, 2021, 05:58:15 PMIs there a way for the user to disable an existing hotkey ?

No, this is not possible yet. In general, my decision to configure alternative keyboard shortcuts via config3 file was taken with simplicity of implementation in mind only. I don't think it is a good thing to let users edit XML files. IMHO this is much more in need of a fix than actual assignment of shortcuts.

butterw

#9
Quote from: eumagga0x2a on March 04, 2021, 06:18:09 PM
Quote from: butterw on March 04, 2021, 05:58:15 PMIs there a way for the user to disable an existing hotkey ?

No, this is not possible yet. In general, my decision to configure alternative keyboard shortcuts via config3 file was taken with simplicity of implementation in mind only. I don't think it is a good thing to let users edit XML files. IMHO this is much more in need of a fix than actual assignment of shortcuts.

Yes, json is fine to store the settings handled by the preferences GUI, but not so good for user editing.

Hotkeys and user editable customizations should be defined in a separate file, using .conf or .ini value pair format.
Avidemux GUI should have defaults, which are overidden by the values for each key defined in the .conf file.


 

butterw

#10
After a bit more testing:
- It is in fact possible to deactivate an existing hotkey by setting it to empty string.
- But some Qt widgets have default hotkeys (ex: the position cursor has HOME/END) which become active when the widget has focus.
- Many key combinations are possible: ex: Shift+F1, Ctrl+Shift+A, =, some keys have names (ex: Home, End)

- Collision can happen !
I tried setting "alt_end" : "Ctrl+A" (the default hotkey for Append.)
"alt_end" is set to [], CTRL+A is displayed in the menu next to Append, but neither fire on Ctrl+A.

Edit: syntax errors in config3 can cause Avidemux not to load at all !

butterw

The GUI code doesn't look too difficult, but it probably does require some C++ skills to do the required changes and code clean-up here.

A dedicated user .conf file would be a more robust and better solution for hotkeys and GUI customizations than putting them in the json GUI preferences file config3.
- This approach would allow user customizations without requiring the addition of a complex GUI interface to handle them.
- It would allow also all current hotkeys/commands to be documented in one place.
 

butterw

Quote from: eumagga0x2a on March 05, 2021, 08:00:54 PMIt matters for me that a GUI behaves consistently and does not startle the user while providing the necessary minimum of feedback and controls. It should not try to automate everything or guess every wish. It should just provide a reasonable way to accomplish usual tasks.

On my GUI-related todo or rather wishlist:

1. Decouple GUI event handling from video rendering, necessary to fix GUI becoming unresponsive when video fps matches display refresh rate. This should also allow to interact with some menus and dialogs like video properties dialog during playback.

2. Allow to paste time in dd:dd:dd.ddd format or as an integer value from clipboard into time chooser when possible and into time display. Desirably, this should be possible also in on-the-fly filter preview too. It looks like this feature was started and abandoned.

3. Rework custom shortcuts configuration backend.

4. Persistent widgets' state across sessions?

5. A custom action button in toolbar maybe?

6. Better accessibility of the interface, especially of the main window.

I have no idea whether I'll succeed even in a single one of these tasks.

A GUI can be tricky to get right. I have some ideas and will try them out with scripts to see what works.
One potentially useful feature for video edits, very under used by the current GUI, is segments. I think much more could be done with this. Generally I would like Avidemux to offer better usability. Customization options are a part of this goal. 

> 5. A custom action button in toolbar maybe?
The two unused black frame search buttons could be reclaimed as customizable action buttons.
I would also suggest the 1min-seek could be made a customizable seek.

butterw

#seek Script

I've done a script which allows to browse keyframes (backward: _ix.py, forward _ixxx.py) with a configurable seek time (ex: 120s). The only issue is that I cannot associate a hotkey to it.

I've also completed a script which allows to browse segments:

bSegments.py:


available here:
https://github.com/butterw/bShaders/tree/master/test_LimitedRange/Avidemux/Settings/Custom

butterw

#14
Quote from: eumagga0x2a on March 05, 2021, 08:00:54 PM2. Allow to paste time in dd:dd:dd.ddd format or as an integer value from clipboard into time chooser when possible and into time display. Desirably, this should be possible also in on-the-fly filter preview too. It looks like this feature was started and abandoned.

Currently currentTime in the main GUI and and the filter preview is a default QLineEdit with the readonly property.
The currentTime value can be copied to the system clipboard (but cannot be pasted into the GUI).
The widget should be customized to provide 2 contextMenu options: Copy and Paste.
This could also replace the Go to time dialog widget which is impractical to use.

from https://doc.qt.io/qt-5/qlineedit.html, If you want to customize the context menu, reimplement this function.
void QLineEdit::contextMenuEvent(QContextMenuEvent *event)