[vlc-commits] Qt: epg: show description items
Francois Cartegnie
git at videolan.org
Tue Jul 4 20:26:11 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jul 4 14:15:46 2017 +0200| [89b077e2141fb0a7cb76e0b1a5f0785e8d1f9586] | committer: Francois Cartegnie
Qt: epg: show description items
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=89b077e2141fb0a7cb76e0b1a5f0785e8d1f9586
---
modules/gui/qt/components/epg/EPGItem.cpp | 12 ++++++++++++
modules/gui/qt/components/epg/EPGItem.hpp | 2 ++
modules/gui/qt/dialogs/epg.cpp | 8 ++++++++
3 files changed, 22 insertions(+)
diff --git a/modules/gui/qt/components/epg/EPGItem.cpp b/modules/gui/qt/components/epg/EPGItem.cpp
index b3bc7376e1..fbdca4183e 100644
--- a/modules/gui/qt/components/epg/EPGItem.cpp
+++ b/modules/gui/qt/components/epg/EPGItem.cpp
@@ -170,6 +170,13 @@ bool EPGItem::setData( const vlc_epg_event_t *data )
m_shortDescription = newshortdesc;
setDuration( data->i_duration );
setRating( data->i_rating );
+ m_descitems.clear();
+ for( int i=0; i<data->i_description_items; i++ )
+ {
+ m_descitems.append(QPair<QString, QString>(
+ QString(data->description_items[i].psz_key),
+ QString(data->description_items[i].psz_value)));
+ }
updatePos();
prepareGeometryChange();
return true;
@@ -187,6 +194,11 @@ bool EPGItem::playsAt( const QDateTime & ref ) const
return (m_start <= ref) && !endsBefore( ref );
}
+const QList<QPair<QString, QString>> & EPGItem::descriptionItems() const
+{
+ return m_descitems;
+}
+
void EPGItem::setDuration( uint32_t duration )
{
m_duration = duration;
diff --git a/modules/gui/qt/components/epg/EPGItem.hpp b/modules/gui/qt/components/epg/EPGItem.hpp
index 1cee1172cd..ff2dc49b8e 100644
--- a/modules/gui/qt/components/epg/EPGItem.hpp
+++ b/modules/gui/qt/components/epg/EPGItem.hpp
@@ -57,6 +57,7 @@ public:
void updatePos();
bool endsBefore( const QDateTime & ) const;
bool playsAt( const QDateTime & ) const;
+ const QList<QPair<QString, QString>> &descriptionItems() const;
protected:
void focusInEvent( QFocusEvent * event ) Q_DECL_OVERRIDE;
@@ -75,6 +76,7 @@ private:
QString m_name;
QString m_description;
QString m_shortDescription;
+ QList<QPair<QString, QString>> m_descitems;
uint8_t m_rating;
};
diff --git a/modules/gui/qt/dialogs/epg.cpp b/modules/gui/qt/dialogs/epg.cpp
index a7303da407..ab570169ce 100644
--- a/modules/gui/qt/dialogs/epg.cpp
+++ b/modules/gui/qt/dialogs/epg.cpp
@@ -162,6 +162,14 @@ void EpgDialog::displayEvent( EPGItem *epgItem )
QString() )
);
description->setText( epgItem->description() );
+ const QList<QPair<QString, QString>> items = epgItem->descriptionItems();
+ QList<QPair<QString, QString>>::const_iterator it;
+ for( it=items.begin(); it != items.end(); ++it )
+ {
+ description->append(QString("\n<b>%1:</b> %2")
+ .arg((*it).first)
+ .arg((*it).second));
+ }
description->verticalScrollBar()->setValue(0);
}
More information about the vlc-commits
mailing list