Music Hub  ..
A session-wide music playback service
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Friends
track_list.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Thomas Voß <thomas.voss@canonical.com>
17  */
18 #ifndef COM_UBUNTU_MUSIC_TRACK_LIST_H_
19 #define COM_UBUNTU_MUSIC_TRACK_LIST_H_
20 
21 #include "com/ubuntu/music/track.h"
22 
23 #include <functional>
24 #include <memory>
25 
26 namespace com
27 {
28 namespace ubuntu
29 {
30 namespace music
31 {
32 class TrackList
33 {
34  public:
35  TrackList();
36  TrackList(const TrackList& rhs);
37  ~TrackList();
38 
39  TrackList& operator=(const TrackList&);
40  bool operator==(const TrackList&) const;
41 
42  bool is_editable();
43 
44  void add_track_with_uri(const Track::UriType& uri, const Track& after, bool make_current);
45  void remove_track(const Track& track);
46 
47  void for_each(const std::function<void(const Track&)> functor) const;
48 
49  void go_to(const Track& track);
50 
51  Connection on_track_list_replaced(const std::function<void()>& slot);
52  Connection on_track_added(const std::function<void(const Track& t)>& slot);
53  Connection on_track_removed(const std::function<void(const Track& t)>& slot);
54  Connection on_current_track_changed(const std::function<void(const Track&)>& slot);
55 
56  private:
57  struct Private;
58  std::unique_ptr<Private> d;
59 };
60 }
61 }
62 }
63 
64 #endif // COM_UBUNTU_MUSIC_TRACK_LIST_H_