Commit 95e775c3 authored by Adrien Maglo's avatar Adrien Maglo Committed by Jean-Baptiste Kempf

Qt/EPG: Set the EPGView start time correctly.

(cherry picked from commit 16967781)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 8e39f1cc
......@@ -52,21 +52,33 @@ void EPGView::setScale( double scaleFactor )
setMatrix( matrix );
}
void EPGView::setStartTime( const QDateTime& startTime )
void EPGView::updateStartTime()
{
QList<QGraphicsItem*> itemList = items();
m_startTime = startTime;
/* Set the new start time. */
for ( int i = 0; i < itemList.count(); ++i )
{
EPGItem* item = qgraphicsitem_cast<EPGItem*>( itemList.at( i ) );
if ( !item )
continue;
if( i == 0 )
m_startTime = item->start();
if ( item->start() < m_startTime )
m_startTime = item->start();
}
/* Update the position of all items. */
for ( int i = 0; i < itemList.count(); ++i )
{
EPGItem* item = qgraphicsitem_cast<EPGItem*>( itemList.at( i ) );
if ( !item ) continue;
if ( !item )
continue;
item->updatePos();
}
// Our start time has changed
emit startTimeChanged( startTime );
// Our start time may have changed.
emit startTimeChanged( m_startTime );
}
const QDateTime& EPGView::startTime()
......
......@@ -41,7 +41,7 @@ public:
void setScale( double scaleFactor );
void setStartTime( const QDateTime& startTime );
void updateStartTime();
const QDateTime& startTime();
void addEvent( EPGEvent* event );
......
......@@ -108,9 +108,6 @@ void EPGWidget::updateEPG( vlc_epg_t **pp_epg, int i_epg )
if ( !alreadyIn )
{
m_events.insert( channelName, item );
if ( item->start < m_epgView->startTime() )
m_epgView->setStartTime( item->start );
m_epgView->addEvent( item );
}
else
......@@ -135,7 +132,8 @@ void EPGWidget::updateEPG( vlc_epg_t **pp_epg, int i_epg )
++i;
}
// Update the global duration
// Update the global duration and start time.
m_epgView->updateDuration();
m_epgView->updateStartTime();
}
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