X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Ftrack.cpp;h=50f5315e343821827dbcb9b1877103f756b8e9fe;hb=aef3af72d3bf587c3d6487d9fed6f5a71fe98afb;hp=c61a07a62203379366b195df04fbc76ff167c4a8;hpb=dd00ef6be1a5989020c9ae2c1fa6c17910b260d1;p=someplayer diff --git a/src/track.cpp b/src/track.cpp index c61a07a..50f5315 100644 --- a/src/track.cpp +++ b/src/track.cpp @@ -1,40 +1,67 @@ +/* + * SomePlayer - An alternate music player for Maemo 5 + * Copyright (C) 2010 Nikolay (somebody) Tischenko + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "track.h" #include "tagresolver.h" +#include using namespace SomePlayer::DataObjects; Track::Track() : QObject() { } -Track::Track(int id, TrackMetadata metadata, QString source) : QObject() { - _id = id; +Track::Track(TrackMetadata metadata, QString source) : QObject() { _metadata = metadata; + if (_metadata.title() == _UNKNOWN_TRACK_) { + QFileInfo info(source); + _metadata.setTitle(info.baseName()); + } _source = source; + _count = 0; } Track::Track(const Track &track) : QObject() { this->_metadata = track.metadata(); this->_source = track.source(); + this->_count = track._count; } +/// deprecated Track::Track(QString source) :QObject() { _resolver = new TagResolver(this); connect(_resolver, SIGNAL(decoded(Track)), this, SLOT(decoded(Track))); QStringList foo; foo << source; _resolver->decode(foo); + _count = 0; } TrackMetadata Track::metadata() const { return _metadata; } -QString Track::source() const { - return _source; +void Track::setMetadata(TrackMetadata meta) { + _metadata = meta; } -int Track::id() const { - return _id; +QString Track::source() const { + return _source; } void Track::setSource(QString source) { @@ -50,16 +77,15 @@ void Track::setCount(int count) { } void Track::decoded(Track track) { - _id = track.id(); _source = track.source(); _metadata = track.metadata(); delete _resolver; } Track &Track::operator =(const Track &track) { - _id = track.id(); _source = track.source(); _metadata = track.metadata(); + _count = track._count; return *this; }