vlc | branch: master | Francois Cartegnie <[email protected]> | Wed Dec 28 12:16:59 2016 +0100| [cee004987d82f2aabbc37c7236005c0901604fad] | committer: Francois Cartegnie
Qt: EPG: use epgtime for timeline removes last use of system time for epg ui > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cee004987d82f2aabbc37c7236005c0901604fad --- modules/gui/qt/components/epg/EPGView.cpp | 17 +++++++++-------- modules/gui/qt/components/epg/EPGView.hpp | 4 +++- modules/gui/qt/components/epg/EPGWidget.cpp | 4 ++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/modules/gui/qt/components/epg/EPGView.cpp b/modules/gui/qt/components/epg/EPGView.cpp index 667a730..f6d82a2 100644 --- a/modules/gui/qt/components/epg/EPGView.cpp +++ b/modules/gui/qt/components/epg/EPGView.cpp @@ -69,9 +69,9 @@ void EPGGraphicsScene::drawBackground( QPainter *painter, const QRectF &rect) painter->drawLine( QLineF( rect.left(), y, rect.right(), y ) ); /* current hour line */ - if( epgView->liveTime().isValid() ) + if( epgView->epgTime().isValid() ) { - int x = epgView->startTime().secsTo( epgView->liveTime() ); + int x = epgView->startTime().secsTo( epgView->epgTime() ); painter->setPen( QPen( QColor( 255, 192, 192 ) ) ); painter->drawLine( QLineF( x, rect.top(), x, rect.bottom() ) ); } @@ -104,17 +104,18 @@ const QDateTime& EPGView::startTime() const return m_startTime; } -QDateTime EPGView::liveTime() const +QDateTime EPGView::epgTime() const { if( m_startTime.isValid() && m_maxTime.isValid() ) - { - QDateTime now = QDateTime::currentDateTime(); - if( now >= m_startTime && now <= m_maxTime ) - return now; - } + return m_epgTime; return QDateTime(); } +void EPGView::setEpgTime(const QDateTime &time) +{ + m_epgTime = time; +} + bool EPGView::hasValidData() const { return !programs.isEmpty(); diff --git a/modules/gui/qt/components/epg/EPGView.hpp b/modules/gui/qt/components/epg/EPGView.hpp index 114e973..89737c1 100644 --- a/modules/gui/qt/components/epg/EPGView.hpp +++ b/modules/gui/qt/components/epg/EPGView.hpp @@ -60,7 +60,8 @@ public: void setScale( double scaleFactor ); const QDateTime& startTime() const; - QDateTime liveTime() const; + QDateTime epgTime() const; + void setEpgTime(const QDateTime&); bool updateEPG( const vlc_epg_t * const *, size_t ); void reset(); @@ -74,6 +75,7 @@ signals: protected: void walkItems( bool ); + QDateTime m_epgTime; QDateTime m_startTime; QDateTime m_maxTime; QDateTime m_updtMinTime; /* >= startTime before pruning */ diff --git a/modules/gui/qt/components/epg/EPGWidget.cpp b/modules/gui/qt/components/epg/EPGWidget.cpp index 658fc8b..4482835 100644 --- a/modules/gui/qt/components/epg/EPGWidget.cpp +++ b/modules/gui/qt/components/epg/EPGWidget.cpp @@ -31,6 +31,7 @@ #include <QScrollBar> #include <QLabel> #include <QStringList> +#include <QDateTime> #include "EPGWidget.hpp" #include "EPGRuler.hpp" @@ -107,6 +108,9 @@ void EPGWidget::updateEPG( input_item_t *p_input_item ) /* Fixme: input could have dissapeared */ vlc_mutex_lock( & p_input_item->lock ); m_epgView->updateEPG( p_input_item->pp_epg, p_input_item->i_epg ); + m_epgView->setEpgTime( ( p_input_item->i_epg_time ) ? + QDateTime::fromTime_t( p_input_item->i_epg_time ) : + QDateTime() ); vlc_mutex_unlock( & p_input_item->lock ); /* toggle our widget view */ _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
