[vlc-commits] Qt: EPGItem: simplify setters
Francois Cartegnie
git at videolan.org
Sat Mar 5 16:25:47 CET 2011
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Mar 5 14:13:39 2011 +0100| [f66b2c98950f35a879c7aab8b677b7372a26c1df] | committer: Francois Cartegnie
Qt: EPGItem: simplify setters
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f66b2c98950f35a879c7aab8b677b7372a26c1df
---
modules/gui/qt4/components/epg/EPGEvent.hpp | 3 +-
modules/gui/qt4/components/epg/EPGItem.cpp | 33 +++++++-------------------
modules/gui/qt4/components/epg/EPGItem.hpp | 8 ++----
modules/gui/qt4/components/epg/EPGView.cpp | 6 +----
4 files changed, 15 insertions(+), 35 deletions(-)
diff --git a/modules/gui/qt4/components/epg/EPGEvent.hpp b/modules/gui/qt4/components/epg/EPGEvent.hpp
index a830f25..f81f197 100644
--- a/modules/gui/qt4/components/epg/EPGEvent.hpp
+++ b/modules/gui/qt4/components/epg/EPGEvent.hpp
@@ -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;
};
diff --git a/modules/gui/qt4/components/epg/EPGItem.cpp b/modules/gui/qt4/components/epg/EPGItem.cpp
index ca004a7..16767f2 100644
--- a/modules/gui/qt4/components/epg/EPGItem.cpp
+++ b/modules/gui/qt4/components/epg/EPGItem.cpp
@@ -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 );
diff --git a/modules/gui/qt4/components/epg/EPGItem.hpp b/modules/gui/qt4/components/epg/EPGItem.hpp
index db57f67..76a853f 100644
--- a/modules/gui/qt4/components/epg/EPGItem.hpp
+++ b/modules/gui/qt4/components/epg/EPGItem.hpp
@@ -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
diff --git a/modules/gui/qt4/components/epg/EPGView.cpp b/modules/gui/qt4/components/epg/EPGView.cpp
index 5701c3c..f5a8468 100644
--- a/modules/gui/qt4/components/epg/EPGView.cpp
+++ b/modules/gui/qt4/components/epg/EPGView.cpp
@@ -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;
More information about the vlc-commits
mailing list