Music Hub  ..
A session-wide music playback service
track_list_skeleton.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_SKELETON_H_
19 #define CORE_UBUNTU_MEDIA_TRACK_LIST_SKELETON_H_
20 
21 #include "apparmor/ubuntu.h"
22 
23 #include <core/media/track_list.h>
24 
25 #include <core/media/player.h>
26 
27 #include <core/dbus/object.h>
28 #include <core/dbus/skeleton.h>
29 
30 namespace core
31 {
32 namespace ubuntu
33 {
34 namespace media
35 {
37 {
38 public:
39  TrackListSkeleton(const core::dbus::Bus::Ptr& bus, const core::dbus::Object::Ptr& object,
43 
44  bool has_next();
45  bool has_previous();
46  Track::Id next();
48  const Track::Id& current();
49 
50  const core::Property<bool>& can_edit_tracks() const;
51  const core::Property<Container>& tracks() const;
52 
53  const core::Signal<ContainerTrackIdTuple>& on_track_list_replaced() const;
54  const core::Signal<Track::Id>& on_track_added() const;
55  core::Signal<Track::Id>& on_track_added();
56  const core::Signal<Track::Id>& on_track_removed() const;
57  const core::Signal<Track::Id>& on_track_changed() const;
58  const core::Signal<std::pair<Track::Id, bool>>& on_go_to_track() const;
59  core::Signal<std::pair<Track::Id, bool>>& on_go_to_track();
60  const core::Signal<void>& on_end_of_tracklist() const;
61  core::Signal<void>& on_end_of_tracklist();
62  core::Signal<Track::Id>& on_track_removed();
63 
64  core::Property<Container>& tracks();
67 
70  void on_shuffle_changed(bool shuffle);
71 
72 protected:
73  inline bool is_first_track(const ConstIterator &it);
74  inline bool is_last_track(const ConstIterator &it);
77 
78  core::Property<bool>& can_edit_tracks();
79 
80  core::Signal<ContainerTrackIdTuple>& on_track_list_replaced();
81  core::Signal<Track::Id>& on_track_changed();
82 
83  void reset();
84 
85 private:
86  struct Private;
87  std::unique_ptr<Private> d;
88 };
89 
90 // operator<< pretty prints the given TrackList status to the given output stream.
91 std::ostream& operator<<(std::ostream& out, const core::ubuntu::media::TrackList& tracklist);
92 
93 }
94 }
95 }
96 #endif // CORE_UBUNTU_MEDIA_PROPERTY_H_
const core::Property< Container > & tracks() const
const core::Signal< std::pair< Track::Id, bool > > & on_go_to_track() const
const core::Signal< Track::Id > & on_track_changed() const
Definition: player.h:33
const core::Signal< Track::Id > & on_track_removed() const
std::ostream & operator<<(std::ostream &out, Player::PlaybackStatus status)
Definition: player.h:188
std::shared_ptr< RequestContextResolver > Ptr
Definition: ubuntu.h:87
const core::Signal< void > & on_end_of_tracklist() const
core::ubuntu::media::Player::LoopStatus loop_status() const
const core::Signal< ContainerTrackIdTuple > & on_track_list_replaced() const
const core::Signal< Track::Id > & on_track_added() const
bool is_last_track(const ConstIterator &it)
void on_loop_status_changed(const core::ubuntu::media::Player::LoopStatus &loop_status)
bool is_first_track(const ConstIterator &it)
std::shared_ptr< RequestAuthenticator > Ptr
Definition: ubuntu.h:127
const core::Property< bool > & can_edit_tracks() const
Container::const_iterator ConstIterator
Definition: track_list.h:46
const TrackList::ConstIterator & current_iterator()
TrackListSkeleton(const core::dbus::Bus::Ptr &bus, const core::dbus::Object::Ptr &object, const core::ubuntu::media::apparmor::ubuntu::RequestContextResolver::Ptr &request_context_resolver, const core::ubuntu::media::apparmor::ubuntu::RequestAuthenticator::Ptr &request_authenticator)