]> git.sesse.net Git - vlc/commitdiff
Qt4 - MI: Install an event filter to make click on timeLabel automatically switch...
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 8 Sep 2007 02:00:20 +0000 (02:00 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 8 Sep 2007 02:00:20 +0000 (02:00 +0000)
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp

index e531b8ab813ae4b1ae6f9974ae70f8bea7956703..e2248c0225e38bc460639be56f9d7bf46f867bb8 100644 (file)
@@ -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 );
index 7106b0fbd243466a05996685bd2452a5c32ca0e0..797ce02b4b661ffe3c0e0b24372e923e7bb084c0 100644 (file)
@@ -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