File indexing completed on 2025-01-05 04:26:50
0001 /**************************************************************************************** 0002 * Copyright (c) 2008 Leo Franchi <lfranchi@kde.org> * 0003 * Copyright (c) 2008 Peter ZHOU <peterzhoulei@gmail.com> * 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_LYRICS_SCRIPT_H 0019 #define AMAROK_LYRICS_SCRIPT_H 0020 0021 #include "core/meta/forward_declarations.h" 0022 0023 #include <QObject> 0024 0025 class QJSEngine; 0026 class QByteArray; 0027 0028 namespace AmarokScript 0029 { 0030 // SCRIPTDOX Amarok.Lyrics 0031 class AmarokLyricsScript : public QObject 0032 { 0033 Q_OBJECT 0034 0035 public: 0036 explicit AmarokLyricsScript( QJSEngine* scriptEngine ); 0037 0038 Q_INVOKABLE void showLyrics( const QString& lyrics ) const; 0039 0040 Q_INVOKABLE void showLyricsHtml( const QString& lyrics ) const; 0041 Q_INVOKABLE void showLyricsError( const QString& error ) const; 0042 Q_INVOKABLE void showLyricsNotFound( const QString& msg ) const; 0043 0044 Q_INVOKABLE QString escape( const QString& str ); 0045 0046 Q_INVOKABLE void setLyricsForTrack( const QString& trackUrl , const QString& lyrics ) const; 0047 Q_INVOKABLE QString toUtf8( const QByteArray& lyrics, const QString& encoding = "UTF-8" ); 0048 Q_INVOKABLE QString QStringtoUtf8( const QString& lyrics, const QString& encoding = "UTF-8" ); 0049 Q_INVOKABLE QByteArray fromUtf8( const QString& str, const QString& encoding ); 0050 0051 Q_SIGNALS: 0052 void fetchLyrics( const QString& artist, const QString& title, const QString&, Meta::TrackPtr ); 0053 }; 0054 } 0055 0056 #endif