X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Ftrack.cpp;h=807f15633a4357d86f668a07f2ca64d2a441cbcc;hb=bd0e545d4cfd3809624a3ac57bb9ee0b14afec84;hp=e02a59e4543543a820f684271973294de73a5bf8;hpb=e0bce0a80c207c746ef2e5de527d7919e63252f7;p=someplayer diff --git a/src/track.cpp b/src/track.cpp index e02a59e..807f156 100644 --- a/src/track.cpp +++ b/src/track.cpp @@ -1,5 +1,25 @@ +/* + * 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; @@ -9,6 +29,10 @@ Track::Track() : QObject() { Track::Track(int id, TrackMetadata metadata, QString source) : QObject() { _id = id; _metadata = metadata; + if (_metadata.title() == _UNKNOWN_TRACK_) { + QFileInfo info(source); + _metadata.setTitle(info.baseName()); + } _source = source; _count = 0; } @@ -20,6 +44,7 @@ Track::Track(const Track &track) : QObject() { this->_count = track._count; } +/// deprecated Track::Track(QString source) :QObject() { _resolver = new TagResolver(this); connect(_resolver, SIGNAL(decoded(Track)), this, SLOT(decoded(Track))); @@ -27,13 +52,17 @@ Track::Track(QString source) :QObject() { foo << source; _resolver->decode(foo); _count = 0; - _id = 0; + _id = -1; } TrackMetadata Track::metadata() const { return _metadata; } +void Track::setMetadata(TrackMetadata meta) { + _metadata = meta; +} + QString Track::source() const { return _source; }