Commit f6857c6a authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - MouseWheel support - patch by Sergey Volk.

parent 3e54b375
......@@ -551,6 +551,21 @@ void MainInterface::keyPressEvent( QKeyEvent *e )
e->ignore();
}
void MainInterface::wheelEvent( QWheelEvent *e )
{
int i_vlckey = 0;
if ( e->delta() > 0 )
i_vlckey = KEY_MOUSEWHEELUP;
else
i_vlckey = KEY_MOUSEWHEELDOWN;
/* Handle modifiers */
i_vlckey |= qtKeyModifiersToVLC( e );
var_SetInteger( p_intf->p_libvlc, "key-pressed", i_vlckey );
e->accept();
}
void MainInterface::stop()
{
playlist_Stop( THEPL );
......
......@@ -76,6 +76,7 @@ private:
/* Video */
VideoWidget *videoWidget;
virtual void keyPressEvent( QKeyEvent *);
virtual void wheelEvent( QWheelEvent * );
bool embeddedPlaylistWasActive;
bool videoIsActive;
......
......@@ -97,15 +97,21 @@ void ClickLineEdit::focusOutEvent( QFocusEvent *ev )
/***************************************************************************
* Hotkeys converters
***************************************************************************/
int qtKeyModifiersToVLC( QInputEvent* e )
{
int i_keyModifiers = 0;
if( e->modifiers() & Qt::ShiftModifier ) i_keyModifiers |= KEY_MODIFIER_SHIFT;
if( e->modifiers() & Qt::AltModifier ) i_keyModifiers |= KEY_MODIFIER_ALT;
if( e->modifiers() & Qt::ControlModifier ) i_keyModifiers |= KEY_MODIFIER_CTRL;
if( e->modifiers() & Qt::MetaModifier ) i_keyModifiers |= KEY_MODIFIER_META;
return i_keyModifiers;
}
int qtEventToVLCKey( QKeyEvent *e )
{
int i_vlck = 0;
/* Handle modifiers */
if( e->modifiers()& Qt::ShiftModifier ) i_vlck |= KEY_MODIFIER_SHIFT;
if( e->modifiers()& Qt::AltModifier ) i_vlck |= KEY_MODIFIER_ALT;
if( e->modifiers()& Qt::ControlModifier ) i_vlck |= KEY_MODIFIER_CTRL;
if( e->modifiers()& Qt::MetaModifier ) i_vlck |= KEY_MODIFIER_META;
i_vlck |= qtKeyModifiersToVLC( e );
bool found = false;
/* Look for some special keys */
......
......@@ -88,5 +88,6 @@ signals:
class QKeyEvent;
int qtEventToVLCKey( QKeyEvent *e );
QString VLCKeyToString( int val );
int qtKeyModifiersToVLC( QInputEvent* e );
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment