[vlc-commits] commit: Qt: EPGItem aesthetic rework. (Adrien Maglo )

git at videolan.org git at videolan.org
Tue Jun 15 22:42:58 CEST 2010


vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Tue Jun 15 22:41:58 2010 +0200| [e29018e7eda0814cfcf78873c4164d44654d900a] | committer: Adrien Maglo 

Qt: EPGItem aesthetic rework.
Do not display the description in the items.
Display the start and end times in the items.
Change the item colors.
Feel free to modify these choices.

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

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

diff --git a/modules/gui/qt4/components/epg/EPGItem.cpp b/modules/gui/qt4/components/epg/EPGItem.cpp
index 3ec8bac..39dbea5 100644
--- a/modules/gui/qt4/components/epg/EPGItem.cpp
+++ b/modules/gui/qt4/components/epg/EPGItem.cpp
@@ -62,9 +62,9 @@ void EPGItem::paint( QPainter *painter, const QStyleOptionGraphicsItem*, QWidget
     painter->setPen( QPen( Qt::black ) );
 
     if ( m_current )
-        painter->setBrush( QBrush( Qt::red ) );
+        painter->setBrush( QBrush( QColor( 100, 100, 100 ) ) );
     else
-        painter->setBrush( QBrush( Qt::blue ) );
+        painter->setBrush( QBrush( QColor( 150, 150, 150 ) ) );
 
     painter->drawRect( mapped );
 
@@ -73,30 +73,28 @@ void EPGItem::paint( QPainter *painter, const QStyleOptionGraphicsItem*, QWidget
 
     // Setup the font
     QFont f = painter->font();
-    f.setBold( true );
-    painter->setFont( f );
 
     // Get the font metrics
     QFontMetrics fm = painter->fontMetrics();
 
     // Adjust the drawing rect
-    mapped.adjust( 2, 2, -2, -2 );
+    mapped.adjust( 6, 6, -6, -6 );
 
     painter->setPen( Qt::white );
+    /* Draw the title. */
     painter->drawText( mapped, Qt::AlignTop | Qt::AlignLeft, fm.elidedText( m_name, Qt::ElideRight, mapped.width() ) );
 
-
-    f.setBold( false );
+    mapped.adjust( 0, 20, 0, 0 );
+    QDateTime m_end = m_start.addSecs( m_duration );
+    f.setPixelSize( 10 );
     f.setItalic( true );
     painter->setFont( f );
 
-    QTextOption textoption;
-    textoption.setWrapMode( QTextOption::WordWrap );
-    textoption.setAlignment( Qt::AlignTop | Qt::AlignLeft );
-
-    painter->drawText( mapped.adjusted( 0, 20, 0, 0 ),
-                       m_shortDescription,
-                       textoption );
+    /* Draw the hours. */
+    painter->drawText( mapped, Qt::AlignTop | Qt::AlignLeft,
+                       fm.elidedText( m_start.toString( "hh:mm" ) + " - " +
+                                      m_end.toString( "hh:mm" ),
+                                      Qt::ElideRight, mapped.width() ) );
 }
 
 const QDateTime& EPGItem::start() const



More information about the vlc-commits mailing list