File indexing completed on 2024-05-05 04:49:21
0001 /**************************************************************************************** 0002 * Copyright (c) 2013 Konrad Zemek <konrad.zemek@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 #ifndef STATSYNCING_PROVIDER_FACTORY_H 0018 #define STATSYNCING_PROVIDER_FACTORY_H 0019 0020 #include "amarok_export.h" 0021 #include "core/support/PluginFactory.h" 0022 0023 #include <QIcon> 0024 0025 #include <QString> 0026 #include <QVariantMap> 0027 0028 namespace StatSyncing 0029 { 0030 class Provider; 0031 typedef QSharedPointer<Provider> ProviderPtr; 0032 class ProviderConfigWidget; 0033 0034 /** 0035 * A class allowing the creation of multiple providers of the same type. 0036 */ 0037 class AMAROK_EXPORT ProviderFactory : public Plugins::PluginFactory 0038 { 0039 Q_OBJECT 0040 0041 public: 0042 ProviderFactory(); 0043 ~ProviderFactory() override; 0044 0045 /** 0046 * A string that is unique to this provider factory. It may be used as a key 0047 * in associative structures. 0048 */ 0049 virtual QString type() const = 0; 0050 0051 /** 0052 * The name of the type of created provider. This name will be displayed 0053 * in the provider creation dialog. 0054 */ 0055 virtual QString prettyName() const = 0; 0056 0057 /** 0058 * User-visible short localized description. This is the default description 0059 * of created providers. Default implementation returns an empty string. 0060 */ 0061 virtual QString description() const; 0062 0063 /** 0064 * The icon representing the type of created provider. This icon will be 0065 * displayed in the provider creation dialog, and is the default icon 0066 * of created providers. 0067 */ 0068 virtual QIcon icon() const = 0; 0069 0070 /** 0071 * New instance of configuration widget for the provider. Please note that 0072 * ProviderFactory does *not* retain ownership of this pointer, therefore 0073 * should always return a new instance. 0074 */ 0075 virtual ProviderConfigWidget *createConfigWidget() = 0; 0076 0077 /** 0078 * Create a new provider instance using configuration stored in @param config 0079 */ 0080 virtual ProviderPtr createProvider( const QVariantMap &config ) = 0; 0081 }; 0082 0083 } // namespace StatSyncing 0084 0085 #endif // STATSYNCING_PROVIDER_H