covericonview.cpp 1.69 KB
Newer Older
Michael Pyne's avatar
Michael Pyne committed
1
/***************************************************************************
2
    begin                : Sat Jul 9 2005
Michael Pyne's avatar
Michael Pyne committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
    copyright            : (C) 2005 by Michael Pyne
    email                : michael.pyne@kdemail.net
***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "covericonview.h"
#include "covermanager.h"

using CoverUtility::CoverIconViewItem;

Laurent Montel's avatar
Laurent Montel committed
21
CoverIconViewItem::CoverIconViewItem(coverKey id, Q3IconView *parent) :
Michael Pyne's avatar
Michael Pyne committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
    KIconViewItem(parent), m_id(id)
{
    CoverDataPtr data = CoverManager::coverInfo(id);
    setText(QString("%1 - %2").arg(data->artist, data->album));
    setPixmap(data->thumbnail());
}

CoverIconView::CoverIconView(QWidget *parent, const char *name) : KIconView(parent, name)
{
    setResizeMode(Adjust);
}

CoverIconViewItem *CoverIconView::currentItem() const
{
    return static_cast<CoverIconViewItem *>(KIconView::currentItem());
}

Laurent Montel's avatar
Laurent Montel committed
39
Q3DragObject *CoverIconView::dragObject()
Michael Pyne's avatar
Michael Pyne committed
40 41 42
{
    CoverIconViewItem *item = currentItem();
    if(item)
43
        return new CoverDrag(item->id(), this);
Michael Pyne's avatar
Michael Pyne committed
44 45 46 47

    return 0;
}

48
// vim: set et sw=4 tw=0 sta: