Tulip  5.7.4
Large graphs analysis and drawing
PluginManager.h
1 /*
2  *
3  * This file is part of Tulip (https://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef PLUGINMANAGER_H
22 #define PLUGINMANAGER_H
23 
24 #include <QObject>
25 #include <QStringList>
26 
27 #include <tulip/tulipconf.h>
28 
29 class QNetworkReply;
30 
31 namespace tlp {
32 
33 class Plugin;
34 
35 struct TLP_QT_SCOPE PluginVersionInformation {
36  bool isValid;
37 
38  QString libraryLocation;
39  QString author;
40  QString version;
41  QString icon;
42  QString description;
43  QString date;
44 
45  QStringList dependencies;
46 
47  PluginVersionInformation();
48  PluginVersionInformation(const PluginVersionInformation &copy);
49  PluginVersionInformation &operator=(const PluginVersionInformation &) = default;
50 };
51 
52 struct TLP_QT_SCOPE PluginInformation {
53  QString name;
54  QString category;
55  PluginVersionInformation installedVersion;
56  PluginVersionInformation availableVersion;
57 
58  PluginInformation();
59  PluginInformation(const PluginInformation &copy);
60  PluginInformation &operator=(const PluginInformation &) = default;
61 
62  void fillLocalInfo(const tlp::Plugin &info);
63 };
64 
65 class TLP_QT_SCOPE PluginManager {
66  static QStringList _markedForInstallation;
67 
68 public:
69  enum PluginLocation { Remote = 0x01, Local = 0x02 };
70  Q_DECLARE_FLAGS(PluginLocations, PluginLocation)
71 
72  static const QString STABLE_LOCATION;
73  static const QString TESTING_LOCATION;
74 
75  typedef QList<PluginVersionInformation> PluginVersionInformationList;
76 
77  typedef QList<PluginInformation> PluginInformationList;
78 
79  static void addRemoteLocation(const QString &location);
80  static void removeRemoteLocation(const QString &location);
81  static QStringList remoteLocations();
82 
83  static PluginInformationList listPlugins(PluginLocations locations,
84  const QString &nameFilter = QString(),
85  const QString &categoryFilter = QString());
86 
87  static void markForRemoval(const QString &plugin);
88  static void markForInstallation(const QString &plugin, QObject *recv, const char *progressSlot);
89 
90  static QStringList markedForInstallation();
91  static QStringList markedForRemoval();
92  static void unmarkForRemoval(const QString &file);
93 };
94 
95 Q_DECLARE_OPERATORS_FOR_FLAGS(PluginManager::PluginLocations)
96 } // namespace tlp
97 
98 #endif // PLUGINMANAGER_H
99 ///@endcond
Top-level interface for plug-ins.
Definition: Plugin.h:86