xref: /haiku/src/apps/mediaplayer/playlist/FilePlaylistItem.h (revision 3248de3de47011137e0c667a7247dd424c827bd7)
1c60fcc87SStephan Aßmus /*
2f70b711fSStephan Aßmus  * Copyright 2009-2010 Stephan Aßmus <superstippi@gmx.de>
3c60fcc87SStephan Aßmus  * All rights reserved. Distributed under the terms of the MIT license.
4c60fcc87SStephan Aßmus  */
5c60fcc87SStephan Aßmus #ifndef FILE_PLAYLIST_ITEM_H
6c60fcc87SStephan Aßmus #define FILE_PLAYLIST_ITEM_H
7c60fcc87SStephan Aßmus 
8c60fcc87SStephan Aßmus #include "PlaylistItem.h"
9c60fcc87SStephan Aßmus 
10ec2878c3SPhilippe Houdoin #include <vector>
11ec2878c3SPhilippe Houdoin 
12c60fcc87SStephan Aßmus #include <Entry.h>
13c60fcc87SStephan Aßmus 
14ec2878c3SPhilippe Houdoin using std::vector;
15ec2878c3SPhilippe Houdoin 
16ec2878c3SPhilippe Houdoin 
17c60fcc87SStephan Aßmus class FilePlaylistItem : public PlaylistItem {
18c60fcc87SStephan Aßmus public:
19c60fcc87SStephan Aßmus 								FilePlaylistItem(const entry_ref& ref);
20c60fcc87SStephan Aßmus 								FilePlaylistItem(const FilePlaylistItem& item);
21c60fcc87SStephan Aßmus 								FilePlaylistItem(const BMessage* archive);
22c60fcc87SStephan Aßmus 	virtual						~FilePlaylistItem();
23c60fcc87SStephan Aßmus 
24c60fcc87SStephan Aßmus 	virtual	PlaylistItem*		Clone() const;
25c60fcc87SStephan Aßmus 
26c60fcc87SStephan Aßmus 	// archiving
27c60fcc87SStephan Aßmus 	static	BArchivable*		Instantiate(BMessage* archive);
28c60fcc87SStephan Aßmus 	virtual	status_t			Archive(BMessage* into,
29c60fcc87SStephan Aßmus 									bool deep = true) const;
30c60fcc87SStephan Aßmus 
31c60fcc87SStephan Aßmus 	// attributes
32c60fcc87SStephan Aßmus 	virtual	status_t			SetAttribute(const Attribute& attribute,
33c60fcc87SStephan Aßmus 									const BString& string);
34c60fcc87SStephan Aßmus 	virtual	status_t			GetAttribute(const Attribute& attribute,
35c60fcc87SStephan Aßmus 									BString& string) const;
36c60fcc87SStephan Aßmus 
37c60fcc87SStephan Aßmus 	virtual	status_t			SetAttribute(const Attribute& attribute,
38c60fcc87SStephan Aßmus 									const int32& value);
39c60fcc87SStephan Aßmus 	virtual	status_t			GetAttribute(const Attribute& attribute,
40c60fcc87SStephan Aßmus 									int32& value) const;
41c60fcc87SStephan Aßmus 
42c60fcc87SStephan Aßmus 	virtual	status_t			SetAttribute(const Attribute& attribute,
43c60fcc87SStephan Aßmus 									const int64& value);
44c60fcc87SStephan Aßmus 	virtual	status_t			GetAttribute(const Attribute& attribute,
45c60fcc87SStephan Aßmus 									int64& value) const;
46c60fcc87SStephan Aßmus 
47*3248de3dSJulien Lepiller 	virtual	status_t			SetAttribute(const Attribute& attribute,
48*3248de3dSJulien Lepiller 									const float& value);
49*3248de3dSJulien Lepiller 	virtual	status_t			GetAttribute(const Attribute& attribute,
50*3248de3dSJulien Lepiller 									float& value) const;
51*3248de3dSJulien Lepiller 
52c60fcc87SStephan Aßmus 	// methods
53c60fcc87SStephan Aßmus 	virtual	BString				LocationURI() const;
54c60fcc87SStephan Aßmus 	virtual	status_t			GetIcon(BBitmap* bitmap,
55c60fcc87SStephan Aßmus 									icon_size iconSize) const;
56c60fcc87SStephan Aßmus 
57c60fcc87SStephan Aßmus 	virtual	status_t			MoveIntoTrash();
58c60fcc87SStephan Aßmus 	virtual	status_t			RestoreFromTrash();
59c60fcc87SStephan Aßmus 
60ec2878c3SPhilippe Houdoin 			status_t			AddRef(const entry_ref& ref);
Ref()61ec2878c3SPhilippe Houdoin 			const entry_ref&	Ref() const { return fRefs[0]; }
62ec2878c3SPhilippe Houdoin 
63ec2878c3SPhilippe Houdoin 			status_t			AddImageRef(const entry_ref& ref);
64ec2878c3SPhilippe Houdoin 			const entry_ref&	ImageRef() const;
651aa885efSAxel Dörfler 
66b5387effSMarkus Himmel protected:
6770efd0dbSDario Casalinuovo 	virtual	bigtime_t			_CalculateDuration();
6870efd0dbSDario Casalinuovo 	// playback
6970efd0dbSDario Casalinuovo 	virtual	TrackSupplier*		_CreateTrackSupplier() const;
70b5387effSMarkus Himmel 
71c60fcc87SStephan Aßmus private:
72f70b711fSStephan Aßmus 			status_t			_SetAttribute(const char* attrName,
73f70b711fSStephan Aßmus 									type_code type, const void* data,
74f70b711fSStephan Aßmus 									size_t size);
75f70b711fSStephan Aßmus 			status_t			_GetAttribute(const char* attrName,
76f70b711fSStephan Aßmus 									type_code type, void* data,
771c68b67aSMarkus Himmel 									size_t size) const;
78ec2878c3SPhilippe Houdoin 			status_t			_MoveIntoTrash(vector<entry_ref>* refs,
79ec2878c3SPhilippe Houdoin 									vector<BString>* namesInTrash);
80ec2878c3SPhilippe Houdoin 			status_t			_RestoreFromTrash(vector<entry_ref>* refs,
81ec2878c3SPhilippe Houdoin 									vector<BString>* namesInTrash);
82f70b711fSStephan Aßmus 
83f70b711fSStephan Aßmus private:
84ec2878c3SPhilippe Houdoin 	// always fRefs.size() == fNamesInTrash.size()
85ec2878c3SPhilippe Houdoin 			vector<entry_ref>	fRefs;
86ec2878c3SPhilippe Houdoin 			vector<BString>		fNamesInTrash;
87ec2878c3SPhilippe Houdoin 	// always fImageRefs.size() == fImageNamesInTrash.size()
88ec2878c3SPhilippe Houdoin 			vector<entry_ref>	fImageRefs;
89ec2878c3SPhilippe Houdoin 			vector<BString>		fImageNamesInTrash;
90c60fcc87SStephan Aßmus };
91c60fcc87SStephan Aßmus 
92c60fcc87SStephan Aßmus #endif // FILE_PLAYLIST_ITEM_H
93