File indexing completed on 2024-12-01 04:37:02

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolawidgets_private_export.h"
0010 #include <KPluginMetaData>
0011 #include <QObject>
0012 #include <QVector>
0013 
0014 class PluginText;
0015 
0016 class PluginTextUtilData
0017 {
0018 public:
0019     PluginTextUtilData() = default;
0020 
0021     QStringList mExtraInfo;
0022     QString mIdentifier;
0023     QString mName;
0024 };
0025 
0026 class TextPluginManagerInfo
0027 {
0028 public:
0029     TextPluginManagerInfo() = default;
0030 
0031     KPluginMetaData data;
0032     QString metaDataFileNameBaseName;
0033     QString metaDataFileName;
0034     PluginTextUtilData pluginData;
0035     PluginText *plugin = nullptr;
0036 };
0037 
0038 class LIBRUQOLAWIDGETS_TESTS_EXPORT TextPluginManager : public QObject
0039 {
0040     Q_OBJECT
0041 public:
0042     explicit TextPluginManager(QObject *parent = nullptr);
0043     ~TextPluginManager() override;
0044     static TextPluginManager *self();
0045 
0046     [[nodiscard]] QVector<PluginText *> pluginsList() const;
0047 
0048 private:
0049     Q_DISABLE_COPY(TextPluginManager)
0050     LIBRUQOLAWIDGETS_NO_EXPORT void initializePluginList();
0051     LIBRUQOLAWIDGETS_NO_EXPORT void loadPlugin(TextPluginManagerInfo *item);
0052     LIBRUQOLAWIDGETS_NO_EXPORT PluginTextUtilData createPluginMetaData(const KPluginMetaData &metaData);
0053     QVector<TextPluginManagerInfo> mPluginList;
0054     QVector<PluginTextUtilData> mPluginDataList;
0055 };