covericonview.cpp 1.59 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/**
 * Copyright (C) 2005 Michael Pyne <mpyne@kde.org>
 *
 * 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.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 */
Michael Pyne's avatar
Michael Pyne committed
16 17 18 19 20 21

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

using CoverUtility::CoverIconViewItem;

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

Laurent Montel's avatar
Laurent Montel committed
30
CoverIconView::CoverIconView(QWidget *parent, const char *name) : K3IconView(parent, name)
Michael Pyne's avatar
Michael Pyne committed
31 32 33 34 35 36
{
    setResizeMode(Adjust);
}

CoverIconViewItem *CoverIconView::currentItem() const
{
Laurent Montel's avatar
Laurent Montel committed
37
    return static_cast<CoverIconViewItem *>(K3IconView::currentItem());
Michael Pyne's avatar
Michael Pyne committed
38 39
}

Laurent Montel's avatar
Laurent Montel committed
40
Q3DragObject *CoverIconView::dragObject()
Michael Pyne's avatar
Michael Pyne committed
41
{
Michael Pyne's avatar
Michael Pyne committed
42 43 44
#if 0
    // Temporarily disabled pending conversion of the cover manager icon view
    // to Qt 4 ish stuff.
Michael Pyne's avatar
Michael Pyne committed
45 46
    CoverIconViewItem *item = currentItem();
    if(item)
47
        return new CoverDrag(item->id(), this);
Michael Pyne's avatar
Michael Pyne committed
48
#endif
Michael Pyne's avatar
Michael Pyne committed
49 50 51
    return 0;
}

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