Commit 2178d5b1 authored by François Cartegnie's avatar François Cartegnie 🤞

Qt: PLModel: rename custom data roles

parent 5d845f77
......@@ -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 );
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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 ) )
......
......@@ -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 );
......
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