2
* Copyright © 2013 Canonical Ltd.
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.
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.
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/>.
16
* Authored by: Thomas Voß <thomas.voss@canonical.com>
19
#include "com/ubuntu/music/track_list.h"
21
#include "com/ubuntu/music/track.h"
27
namespace music = com::ubuntu::music;
29
struct music::TrackList::Private
31
std::vector<music::Track> tracks;
32
bool is_editable = true;
34
bool operator==(const Private& rhs) const
36
return tracks == rhs.tracks && is_editable == rhs.is_editable;
41
music::TrackList::TrackList() : d(new Private())
45
music::TrackList::TrackList(const music::TrackList& rhs) : d(new Private(*rhs.d))
49
music::TrackList::~TrackList()
53
music::TrackList& music::TrackList::operator=(const music::TrackList& rhs)
59
bool music::TrackList::operator==(const music::TrackList& rhs) const
64
bool music::TrackList::is_editable()
66
return d->is_editable;
69
void music::TrackList::add_track_with_uri(const music::Track::UriType& uri, const music::Track& after, bool make_current)
74
// ToDo: Talk to service.
77
void music::TrackList::remove_track(const Track& track)
81
// TODO: Talk to actual service here.
84
void music::TrackList::for_each(const std::function<void(const music::Track&)> functor) const
86
for (auto track : d->tracks)
90
void music::TrackList::go_to(const music::Track& track)
95
music::Connection music::TrackList::on_track_list_replaced(const std::function<void()>& slot)
98
return Connection(nullptr);
101
music::Connection music::TrackList::on_track_added(const std::function<void(const music::Track& t)>& slot)
104
return Connection(nullptr);
107
music::Connection music::TrackList::on_track_removed(const std::function<void(const music::Track& t)>& slot)
110
return Connection(nullptr);
113
music::Connection music::TrackList::on_current_track_changed(const std::function<void(const music::Track&)>& slot)
116
return Connection(nullptr);