|
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::atomic< 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 57 of file cswordbackend.h.
|
private |
Definition at line 75 of file cswordbackend.h.
The error codes which may be returned by the Load() call.
| Enumerator | |
|---|---|
| NoSwordConfig | |
| NoError | |
| NoModules | |
Definition at line 67 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 80 of file cswordbackend.cpp.
|
override |
Definition at line 87 of file cswordbackend.cpp.
References shutdownModules().
|
noexcept |
Definition at line 101 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 332 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 464 of file cswordbackend.cpp.
References btConfig(), CSwordModuleInfo::deleteIndexForModule(), findModuleByName(), and CSwordModuleInfo::getGlobalBaseIndexLocation().
Referenced by CSwordBackend().
| CSwordModuleInfo * CSwordBackend::findFirstAvailableModule | ( | CSwordModuleInfo::ModuleType | type | ) |
Definition at line 91 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 318 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 325 of file cswordbackend.cpp.
References m_dataModel.
Referenced by anonymous_namespace{osistohtml.cpp}::renderReference().
|
inline |
Definition at line 168 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 179 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 171 of file cswordbackend.cpp.
References findModuleByName().
| CSwordBackend::LoadError CSwordBackend::initModules | ( | ) |
Initializes the Sword modules.
Definition at line 187 of file cswordbackend.cpp.
References BT_ASSERT, btConfig(), m_dataModel, m_manager, shutdownModules(), and sigSwordSetupChanged().
Referenced by CSwordBackend(), and reloadModules().
|
inlinestaticnoexcept |
Definition at line 99 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(), BtModelViewReadDisplay::text(), BtBookshelfTaskPage::timeToUpdate(), and anonymous_namespace{btbookmarksmodel.cpp}::BookmarkItem::toolTip().
|
inline |
Definition at line 112 of file cswordbackend.h.
References m_dataModel.
Referenced by availableLanguages().
|
inline |
Definition at line 109 of file cswordbackend.h.
References m_dataModel.
Referenced by findFirstAvailableModule(), anonymous_namespace{btinforendering.cpp}::getFirstAvailableStrongsModule(), main(), and BtIndexDialog::populateModuleList().
|
inline |
Definition at line 208 of file cswordbackend.h.
References m_manager.
Referenced by CSwordBackend::Private::reloadConfig(), BtInstallThread::removeModule(), and uninstallModules().
|
inline |
Definition at line 211 of file cswordbackend.h.
References m_manager.
Referenced by CSwordModuleInfo::unlock().
| void CSwordBackend::reloadModules | ( | ) |
Reloads all Sword modules.
Definition at line 355 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 335 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 302 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 298 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 276 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 377 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 128 of file cswordbackend.cpp.
References CSwordModuleInfo::AbsoluteDataPath, CSwordModuleInfo::DataPath, m_dataModel, prefixPath(), and sigSwordSetupChanged().
Referenced by BtBookshelfRemoveFinalPage::initializePage().
|
private |
Definition at line 242 of file cswordbackend.h.
Referenced by availableLanguages(), and CSwordBackend().
|
private |
Definition at line 240 of file cswordbackend.h.
Referenced by availableLanguages(), CSwordBackend(), findModuleByName(), findSwordModuleByPointer(), initModules(), model(), moduleList(), setBooknameLanguage(), shutdownModules(), and uninstallModules().
|
staticprivate |
Definition at line 244 of file cswordbackend.h.
Referenced by CSwordBackend(), and instance().
|
private |
Referenced by getConfig(), initModules(), prefixPath(), raw(), reloadModules(), setOption(), shutdownModules(), and swordDirList().