Commit f66b2c98 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: EPGItem: simplify setters

parent b8635eb0
......@@ -32,7 +32,7 @@ class EPGEvent
{
public:
EPGEvent( const QString& eventName )
: current( false ), updated( true ), item( NULL )
: current( false ), updated( true ), simultaneous( false ), item( NULL )
{
name = eventName;
}
......@@ -62,6 +62,7 @@ public:
QString channelName;
bool current;
bool updated;
bool simultaneous;
EPGItem *item;
};
......
......@@ -40,7 +40,6 @@ EPGItem::EPGItem( EPGView *view )
: m_view( view )
{
m_current = false;
m_boundingRect.setHeight( TRACKS_HEIGHT );
setFlags( QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
setAcceptHoverEvents( true );
......@@ -137,10 +136,17 @@ void EPGItem::setChannelNb( int channelNb )
updatePos();
}
void EPGItem::setStart( const QDateTime& start )
void EPGItem::setData( EPGEvent *event )
{
m_start = start;
m_start = event->start;
m_name = event->name;
m_description = event->description;
m_shortDescription = event->shortDescription;
m_current = event->current;
m_simultaneous = event->simultaneous;
setDuration( event->duration );
updatePos();
setToolTip( m_name );
}
void EPGItem::setDuration( int duration )
......@@ -149,27 +155,6 @@ void EPGItem::setDuration( int duration )
m_boundingRect.setWidth( duration );
}
void EPGItem::setName( const QString& name )
{
m_name = name;
setToolTip( m_name );
}
void EPGItem::setDescription( const QString& description )
{
m_description = description;
}
void EPGItem::setShortDescription( const QString& shortDescription )
{
m_shortDescription = shortDescription;
}
void EPGItem::setCurrent( bool current )
{
m_current = current;
}
void EPGItem::updatePos()
{
int x = m_view->startTime().secsTo( m_start );
......
......@@ -31,6 +31,7 @@ class QString;
class QDateTime;
class EPGView;
class EPGEvent;
class EPGItem : public QGraphicsItem
{
......@@ -46,13 +47,9 @@ public:
int duration() const;
int getChannelNb() const;
void setData( EPGEvent * );
void setChannelNb( int channelNb );
void setStart( const QDateTime& start );
void setDuration( int duration );
void setName( const QString& name );
void setDescription( const QString& description );
void setShortDescription( const QString& shortDescription );
void setCurrent( bool current );
void updatePos();
protected:
......@@ -70,6 +67,7 @@ private:
QString m_description;
QString m_shortDescription;
bool m_current;
bool m_simultaneous;
};
#endif // EPGITEM_H
......@@ -92,13 +92,9 @@ void EPGView::addEvent( EPGEvent* event )
m_channels.append( event->channelName );
EPGItem* item = new EPGItem( this );
item->setData( event );
item->setChannelNb( m_channels.indexOf( event->channelName ) );
item->setStart( event->start );
item->setDuration( event->duration );
item->setName( event->name );
item->setDescription( event->description );
item->setShortDescription( event->shortDescription );
item->setCurrent( event->current );
event->item = item;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment