File indexing completed on 2024-05-19 04:48:42
0001 /**************************************************************************************** 0002 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhn@kde.org> * 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 "ServiceBrowser.h" 0018 0019 #include "core/support/Debug.h" 0020 0021 #include <QStandardPaths> 0022 0023 ServiceBrowser * ServiceBrowser::s_instance = nullptr; 0024 0025 ServiceBrowser * ServiceBrowser::instance() 0026 { 0027 if ( s_instance == nullptr ) 0028 s_instance = new ServiceBrowser( QStringLiteral("internet") ); 0029 0030 return s_instance; 0031 } 0032 0033 0034 ServiceBrowser::ServiceBrowser( const QString& name, QWidget* parent ) 0035 : BrowserCategoryList( name, parent, true ) 0036 { 0037 debug() << "ServiceBrowser starting..."; 0038 0039 setLongDescription( i18n( "The Internet browser lets you browse online sources of content that integrates directly into Amarok. Amarok ships with a number of these sources, but many more can be added using scripts." ) ); 0040 0041 setImagePath( QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral("amarok/images/hover_info_internet.png") ) ); 0042 } 0043 0044 0045 ServiceBrowser::~ServiceBrowser() 0046 { 0047 DEBUG_BLOCK 0048 } 0049 0050 //TODO: This should be moved to the ScriptableServiceManager instead 0051 void 0052 ServiceBrowser::setScriptableServiceManager( ScriptableServiceManager * scriptableServiceManager ) 0053 { 0054 m_scriptableServiceManager = scriptableServiceManager; 0055 m_scriptableServiceManager->setParent( this ); 0056 connect ( m_scriptableServiceManager, &ScriptableServiceManager::addService, 0057 this, &ServiceBrowser::addService ); 0058 } 0059 0060 void 0061 ServiceBrowser::resetService( const QString &name ) 0062 { 0063 //What in the world is this for... 0064 0065 //Currently unused, but needed, in the future, for resetting a service based on config changes 0066 //or the user choosing to reset the state of the service somehow. 0067 Q_UNUSED( name ); 0068 } 0069 0070 void ServiceBrowser::addService( ServiceBase * service ) 0071 { 0072 DEBUG_BLOCK 0073 addCategory( service ); 0074 } 0075 0076