File indexing completed on 2024-05-19 04:50:12
0001 /**************************************************************************************** 0002 * Copyright (c) 2010 - 2011 Stefan Derkits <stefan@derkits.at> * 0003 * Copyright (c) 2010 - 2011 Christian Wagner <christian.wagner86@gmx.at> * 0004 * Copyright (c) 2010 - 2011 Felix Winter <ixos01@gmail.com> * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify it under * 0007 * the terms of the GNU General Public License as published by the Free Software * 0008 * Foundation; either version 2 of the License, or (at your option) any later * 0009 * version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0012 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0013 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License along with * 0016 * this program. If not, see <http://www.gnu.org/licenses/>. * 0017 ****************************************************************************************/ 0018 0019 #ifndef GPODDERSERVICE_H 0020 #define GPODDERSERVICE_H 0021 0022 #include "core/support/Amarok.h" 0023 #include "GpodderProvider.h" 0024 #include "services/ServiceBase.h" 0025 0026 #include <QItemSelectionModel> 0027 #include <QSortFilterProxyModel> 0028 0029 class GpodderService; 0030 0031 namespace The { GpodderService *gpodderService(); } 0032 0033 class GpodderServiceFactory : public ServiceFactory 0034 { 0035 Q_PLUGIN_METADATA(IID AmarokPluginFactory_iid FILE "amarok_service_gpodder.json") 0036 Q_INTERFACES(Plugins::PluginFactory) 0037 Q_OBJECT 0038 0039 public: 0040 GpodderServiceFactory(); 0041 ~GpodderServiceFactory() override; 0042 0043 void init() override; 0044 QString name() override; 0045 KConfigGroup config() override; 0046 0047 private Q_SLOTS: 0048 void slotCreateGpodderService(); 0049 void slotRemoveGpodderService(); 0050 0051 private: 0052 ServiceBase *createGpodderService(); 0053 }; 0054 0055 class GpodderService : public ServiceBase 0056 { 0057 Q_OBJECT 0058 0059 public: 0060 GpodderService( GpodderServiceFactory *parent, const QString &name ); 0061 ~GpodderService() override; 0062 0063 private Q_SLOTS: 0064 void subscribe(); 0065 void itemSelected( CollectionTreeItem *selectedItem ); 0066 0067 private: 0068 void init(); 0069 void polish() override; 0070 0071 void enableGpodderProvider( const QString &username ); 0072 0073 Collections::Collection *collection() override { return nullptr; } 0074 0075 bool m_inited; 0076 0077 mygpo::ApiRequest *m_apiRequest; 0078 0079 Podcasts::GpodderProvider *m_podcastProvider; 0080 0081 QSortFilterProxyModel *m_proxyModel; 0082 0083 QPushButton *m_subscribeButton; 0084 QItemSelectionModel *m_selectionModel; 0085 }; 0086 0087 #endif // GPODDERSERVICE_H