BibleTime
|
The backend layer main class, a backend implementation of Sword. More...
#include <cswordbackend.h>
Classes | |
struct | Private |
Public Types | |
enum | LoadError { NoSwordConfig = -1 , NoError = 0 , NoModules = 1 } |
The error codes which may be returned by the Load() call. More... | |
Signals | |
void | sigSwordSetupChanged () |
Public Member Functions | |
std::shared_ptr< AvailableLanguagesCacheContainer const > | availableLanguages () noexcept |
QString | booknameLanguage () const |
CSwordBackend () | |
Creates the regular CSwordBackend instance. | |
CSwordBackend (const QString &path, const bool augmentHome=true) | |
void | deleteOrphanedIndices () |
CSwordModuleInfo * | findFirstAvailableModule (CSwordModuleInfo::ModuleType type) |
CSwordModuleInfo * | findModuleByName (const QString &name) const |
Searches for a module with the given name. | |
CSwordModuleInfo * | findSwordModuleByPointer (const sword::SWModule *const swmodule) const |
Searches for a module with the given sword module as module(). | |
sword::SWConfig * | getConfig () const |
BtConstModuleList | getConstPointerList (const QStringList &names) const |
QList< CSwordModuleInfo * > | getPointerList (const QStringList &names) const |
CSwordBackend::LoadError | initModules () |
Initializes the Sword modules. | |
std::shared_ptr< BtBookshelfModel > | model () |
QList< CSwordModuleInfo * > const & | moduleList () const |
QString | prefixPath () const |
sword::SWMgr & | raw () |
void | reloadModules () |
Reloads all Sword modules. | |
void | setBooknameLanguage (QString const &langName) |
Sets the language for the international booknames of Sword. | |
void | setFilterOptions (const FilterOptions &options) |
void | setOption (CSwordModuleInfo::FilterOption const &type, const int state) |
Sets the state of the given filter option. | |
void | shutdownModules () |
Deinitializes and frees the modules. | |
QStringList | swordDirList () const |
Sword prefix list. | |
void | uninstallModules (BtConstModuleSet const &modules) |
Uninstalls the given modules. | |
~CSwordBackend () override | |
Static Public Member Functions | |
static CSwordBackend & | instance () noexcept |
Private Types | |
using | AvailableLanguagesCacheContainer = std::set< std::shared_ptr< Language const > > |
Private Attributes | |
std::shared_ptr< AvailableLanguagesCacheContainer const > | m_availableLanguagesCache |
std::shared_ptr< BtBookshelfModel > const | m_dataModel |
CSwordBackend::Private | m_manager |
Static Private Attributes | |
static CSwordBackend * | m_instance = nullptr |
The backend layer main class, a backend implementation of Sword.
This is the implementation of CBackend for Sword. It's additionally derived from SWMgr to provide functions of Sword.
Definition at line 56 of file cswordbackend.h.
|
private |
Definition at line 74 of file cswordbackend.h.
The error codes which may be returned by the Load() call.
Enumerator | |
---|---|
NoSwordConfig | |
NoError | |
NoModules |
Definition at line 66 of file cswordbackend.h.
CSwordBackend::CSwordBackend | ( | ) |
Creates the regular CSwordBackend instance.
Definition at line 56 of file cswordbackend.cpp.
References booknameLanguage(), BT_ASSERT, BT_CONNECT, btConfig(), deleteOrphanedIndices(), initModules(), m_availableLanguagesCache, m_dataModel, m_instance, and setBooknameLanguage().
CSwordBackend::CSwordBackend | ( | const QString & | path, |
const bool | augmentHome = true |
||
) |
[in] | path | The path which is used to load modules. |
[in] | augmentHome | Whether $HOME/.sword/ modules should be augmented with the other modules. |
Definition at line 81 of file cswordbackend.cpp.
|
override |
Definition at line 88 of file cswordbackend.cpp.
References shutdownModules().
|
noexcept |
Definition at line 102 of file cswordbackend.cpp.
References m_availableLanguagesCache, m_dataModel, and model().
Referenced by BtFontSettingsPage::BtFontSettingsPage(), and CDisplayTemplateMgr::fillTemplate().
QString CSwordBackend::booknameLanguage | ( | ) | const |
Definition at line 336 of file cswordbackend.cpp.
References BtLocaleMgr::defaultLocaleName().
Referenced by CSwordBibleModuleInfo::books(), and CSwordBackend().
void CSwordBackend::deleteOrphanedIndices | ( | ) |
Deletes all indices of modules where hasIndex() returns false (because of wrong index version etc.) and deletes all orphaned indexes (no module present) if autoDeleteOrphanedIndices is true.
Definition at line 470 of file cswordbackend.cpp.
References btConfig(), CSwordModuleInfo::deleteIndexForModule(), findModuleByName(), and CSwordModuleInfo::getGlobalBaseIndexLocation().
Referenced by CSwordBackend().
CSwordModuleInfo * CSwordBackend::findFirstAvailableModule | ( | CSwordModuleInfo::ModuleType | type | ) |
Definition at line 92 of file cswordbackend.cpp.
References moduleList().
Referenced by anonymous_namespace{osistohtml.cpp}::renderReference(), and Filters::TeiToHtml::renderReference().
CSwordModuleInfo * CSwordBackend::findModuleByName | ( | const QString & | name | ) | const |
Searches for a module with the given name.
[in] | name | The name of the desired module. |
Definition at line 322 of file cswordbackend.cpp.
References m_dataModel.
Referenced by Search::CModuleResultView::activeModule(), ReferenceManager::decodeHyperlink(), anonymous_namespace{btinforendering.cpp}::decodeSwordReference(), deleteOrphanedIndices(), BtQuickWidget::dragEnterEvent(), CBookmarkIndex::dropEvent(), anonymous_namespace{btbookshelfworkspage.cpp}::filter(), getConstPointerList(), BtConfig::getDefaultSwordModuleByType(), BtQmlInterface::getFontsFromSettings(), getPointerList(), Search::BtSearchOptionsArea::initConnections(), CDisplayWindow::lookupKey(), BibleTime::reloadProfile(), BtInstallThread::removeModule(), and Filters::TeiToHtml::renderReference().
CSwordModuleInfo * CSwordBackend::findSwordModuleByPointer | ( | const sword::SWModule *const | swmodule | ) | const |
Searches for a module with the given sword module as module().
[in] | swmodule | The SWModule of the desired module. |
Definition at line 329 of file cswordbackend.cpp.
References m_dataModel.
Referenced by anonymous_namespace{osistohtml.cpp}::renderReference().
|
inline |
Definition at line 167 of file cswordbackend.h.
References m_manager.
Referenced by CSwordModuleInfo::isEncrypted().
BtConstModuleList CSwordBackend::getConstPointerList | ( | const QStringList & | names | ) | const |
[in] | names | The names of the modules to return. |
Definition at line 183 of file cswordbackend.cpp.
References findModuleByName().
QList< CSwordModuleInfo * > CSwordBackend::getPointerList | ( | const QStringList & | names | ) | const |
[in] | names | The names of the modules to return. |
Definition at line 175 of file cswordbackend.cpp.
References findModuleByName().
CSwordBackend::LoadError CSwordBackend::initModules | ( | ) |
Initializes the Sword modules.
Definition at line 191 of file cswordbackend.cpp.
References BT_ASSERT, btConfig(), m_dataModel, m_manager, shutdownModules(), and sigSwordSetupChanged().
Referenced by CSwordBackend(), and reloadModules().
|
inlinestaticnoexcept |
Definition at line 98 of file cswordbackend.h.
References BT_ASSERT, and m_instance.
Referenced by Search::CModuleResultView::activeModule(), BtBookshelfDockWidget::BtBookshelfDockWidget(), BtBookshelfWorksPage::BtBookshelfWorksPage(), BtFontSettingsPage::BtFontSettingsPage(), BtIndexDialog::BtIndexDialog(), BtModelViewReadDisplay::BtModelViewReadDisplay(), BtOpenWorkAction::BtOpenWorkAction(), BtSearchModuleChooserDialog::BtSearchModuleChooserDialog(), CDisplayWindow::CDisplayWindow(), BtIndexDialog::createIndices(), BtInstallPageModel::data(), anonymous_namespace{btinforendering.cpp}::decodeFootnote(), ReferenceManager::decodeHyperlink(), anonymous_namespace{btinforendering.cpp}::decodeSwordReference(), BtIndexDialog::deleteIndices(), BtQuickWidget::dragEnterEvent(), CBookmarkIndex::dropEvent(), Search::CModuleResultView::executed(), CDisplayTemplateMgr::fillTemplate(), anonymous_namespace{btbookshelfworkspage.cpp}::filter(), BtConfig::getDefaultSwordModuleByType(), anonymous_namespace{btinforendering.cpp}::getFirstAvailableStrongsModule(), BtQmlInterface::getFontsFromSettings(), CSwordModuleInfo::getFormattedConfigEntry(), Search::BtSearchOptionsArea::initConnections(), Search::CRangeChooserDialog::initConnections(), BtBookshelfRemoveFinalPage::initializePage(), CDisplayWindow::lookupKey(), main(), BibleTime::moduleUnlock(), BtTextBrowser::mouseMoveEvent(), ReferenceManager::parseVerseReference(), BtIndexDialog::populateModuleList(), Filters::GbfToHtml::processText(), CDisplayWindow::reload(), CBibleReadWindow::reload(), CCommentaryReadWindow::reload(), BibleTime::reloadProfile(), BtInstallThread::removeModule(), Rendering::CTextRendering::renderKeyTree(), anonymous_namespace{osistohtml.cpp}::renderReference(), Filters::TeiToHtml::renderReference(), Filters::TeiToHtml::renderTargetReference(), CSwordModuleSearch::search(), BtQmlInterface::setRawText(), BtBookshelfWorksPage::slotInitPathCombo(), BibleTime::slotSettingsOptions(), BtBookshelfInstallFinalPage::slotThreadFinished(), anonymous_namespace{btmodulechoosermenu.cpp}::SortModel::SortModel(), BtModelViewReadDisplay::text(), BtBookshelfTaskPage::timeToUpdate(), and anonymous_namespace{btbookmarksmodel.cpp}::BookmarkItem::toolTip().
|
inline |
Definition at line 111 of file cswordbackend.h.
References m_dataModel.
Referenced by availableLanguages().
|
inline |
Definition at line 108 of file cswordbackend.h.
References m_dataModel.
Referenced by findFirstAvailableModule(), anonymous_namespace{btinforendering.cpp}::getFirstAvailableStrongsModule(), main(), and BtIndexDialog::populateModuleList().
|
inline |
Definition at line 207 of file cswordbackend.h.
References m_manager.
Referenced by CSwordBackend::Private::reloadConfig(), BtInstallThread::removeModule(), and uninstallModules().
|
inline |
Definition at line 210 of file cswordbackend.h.
References m_manager.
Referenced by CSwordModuleInfo::unlock().
void CSwordBackend::reloadModules | ( | ) |
Reloads all Sword modules.
Definition at line 359 of file cswordbackend.cpp.
References initModules(), m_manager, CSwordBackend::Private::reloadConfig(), and shutdownModules().
Referenced by BtBookshelfInstallFinalPage::slotThreadFinished().
void CSwordBackend::setBooknameLanguage | ( | QString const & | langName | ) |
Sets the language for the international booknames of Sword.
[in] | langName | The abbreviation string which should be used for the Sword backend. |
Definition at line 339 of file cswordbackend.cpp.
References BtLocaleMgr::defaultLocaleName(), m_dataModel, and BtLocaleMgr::setDefaultLocaleName().
Referenced by CSwordBackend(), and BibleTime::slotSettingsOptions().
void CSwordBackend::setFilterOptions | ( | const FilterOptions & | options | ) |
Definition at line 306 of file cswordbackend.cpp.
References FilterOptions::footnotes, CSwordModuleInfo::footnotes, FilterOptions::greekAccents, CSwordModuleInfo::greekAccents, FilterOptions::headings, CSwordModuleInfo::headings, FilterOptions::hebrewCantillation, CSwordModuleInfo::hebrewCantillation, FilterOptions::hebrewPoints, CSwordModuleInfo::hebrewPoints, FilterOptions::lemmas, CSwordModuleInfo::lemmas, FilterOptions::morphSegmentation, CSwordModuleInfo::morphSegmentation, FilterOptions::morphTags, CSwordModuleInfo::morphTags, FilterOptions::redLetterWords, CSwordModuleInfo::redLetterWords, FilterOptions::scriptureReferences, CSwordModuleInfo::scriptureReferences, setOption(), FilterOptions::strongNumbers, CSwordModuleInfo::strongNumbers, FilterOptions::textualVariants, and CSwordModuleInfo::textualVariants.
Referenced by CSwordModuleInfo::buildIndex(), anonymous_namespace{btinforendering.cpp}::decodeFootnote(), Rendering::CTextRendering::renderKeyTree(), CSwordModuleSearch::search(), BtModelViewReadDisplay::text(), and anonymous_namespace{btbookmarksmodel.cpp}::BookmarkItem::toolTip().
void CSwordBackend::setOption | ( | CSwordModuleInfo::FilterOption const & | type, |
const int | state | ||
) |
Sets the state of the given filter option.
[in] | type | The filter type whose state to set. |
[in] | state | The new filter option state. |
Definition at line 302 of file cswordbackend.cpp.
References m_manager, CSwordModuleInfo::FilterOption::optionName, and CSwordModuleInfo::FilterOption::valueToString.
Referenced by CSwordModuleInfo::buildIndex(), setFilterOptions(), and CSwordModuleInfo::setImportantFilterOptions().
void CSwordBackend::shutdownModules | ( | ) |
Deinitializes and frees the modules.
Definition at line 280 of file cswordbackend.cpp.
References m_dataModel, m_manager, and CSwordBackend::Private::shutdownModules().
Referenced by initModules(), reloadModules(), and ~CSwordBackend().
|
signal |
QStringList CSwordBackend::swordDirList | ( | ) | const |
Sword prefix list.
Definition at line 381 of file cswordbackend.cpp.
References util::directory::getUserHomeSwordDir(), and m_manager.
Referenced by BtBookshelfWorksPage::slotInitPathCombo().
void CSwordBackend::uninstallModules | ( | BtConstModuleSet const & | modules | ) |
Uninstalls the given modules.
[in] | modules | The modules to uninstall. |
Definition at line 132 of file cswordbackend.cpp.
References CSwordModuleInfo::AbsoluteDataPath, CSwordModuleInfo::DataPath, m_dataModel, prefixPath(), and sigSwordSetupChanged().
Referenced by BtBookshelfRemoveFinalPage::initializePage().
|
private |
Definition at line 241 of file cswordbackend.h.
Referenced by availableLanguages(), and CSwordBackend().
|
private |
Definition at line 239 of file cswordbackend.h.
Referenced by availableLanguages(), CSwordBackend(), findModuleByName(), findSwordModuleByPointer(), initModules(), model(), moduleList(), setBooknameLanguage(), shutdownModules(), and uninstallModules().
|
staticprivate |
Definition at line 243 of file cswordbackend.h.
Referenced by CSwordBackend(), and instance().
|
private |
Referenced by getConfig(), initModules(), prefixPath(), raw(), reloadModules(), setOption(), shutdownModules(), and swordDirList().