File indexing completed on 2025-01-19 04:25:18

0001 /****************************************************************************************
0002  * Copyright (c) 2008 Peter ZHOU <peterzhoulei@gmail.com>                               *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #include "AmarokServicePluginManagerScript.h"
0018 
0019 #include "App.h"
0020 #include "services/ServicePluginManager.h"
0021 
0022 #include <QJSEngine>
0023 
0024 using namespace AmarokScript;
0025 
0026 AmarokServicePluginManagerScript::AmarokServicePluginManagerScript( QJSEngine *engine )
0027     : QObject( engine )
0028 {
0029     QJSValue scriptObject = engine->newQObject( this );
0030     engine->globalObject().property( QStringLiteral("Amarok") ).setProperty( QStringLiteral("ServicePluginManager"), scriptObject );
0031 }
0032 
0033 QStringList
0034 AmarokServicePluginManagerScript::loadedServices()
0035 {
0036     return ServicePluginManager::instance()->loadedServices();
0037 }
0038 
0039 QStringList
0040 AmarokServicePluginManagerScript::loadedServiceNames()
0041 {
0042     return ServicePluginManager::instance()->loadedServiceNames();
0043 }
0044 
0045 QString
0046 AmarokServicePluginManagerScript::serviceDescription( const QString &service )
0047 {
0048     return ServicePluginManager::instance()->serviceDescription( service );
0049 }
0050 
0051 QString
0052 AmarokServicePluginManagerScript::serviceMessages( const QString &service )
0053 {
0054     return ServicePluginManager::instance()->serviceMessages( service );
0055 }
0056 
0057 QString
0058 AmarokServicePluginManagerScript::sendMessage( const QString &service, const QString &message )
0059 {
0060     return ServicePluginManager::instance()->sendMessage( service, message );
0061 }