2 * SomePlayer - An alternate music player for Maemo 5
3 * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
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.
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.
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.
21 #include "tagresolver.h"
24 using namespace SomePlayer::DataObjects;
26 Track::Track() : QObject() {
29 Track::Track(int id, TrackMetadata metadata, QString source) : QObject() {
32 if (_metadata.title() == _UNKNOWN_TRACK_) {
33 QFileInfo info(source);
34 _metadata.setTitle(info.baseName());
40 Track::Track(const Track &track) : QObject() {
41 this->_metadata = track.metadata();
42 this->_source = track.source();
43 this->_id = track._id;
44 this->_count = track._count;
48 Track::Track(QString source) :QObject() {
49 _resolver = new TagResolver(this);
50 connect(_resolver, SIGNAL(decoded(Track)), this, SLOT(decoded(Track)));
53 _resolver->decode(foo);
58 TrackMetadata Track::metadata() const {
62 void Track::setMetadata(TrackMetadata meta) {
66 QString Track::source() const {
70 int Track::id() const {
74 void Track::setSource(QString source) {
78 int Track::count() const{
82 void Track::setCount(int count) {
86 void Track::decoded(Track track) {
88 _source = track.source();
89 _metadata = track.metadata();
93 Track &Track::operator =(const Track &track) {
95 _source = track.source();
96 _metadata = track.metadata();
97 _count = track._count;
103 bool Track::operator ==(const Track &track) {
104 return _source == track._source;