File indexing completed on 2025-01-05 04:26:51
0001 /**************************************************************************************** 0002 * Copyright (c) 2008 Peter ZHOU <peterzhoulei@gmail.com> * 0003 * Copyright (c) 2008 Nikolaj Hald Nielsen <nhn@kde.org> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify it under * 0006 * the terms of the GNU General Public License as published by the Free Software * 0007 * Foundation; either version 2 of the License, or (at your option) any later * 0008 * version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0011 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0012 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License along with * 0015 * this program. If not, see <http://www.gnu.org/licenses/>. * 0016 ****************************************************************************************/ 0017 0018 #include "AmarokStreamItemScript.h" 0019 0020 #include "core/support/Debug.h" 0021 0022 #include <QJSEngine> 0023 0024 //using namespace AmarokScript; 0025 0026 StreamItem::StreamItem( QJSEngine *engine ) 0027 : QObject( engine ) 0028 , m_year( 0 ) 0029 { 0030 qRegisterMetaType<StreamItem*>(); 0031 QJSValue scriptObj = engine->newQObject( this ); 0032 scriptObj.setPrototype( QJSValue() ); 0033 engine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("StreamItem"), scriptObj ); 0034 } 0035 0036 QString 0037 StreamItem::itemName() const 0038 { 0039 return m_name; 0040 } 0041 0042 QString 0043 StreamItem::infoHtml() const 0044 { 0045 return m_infoHtml; 0046 } 0047 0048 QString 0049 StreamItem::playableUrl() const 0050 { 0051 return m_playableUrl; 0052 } 0053 0054 QString 0055 StreamItem::callbackData() const 0056 { 0057 return m_callbackData; 0058 } 0059 0060 int 0061 StreamItem::level() const 0062 { 0063 return m_level; 0064 } 0065 0066 0067 QString 0068 StreamItem::album() const 0069 { 0070 return m_album; 0071 } 0072 0073 QString 0074 StreamItem::artist() const 0075 { 0076 return m_artist; 0077 } 0078 0079 QString 0080 StreamItem::genre() const 0081 { 0082 return m_genre; 0083 } 0084 0085 QString 0086 StreamItem::composer() const 0087 { 0088 return m_composer; 0089 } 0090 0091 int 0092 StreamItem::year() const 0093 { 0094 return m_year; 0095 } 0096 0097 QString 0098 StreamItem::coverUrl() 0099 { 0100 return m_coverUrl; 0101 } 0102 0103 0104 void 0105 StreamItem::setItemName( const QString &name ) 0106 { 0107 m_name = name; 0108 } 0109 0110 void 0111 StreamItem::setInfoHtml( const QString &infoHtml ) 0112 { 0113 m_infoHtml = infoHtml; 0114 } 0115 0116 void 0117 StreamItem::setPlayableUrl( const QString &playableUrl ) 0118 { 0119 m_playableUrl = playableUrl; 0120 } 0121 0122 void 0123 StreamItem::setCallbackData( const QString &callbackData ) 0124 { 0125 m_callbackData = callbackData; 0126 } 0127 0128 void 0129 StreamItem::setLevel( int level ) 0130 { 0131 m_level = level; 0132 } 0133 0134 void 0135 StreamItem::setAlbum( const QString &album ) 0136 { 0137 m_album = album; 0138 } 0139 0140 void 0141 StreamItem::setArtist( const QString &artist ) 0142 { 0143 m_artist = artist; 0144 } 0145 0146 void 0147 StreamItem::setGenre( const QString &genre ) 0148 { 0149 m_genre = genre; 0150 } 0151 0152 void 0153 StreamItem::setComposer( const QString &composer ) 0154 { 0155 m_composer = composer; 0156 } 0157 0158 void 0159 StreamItem::setYear( int year ) 0160 { 0161 m_year = year; 0162 } 0163 0164 void 0165 StreamItem::setCoverUrl( const QString &url ) 0166 { 0167 m_coverUrl = url; 0168 }