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