Avidemux Forum

Participate => User interface and Usability => Topic started by: butterw on January 28, 2021, 02:43:54 PM

Title: Hotkeys, Seeking & GUI preferences
Post by: butterw on January 28, 2021, 02:43:54 PM
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.
Title: Re: GUI preferences and Hotkeys
Post by: butterw on March 04, 2021, 09:26:16 AM
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.

Title: Re: GUI preferences and Hotkeys
Post by: butterw on March 04, 2021, 10:13:14 AM
# 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.
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: butterw on March 04, 2021, 03:25:05 PM
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 ?
 
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: butterw on March 04, 2021, 03:53:34 PM
#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. (https://github.com/mean00/avidemux2/blob/ee6303ce99d6ab2193ecead99341b3a1a72ef90e/avidemux/common/gui_action.names)
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: eumagga0x2a on March 04, 2021, 03:55:56 PM
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 + ,).
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: eumagga0x2a on March 04, 2021, 03:58:23 PM
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.
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: butterw on March 04, 2021, 05:58:15 PM
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



Title: Re: Hotkeys, Seeking & GUI preferences
Post by: eumagga0x2a on March 04, 2021, 06:18:09 PM
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 (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 (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.
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: butterw on March 04, 2021, 08:30:24 PM
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.


 
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: butterw on March 04, 2021, 10:02:04 PM
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 !
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: butterw on March 05, 2021, 11:16:51 AM
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.
 
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: butterw on March 05, 2021, 10:01:37 PM
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.
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: butterw on March 08, 2021, 05:30:39 PM
#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:
(https://files.videohelp.com/u/295418/adm-bSegments.png)

available here:
https://github.com/butterw/bShaders/tree/master/test_LimitedRange/Avidemux/Settings/Custom
Title: Paste currentTime value in
Post by: butterw on March 10, 2021, 10:39:33 AM
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)
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: eumagga0x2a on March 10, 2021, 05:11:08 PM
The currentTime QLineEdit is read-only because the backend is not fully implemented. No need to touch context menu, it will have all necessary entries by default once the backend is there and the field can be made read-write.
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: signy13 on April 09, 2021, 02:12:22 PM
Quote from: butterw on March 08, 2021, 05:30:39 PMThe only issue is that I cannot associate a hotkey to it.
I also have user scripts I use very often and I made custom keyboard shortcuts for them in a very stupid way with AutoKey scripts (Linux alternative for AutoHotKey on windows).
Example of a script:
keyboard.send_keys("<alt>+c")           # Open menu File
keyboard.send_key("<down>",repeat=3)    # Down X-times
keyboard.send_keys("<enter>")           # Open submenu - Run

With AutoKey settings:

And because I am bad at remembering my shortcuts I just put shortcuts in names of *.py files (separated by spaces) in the Avidemux custom directory so I can see them in the menu like on the screenshot.

It is a very stupid way but it works...
It there was a way how to associate a shortcut with particular custom file (identified simply by filename of filepath inside the custom directory), that would be great.
Title: Re: Hotkeys, Seeking & GUI preferences
Post by: butterw on April 09, 2021, 02:59:26 PM
b&Segments.py puts an accelerator key on S.

On Windows you can use Alt followed by C to open Custom Menu, then S to open the bSegments.py.