[vlc-commits] commit: Qt/EPG: Set the EPGView start time correctly. (Adrien Maglo )
git at videolan.org
git at videolan.org
Sun Jun 20 22:37:00 CEST 2010
vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Sun Jun 20 22:35:05 2010 +0200| [16967781bf90e39fab994a82414454ba3f87f122] | committer: Adrien Maglo
Qt/EPG: Set the EPGView start time correctly.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=16967781bf90e39fab994a82414454ba3f87f122
---
modules/gui/qt4/components/epg/EPGView.cpp | 22 +++++++++++++++++-----
modules/gui/qt4/components/epg/EPGView.hpp | 2 +-
modules/gui/qt4/components/epg/EPGWidget.cpp | 6 ++----
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/modules/gui/qt4/components/epg/EPGView.cpp b/modules/gui/qt4/components/epg/EPGView.cpp
index d1d9534..cb6690c 100644
--- a/modules/gui/qt4/components/epg/EPGView.cpp
+++ b/modules/gui/qt4/components/epg/EPGView.cpp
@@ -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()
diff --git a/modules/gui/qt4/components/epg/EPGView.hpp b/modules/gui/qt4/components/epg/EPGView.hpp
index 0655ce5..6c26be1 100644
--- a/modules/gui/qt4/components/epg/EPGView.hpp
+++ b/modules/gui/qt4/components/epg/EPGView.hpp
@@ -41,7 +41,7 @@ public:
void setScale( double scaleFactor );
- void setStartTime( const QDateTime& startTime );
+ void updateStartTime();
const QDateTime& startTime();
void addEvent( EPGEvent* event );
diff --git a/modules/gui/qt4/components/epg/EPGWidget.cpp b/modules/gui/qt4/components/epg/EPGWidget.cpp
index b614846..948b83c 100644
--- a/modules/gui/qt4/components/epg/EPGWidget.cpp
+++ b/modules/gui/qt4/components/epg/EPGWidget.cpp
@@ -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();
}
More information about the vlc-commits
mailing list