summaryrefslogtreecommitdiffstats
path: root/src/plugincontroller.h
blob: 9b526e3eabef446537ec21601f94ee66ae87e6de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef __PLUGINCONTROLLER_H__
#define __PLUGINCONTROLLER_H__

#include <qdict.h>
#include <qvaluelist.h>

#include <kservice.h>

#include <kdevplugincontroller.h>

#include <profileengine.h>

class KXMLGUIClient;
class KService;
class KDevPlugin;
class KDialogBase;
class ProjectInfo;

/**
Plugin controller implementation.
Loads and unloads plugins.
*/
class PluginController : public KDevPluginController
{
  Q_OBJECT

public:

  ~PluginController();

  static PluginController *getInstance();
  static QStringList argumentsFromService( const KService::Ptr &service );


  virtual KDevPlugin * loadPlugin( const QString & serviceType, const QString & constraint );
  virtual void unloadPlugin( const QString & plugin );

  QString currentProfile() const { return m_profile; }

  void loadInitialPlugins();

  void loadProjectPlugins( const QStringList & ignorePlugins );
  void unloadProjectPlugins();

  void loadGlobalPlugins( const QStringList & ignorePlugins = QStringList() );

  //  KDevPlugin * getPlugin( const KService::Ptr &service );

  virtual KDevPlugin *extension(const QString &serviceType, const QString &constraint = "");

  void unloadPlugins( QStringList const & );

  void integratePart(KXMLGUIClient *part);
  void integrateAndRememberPart(const QString &name, KDevPlugin *part);
  void removePart(KXMLGUIClient* part);
  void removeAndForgetPart(const QString &name, KDevPlugin* part);

  const QValueList<KDevPlugin*> loadedPlugins();

  ProfileEngine &engine() { return m_engine; }

  virtual KURL::List profileResources(const QString &nameFilter);
  virtual KURL::List profileResourcesRecursive(const QString &nameFilter);

  //returns the name of an old profile that was unloaded
  QString changeProfile(const QString &newProfile);

public slots:
  void selectPlugins();

signals:
  void loadingPlugin(const QString &plugin);

protected:
  PluginController();

private slots:
//  void slotConfigWidget( KDialogBase* );
  void loadCorePlugins();
  void loadPlugins( KTrader::OfferList offers, const QStringList & ignorePlugins = QStringList() );
  void unloadPlugins();

private:
	static KDevPlugin *loadPlugin( const KService::Ptr &service );


  QDict<KDevPlugin> m_parts;
  QString m_profile;

  static PluginController *s_instance;

  ProfileEngine m_engine;

};

#endif