summaryrefslogtreecommitdiffstats
path: root/juk/covericonview.cpp
blob: 2dd1260b5c090f5a0be02f12d55565fbc082198d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/***************************************************************************
    begin                : Sat Jul 9 2005 
    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;

CoverIconViewItem::CoverIconViewItem(coverKey id, TQIconView *tqparent) :
    KIconViewItem(tqparent), m_id(id)
{
    CoverDataPtr data = CoverManager::coverInfo(id);
    setText(TQString("%1 - %2").tqarg(data->artist, data->album));
    setPixmap(data->thumbnail());
}

CoverIconView::CoverIconView(TQWidget *tqparent, const char *name) : KIconView(tqparent, name)
{
    setResizeMode(Adjust);
}

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

TQDragObject *CoverIconView::dragObject()
{
    CoverIconViewItem *item = currentItem();
    if(item)
	return new CoverDrag(item->id(), this);

    return 0;
}

// vim: set et ts=4 sw=4: