~ubuntu-branches/ubuntu/saucy/clementine/saucy

« back to all changes in this revision

Viewing changes to src/scripting/python/queue.sip

  • Committer: Package Import Robot
  • Author(s): Thomas PIERSON
  • Date: 2012-01-01 20:43:39 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120101204339-lsb6nndwhfy05sde
Tags: 1.0.1+dfsg-1
New upstream release. (Closes: #653926, #651611, #657391)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
struct Queue : QAbstractProxyModel {
2
 
 
3
 
%TypeHeaderCode
4
 
#include "playlist/queue.h"
5
 
%End
6
 
 
7
 
%Docstring
8
 
A model containing the list of songs that are enqueued on a playlist.
9
 
 
10
 
In Clementine each L{Playlist} has its own Queue object.  The Queue keeps an
11
 
ordered list of items that are enqueued on that playlist.  Whenever a song
12
 
finishes the top item is removed from the Queue and is played immediately.
13
 
When there are no items left on the Queue playback continues again in the normal
14
 
order.
15
 
 
16
 
The L{Playlist} is a standard Qt item model where each row represents one item
17
 
in the playlist.  The Queue is a Qt proxy model on top of the Playlist model,
18
 
which means that rows in the Queue can map directly onto rows in the Playlist.
19
 
Use C{mapToSource(index)} and C{mapFromSource(index)} to map rows in the Queue
20
 
to or from rows in the Playlist.
21
 
 
22
 
You can't create Queue objects directly.  Instead you have to get a Queue from
23
 
an existing playlist.
24
 
 
25
 
  >>> queue = clementine.playlists.current().queue()
26
 
  >>> queue.Clear()
27
 
%End
28
 
 
29
 
public:
30
 
  static const char* kRowsMimetype;
31
 
 
32
 
  bool is_empty() const;
33
 
%Docstring
34
 
is_empty() -> bool
35
 
Checks whether the queue is empty.
36
 
%End
37
 
 
38
 
  int PositionOf(const QModelIndex& source_index) const;
39
 
%Docstring
40
 
PositionOf(source_index) -> int
41
 
Finds the position in the Queue of a playlist item.
42
 
 
43
 
@param source_index: The index of an item in the underlying L{Playlist} model.
44
 
@type source_index: L{PyQt4.QtCore.QModelIndex}
45
 
@return: The position in the queue of the playlist item, or -1 if the playlist
46
 
  item is invalid or is not in the queue.
47
 
%End
48
 
 
49
 
  bool ContainsSourceRow(int source_row) const;
50
 
%Docstring
51
 
ContainsSourceRow(source_row) -> bool
52
 
Checks whether a playlist row is in the queue.
53
 
 
54
 
@param source_row: The row number of an item in the underlying L{Playlist} model.
55
 
@type source_row: int
56
 
%End
57
 
 
58
 
  int PeekNext() const;
59
 
%Docstring
60
 
PeekNext() -> int
61
 
Returns the row number in the L{Playlist} of the next item in the queue, leaving
62
 
the Queue unchanged.
63
 
%End
64
 
 
65
 
  int TakeNext();
66
 
%Docstring
67
 
TakeNext() -> int
68
 
Like L{PeekNext()}, but removes the item from the Queue as well as returning it.
69
 
%End
70
 
 
71
 
  void ToggleTracks(const QModelIndexList& source_indexes);
72
 
%Docstring
73
 
ToggleTracks(source_indexes)
74
 
Adds or removes the Playlist indexes to/from the queue.
75
 
 
76
 
@param source_indexes: A list of indexes from the underlying L{Playlist} model.
77
 
@type source_indexes: list of L{PyQt4.QtCore.QModelIndex}es
78
 
%End
79
 
 
80
 
  void Clear();
81
 
%Docstring
82
 
Clear()
83
 
Removes all the items from the Queue.
84
 
%End
85
 
 
86
 
  void Move(const QList<int>& proxy_rows, int pos);
87
 
%Docstring
88
 
Move(proxy_rows, pos)
89
 
Moves a list of queued items to a different position in the queue.
90
 
 
91
 
Example::
92
 
 
93
 
  # Moves the second item to the front.
94
 
  queue.Move([1], 0)
95
 
  
96
 
  # Moves the first three items to the end.
97
 
  queue.Move([0, 1, 2], queue.rowCount() - 1)
98
 
 
99
 
@param proxy_rows: A list of row numbers of items already in the queue.
100
 
@type proxy_rows: list of ints
101
 
@param pos: The new position in which to insert the items.
102
 
@type pos: int
103
 
%End
104
 
 
105
 
  void MoveUp(int row);
106
 
%Docstring
107
 
MoveUp(row)
108
 
Moves the queued item up one position in the Queue.
109
 
 
110
 
This is equivalent to::
111
 
 
112
 
  queue.Move([row], row - 1)
113
 
%End
114
 
 
115
 
  void MoveDown(int row);
116
 
%Docstring
117
 
MoveUp(row)
118
 
Moves the queued item down one position in the Queue.
119
 
 
120
 
This is equivalent to::
121
 
 
122
 
  queue.Move([row], row + 2)
123
 
%End
124
 
 
125
 
private:
126
 
  Queue();
127
 
};