move pixmap stuff to playlist class where it belongs

parent 7f64cc25
......@@ -87,31 +87,6 @@ FileHandle PlaylistItem::file() const
return d->fileHandle;
}
K_GLOBAL_STATIC_WITH_ARGS(QPixmap, globalGenericImage, (SmallIcon("image-x-generic")))
K_GLOBAL_STATIC_WITH_ARGS(QPixmap, globalPlayingImage, (UserIcon("playing")))
const QPixmap *PlaylistItem::pixmap(int column) const
{
int offset = playlist()->columnOffset();
// Don't use hasCover here because that may dig into the track itself.
// Besides, we really just want to know if the cover manager has a cover
// for the track.
if((column - offset) == Playlist::CoverColumn &&
d->fileHandle.coverInfo()->coverId() != CoverManager::NoMatch)
{
return globalGenericImage;
}
if(column == playlist()->leftColumn() &&
m_playingItems.contains(const_cast<PlaylistItem *>(this)))
{
return globalPlayingImage;
}
return globalPlayingImage;
// return K3ListViewItem::pixmap(column);
}
void PlaylistItem::setText(int column, const QString &text)
{
int offset = playlist()->columnOffset();
......
......@@ -84,7 +84,6 @@ public:
void setFile(const QString &file);
FileHandle file() const;
virtual const QPixmap *pixmap(int column) const;
// virtual QString text(int column) const;
virtual void setText(int column, const QString &text);
......
......@@ -920,18 +920,28 @@ int Playlist::columnCount(const QModelIndex& parent) const
return 12;
}
K_GLOBAL_STATIC_WITH_ARGS(QPixmap, globalGenericImage, (SmallIcon("image-x-generic")))
K_GLOBAL_STATIC_WITH_ARGS(QPixmap, globalPlayingImage, (UserIcon("playing")))
QVariant Playlist::data(const QModelIndex& index, int role) const
{
const int column = index.column();
const FileHandle &fileHandle = m_items[index.row()]->file();
if (role == Qt::DecorationRole) {
// ### TODO: FIXME
// return *(m_items[index.row()]->pixmap(index.column()));
if (column == CoverColumn &&
fileHandle.coverInfo()->coverId() != CoverManager::NoMatch) {
return *globalGenericImage;
} else if (column == 0) {
return *globalPlayingImage;
}
}
if (role != Qt::DisplayRole)
return QVariant();
FileHandle fileHandle = m_items[index.row()]->file();
switch(index.column()) {
switch(column) {
case TrackColumn:
return fileHandle.tag()->title();
case ArtistColumn:
......
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