]> git.sesse.net Git - vlc/commitdiff
Qt/EPG: Fix an EPGitem position issue.
authorAdrien Maglo <magsoft@videolan.org>
Fri, 18 Jun 2010 17:14:40 +0000 (19:14 +0200)
committerAdrien Maglo <magsoft@videolan.org>
Fri, 18 Jun 2010 17:15:26 +0000 (19:15 +0200)
This was wrong to update the EPGItem start times when changing the EPGView start time.

modules/gui/qt4/components/epg/EPGItem.cpp
modules/gui/qt4/components/epg/EPGItem.hpp
modules/gui/qt4/components/epg/EPGView.cpp

index f3fbb1863d1a05d48ee6c0a37bba61bf040111c7..8f0ebc399ebdb2579e564fcfb1bba66856b14f91 100644 (file)
@@ -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 );
index fd531caefe048d9e887d5c38422c0efa3734ea51..04f9909ef37e7560179a0c096e097bb4a588fbee 100644 (file)
@@ -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 );
index 5a8da879a47e7b31a01590982185cef979852d0e..aa2a6145c276a2736b37bdf328e53cf4b215c708 100644 (file)
@@ -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 );
 }