X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Futil%2Fcustomwidgets.cpp;h=ba58004ae9520e00ba6752e4ccf39924e72056f1;hb=9e9b88590430f51228ad3f0c72d219543ca1e1f0;hp=cd30fb547406d8ab5b61aa8c49aaa120e17133f2;hpb=f6857c6a31f40a49859972e483bfdec57cb8861b;p=vlc diff --git a/modules/gui/qt4/util/customwidgets.cpp b/modules/gui/qt4/util/customwidgets.cpp index cd30fb5474..ba58004ae9 100644 --- a/modules/gui/qt4/util/customwidgets.cpp +++ b/modules/gui/qt4/util/customwidgets.cpp @@ -3,7 +3,7 @@ **************************************************************************** * Copyright (C) 2006 the VideoLAN team * Copyright (C) 2004 Daniel Molkentin - * $Id: qvlcframe.hpp 16283 2006-08-17 18:16:09Z zorglub $ + * $Id$ * * Authors: Clément Stenac * The "ClickLineEdit" control is based on code by Daniel Molkentin @@ -21,15 +21,19 @@ * * 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. + *****************************************************************************/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include "customwidgets.hpp" #include #include -#include #include #include #include +#include #include @@ -55,9 +59,9 @@ void ClickLineEdit::setText( const QString &txt ) void ClickLineEdit::paintEvent( QPaintEvent *pe ) { - QPainter p( this ); QLineEdit::paintEvent( pe ); if ( mDrawClickMsg == true && !hasFocus() ) { + QPainter p( this ); QPen tmp = p.pen(); p.setPen( palette().color( QPalette::Disabled, QPalette::Text ) ); QRect cr = contentsRect(); @@ -65,6 +69,7 @@ void ClickLineEdit::paintEvent( QPaintEvent *pe ) cr.setLeft( cr.left() + 3 ); p.drawText( cr, Qt::AlignLeft | Qt::AlignVCenter, mClickMessage ); p.setPen( tmp ); + p.end(); } } @@ -74,7 +79,6 @@ void ClickLineEdit::dropEvent( QDropEvent *ev ) QLineEdit::dropEvent( ev ); } - void ClickLineEdit::focusInEvent( QFocusEvent *ev ) { if ( mDrawClickMsg == true ) { @@ -84,7 +88,6 @@ void ClickLineEdit::focusInEvent( QFocusEvent *ev ) QLineEdit::focusInEvent( ev ); } - void ClickLineEdit::focusOutEvent( QFocusEvent *ev ) { if ( text().isEmpty() ) { @@ -143,6 +146,13 @@ 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_VolumeMute, KEY_VOLUME_MUTE ); + 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,8 +167,22 @@ 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 ) { + const char *base = KeyToString (val & ~KEY_MODIFIER); + QString r = ""; if( val & KEY_MODIFIER_CTRL ) r+= "Ctrl+"; @@ -167,13 +191,6 @@ QString VLCKeyToString( int val ) if( val & KEY_MODIFIER_SHIFT ) r+= "Shift+"; - unsigned int i_keys = sizeof(vlc_keys)/sizeof(key_descriptor_t); - for( unsigned int i = 0; i< i_keys; i++ ) - { - if( vlc_keys[i].i_key_code == (val& ~KEY_MODIFIER) ) - { - r+= vlc_keys[i].psz_key_string; - } - } - return r; + return r + (base ? base : "Unset"); } +