From e29018e7eda0814cfcf78873c4164d44654d900a Mon Sep 17 00:00:00 2001 From: Adrien Maglo Date: Tue, 15 Jun 2010 22:41:58 +0200 Subject: [PATCH] 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. --- modules/gui/qt4/components/epg/EPGItem.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/modules/gui/qt4/components/epg/EPGItem.cpp b/modules/gui/qt4/components/epg/EPGItem.cpp index 3ec8bac9a8..39dbea5153 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 -- 2.11.4.GIT