Basic openoffice.org control, and listening for new presentation documents, still...
[kworship.git] / kworship / bible / KwBibleManager.h
blob99c069bc4c822944a395d21964097b3821e5fdc6
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 _KwBibleManager_h_
21 #define _KwBibleManager_h_
23 /**
24 * @file KwBibleManager.h
25 * @brief A bible manager (analagous to a SWORD manager).
26 * @author James Hogan <james@albanarts.com>
29 #include "KwBibleExport.h"
31 #include <Factory.h>
33 #include <QObject>
34 #include <QStringList>
35 #include <QString>
36 #include <QList>
37 #include <QMap>
39 class KwBibleModule;
41 #define KW_BIBLE_MANAGER(X, KEY) \
42 private: \
43 /* \
44 * Static private variables \
45 */ \
46 static bool s_registered; \
47 public: \
48 static void registerManager() \
49 { \
50 if (!s_registered) \
51 { \
52 s_registered = KwBibleManager::factory()->addType< X >(KEY); \
53 } \
56 #define KW_REGISTER_BIBLE_MANAGER(X) \
57 bool X::s_registered = false;
59 /// A bible manager (analagous to a SWORD manager).
60 class KWBIBLE_EXPORT KwBibleManager : public QObject
62 Q_OBJECT
64 public:
67 * Manager factory
70 /// Factory of managers identified by strings.
71 typedef ::Factory<QString, KwBibleManager, META_TUPLE(())> Factory;
73 /// Get a factory object.
74 static Factory* factory();
76 /// Get a singleton for a manager.
77 static KwBibleManager* singleton(const QString& key);
80 * Constructors + destructor
83 /// Default constructor.
84 KwBibleManager(QObject* parent = 0, const QStringList& params = QStringList());
86 /// Destructor.
87 virtual ~KwBibleManager();
90 * Main interface
93 /// Get the name of the manager.
94 virtual QString name() const = 0;
96 /** Get whether the manager is remote.
97 * This means the modules should not be accessed unless they are requested
98 * explicitly by the user.
100 virtual bool isRemote() const = 0;
102 /// Get a module by name.
103 virtual KwBibleModule* module(const QString& name) = 0;
105 /// Get the list of module names.
106 virtual QStringList moduleNames() = 0;
108 /// Get the list of module names in a specific language.
109 virtual QStringList moduleNamesInLanguage(const QString& lang) = 0;
111 /// Get a list of module languages.
112 virtual QStringList languages() = 0;
115 #endif // _KwBibleManager_h_