File: plugin.h

package info (click to toggle)
packagesearch 2.7.5
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 3,248 kB
  • ctags: 2,160
  • sloc: cpp: 12,397; perl: 252; makefile: 69; sh: 13
file content (91 lines) | stat: -rw-r--r-- 2,526 bytes parent folder | download | duplicates (5)
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
#ifndef __PLUGIN_H_2004_06_21
#define __PLUGIN_H_2004_06_21

#include <string>

#include "ixmlstorable.h"

namespace NPlugin
{

class IProvider;

/**
  * @author Benjamin Mesing
  */
class Plugin : NXml::IXmlStorable
{
protected:
	/** This offers an empty string for its children. */
	static const QString _emptyString;
public:
	virtual ~Plugin() {};
	/**
	  * 
	  * @param pProvider provides information needed by the plugin
	  */
	virtual void init(IProvider* pProvider) = 0;
	/**
	  * Enables/Disables all widgets that belong to this plugin.
	  * @param enabled 
	  */
	virtual void setEnabled(bool enabled) = 0;
	/**
	  * Shows or hides the given plugin.
	  * @param visible 
	  */
	virtual void setVisible(bool visible) = 0;
	
	/** @brief Returns the name of the plugin, this should be unique in the whole application.
	  *
	  * This name should be used in the IPluginFactory to create the plugins for 
	  * the container.
	  *
	  * You will probably want code like this:
	  * @code
class MyPlugin : SearchPlugin	// SearchPlugin inherits Plugin
{
public:
	static const QString PLUGIN_NAME = "MyPlugin";	// note that you can't initialize this way in C++
	virtual QString name() const { return PLUGIN_NAME; }
	[...]
};
	  * @endcode
	  * It is probably sufficient to make the name unique in the plugin container it belongs
	  * to, but I'm not sure about this.
	  */
	virtual QString name() const = 0;

	/** @brief Returns the title of the plugin, this is how it will be shown in configuration
	  * dialogs or similar.
	  * 
	  */
	virtual QString title() const = 0;
	/** @returns a brief description for this plugin. */
	virtual QString briefDescription() const = 0;
	/** @returns a description for this plugin. */
	virtual QString description() const = 0;
	/** @brief Loads the settings from the element node.
	  *
	  * Does nothing in its default implementation. 
	  * @param source data used as source for loading
	  */
	virtual QDomElement loadSettings(const QDomElement source);
	/** @brief Save the settings from this plugin container into the given XML tree
	  * 
	  * Does nothing in its default implementation.\n
	  * If settings are to be saved they must contain of a single tree with a 
	  * QDomElement in the root which must be added under parent.
	  * @param parent the parent under which to add the settings
	  * @param outData XML Document which owns parent
	  */
	virtual void saveSettings(NXml::XmlData& outData, QDomElement parent) const;

};



}	// namespace NPlugin

#endif	// __PLUGIN_H_2004_06_21