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 <list>
28 #include <memory>
29 
30 namespace core
31 {
32 namespace ubuntu
33 {
34 namespace media
35 {
36 class Player;
37 
38 class TrackList : public std::enable_shared_from_this<TrackList>
39 {
40  public:
41  typedef std::vector<Track::Id> Container;
42  typedef Container::iterator Iterator;
43  typedef Container::const_iterator ConstIterator;
44 
45  static const Track::Id& after_empty_track();
46 
47  TrackList(const TrackList&) = delete;
48  ~TrackList();
49 
50  TrackList& operator=(const TrackList&) = delete;
51  bool operator==(const TrackList&) const = delete;
52 
53  virtual const core::Property<bool>& can_edit_tracks() const = 0;
54  virtual const core::Property<Container>& tracks() const = 0;
55 
57  virtual void add_track_with_uri_at(const Track::UriType& uri, const Track::Id& position, bool make_current) = 0;
58  virtual void remove_track(const Track::Id& id) = 0;
59 
60  virtual void go_to(const Track::Id& track) = 0;
61 
62  virtual const core::Signal<void>& on_track_list_replaced() const = 0;
63  virtual const core::Signal<Track::Id>& on_track_added() const = 0;
64  virtual const core::Signal<Track::Id>& on_track_removed() const = 0;
65  virtual const core::Signal<Track::Id>& on_track_changed() const = 0;
66 
67 protected:
68  TrackList();
69 };
70 }
71 }
72 }
73 
74 #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
Definition: player.h:29
virtual const core::Signal< Track::Id > & on_track_added() const =0
virtual const core::Signal< Track::Id > & on_track_removed() const =0
virtual const core::Signal< void > & on_track_list_replaced() const =0
virtual void remove_track(const Track::Id &id)=0
virtual void go_to(const Track::Id &track)=0
Container::iterator Iterator
Definition: track_list.h:42
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:41
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:43