defuze.me  Client
libraryitem.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 "libraryitem.hpp"
00012 #include "librarymodel.hpp"
00013 
00014 using namespace Library;
00015 
00016 LibraryItem::LibraryItem(const QString title, int id, int itemKind, TreeItem *parent)
00017     : TreeItem(title, parent), id(id)
00018 {
00019     isInAlbum = false;
00020     if (itemKind == LibraryModel::ALBUM)
00021         kind = ALBUM;
00022     else if (itemKind == LibraryModel::ALBUM_ARTIST ||
00023              itemKind == LibraryModel::ARTIST)
00024         kind = ARTIST;
00025     else if (itemKind == LibraryModel::GENRE)
00026         kind = GENRE;
00027     else
00028     {
00029         if (itemKind == LibraryModel::TRACK)
00030             isInAlbum = true;
00031         kind = TRACK;
00032     }
00033 }
00034 
00035 LibraryItem::Kind LibraryItem::getKind() const
00036 {
00037     return kind;
00038 }
00039 
00040 bool LibraryItem::getIsInAlbum() const
00041 {
00042     return isInAlbum;
00043 }
00044 
00045 AudioTrack* LibraryItem::getTrack()
00046 {
00047     return AudioTrack::getTrack(id);
00048 }
00049 
00050 int         LibraryItem::getId() const
00051 {
00052     return id;
00053 }