File indexing completed on 2024-12-01 13:37:51
0001 /* 0002 * Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com> 0003 * 0004 * This file is part of Latte-Dock 0005 * 0006 * Latte-Dock is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU General Public License as 0008 * published by the Free Software Foundation; either version 2 of 0009 * the License, or (at your option) any later version. 0010 * 0011 * Latte-Dock is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License 0017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef INDICATORFACTORY_H 0021 #define INDICATORFACTORY_H 0022 0023 // local 0024 #include "../../liblatte2/types.h" 0025 0026 // Qt 0027 #include <QHash> 0028 #include <QObject> 0029 #include <QWidget> 0030 0031 class KPluginMetaData; 0032 0033 namespace Latte { 0034 namespace Indicator { 0035 0036 class Factory : public QObject 0037 { 0038 Q_OBJECT 0039 0040 public: 0041 Factory(QObject *parent); 0042 ~Factory() override; 0043 0044 int customPluginsCount(); 0045 QStringList customPluginIds(); 0046 QStringList customPluginNames(); 0047 QStringList customLocalPluginIds(); 0048 0049 KPluginMetaData metadata(QString pluginId); 0050 0051 void downloadIndicator(); 0052 void removeIndicator(QString id); 0053 0054 bool pluginExists(QString id) const; 0055 0056 QString uiPath(QString pluginName) const; 0057 0058 //! metadata record 0059 static bool metadataAreValid(KPluginMetaData &metadata); 0060 //! metadata file 0061 static bool metadataAreValid(QString &file); 0062 0063 //! imports an indicator compressed file 0064 static Latte::Types::ImportExportState importIndicatorFile(QString compressedFile); 0065 signals: 0066 void customPluginsChanged(); 0067 void pluginsUpdated(); 0068 0069 private: 0070 void reload(); 0071 0072 private: 0073 QHash<QString, KPluginMetaData> m_plugins; 0074 QHash<QString, QString> m_pluginUiPaths; 0075 0076 QStringList m_customPluginIds; 0077 QStringList m_customPluginNames; 0078 QStringList m_customLocalPluginIds; 0079 0080 QStringList m_watchedPaths; 0081 0082 QWidget *m_parentWidget; 0083 }; 0084 0085 } 0086 } 0087 0088 #endif