[vlc-commits] commit: Qt/EPG: Fix an EPGitem position issue. (Adrien Maglo )

git at videolan.org git at videolan.org
Fri Jun 18 19:22:32 CEST 2010


vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Jun 18 19:14:40 2010 +0200| [330016cb7d533bc6c5d7946c66aa26b9944eb830] | committer: Adrien Maglo 

Qt/EPG: Fix an EPGitem position issue.
This was wrong to update the EPGItem start times when changing the EPGView start time.

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

 modules/gui/qt4/components/epg/EPGItem.cpp |   11 ++++++++---
 modules/gui/qt4/components/epg/EPGItem.hpp |    1 +
 modules/gui/qt4/components/epg/EPGView.cpp |    6 ++----
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/components/epg/EPGItem.cpp b/modules/gui/qt4/components/epg/EPGItem.cpp
index f3fbb18..8f0ebc3 100644
--- a/modules/gui/qt4/components/epg/EPGItem.cpp
+++ b/modules/gui/qt4/components/epg/EPGItem.cpp
@@ -112,14 +112,13 @@ void EPGItem::setChannel( int channelNb )
 {
     //qDebug() << "Channel" << channelNb;
     m_channelNb = channelNb;
-    setPos( pos().x(), m_channelNb * TRACKS_HEIGHT );
+    updatePos();
 }
 
 void EPGItem::setStart( const QDateTime& start )
 {
     m_start = start;
-    int x = m_view->startTime().secsTo( start );
-    setPos( x, pos().y() );
+    updatePos();
 }
 
 void EPGItem::setDuration( int duration )
@@ -148,6 +147,12 @@ void EPGItem::setCurrent( bool current )
     m_current = current;
 }
 
+void EPGItem::updatePos()
+{
+    int x = m_view->startTime().secsTo( m_start );
+    setPos( x, m_channelNb * TRACKS_HEIGHT );
+}
+
 void EPGItem::focusInEvent( QFocusEvent * event )
 {
     EPGEvent *evEPG = new EPGEvent( m_name );
diff --git a/modules/gui/qt4/components/epg/EPGItem.hpp b/modules/gui/qt4/components/epg/EPGItem.hpp
index fd531ca..04f9909 100644
--- a/modules/gui/qt4/components/epg/EPGItem.hpp
+++ b/modules/gui/qt4/components/epg/EPGItem.hpp
@@ -52,6 +52,7 @@ public:
     void setDescription( const QString& description );
     void setShortDescription( const QString& shortDescription );
     void setCurrent( bool current );
+    void updatePos();
 
 protected:
     virtual void focusInEvent( QFocusEvent * event );
diff --git a/modules/gui/qt4/components/epg/EPGView.cpp b/modules/gui/qt4/components/epg/EPGView.cpp
index 5a8da87..aa2a614 100644
--- a/modules/gui/qt4/components/epg/EPGView.cpp
+++ b/modules/gui/qt4/components/epg/EPGView.cpp
@@ -56,17 +56,15 @@ void EPGView::setStartTime( const QDateTime& startTime )
 {
     QList<QGraphicsItem*> itemList = items();
 
-    int diff = startTime.secsTo( m_startTime );
+    m_startTime = startTime;
 
     for ( int i = 0; i < itemList.count(); ++i )
     {
         EPGItem* item = qgraphicsitem_cast<EPGItem*>( itemList.at( i ) );
         if ( !item ) continue;
-        item->setStart( item->start().addSecs( diff ) );
+        item->setStart( item->start() );
     }
 
-    m_startTime = startTime;
-
     // Our start time has changed
     emit startTimeChanged( startTime );
 }



More information about the vlc-commits mailing list