[vlc-commits] Qt: PLModel: rename custom data roles
Francois Cartegnie
git at videolan.org
Tue May 10 19:30:36 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue May 10 16:19:13 2016 +0200| [2178d5b186ed3625c508b60ae2fb1965c631689f] | committer: Francois Cartegnie
Qt: PLModel: rename custom data roles
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2178d5b186ed3625c508b60ae2fb1965c631689f
---
modules/gui/qt/components/playlist/standardpanel.cpp | 2 +-
modules/gui/qt/components/playlist/views.cpp | 14 +++++++-------
modules/gui/qt/components/playlist/vlc_model.hpp | 6 +++---
modules/gui/qt/util/pictureflow.cpp | 2 +-
modules/gui/qt/util/qmenuview.cpp | 2 +-
5 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/modules/gui/qt/components/playlist/standardpanel.cpp b/modules/gui/qt/components/playlist/standardpanel.cpp
index 06e50c4..4e6e609 100644
--- a/modules/gui/qt/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt/components/playlist/standardpanel.cpp
@@ -791,7 +791,7 @@ void StandardPLPanel::activate( const QModelIndex &index )
if( currentView->model() == model )
{
/* If we are not a leaf node */
- if( !index.data( VLCModelSubInterface::IsLeafNodeRole ).toBool() )
+ if( !index.data( VLCModelSubInterface::LEAF_NODE_ROLE ).toBool() )
{
if( currentView != treeView )
browseInto( index );
diff --git a/modules/gui/qt/components/playlist/views.cpp b/modules/gui/qt/components/playlist/views.cpp
index 0bbb44a..c99e170 100644
--- a/modules/gui/qt/components/playlist/views.cpp
+++ b/modules/gui/qt/components/playlist/views.cpp
@@ -58,7 +58,7 @@ void AbstractPlViewItemDelegate::paintBackground(
painter->setPen( option.palette.color( QPalette::Highlight ).darker( 150 ) );
painter->drawRect( r );
}
- else if( index.data( VLCModel::IsCurrentRole ).toBool() )
+ else if( index.data( VLCModel::CURRENT_ITEM_ROLE ).toBool() )
{
painter->setBrush( QBrush( Qt::lightGray ) );
painter->setPen( QColor( Qt::darkGray ) );
@@ -80,7 +80,7 @@ void PlIconViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
QString artist = VLCModel::getMeta( index, COLUMN_ARTIST );
QFont font( index.data( Qt::FontRole ).value<QFont>() );
- font.setBold( index.data( VLCModel::IsCurrentRole ).toBool() );
+ font.setBold( index.data( VLCModel::CURRENT_ITEM_ROLE ).toBool() );
painter->setFont( font );
QFontMetrics fm = painter->fontMetrics();
@@ -119,12 +119,12 @@ void PlIconViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
//Draw children indicator
- if( !index.data( VLCModel::IsLeafNodeRole ).toBool() )
+ if( !index.data( VLCModel::LEAF_NODE_ROLE ).toBool() )
{
QRect r( option.rect );
r.setSize( QSize( 25, 25 ) );
r.translate( 5, 5 );
- if( index.data( VLCModel::IsCurrentsParentNodeRole ).toBool() )
+ if( index.data( VLCModel::CURRENT_ITEM_CHILD_ROLE ).toBool() )
{
painter->setOpacity( 0.75 );
QPainterPath nodeRectPath;
@@ -219,7 +219,7 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
//Draw title info
f.setItalic( true );
- f.setBold( index.data( VLCModel::IsCurrentRole ).toBool() );
+ f.setBold( index.data( VLCModel::CURRENT_ITEM_ROLE ).toBool() );
painter->setFont( f );
QFontMetrics fm( painter->fontMetrics() );
@@ -231,7 +231,7 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
}
//Draw children indicator
- if( !index.data( VLCModel::IsLeafNodeRole ).toBool() )
+ if( !index.data( VLCModel::LEAF_NODE_ROLE ).toBool() )
{
QPixmap dirPix = QPixmap( ":/type/node" );
painter->drawPixmap( QPoint( textRect.x(), textRect.center().y() - dirPix.height() / 2 ),
@@ -273,7 +273,7 @@ QSize PlListViewItemDelegate::sizeHint ( const QStyleOptionViewItem &, const QMo
void PlTreeViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
- if ( index.data( VLCModel::IsCurrentRole ).toBool() )
+ if ( index.data( VLCModel::CURRENT_ITEM_ROLE ).toBool() )
{
QStyleOptionViewItem myoptions = option;
myoptions.font.setBold( true );
diff --git a/modules/gui/qt/components/playlist/vlc_model.hpp b/modules/gui/qt/components/playlist/vlc_model.hpp
index 5d764fe..532cf39 100644
--- a/modules/gui/qt/components/playlist/vlc_model.hpp
+++ b/modules/gui/qt/components/playlist/vlc_model.hpp
@@ -57,9 +57,9 @@ public:
virtual ~VLCModelSubInterface();
enum nodeRole
{
- IsCurrentRole = Qt::UserRole,
- IsLeafNodeRole,
- IsCurrentsParentNodeRole
+ CURRENT_ITEM_ROLE = Qt::UserRole,
+ CURRENT_ITEM_CHILD_ROLE,
+ LEAF_NODE_ROLE, /* FIXME: same as index().child() ? */
};
virtual void rebuild( playlist_item_t * p = NULL ) = 0;
virtual void doDelete( QModelIndexList ) = 0;
diff --git a/modules/gui/qt/util/pictureflow.cpp b/modules/gui/qt/util/pictureflow.cpp
index 9318953..a76a4ac 100644
--- a/modules/gui/qt/util/pictureflow.cpp
+++ b/modules/gui/qt/util/pictureflow.cpp
@@ -503,7 +503,7 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
artURL = m->data( index, COLUMN_COVER ).toString();
}
- QString key = QString("%1%2%3%4").arg(VLCModel::getMeta( index, COLUMN_TITLE )).arg( VLCModel::getMeta( index, COLUMN_ARTIST ) ).arg(index.data( VLCModel::IsCurrentRole ).toBool() ).arg( artURL );
+ QString key = QString("%1%2%3%4").arg(VLCModel::getMeta( index, COLUMN_TITLE )).arg( VLCModel::getMeta( index, COLUMN_ARTIST ) ).arg(index.data( VLCModel::CURRENT_ITEM_ROLE ).toBool() ).arg( artURL );
QImage* src;
if( cache.contains( key ) )
diff --git a/modules/gui/qt/util/qmenuview.cpp b/modules/gui/qt/util/qmenuview.cpp
index 2ccc868..b075b5e 100644
--- a/modules/gui/qt/util/qmenuview.cpp
+++ b/modules/gui/qt/util/qmenuview.cpp
@@ -96,7 +96,7 @@ QAction* QMenuView::createActionFromIndex( QModelIndex index )
QAction * action = new QAction( icon, index.data().toString(), this );
/* Display in bold the active element */
- if( index.data( VLCModel::IsCurrentRole ).toBool() )
+ if( index.data( VLCModel::CURRENT_ITEM_ROLE ).toBool() )
{
QFont font; font.setBold ( true );
action->setFont( font );
More information about the vlc-commits
mailing list