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