BibleTime
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BtModuleTextModel Class Reference

Model that represents the entire text of a given module. More...

#include <btmoduletextmodel.h>

Inheritance diagram for BtModuleTextModel:

Public Member Functions

 BtModuleTextModel (QObject *parent=nullptr)
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
int firstEntryIndex () const noexcept
 
CSwordKeyindexToKey (int index, int moduleNum) const
 
QString indexToKeyName (int index) const
 
int indexToVerse (int index) const
 
CSwordVerseKey indexToVerseKey (int index) const
 
CSwordVerseKey indexToVerseKey (int index, CSwordModuleInfo const &module) const
 
int keyToIndex (CSwordKey const &key) const
 
void reloadModules ()
 
QHash< int, QByteArray > roleNames () const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
void setFindState (std::optional< FindState > findState)
 
void setHighlightWords (const QString &highlightWords, bool caseSensitive)
 
void setModules (const QStringList &modules)
 
void setOptions (DisplayOptions const &displayOptions, FilterOptions const &filterOptions)
 
int verseKeyToIndex (const CSwordVerseKey &key) const
 

Private Member Functions

QString bookData (const QModelIndex &index, int role=Qt::DisplayRole) const
 
CSwordTreeKey indexToBookKey (int index) const
 
bool isBible () const
 
bool isBook () const
 
bool isCommentary () const
 
bool isLexicon () const
 
bool isSelected (int index) const
 
QString lexiconData (const QModelIndex &index, int role=Qt::DisplayRole) const
 
QString verseData (const QModelIndex &index, int role=Qt::DisplayRole) const
 

Private Attributes

Rendering::CDisplayRendering m_displayRendering
 
std::optional< FindStatem_findState
 
int m_firstEntry
 
QString m_highlightWords
 
int m_maxEntries
 
BtConstModuleList m_moduleInfoList
 
QStringList m_modules
 

Detailed Description

Model that represents the entire text of a given module.

It is used by a QML ListView to view a small portion of the available module text. Only the portions of the module that are currently displayed and some just above or below this, are instantiated.

Note
Four parallel modules are supported.

Definition at line 105 of file btmoduletextmodel.h.

Constructor & Destructor Documentation

◆ BtModuleTextModel()

BtModuleTextModel::BtModuleTextModel ( QObject parent = nullptr)

Member Function Documentation

◆ bookData()

QString BtModuleTextModel::bookData ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
private

returns text string for each model index

◆ columnCount()

int BtModuleTextModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

Reimplemented from QAbstractItemModel.

◆ data()

QVariant BtModuleTextModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

◆ firstEntryIndex()

int BtModuleTextModel::firstEntryIndex ( ) const
inlinenoexcept

Get index offset of first entry of module

Definition at line 136 of file btmoduletextmodel.h.

References m_firstEntry.

Referenced by BtQmlInterface::scrollToSwordKey().

◆ indexToBookKey()

CSwordTreeKey BtModuleTextModel::indexToBookKey ( int  index) const
private

◆ indexToKey()

CSwordKey * BtModuleTextModel::indexToKey ( int  index,
int  moduleNum 
) const

◆ indexToKeyName()

QString BtModuleTextModel::indexToKeyName ( int  index) const

◆ indexToVerse()

int BtModuleTextModel::indexToVerse ( int  index) const

Convert index(row) into verse.

Referenced by BtQmlInterface::indexToVerse().

◆ indexToVerseKey() [1/2]

CSwordVerseKey BtModuleTextModel::indexToVerseKey ( int  index) const

Convert index(row) into CSwordVerseKey.

◆ indexToVerseKey() [2/2]

CSwordVerseKey BtModuleTextModel::indexToVerseKey ( int  index,
CSwordModuleInfo const &  module 
) const

Convert index(row) into CSwordVerseKey.

◆ isBible()

bool BtModuleTextModel::isBible ( ) const
private

◆ isBook()

bool BtModuleTextModel::isBook ( ) const
private

◆ isCommentary()

bool BtModuleTextModel::isCommentary ( ) const
private

◆ isLexicon()

bool BtModuleTextModel::isLexicon ( ) const
private

◆ isSelected()

bool BtModuleTextModel::isSelected ( int  index) const
private

◆ keyToIndex()

int BtModuleTextModel::keyToIndex ( CSwordKey const &  key) const

◆ lexiconData()

QString BtModuleTextModel::lexiconData ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
private

◆ reloadModules()

void BtModuleTextModel::reloadModules ( )

Load module pointers from module names

◆ roleNames()

QHash< int, QByteArray > BtModuleTextModel::roleNames ( ) const
override

Used by model to get the roleNames and corresponding role numbers.

◆ rowCount()

int BtModuleTextModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Reimplemented from QAbstractItemModel.

Referenced by BtQmlInterface::findText().

◆ setData()

virtual bool BtModuleTextModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
overridevirtual

Reimplemented from QAbstractItemModel.

Referenced by BtQmlInterface::setRawText().

◆ setFindState()

void BtModuleTextModel::setFindState ( std::optional< FindState findState)

Set the state of the currently found word functionality

Referenced by BtQmlInterface::findText(), and BtQmlInterface::setHighlightWords().

◆ setHighlightWords()

void BtModuleTextModel::setHighlightWords ( const QString &  highlightWords,
bool  caseSensitive 
)

Set the color of word that are highlighted

Referenced by BtQmlInterface::setHighlightWords().

◆ setModules()

void BtModuleTextModel::setModules ( const QStringList &  modules)

Specifies one or more module names for use by the model

Referenced by BtQmlInterface::setModules().

◆ setOptions()

void BtModuleTextModel::setOptions ( DisplayOptions const &  displayOptions,
FilterOptions const &  filterOptions 
)

Set the display and filter options used for rendering module text.

◆ verseData()

QString BtModuleTextModel::verseData ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
private

◆ verseKeyToIndex()

int BtModuleTextModel::verseKeyToIndex ( const CSwordVerseKey key) const

Convert CSwordVerseKey into index(row).

Referenced by BtQmlInterface::getCurrentModelIndex().

Member Data Documentation

◆ m_displayRendering

Rendering::CDisplayRendering BtModuleTextModel::m_displayRendering
private

Definition at line 192 of file btmoduletextmodel.h.

◆ m_findState

std::optional<FindState> BtModuleTextModel::m_findState
private

Definition at line 193 of file btmoduletextmodel.h.

◆ m_firstEntry

int BtModuleTextModel::m_firstEntry
private

Definition at line 190 of file btmoduletextmodel.h.

Referenced by firstEntryIndex().

◆ m_highlightWords

QString BtModuleTextModel::m_highlightWords
private

Definition at line 188 of file btmoduletextmodel.h.

◆ m_maxEntries

int BtModuleTextModel::m_maxEntries
private

Definition at line 191 of file btmoduletextmodel.h.

◆ m_moduleInfoList

BtConstModuleList BtModuleTextModel::m_moduleInfoList
private

Definition at line 186 of file btmoduletextmodel.h.

◆ m_modules

QStringList BtModuleTextModel::m_modules
private

Definition at line 187 of file btmoduletextmodel.h.


The documentation for this class was generated from the following file: