summaryrefslogtreecommitdiffstats
path: root/noatun/modules/splitplaylist/playlist.h
blob: 04cb648d29d4a0ace6776336530e50994862ba6d (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef PLAYLIST_H
#define PLAYLIST_H

#include <noatun/playlist.h>
#include <noatun/plugin.h>

/*
class PlaylistItem
{
	PlaylistItem(const KURL &u=0);
	virtual ~PlaylistItem();

	QString title() const;
	virtual void setTitle(const QString &t);

	KURL url() const;
	virtual void setUrl(const KURL &u);

	int length() const;
	virtual void setLength(int l);
};
*/
class SafeListViewItem;
class View;
class List;
class QListViewItem;

class SplitPlaylist : public Playlist, public Plugin
{
Q_OBJECT
friend class SafeListViewItem;
friend class List;
public:
	SplitPlaylist();
	~SplitPlaylist();

	/**
	 * go to the front
	 **/
	virtual void reset();

	virtual void clear();
	virtual void addFile(const KURL&, bool play=false);
	/**
	 * Cycle everthing through forward
	 **/
	virtual PlaylistItem next();
	PlaylistItem next(bool play);
	/**
	 * return the one that might/should be playing now
	 **/
	virtual PlaylistItem current();
	/**
	 * Cycle through backwards
	 **/
	virtual PlaylistItem previous();

	virtual PlaylistItem getFirst() const;
	virtual PlaylistItem getAfter(const PlaylistItem &item) const;

	virtual bool listVisible() const;
	virtual void init();

	virtual Playlist *playlist()
		{ return this; }

	static SplitPlaylist *SPL() { return Self; }
	inline bool exiting() const { return mExiting; }
public slots:
	virtual void showList();
	virtual void hideList();
	virtual void remove(const PlaylistItem&);
	virtual void sort();


public slots:
	void setCurrent(const PlaylistItem &, bool emitC);
	void setCurrent(const PlaylistItem &);

	void listItemSelected(QListViewItem*);

	void randomize();

private:
	PlaylistItem currentItem, randomPrevious;

signals:
	void play(PlaylistItem*);

private:
	bool mExiting; // HACK HACK HACK HACK!!!
	View *view;
//	QRect currentRect;
	static SplitPlaylist *Self;
};


#endif