vlc | branch: master | Francois Cartegnie <[email protected]> | Wed Feb 15 
17:27:38 2012 +0100| [a587c752dc76d7e5c3e6f0d8234d9604141f706e] | committer: 
Francois Cartegnie

Qt: trigger epg on program doubleclick

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a587c752dc76d7e5c3e6f0d8234d9604141f706e
---

 modules/gui/qt4/components/interface_widgets.cpp |    2 +-
 modules/gui/qt4/components/interface_widgets.hpp |   19 +++++++++++++++----
 modules/gui/qt4/main_interface.cpp               |    5 +++--
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp 
b/modules/gui/qt4/components/interface_widgets.cpp
index 419b5e6..6833cc6 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -550,7 +550,7 @@ void CoverArtLabel::askForUpdate()
 }
 
 TimeLabel::TimeLabel( intf_thread_t *_p_intf, TimeLabel::Display _displayType  
)
-    : QLabel(), p_intf( _p_intf ), bufTimer( new QTimer(this) ),
+    : ClickableQLabel(), p_intf( _p_intf ), bufTimer( new QTimer(this) ),
       buffering( false ), showBuffering(false), bufVal( -1 ), displayType( 
_displayType )
 {
     b_remainingTime = false;
diff --git a/modules/gui/qt4/components/interface_widgets.hpp 
b/modules/gui/qt4/components/interface_widgets.hpp
index cd95276..6251d46 100644
--- a/modules/gui/qt4/components/interface_widgets.hpp
+++ b/modules/gui/qt4/components/interface_widgets.hpp
@@ -118,7 +118,20 @@ private slots:
 };
 #endif
 
-class TimeLabel : public QLabel
+class ClickableQLabel : public QLabel
+{
+    Q_OBJECT
+public:
+    virtual void mouseDoubleClickEvent( QMouseEvent *event )
+    {
+        Q_UNUSED( event );
+        emit doubleClicked();
+    }
+signals:
+    void doubleClicked();
+};
+
+class TimeLabel : public ClickableQLabel
 {
     Q_OBJECT
 public:
@@ -142,7 +155,7 @@ protected:
         if( displayType != TimeLabel::Both ) return;
         event->accept();
         toggleTimeDisplay();
-        emit timeLabelDoubleClicked();
+        ClickableQLabel::mouseDoubleClickEvent( event );
     }
 private:
     intf_thread_t *p_intf;
@@ -159,8 +172,6 @@ private:
     char psz_time[MSTRTIME_MAX_SIZE];
     void toggleTimeDisplay();
     void paintEvent( QPaintEvent* );
-signals:
-    void timeLabelDoubleClicked();
 private slots:
     void setDisplayPosition( float pos, int64_t time, int length );
     void setDisplayPosition( float pos );
diff --git a/modules/gui/qt4/main_interface.cpp 
b/modules/gui/qt4/main_interface.cpp
index afc9456..091a99b 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -459,7 +459,7 @@ inline void MainInterface::createStatusBar()
     QStatusBar *statusBarr = statusBar();
 
     TimeLabel *timeLabel = new TimeLabel( p_intf );
-    nameLabel = new QLabel( this );
+    nameLabel = new ClickableQLabel();
     nameLabel->setTextInteractionFlags( Qt::TextSelectableByMouse
                                       | Qt::TextSelectableByKeyboard );
     SpeedLabel *speedLabel = new SpeedLabel( p_intf, this );
@@ -480,11 +480,12 @@ inline void MainInterface::createStatusBar()
     statusBarr->addPermanentWidget( speedLabel, 0 );
     statusBarr->addPermanentWidget( timeLabel, 0 );
 
+    CONNECT( nameLabel, doubleClicked(), THEDP, epgDialog() );
     /* timeLabel behaviour:
        - double clicking opens the goto time dialog
        - right-clicking and clicking just toggle between remaining and
          elapsed time.*/
-    CONNECT( timeLabel, timeLabelDoubleClicked(), THEDP, gotoTimeDialog() );
+    CONNECT( timeLabel, doubleClicked(), THEDP, gotoTimeDialog() );
 
     CONNECT( THEMIM->getIM(), encryptionChanged( bool ),
              this, showCryptedLabel( bool ) );

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to