Commit 6ad5c698 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: forward video key presses to main interface for processing

parent 25bbccd3
...@@ -59,6 +59,22 @@ static void videoSync( void ) ...@@ -59,6 +59,22 @@ static void videoSync( void )
#include <math.h> #include <math.h>
class ReparentableWidget : public QWidget
{
private:
VideoWidget *owner;
public:
ReparentableWidget( VideoWidget *owner ) : owner( owner )
{
}
protected:
void keyPressEvent( QKeyEvent *e )
{
emit owner->keyPressed( e );
}
};
/********************************************************************** /**********************************************************************
* Video Widget. A simple frame on which video is drawn * Video Widget. A simple frame on which video is drawn
* This class handles resize issues * This class handles resize issues
...@@ -112,7 +128,7 @@ WId VideoWidget::request( int *pi_x, int *pi_y, ...@@ -112,7 +128,7 @@ WId VideoWidget::request( int *pi_x, int *pi_y,
* reparentable widget, that will be within the VideoWidget in windowed * reparentable widget, that will be within the VideoWidget in windowed
* mode, and within the root window (NULL parent) in full-screen mode. * mode, and within the root window (NULL parent) in full-screen mode.
*/ */
reparentable = new QWidget(); reparentable = new ReparentableWidget( this );
QLayout *innerLayout = new QHBoxLayout( reparentable ); QLayout *innerLayout = new QHBoxLayout( reparentable );
innerLayout->setContentsMargins( 0, 0, 0, 0 ); innerLayout->setContentsMargins( 0, 0, 0, 0 );
......
...@@ -48,12 +48,13 @@ class QPalette; ...@@ -48,12 +48,13 @@ class QPalette;
class QPixmap; class QPixmap;
class QHBoxLayout; class QHBoxLayout;
class QMenu; class QMenu;
class ReparentableWidget;
/******************** Video Widget ****************/ /******************** Video Widget ****************/
class VideoWidget : public QFrame class VideoWidget : public QFrame
{ {
Q_OBJECT Q_OBJECT
friend class MainInterface; friend class ReparentableWidget;
public: public:
VideoWidget( intf_thread_t * ); VideoWidget( intf_thread_t * );
...@@ -79,6 +80,9 @@ private: ...@@ -79,6 +80,9 @@ private:
QWidget *reparentable; QWidget *reparentable;
QLayout *layout; QLayout *layout;
signals:
void keyPressed( QKeyEvent * );
public slots: public slots:
void SetSizing( unsigned int, unsigned int ); void SetSizing( unsigned int, unsigned int );
void SetFullScreen( bool ); void SetFullScreen( bool );
......
...@@ -230,6 +230,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -230,6 +230,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
videoWidget, SetSizing( unsigned int, unsigned int ) ); videoWidget, SetSizing( unsigned int, unsigned int ) );
CONNECT( this, askVideoSetFullScreen( bool ), CONNECT( this, askVideoSetFullScreen( bool ),
videoWidget, SetFullScreen( bool ) ); videoWidget, SetFullScreen( bool ) );
CONNECT( videoWidget, keyPressed( QKeyEvent * ),
this, handleKeyPress( QKeyEvent * ) );
} }
CONNECT( this, askUpdate(), this, doComponentsUpdate() ); CONNECT( this, askUpdate(), this, doComponentsUpdate() );
...@@ -1201,6 +1203,11 @@ void MainInterface::customEvent( QEvent *event ) ...@@ -1201,6 +1203,11 @@ void MainInterface::customEvent( QEvent *event )
} }
void MainInterface::keyPressEvent( QKeyEvent *e ) void MainInterface::keyPressEvent( QKeyEvent *e )
{
handleKeyPress( e );
}
void MainInterface::handleKeyPress( QKeyEvent *e )
{ {
if( ( e->modifiers() & Qt::ControlModifier ) && ( e->key() == Qt::Key_H ) if( ( e->modifiers() & Qt::ControlModifier ) && ( e->key() == Qt::Key_H )
&& !menuBar()->isVisible() ) && !menuBar()->isVisible() )
......
...@@ -178,6 +178,9 @@ private slots: ...@@ -178,6 +178,9 @@ private slots:
void updateSystrayTooltipStatus( int ); void updateSystrayTooltipStatus( int );
void showCryptedLabel( bool ); void showCryptedLabel( bool );
void handleKeyPress( QKeyEvent * );
signals: signals:
void askGetVideo( WId *p_id, int *pi_x, int *pi_y, void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
unsigned int *pi_width, unsigned int *pi_height ); unsigned int *pi_width, unsigned int *pi_height );
......
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