Made plugins use KParts and so are able to load extra menus etc
[kworship.git] / kworship / KwPlugin.h
blob02790a45b8e8e5ffbdb02755fc51ece4c990413d
1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
4 * *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _KwPlugin_h_
21 #define _KwPlugin_h_
23 /**
24 * @file KwPlugin.h
25 * @brief An abstract KWorship plugin.
26 * @author James Hogan <james@albanarts.com>
29 #include <kdemacros.h>
31 #include <KParts/Plugin>
33 #include <QString>
35 class KwPluginManager;
37 class QDockWidget;
39 /// An abstract KWorship plugin.
40 class KDE_EXPORT KwPlugin : public KParts::Plugin
42 Q_OBJECT
44 public:
47 * Constructors + destructor
50 /** Primary constructor.
51 * @param id Short unique untranslated id.
52 * @param name Translated name of plugin.
53 * @param description Translated description of plugin.
55 KwPlugin(QObject* parent, const QString& id, const QString& name, const QString& description);
57 /// Destructor.
58 virtual ~KwPlugin();
61 * Basic information accessors
64 /// Get the id.
65 const QString& id() const;
67 /// Get the name.
68 const QString& name() const;
70 /// Get the description.
71 const QString& description() const;
73 /// Get whether the plugin is loaded.
74 bool isLoaded() const;
77 * Loading and unloading
80 /** Set the manager.
81 * This should only be called by the manager class itself.
82 * @pre Manager must not have already been set.
83 * @param manager New manager object.
85 void setManager(KwPluginManager* manager);
87 /** Load the plugin.
88 * @pre Manager must have been set.
90 void load();
92 /// Unload the plugin.
93 void unload();
95 protected:
98 * Loading and unloading virtual interface
101 /** Load the plugin.
102 * @pre !isLoaded()
104 virtual void _load() = 0;
106 /** Unload the plugin.
107 * @pre isLoaded()
109 virtual void _unload() = 0;
111 private:
114 * Constants
117 /// Short unique untranslated id.
118 QString m_id;
120 /// Translated name.
121 QString m_name;
123 /// Translated description.
124 QString m_description;
127 * Variables
130 /// The current plugin manager.
131 KwPluginManager* m_manager;
133 /// Whether the plugin is loaded.
134 bool m_loaded;
138 #endif // _KwPlugin_h_