defuze.me  Client
queuetrack.cpp
00001 /**************************************************************************
00002 ** defuze.me Epitech Innovative Project
00003 **
00004 ** Copyright 2010-2011
00005 **   Athena Calmettes - Jocelyn De La Rosa - Francois Gaillard
00006 **   Adrien Jarthon - Alexandre Moore - Luc Peres - Arnaud Sellier
00007 **
00008 ** All rights reserved.
00009 **************************************************************************/
00010 
00011 #include "queuetrack.hpp"
00012 
00013 using namespace Queue;
00014 
00015 QueueTrack::QueueTrack(Library::AudioTrack &track) : track(track)
00016 {
00017 }
00018 
00019 QueueTrack::~QueueTrack()
00020 {}
00021 
00022 Library::AudioTrack*    QueueTrack::getTrack() const
00023 {
00024     return &track;
00025 }
00026 
00027 Library::AudioTrack*    QueueTrack::getTrack()
00028 {
00029     return &track;
00030 }
00031 
00032 int         QueueTrack::queueDuration(QDateTime) const
00033 {
00034     return track.getDuration();
00035 }
00036 
00037 QString     QueueTrack::queueType() const
00038 {
00039     return "QueueTrack";
00040 }
00041 
00042 int         QueueTrack::queueId() const
00043 {
00044     return track.getUid();
00045 }
00046 
00047 QVariantMap QueueTrack::getContent(bool forWeb) const
00048 {
00049     QVariantMap content;
00050 
00051     if (forWeb)
00052         content["uid"] = track.getUid();
00053     else
00054         content["id"] = track.getUid();
00055     content["title"] = track.getTitle();
00056     content["artist"] = track.getArtist();
00057     content["album_artist"] = track.getAlbumArtist();
00058     content["album"] = track.getAlbum();
00059     content["year"] = track.getYear();
00060     content["track"] = track.getTrack();
00061     content["genre"] = track.getGenre();
00062     content["duration"] = track.getDuration();
00063     return content;
00064 }
00065 
00066 Queueable*  QueueTrack::clone() const
00067 {
00068     QueueTrack  *instance = new QueueTrack(track);
00069     instance->attributes = attributes;
00070     return instance;
00071 }