Commit 0bf8724d authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: epg: updateduration: simplify.

(there was no guarantee that each graphic item could be safely casted to
epgitem)
parent cea122b1
...@@ -276,21 +276,13 @@ EPGView::~EPGView() ...@@ -276,21 +276,13 @@ EPGView::~EPGView()
void EPGView::updateDuration() void EPGView::updateDuration()
{ {
QDateTime lastItem; QDateTime maxItemTime;
mutex.lock(); mutex.lock();
QList<QGraphicsItem*> list = items(); foreach( EPGEventByTimeQMap *epgItemByTime, epgitemsByChannel.values() )
foreach( EPGItem *epgItem, epgItemByTime->values() )
for ( int i = 0; i < list.count(); ++i ) if ( epgItem->end() > maxItemTime ) maxItemTime = epgItem->end();
{
EPGItem* item = qgraphicsitem_cast<EPGItem*>( list.at( i ) );
if ( !item ) continue;
QDateTime itemEnd = item->start().addSecs( item->duration() );
if ( itemEnd > lastItem )
lastItem = itemEnd;
}
mutex.unlock(); mutex.unlock();
m_duration = m_startTime.secsTo( lastItem ); m_duration = m_startTime.secsTo( maxItemTime );
emit durationChanged( m_duration ); emit durationChanged( m_duration );
} }
......
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