diff options
author | Teus Benschop <teusjannette@gmail.com> | 2017-10-06 12:24:31 +0200 |
---|---|---|
committer | Teus Benschop <teusjannette@gmail.com> | 2017-10-06 12:24:31 +0200 |
commit | 90d2181239761f8950b95768d3b037843e9e8b50 (patch) | |
tree | 6cc667ab420cc04029de2de7e361d2305e214595 /src/backend/managers/cswordbackend.h | |
parent | 1ea03c0fce8066c1e22188447b4a6ca4dcef1201 (diff) |
New upstream version 2.11.0
Diffstat (limited to 'src/backend/managers/cswordbackend.h')
-rw-r--r-- | src/backend/managers/cswordbackend.h | 72 |
1 files changed, 31 insertions, 41 deletions
diff --git a/src/backend/managers/cswordbackend.h b/src/backend/managers/cswordbackend.h index 21da696..ff85bf6 100644 --- a/src/backend/managers/cswordbackend.h +++ b/src/backend/managers/cswordbackend.h @@ -4,7 +4,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2014 by the BibleTime developers. +* Copyright 1999-2016 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -15,16 +15,18 @@ #include <QObject> #include <QString> #include <QStringList> -#include "backend/drivers/cswordmoduleinfo.h" -#include "backend/bookshelfmodel/btbookshelfmodel.h" -#include "backend/filters/gbftohtml.h" -#include "backend/filters/osistohtml.h" -#include "backend/filters/plaintohtml.h" -#include "backend/filters/teitohtml.h" -#include "backend/filters/thmltohtml.h" -#include "backend/rendering/cbookdisplay.h" -#include "backend/rendering/cchapterdisplay.h" -#include "backend/rendering/centrydisplay.h" +#include "../../util/btassert.h" +#include "../drivers/cswordmoduleinfo.h" +#include "../drivers/btconstmoduleset.h" +#include "../bookshelfmodel/btbookshelfmodel.h" +#include "../filters/gbftohtml.h" +#include "../filters/osistohtml.h" +#include "../filters/plaintohtml.h" +#include "../filters/teitohtml.h" +#include "../filters/thmltohtml.h" +#include "../rendering/cbookdisplay.h" +#include "../rendering/cchapterdisplay.h" +#include "../rendering/centrydisplay.h" // Sword includes: #include <swmgr.h> @@ -89,7 +91,7 @@ public: /* Methods: */ /** \returns the CSwordBackend singleton instance (created if needed). */ static inline CSwordBackend * createInstance() { - Q_ASSERT(!m_instance); + BT_ASSERT(!m_instance); m_instance = new CSwordBackend(); return m_instance; } @@ -100,7 +102,7 @@ public: /* Methods: */ /** \brief Destroys the singleton instance, if one exists. */ static inline void destroyInstance() { delete m_instance; - m_instance = NULL; + m_instance = nullptr; } /** @@ -108,9 +110,14 @@ public: /* Methods: */ \note This method is equivalent to model()->modules(). \returns The list of modules managed by this backend. */ - inline const QList<CSwordModuleInfo *> & moduleList() const; + inline const QList<CSwordModuleInfo*> & moduleList() const { + return m_dataModel.moduleList(); + } + BtModuleList moduleList(CSwordModuleInfo::ModuleType type) const; - inline BtBookshelfModel * model(); + inline BtBookshelfModel * model() { + return &m_dataModel; + } /** \brief Initializes the Sword modules. @@ -165,7 +172,9 @@ public: /* Methods: */ \returns The global config object containing the configs of all modules merged together. */ - inline sword::SWConfig * getConfig() const; + inline sword::SWConfig * getConfig() const { + return config; + } /** \param[in] option The option name to return. @@ -192,26 +201,24 @@ public: /* Methods: */ void reloadModules(const SetupChangedReason reason); /** - \brief Takes off the given modules from the list and returns them. - \param[in] names The names of the modules to take. - \note User must take care of the deletion of the returned CSwordModuleInfo - pointers. + \brief Uninstalls the given modules. + \param[in] modules The modules to uninstall. */ - QList<CSwordModuleInfo *> takeModulesFromList(const QStringList & names); + void uninstallModules(BtConstModuleSet const & modules); /** \param[in] names The names of the modules to return. \returns a list of pointers to modules, created from a list of module names. */ - QList<CSwordModuleInfo *> getPointerList(const QStringList & names) const; + QList<CSwordModuleInfo*> getPointerList(const QStringList & names) const; /** \param[in] names The names of the modules to return. \returns a list of pointers to const modules, created from a list of module names. */ - QList<const CSwordModuleInfo *> getConstPointerList(const QStringList & names) const; + BtConstModuleList getConstPointerList(const QStringList & names) const; /** \brief Sword prefix list. @@ -240,10 +247,7 @@ protected: /* Methods: */ /** Reimplemented from sword::SWMgr. */ void AddRenderFilters(sword::SWModule * module, - sword::ConfigEntMap & section); - - /** Overrides Sword filters which appear to be buggy. */ - void filterInit(); + sword::ConfigEntMap & section) override; QStringList getSharedSwordConfigFiles() const; QString getPrivateSwordConfigPath() const; @@ -269,18 +273,4 @@ private: /* Fields: */ }; -/**Returns The list of modules managed by this backend*/ -inline const QList<CSwordModuleInfo *> & CSwordBackend::moduleList() const { - return m_dataModel.moduleList(); -} - -inline BtBookshelfModel * CSwordBackend::model() { - return &m_dataModel; -} - -/** Returns our local config object to store the cipher keys etc. locally for each user. The values of the config are merged with the global config. */ -inline sword::SWConfig * CSwordBackend::getConfig() const { - return config; -} - #endif |