Clementine-audio-player-Mac.../src/playlistitem.cpp

26 lines
599 B
C++
Raw Normal View History

2009-12-24 20:16:07 +01:00
#include "playlistitem.h"
#include "songplaylistitem.h"
2009-12-26 22:35:45 +01:00
#include "radioplaylistitem.h"
2009-12-24 20:16:07 +01:00
#include <QtDebug>
QString PlaylistItem::type_string() const {
switch (type()) {
case Type_Song: return "Song";
2009-12-26 22:35:45 +01:00
case Type_Radio: return "Radio";
2009-12-24 20:16:07 +01:00
default:
qWarning() << "Invalid PlaylistItem type:" << type();
return QString::null;
}
}
PlaylistItem* PlaylistItem::NewFromType(const QString& type) {
if (type == "Song")
return new SongPlaylistItem;
2009-12-26 22:35:45 +01:00
if (type == "Radio")
return new RadioPlaylistItem;
2009-12-24 20:16:07 +01:00
qWarning() << "Invalid PlaylistItem type:" << type;
return NULL;
}