Miam-Player  0.8.0
A nice music player
LibraryItemDelegate Class Reference

The LibraryItemDelegate class. More...

#include <libraryitemdelegate.h>

Inheritance diagram for LibraryItemDelegate:
MiamItemDelegate

Public Slots

void displayIcon (bool b)
 
void updateCoverSize ()
 

Public Member Functions

 LibraryItemDelegate (LibraryTreeView *libraryTreeView, QSortFilterProxyModel *proxy)
 
virtual void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
virtual QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
- Public Member Functions inherited from MiamItemDelegate
 MiamItemDelegate (QSortFilterProxyModel *proxy)
 

Protected Member Functions

virtual void drawAlbum (QPainter *painter, QStyleOptionViewItem &option, AlbumItem *item) const override
 
virtual void drawArtist (QPainter *painter, QStyleOptionViewItem &option, ArtistItem *item) const override
 
void drawDisc (QPainter *painter, QStyleOptionViewItem &option, DiscItem *item) const
 
virtual void drawTrack (QPainter *painter, QStyleOptionViewItem &option, TrackItem *track) const override
 
void paintCoverOnTrack (QPainter *painter, const QStyleOptionViewItem &option, const TrackItem *track) const
 
void paintText (QPainter *painter, const QStyleOptionViewItem &option, const QRect &rectText, const QString &text, const QStandardItem *item) const
 
- Protected Member Functions inherited from MiamItemDelegate
void drawLetter (QPainter *painter, QStyleOptionViewItem &option, SeparatorItem *item) const
 
void paintRect (QPainter *painter, const QStyleOptionViewItem &option) const
 
void paintText (QPainter *p, const QStyleOptionViewItem &opt, const QRect &rectText, const QString &text, const QStandardItem *item) const
 

Additional Inherited Members

- Protected Attributes inherited from MiamItemDelegate
QStandardItemModel * _libraryModel
 
QSortFilterProxyModel * _proxy
 
bool _showCovers
 
QTimer * _timer
 
int _coverSize
 
- Static Protected Attributes inherited from MiamItemDelegate
static qreal _iconOpacity = 1.0
 

Detailed Description

The LibraryItemDelegate class.

Author
Matthieu Bachelier

Constructor & Destructor Documentation

LibraryItemDelegate::LibraryItemDelegate ( LibraryTreeView libraryTreeView,
QSortFilterProxyModel *  proxy 
)
explicit

Member Function Documentation

void LibraryItemDelegate::displayIcon ( bool  b)
slot
void LibraryItemDelegate::drawAlbum ( QPainter *  painter,
QStyleOptionViewItem &  option,
AlbumItem item 
) const
overrideprotectedvirtual

Albums have covers usually.

XXX: reload cover with high resolution when one has increased coverSize (every 64px)

Implements MiamItemDelegate.

void LibraryItemDelegate::drawArtist ( QPainter *  painter,
QStyleOptionViewItem &  option,
ArtistItem item 
) const
overrideprotectedvirtual

XXX: paint articles like ", the" in gray? Could be nice

Implements MiamItemDelegate.

void LibraryItemDelegate::drawDisc ( QPainter *  painter,
QStyleOptionViewItem &  option,
DiscItem item 
) const
protected
void LibraryItemDelegate::drawTrack ( QPainter *  painter,
QStyleOptionViewItem &  option,
TrackItem track 
) const
overrideprotectedvirtual

XXX: it will be a piece of cake to add an option that one can customize how track number will be displayed QString title = settings->libraryItemTitle(); for example: zero padding

XXX: create an option to display stars right to the text, and fade them if text is too large

Reimplemented from MiamItemDelegate.

void LibraryItemDelegate::paint ( QPainter *  painter,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
overridevirtual

Redefined.

void LibraryItemDelegate::paintCoverOnTrack ( QPainter *  painter,
const QStyleOptionViewItem &  option,
const TrackItem track 
) const
protected
void LibraryItemDelegate::paintText ( QPainter *  p,
const QStyleOptionViewItem &  opt,
const QRect &  rectText,
const QString &  text,
const QStandardItem *  item 
) const
protected

Check if color needs to be inverted then paint text.

QSize LibraryItemDelegate::sizeHint ( const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
overridevirtual

Redefined to always display the same height for albums, even for those without one.

void LibraryItemDelegate::updateCoverSize ( )
slot

The documentation for this class was generated from the following files: