]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/util/customwidgets.cpp
Qt4 - New kind of volume slider.
[vlc] / modules / gui / qt4 / util / customwidgets.cpp
index cd30fb547406d8ab5b61aa8c49aaa120e17133f2..1fbaec2abc66639cccaf5ce47b2ae12c21394bce 100644 (file)
@@ -21,7 +21,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
 
 #include "customwidgets.hpp"
 #include <QPainter>
@@ -30,6 +31,7 @@
 #include <QColorGroup>
 #include <QRect>
 #include <QKeyEvent>
+#include <QWheelEvent>
 
 #include <vlc_keys.h>
 
@@ -74,7 +76,6 @@ void ClickLineEdit::dropEvent( QDropEvent *ev )
     QLineEdit::dropEvent( ev );
 }
 
-
 void ClickLineEdit::focusInEvent( QFocusEvent *ev )
 {
     if ( mDrawClickMsg == true ) {
@@ -84,7 +85,6 @@ void ClickLineEdit::focusInEvent( QFocusEvent *ev )
     QLineEdit::focusInEvent( ev );
 }
 
-
 void ClickLineEdit::focusOutEvent( QFocusEvent *ev )
 {
     if ( text().isEmpty() ) {
@@ -143,6 +143,12 @@ int qtEventToVLCKey( QKeyEvent *e )
         HANDLE( Key_End, KEY_END );
         HANDLE( Key_Insert, KEY_INSERT );
         HANDLE( Key_Delete, KEY_DELETE );
+        HANDLE( Key_VolumeDown, KEY_VOLUME_DOWN);
+        HANDLE( Key_VolumeUp, KEY_VOLUME_UP );
+        HANDLE( Key_MediaPlay, KEY_MEDIA_PLAY_PAUSE );
+        HANDLE( Key_MediaStop, KEY_MEDIA_STOP );
+        HANDLE( Key_MediaPrevious, KEY_MEDIA_PREV_TRACK );
+        HANDLE( Key_MediaNext, KEY_MEDIA_NEXT_TRACK );
 
     }
     if( !found )
@@ -157,6 +163,18 @@ int qtEventToVLCKey( QKeyEvent *e )
     return i_vlck;
 }
 
+int qtWheelEventToVLCKey( QWheelEvent *e )
+{
+    int i_vlck = 0;
+    /* Handle modifiers */
+    i_vlck |= qtKeyModifiersToVLC( e );
+    if ( e->delta() > 0 )
+        i_vlck |= KEY_MOUSEWHEELUP;
+    else
+        i_vlck |= KEY_MOUSEWHEELDOWN;
+    return i_vlck;
+}
+
 QString VLCKeyToString( int val )
 {
     QString r = "";
@@ -177,3 +195,4 @@ QString VLCKeyToString( int val )
     }
     return r;
 }
+