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

Qt4 - MI: Install an event filter to make click on timeLabel automatically switch between modes.

parent d3a76dfe
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#ifdef WIN32 #ifdef WIN32
#define PREF_W 410 #define PREF_W 410
#define PREF_H 151 #define PREF_H 121
#else #else
#define PREF_W 450 #define PREF_W 450
#define PREF_H 160 #define PREF_H 160
...@@ -145,7 +145,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -145,7 +145,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( speedLabel, customContextMenuRequested( QPoint ), CONNECT( speedLabel, customContextMenuRequested( QPoint ),
this, showSpeedMenu( QPoint ) ); this, showSpeedMenu( QPoint ) );
CONNECT( timeLabel, customContextMenuRequested( QPoint ), CONNECT( timeLabel, customContextMenuRequested( QPoint ),
...@@ -275,6 +275,7 @@ void MainInterface::setVLCWindowsTitle( QString aTitle ) ...@@ -275,6 +275,7 @@ void MainInterface::setVLCWindowsTitle( QString aTitle )
} }
} }
void MainInterface::handleMainUi( QSettings *settings ) void MainInterface::handleMainUi( QSettings *settings )
{ {
/* Create the main Widget and the mainLayout */ /* Create the main Widget and the mainLayout */
...@@ -664,7 +665,7 @@ void MainInterface::setDisplay( float pos, int time, int length ) ...@@ -664,7 +665,7 @@ void MainInterface::setDisplay( float pos, int time, int length )
else timeLabel->setText( " "+title+" " ); else timeLabel->setText( " "+title+" " );
} }
void MainInterface::toggleTimeDisplay( bool b_remain = false ) void MainInterface::toggleTimeDisplay()
{ {
b_remainingTime = ( b_remainingTime ? false : true ); b_remainingTime = ( b_remainingTime ? false : true );
} }
...@@ -803,7 +804,7 @@ void MainInterface::updateSystrayTooltipName( QString name ) ...@@ -803,7 +804,7 @@ void MainInterface::updateSystrayTooltipName( QString name )
else else
{ {
sysTray->setToolTip( name ); sysTray->setToolTip( name );
if( notificationEnabled && ( isHidden() || isMinimized() ) ) if( notificationEnabled )
{ {
sysTray->showMessage( qtr( "VLC media player" ), name, sysTray->showMessage( qtr( "VLC media player" ), name,
QSystemTrayIcon::NoIcon, 4000 ); QSystemTrayIcon::NoIcon, 4000 );
...@@ -910,6 +911,12 @@ void MainInterface::customEvent( QEvent *event ) ...@@ -910,6 +911,12 @@ 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 );
......
...@@ -70,6 +70,9 @@ protected: ...@@ -70,6 +70,9 @@ protected:
void dragMoveEvent( QDragMoveEvent * ); void dragMoveEvent( QDragMoveEvent * );
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;
...@@ -129,7 +132,7 @@ private slots: ...@@ -129,7 +132,7 @@ private slots:
void setName( QString ); void setName( QString );
void setVLCWindowsTitle( QString title = "" ); void setVLCWindowsTitle( QString title = "" );
void setDisplay( float, int, int ); void setDisplay( float, int, int );
void toggleTimeDisplay( bool ); void toggleTimeDisplay();
void setElapsedTime(); void setElapsedTime();
void setRemainTime(); void setRemainTime();
#if 0 #if 0
......
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