Music Hub  ..
A session-wide music playback service
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 CORE_UBUNTU_MEDIA_TRACK_LIST_H_
19 #define CORE_UBUNTU_MEDIA_TRACK_LIST_H_
20 
21 #include <core/media/track.h>
22 
23 #include <core/property.h>
24 #include <core/signal.h>
25 
26 #include <functional>
27 #include <iosfwd>
28 #include <vector>
29 #include <memory>
30 
31 namespace core
32 {
33 namespace ubuntu
34 {
35 namespace media
36 {
37 class Player;
38 
39 class TrackList : public std::enable_shared_from_this<TrackList>
40 {
41  public:
42  typedef std::vector<Track::Id> Container;
43  typedef std::tuple<std::vector<Track::Id>, Track::Id> ContainerTrackIdTuple;
44  typedef Container::iterator Iterator;
45  typedef Container::const_iterator ConstIterator;
46 
47  static const Track::Id& after_empty_track();
48 
49  TrackList(const TrackList&) = delete;
50  ~TrackList();
51 
52  TrackList& operator=(const TrackList&) = delete;
53  bool operator==(const TrackList&) const = delete;
54 
56  virtual const core::Property<bool>& can_edit_tracks() const = 0;
57 
59  virtual const core::Property<Container>& tracks() const = 0;
60 
63 
65  virtual void add_track_with_uri_at(const Track::UriType& uri, const Track::Id& position, bool make_current) = 0;
66 
68  virtual void remove_track(const Track::Id& id) = 0;
69 
71  virtual void go_to(const Track::Id& track, bool toggle_player_state) = 0;
72 
74  bool has_next() const;
75 
77  bool has_previous() const;
78 
80  virtual Track::Id next() = 0;
81 
83  virtual Track::Id previous() = 0;
84 
85 
87  virtual void shuffle_tracks() = 0;
88 
90  virtual void unshuffle_tracks() = 0;
91 
93  virtual void reset() = 0;
94 
95 
97  virtual const core::Signal<ContainerTrackIdTuple>& on_track_list_replaced() const = 0;
98 
100  virtual const core::Signal<Track::Id>& on_track_added() const = 0;
101 
103  virtual const core::Signal<Track::Id>& on_track_removed() const = 0;
104 
106  virtual const core::Signal<Track::Id>& on_track_changed() const = 0;
107 
109  virtual const core::Signal<std::pair<Track::Id, bool>>& on_go_to_track() const = 0;
110 
111 protected:
112  TrackList();
113 };
114 
115 }
116 }
117 }
118 
119 #endif // CORE_UBUNTU_MEDIA_TRACK_LIST_H_
virtual const core::Property< Container > & tracks() const =0
virtual const core::Signal< Track::Id > & on_track_changed() const =0
bool operator==(const TrackList &) const =delete
virtual Track::MetaData query_meta_data_for_track(const Track::Id &id)=0
virtual void go_to(const Track::Id &track, bool toggle_player_state)=0
Definition: player.h:33
virtual const core::Signal< std::pair< Track::Id, bool > > & on_go_to_track() const =0
virtual const core::Signal< Track::Id > & on_track_added() const =0
virtual const core::Signal< Track::Id > & on_track_removed() const =0
virtual Track::Id next()=0
std::tuple< std::vector< Track::Id >, Track::Id > ContainerTrackIdTuple
Definition: track_list.h:43
virtual const core::Signal< ContainerTrackIdTuple > & on_track_list_replaced() const =0
virtual void unshuffle_tracks()=0
virtual void remove_track(const Track::Id &id)=0
Container::iterator Iterator
Definition: track_list.h:44
virtual void add_track_with_uri_at(const Track::UriType &uri, const Track::Id &position, bool make_current)=0
TrackList & operator=(const TrackList &)=delete
std::string UriType
Definition: track.h:40
std::vector< Track::Id > Container
Definition: track_list.h:42
virtual void shuffle_tracks()=0
static const Track::Id & after_empty_track()
Definition: track_list.cpp:23
virtual const core::Property< bool > & can_edit_tracks() const =0
Container::const_iterator ConstIterator
Definition: track_list.h:45
virtual Track::Id previous()=0