Commit 230b1c05 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - MainInterface, avoid the bug that makes the popupMenu toggle the TimeDisplay().

parent 4d9d3b9b
...@@ -186,7 +186,7 @@ public: ...@@ -186,7 +186,7 @@ public:
virtual ~VolumeClickHandler() {}; virtual ~VolumeClickHandler() {};
bool eventFilter( QObject *obj, QEvent *e ) bool eventFilter( QObject *obj, QEvent *e )
{ {
if (e->type() == QEvent::MouseButtonPress ) if (e->type() == QEvent::MouseButtonPress )
{ {
aout_VolumeMute( p_intf, NULL ); aout_VolumeMute( p_intf, NULL );
audio_volume_t i_volume; audio_volume_t i_volume;
...@@ -201,6 +201,18 @@ private: ...@@ -201,6 +201,18 @@ private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
}; };
#include <QLabel>
#include <QMouseEvent>
class TimeLabel : public QLabel
{
Q_OBJECT
void mousePressEvent( QMouseEvent *event )
{
if( event->button() == Qt::LeftButton ) emit timeLabelClicked();
}
signals:
void timeLabelClicked();
};
/******************** Playlist Widgets ****************/ /******************** Playlist Widgets ****************/
#include <QModelIndex> #include <QModelIndex>
......
...@@ -137,7 +137,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -137,7 +137,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
* TODO: do we add a label for the current Volume ? * TODO: do we add a label for the current Volume ?
**/ **/
b_remainingTime = false; b_remainingTime = false;
timeLabel = new QLabel; timeLabel = new TimeLabel;
nameLabel = new QLabel; nameLabel = new QLabel;
speedLabel = new QLabel( "1.00x" ); speedLabel = new QLabel( "1.00x" );
timeLabel->setFrameStyle( QFrame::Sunken | QFrame::Panel ); timeLabel->setFrameStyle( QFrame::Sunken | QFrame::Panel );
...@@ -147,7 +147,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -147,7 +147,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
statusBar()->addPermanentWidget( timeLabel, 2 ); statusBar()->addPermanentWidget( timeLabel, 2 );
speedLabel->setContextMenuPolicy ( Qt::CustomContextMenu ); speedLabel->setContextMenuPolicy ( Qt::CustomContextMenu );
timeLabel->setContextMenuPolicy ( Qt::CustomContextMenu ); timeLabel->setContextMenuPolicy ( Qt::CustomContextMenu );
timeLabel->installEventFilter( this ); CONNECT( timeLabel, timeLabelClicked(), this, toggleTimeDisplay() );
CONNECT( speedLabel, customContextMenuRequested( QPoint ), CONNECT( speedLabel, customContextMenuRequested( QPoint ),
this, showSpeedMenu( QPoint ) ); this, showSpeedMenu( QPoint ) );
CONNECT( timeLabel, customContextMenuRequested( QPoint ), CONNECT( timeLabel, customContextMenuRequested( QPoint ),
...@@ -675,6 +675,7 @@ void MainInterface::setDisplayPosition( float pos, int time, int length ) ...@@ -675,6 +675,7 @@ void MainInterface::setDisplayPosition( float pos, int time, int length )
void MainInterface::toggleTimeDisplay() void MainInterface::toggleTimeDisplay()
{ {
msg_Dbg( p_intf, "coincoin" );
b_remainingTime = ( b_remainingTime ? false : true ); b_remainingTime = ( b_remainingTime ? false : true );
} }
...@@ -697,7 +698,7 @@ void MainInterface::setStatus( int status ) ...@@ -697,7 +698,7 @@ void MainInterface::setStatus( int status )
void MainInterface::setRate( int rate ) void MainInterface::setRate( int rate )
{ {
QString str; QString str;
str.setNum( ( 1000/(double)rate), 'f', 2 ); str.setNum( ( 1000 / (double)rate), 'f', 2 );
str.append( "x" ); str.append( "x" );
speedLabel->setText( str ); speedLabel->setText( str );
speedControl->updateControls( rate ); speedControl->updateControls( rate );
...@@ -932,12 +933,6 @@ void MainInterface::customEvent( QEvent *event ) ...@@ -932,12 +933,6 @@ void MainInterface::customEvent( QEvent *event )
} }
} }
bool MainInterface::eventFilter(QObject *obj, QEvent *event)
{
if( (obj == timeLabel) && (event->type() == QEvent::MouseButtonPress) ) toggleTimeDisplay();
}
void MainInterface::keyPressEvent( QKeyEvent *e ) void MainInterface::keyPressEvent( QKeyEvent *e )
{ {
int i_vlck = qtEventToVLCKey( e ); int i_vlck = qtEventToVLCKey( e );
......
...@@ -72,8 +72,6 @@ protected: ...@@ -72,8 +72,6 @@ protected:
void dragLeaveEvent( QDragLeaveEvent * ); void dragLeaveEvent( QDragLeaveEvent * );
void closeEvent( QCloseEvent *); void closeEvent( QCloseEvent *);
bool eventFilter(QObject *obj, QEvent *event);
friend class VolumeClickHandler; friend class VolumeClickHandler;
private: private:
QSettings *settings; QSettings *settings;
......
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