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 #ifndef AMAROK_STREAMITEM_SCRIPT_H
0019 #define AMAROK_STREAMITEM_SCRIPT_H
0020 
0021 #include <QMetaType> // for Q_DECLARE_METATYPE
0022 #include <QObject>
0023 
0024 class QJSEngine;
0025 
0026 //namespace AmarokScript{
0027 
0028     // SCRIPTDOX: Amarok.StreamItem
0029     class StreamItem : public QObject
0030     {
0031         Q_OBJECT
0032 
0033         Q_PROPERTY( QString itemName WRITE setItemName READ itemName )
0034         Q_PROPERTY( QString infoHtml WRITE setInfoHtml READ infoHtml )
0035         Q_PROPERTY( QString playableUrl WRITE setPlayableUrl READ playableUrl )
0036         Q_PROPERTY( QString callbackData WRITE setCallbackData READ callbackData )
0037         Q_PROPERTY( int level WRITE setLevel READ level )
0038 
0039         Q_PROPERTY( QString album WRITE setAlbum READ album )
0040         Q_PROPERTY( QString artist WRITE setArtist READ artist )
0041         Q_PROPERTY( QString genre WRITE setGenre READ genre )
0042         Q_PROPERTY( QString composer WRITE setComposer READ composer )
0043         Q_PROPERTY( int year WRITE setYear READ year )
0044         Q_PROPERTY( QString coverUrl WRITE setCoverUrl READ coverUrl )
0045 
0046         public:
0047             explicit StreamItem( QJSEngine *engine );
0048 
0049             QString itemName() const;
0050             QString infoHtml() const;
0051             QString playableUrl() const;
0052             QString callbackData() const;
0053             int level() const;
0054 
0055             QString album() const;
0056             QString artist() const;
0057             QString genre() const;
0058             QString composer() const;
0059             int year() const;
0060             QString coverUrl();
0061 
0062         private:
0063             void setItemName( const QString &name );
0064             void setInfoHtml( const QString &infoHtml );
0065             void setPlayableUrl( const QString &playableUrl );
0066             void setCallbackData( const QString &callbackData );
0067             void setLevel( int level );
0068 
0069             void setAlbum( const QString &album );
0070             void setArtist( const QString &artist );
0071             void setGenre( const QString &genre );
0072             void setComposer( const QString &composer );
0073             void setYear( int year );
0074             void setCoverUrl( const QString &url );
0075 
0076             QString m_name;
0077             QString m_infoHtml;
0078             QString m_playableUrl;
0079             QString m_callbackData;
0080             int m_level;
0081 
0082             //these are not required but can be used to override what is shown in the playlist and elsewhere.
0083             QString m_album;
0084             QString m_artist;
0085             QString m_genre;
0086             QString m_composer;
0087             int m_year;
0088             QString m_coverUrl;
0089 
0090     };
0091 //}
0092 
0093 Q_DECLARE_METATYPE( StreamItem* )
0094 
0095 #endif // AMAROK_STREAMITEM_SCRIPT_H