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
24
25#include <core/media/player.h>
26
27#include <core/dbus/object.h>
28#include <core/dbus/skeleton.h>
29
30namespace core
31{
32namespace ubuntu
33{
34namespace media
35{
37{
38public:
39 TrackListSkeleton(const core::dbus::Bus::Ptr& bus, const core::dbus::Object::Ptr& object,
43
44 bool has_next();
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 core::Signal<ContainerTrackIdTuple>& on_track_list_replaced();
55 const core::Signal<Track::Id>& on_track_added() const;
56 core::Signal<Track::Id>& on_track_added();
57 const core::Signal<ContainerURI>& on_tracks_added() const;
58 core::Signal<ContainerURI>& on_tracks_added();
59 const core::Signal<TrackIdTuple>& on_track_moved() const;
60 core::Signal<TrackIdTuple>& on_track_moved();
61 const core::Signal<Track::Id>& on_track_removed() const;
62 const core::Signal<void>& on_track_list_reset() const;
63 const core::Signal<Track::Id>& on_track_changed() const;
64 core::Signal<Track::Id>& on_track_changed();
65 const core::Signal<Track::Id>& on_go_to_track() const;
66 core::Signal<Track::Id>& on_go_to_track();
67 const core::Signal<void>& on_end_of_tracklist() const;
68 core::Signal<void>& on_end_of_tracklist();
69 core::Signal<Track::Id>& on_track_removed();
70 core::Signal<void>& on_track_list_reset();
71
72 core::Property<Container>& tracks();
75
76 void on_position_changed(uint64_t position);
77
81
82 virtual void set_shuffle(bool shuffle) = 0;
83 virtual bool shuffle() = 0;
85
86protected:
87 inline bool is_first_track(const ConstIterator &it)
88 { return it == std::begin(tracks().get()); }
89 inline bool is_last_track(const ConstIterator &it)
90 { return it == std::end(tracks().get()); }
97
98 core::Property<bool>& can_edit_tracks();
99
101
102 void reset();
103
104private:
105 struct Private;
106 std::unique_ptr<Private> d;
107};
108
109// operator<< pretty prints the given TrackList status to the given output stream.
110std::ostream& operator<<(std::ostream& out, const core::ubuntu::media::TrackList& tracklist);
111
112}
113}
114}
115#endif // CORE_UBUNTU_MEDIA_PROPERTY_H_
core::Property< bool > & can_edit_tracks()
const core::Signal< TrackIdTuple > & on_track_moved() const
core::ubuntu::media::Player::LoopStatus loop_status() const
const core::Signal< Track::Id > & on_track_added() const
core::Property< Container > & tracks()
core::Signal< Track::Id > & on_track_removed()
core::Signal< ContainerURI > & on_tracks_added()
const core::Signal< Track::Id > & on_go_to_track() const
core::Signal< ContainerTrackIdTuple > & on_track_list_replaced()
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)
TrackList::ConstIterator get_current_shuffled()
core::Signal< Track::Id > & on_track_added()
const core::Signal< Track::Id > & on_track_changed() const
core::Signal< TrackIdTuple > & on_track_moved()
const core::Signal< void > & on_track_list_reset() const
media::Track::Id get_current_track(void)
const core::Property< bool > & can_edit_tracks() const
const core::Signal< void > & on_end_of_tracklist() const
const core::Signal< ContainerTrackIdTuple > & on_track_list_replaced() const
bool is_last_track(const ConstIterator &it)
void on_loop_status_changed(const core::ubuntu::media::Player::LoopStatus &loop_status)
const TrackList::ConstIterator & current_iterator()
bool update_current_iterator(const TrackList::ConstIterator &it)
const core::Signal< ContainerURI > & on_tracks_added() const
void on_position_changed(uint64_t position)
virtual const media::TrackList::Container & shuffled_tracks()=0
core::Signal< void > & on_end_of_tracklist()
core::Signal< void > & on_track_list_reset()
core::Signal< Track::Id > & on_track_changed()
const core::Property< Container > & tracks() const
bool is_first_track(const ConstIterator &it)
const core::Signal< Track::Id > & on_track_removed() const
core::Signal< Track::Id > & on_go_to_track()
void set_current_track(const media::Track::Id &id)
virtual void set_shuffle(bool shuffle)=0
std::vector< Track::Id > Container
Definition: track_list.h:43
Container::const_iterator ConstIterator
Definition: track_list.h:48
std::shared_ptr< RequestAuthenticator > Ptr
Definition: ubuntu.h:134
std::shared_ptr< RequestContextResolver > Ptr
Definition: ubuntu.h:94
std::ostream & operator<<(std::ostream &out, Player::PlaybackStatus status)
Definition: player.h:217
Definition: player.h:34