Music Hub  ..
A session-wide music playback service
null_track_list.h
Go to the documentation of this file.
1 /*
2  *
3  * This program is free software: you can redistribute it and/or modify it
4  * under the terms of the GNU Lesser General Public License version 3,
5  * as published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public License
13  * along with this program. If not, see <http://www.gnu.org/licenses/>.
14  *
15  * Authored by: Thomas Voß <thomas.voss@canonical.com>
16  */
17 
18 #ifndef CORE_MEDIA_NULL_TRACK_LIST_H_
19 #define CORE_MEDIA_NULL_TRACK_LIST_H_
20 
21 #include <core/media/track.h>
22 #include <core/media/track_list.h>
23 
24 namespace core
25 {
26 namespace ubuntu
27 {
28 namespace media
29 {
30 // A helper type to replace the playlist implementation below.
31 // Please note that this type is only a temporary manner. Ideally,
32 // the actual implementation should be injected as a dependency from the
33 // outside.
35 {
36  NullTrackList() = default;
37 
38  bool has_next()
39  {
40  return false;
41  }
42 
44  {
45  return media::Track::Id{};
46  }
47 
49  {
50  return media::Track::UriType{};
51  }
52 
53  const core::Property<bool>& can_edit_tracks() const override
54  {
55  return props_and_sigs.can_edit_tracks;
56  }
57 
58  const core::Property<Container>& tracks() const override
59  {
60  return props_and_sigs.tracks;
61  }
62 
64  {
65  return media::Track::MetaData{};
66  }
67 
68  void add_track_with_uri_at(const media::Track::UriType&, const media::Track::Id&, bool) override
69  {
70  }
71 
72  void remove_track(const media::Track::Id&) override
73  {
74  }
75 
76  void go_to(const media::Track::Id&) override
77  {
78  }
79 
80  const core::Signal<void>& on_track_list_replaced() const override
81  {
82  return props_and_sigs.on_track_list_replaced;
83  }
84 
85  const core::Signal<media::Track::Id>& on_track_added() const override
86  {
87  return props_and_sigs.on_track_added;
88  }
89 
90  const core::Signal<media::Track::Id>& on_track_removed() const override
91  {
92  return props_and_sigs.on_track_removed;
93  }
94 
95  const core::Signal<media::Track::Id>& on_track_changed() const override
96  {
97  return props_and_sigs.on_track_changed;
98  }
99 
100  struct
101  {
102  core::Property<bool> can_edit_tracks;
103  core::Property<TrackList::Container> tracks;
104  core::Signal<void> on_track_list_replaced;
105  core::Signal<media::Track::Id> on_track_added;
106  core::Signal<media::Track::Id> on_track_removed;
107  core::Signal<media::Track::Id> on_track_changed;
108  } props_and_sigs;
109 };
110 }
111 }
112 }
113 
114 #endif // CORE_MEDIA_NULL_TRACK_LIST_H_
const core::Property< bool > & can_edit_tracks() const override
virtual media::Track::MetaData query_meta_data_for_track(const media::Track::Id &) override
core::Property< bool > can_edit_tracks
core::Property< TrackList::Container > tracks
Definition: player.h:33
const core::Signal< void > & on_track_list_replaced() const override
const core::Signal< media::Track::Id > & on_track_removed() const override
core::Signal< media::Track::Id > on_track_added
void add_track_with_uri_at(const media::Track::UriType &, const media::Track::Id &, bool) override
struct core::ubuntu::media::NullTrackList::@21 props_and_sigs
media::Track::UriType query_uri_for_track(const media::Track::Id &)
const core::Signal< media::Track::Id > & on_track_changed() const override
void remove_track(const media::Track::Id &) override
std::string UriType
Definition: track.h:40
core::Signal< void > on_track_list_replaced
const core::Property< Container > & tracks() const override
void go_to(const media::Track::Id &) override
const core::Signal< media::Track::Id > & on_track_added() const override
core::Signal< media::Track::Id > on_track_removed
core::Signal< media::Track::Id > on_track_changed