Tulip  4.1.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
PluginManager.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
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 <tulip/tulipconf.h>
25 
26 #include <QtCore/QStringList>
27 
28 class QNetworkReply;
29 
30 namespace tlp {
31 
32 class Plugin;
33 
34 struct TLP_QT_SCOPE PluginVersionInformations {
35  bool isValid;
36 
37  QString libraryLocation;
38  QString author;
39  QString version;
40  QString icon;
41  QString description;
42  QString date;
43 
44  QStringList dependencies;
45 
46  PluginVersionInformations();
47  PluginVersionInformations(const PluginVersionInformations& copy);
48 };
49 
50 struct TLP_QT_SCOPE PluginInformations {
51  QString name;
52  QString category;
53  PluginVersionInformations installedVersion;
54  PluginVersionInformations availableVersion;
55 
56  PluginInformations();
57  PluginInformations(const PluginInformations& copy);
58 
59  void fillLocalInfos(const tlp::Plugin*info);
60 };
61 
62 class TLP_QT_SCOPE PluginManager {
63  static QStringList _markedForInstallation;
64 
65 public:
66  enum PluginLocation {
67  Remote = 0x01,
68  Local = 0x02
69  };
70  Q_DECLARE_FLAGS(PluginLocations, PluginLocation)
71 
72  static const QString STABLE_LOCATION;
73  static const QString TESTING_LOCATION;
74 
75  typedef QList<PluginVersionInformations> PluginVersionInformationsList;
76 
77  typedef QList<PluginInformations> PluginInformationsList;
78 
79  static void addRemoteLocation(const QString& location);
80  static void removeRemoteLocation(const QString& location);
81  static QStringList remoteLocations();
82 
83  static PluginInformationsList listPlugins(PluginLocations locations,const QString& nameFilter = QString(),const QString& categoryFilter = QString());
84 
85  static void markForRemoval(const QString& plugin);
86  static void markForInstallation(const QString& plugin, QObject *recv, const char* progressSlot);
87 
88  static QStringList markedForInstallation();
89  static QStringList markedForRemoval();
90  static void unmarkForRemoval(const QString& file);
91 };
92 
93 Q_DECLARE_OPERATORS_FOR_FLAGS(PluginManager::PluginLocations)
94 }
95 
96 #endif //PLUGINMANAGER_H
97 ///@endcond