Version bump
[someplayer] / src / playlist.cpp
1 /*
2  * SomePlayer - An alternate music player for Maemo 5
3  * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #include "playlist.h"
21
22 using namespace SomePlayer::DataObjects;
23
24 Playlist::Playlist()
25 {
26         _name = "New playlist";
27 }
28
29 Playlist::Playlist(const Playlist &playlist) {
30         _name = playlist._name;
31         _tracks = playlist._tracks;
32 }
33
34 QString Playlist::name() {
35         return _name;
36 }
37
38 QList<Track> Playlist::tracks() {
39         return _tracks;
40 }
41
42 void Playlist::setName(QString name) {
43         _name = name;
44 }
45
46 void Playlist::addTrack(Track track) {
47         if (!_tracks.contains(track))
48                 _tracks.append(track);
49 }
50
51 void Playlist::removeTrack(Track track) {
52         _tracks.removeOne(track);
53 }
54
55 void Playlist::removeTrackAt(int id) {
56         _tracks.removeAt(id);
57 }
58
59 void Playlist::setTracks(QList<Track> tracks) {
60         _tracks = tracks;
61 }
62
63 void Playlist::clear() {
64         _tracks.clear();
65 }