1 /* Copyright (C) 2005-2007 Jeff Mitchell <kde-dev@emailgoeshere.com>
2 (c) 2004 Christian Muehlhaeuser <chris@chris.de>
3 (c) 2005-2006 Martin Aumueller <aumuell@reserv.at>
4 (c) 2005 Seb Ruiz <ruiz@kde.org>
5 (c) 2006 T.R.Shashwath <trshash84@gmail.com>
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
24 #ifndef AMAROK_MEDIAITEM_H
25 #define AMAROK_MEDIAITEM_H
27 #include <k3listview.h>
29 #include "amarok_export.h"
34 class AMAROK_EXPORT MediaItem
: public K3ListViewItem
37 MediaItem( Q3ListView
* parent
);
38 MediaItem( Q3ListViewItem
* parent
);
39 MediaItem( Q3ListView
* parent
, Q3ListViewItem
* after
);
40 MediaItem( Q3ListViewItem
* parent
, Q3ListViewItem
* after
);
44 MediaItem
*lastChild() const;
46 virtual KUrl
url() const;
47 const MetaBundle
*bundle() const;
48 void setBundle( MetaBundle
*bundle
);
50 enum Type
{ UNKNOWN
, ARTIST
, ALBUM
, TRACK
, PODCASTSROOT
, PODCASTCHANNEL
,
51 PODCASTITEM
, PLAYLISTSROOT
, PLAYLIST
, PLAYLISTITEM
, INVISIBLEROOT
,
52 INVISIBLE
, STALEROOT
, STALE
, ORPHANEDROOT
, ORPHANED
, DIRECTORY
};
54 enum Flags
{ Failed
=1, BeginTransfer
=2, StopTransfer
=4, Transferring
=8, SmartPlaylist
=16 };
56 void setType( Type type
);
57 void setFailed( bool failed
=true );
58 Type
type() const { return m_type
; }
59 MediaItem
*findItem(const QString
&key
, const MediaItem
*after
=0) const;
60 const QString
&data() const { return m_data
; }
61 void setData( const QString
&data
) { m_data
= data
; }
63 virtual bool isLeafItem() const; // A leaf node of the tree
64 virtual bool isFileBacked() const; // Should the file be deleted of the device when removed
65 virtual QDateTime
playTime() const { return QDateTime(); }
66 virtual int played() const { return 0; }
67 virtual int recentlyPlayed() const { return 0; } // no of times played on device since last sync
68 virtual void setPlayCount( int ) {}
69 virtual int rating() const { return 0; } // rating on device, normalized to 100
70 virtual void setRating( int /*rating*/ ) {}
71 virtual bool ratingChanged() const { return false; }
72 virtual void setLastPlayed( uint
) {}
73 virtual void syncStatsFromPath( const QString
&path
);
74 virtual long size() const;
75 virtual MediaDevice
*device() const { return m_device
; }
76 virtual bool listened() const { return m_listened
; }
77 virtual void setListened( bool listened
=true ) { m_listened
= listened
; }
79 int compare( Q3ListViewItem
*i
, int col
, bool ascending
) const;
80 int flags() const { return m_flags
; }
83 void paintCell( QPainter
*p
, const QColorGroup
&cg
, int column
, int width
, int align
);
88 QString m_playlistName
;
90 MediaDevice
*m_device
;
94 static QPixmap
*s_pixUnknown
;
95 static QPixmap
*s_pixRootItem
;
96 static QPixmap
*s_pixFile
;
97 static QPixmap
*s_pixArtist
;
98 static QPixmap
*s_pixAlbum
;
99 static QPixmap
*s_pixPlaylist
;
100 static QPixmap
*s_pixPodcast
;
101 static QPixmap
*s_pixTrack
;
102 static QPixmap
*s_pixInvisible
;
103 static QPixmap
*s_pixStale
;
104 static QPixmap
*s_pixOrphaned
;
105 static QPixmap
*s_pixDirectory
;
106 static QPixmap
*s_pixTransferFailed
;
107 static QPixmap
*s_pixTransferBegin
;
108 static QPixmap
*s_pixTransferEnd
;
111 mutable MetaBundle
*m_bundle
;
114 #endif /*AMAROK_MEDIAITEM_H*/