[vlc-commits] Qt: EPGItem: only update() if data changed

Francois Cartegnie git at videolan.org
Thu Mar 31 00:09:39 CEST 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar 30 19:39:39 2011 +0200| [30c9622b865da40cf50912dc2f388c0bd88e58b9] | committer: Francois Cartegnie

Qt: EPGItem: only update() if data changed

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=30c9622b865da40cf50912dc2f388c0bd88e58b9
---

 modules/gui/qt4/components/epg/EPGItem.cpp |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/components/epg/EPGItem.cpp b/modules/gui/qt4/components/epg/EPGItem.cpp
index de5c9b6..68fc874 100644
--- a/modules/gui/qt4/components/epg/EPGItem.cpp
+++ b/modules/gui/qt4/components/epg/EPGItem.cpp
@@ -141,13 +141,25 @@ void EPGItem::setRow( unsigned int i_row_ )
 
 void EPGItem::setData( vlc_epg_event_t *data )
 {
-    m_start = QDateTime::fromTime_t( data->i_start );
-    m_name = qfu( data->psz_name );
-    setToolTip( qfu( data->psz_name ) );
-    m_description = qfu( data->psz_description );
-    m_shortDescription = qfu( data->psz_short_description );
-    setDuration( data->i_duration );
-    update();
+    QDateTime newtime = QDateTime::fromTime_t( data->i_start );
+    QString newname = qfu( data->psz_name );
+    QString newdesc = qfu( data->psz_description );
+    QString newshortdesc = qfu( data->psz_short_description );
+
+    if ( m_start != newtime ||
+         m_name != newname ||
+         m_description != newdesc ||
+         m_shortDescription != newshortdesc ||
+         m_duration != data->i_duration )
+    {
+        m_start = newtime;
+        m_name = newname;
+        setToolTip( newname );
+        m_description = newdesc;
+        m_shortDescription = newshortdesc;
+        setDuration( data->i_duration );
+        update();
+    }
 }
 
 void EPGItem::setCurrent( bool b_current )



More information about the vlc-commits mailing list