#491 Customize mouse actions on tray icon and support mouse wheel

open
nobody
None
5
2014-07-24
2012-11-04
No

Here is a patch I made that adds two features that I miss in SMPlayer :
- support the mouse wheel on tray icon (X11 only), either to change volume or current track
- customize mouse actions on tray icon, so that the left click and middle click can be changed to do different things (mute/unmute, play/pause, show/hide)

You can see how it works in the attached capture. It shows the default settings.

Click actions can be set to :
- Do nothing
- Play/Pause
- Show/Hide
- Mute/Unmute

Mouse wheel options are :
- Do nothing
- Volume up/down
- Next/previous track

The mouse wheel combo is greyed out on non-X11 platforms (Mac OS X, Windows, etc.). The customization should work as expected though.

Technical details :
- To ease the synchronization betwen the preferences dialog and the options menu ("Show icon in system tray"), the show_icon_tray setting is added to class Preferences, and changed whenever the checkbox is changed in the menu through a new slot, BaseGuiPlus::setTrayVisibility().
- The preferences dialog's applied() signal is now connected to a new slot, BaseGui::handlePreferences(), which will read the update pref and call applyNewPreferences(), so that we can properly subclass applyNewPreferences() in BaseGuiPlus to update tray settings.
- Qt requires us to subclass QSystemTrayIcon to handle mouse wheel events, which is done in class MyTrayIcon. It provides an additional signal wheel() to report for mouse wheel events.

Discussion

  • Niels Martignène

    Here is a new patch, updated for SMPlayer 14.3.0 and with a couple of other fixes too.

     
  • Ricardo Villalba

    I've just tested your patch, in gnome classic and unity. Unfortunately your patch doesn't work. Clicking and right clicking just open the popup menu. The mouse wheel does nothing. I guess the mouse events are not arriving to the tray icon.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks