BibleTime
Classes | Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
BtQmlInterface Class Reference

#include <btqmlinterface.h>

Inheritance diagram for BtQmlInterface:

Classes

struct  Selection
 

Signals

void backgroundColorChanged ()
 
void backgroundHighlightColorChanged ()
 
void backgroundHighlightColorIndexChanged ()
 
void contextMenuColumnChanged ()
 
void contextMenuIndexChanged ()
 
void currentModelIndexChanged ()
 
void dragOccuring (const QString &moduleName, const QString &keyName)
 
void fontChanged ()
 
void foregroundColorChanged ()
 
void numModulesChanged ()
 
void pixelsPerMMChanged ()
 
void positionItemOnScreen (int index)
 
void setBibleReference (const QString &reference)
 
void textChanged ()
 
void textModelChanged ()
 
void updateReference (const QString &reference)
 

Public Member Functions

QString const & activeLink () const noexcept
 
 BtQmlInterface (QObject *parent=nullptr)
 
void cancelMagTimer ()
 
void changeColorTheme ()
 
Q_INVOKABLE void changeReference (int i)
 
Q_INVOKABLE void clearSelection () noexcept
 
void copyRange (int index1, int index2) const
 
Q_INVOKABLE void dragHandler (int index)
 
void findText (bool backward)
 
QColor getBackgroundColor () const
 
QColor getBackgroundHighlightColor () const
 
int getBackgroundHighlightColorIndex () const
 
QString getBibleUrlFromLink (const QString &url)
 
int getContextMenuColumn () const
 
int getContextMenuIndex () const
 
int getCurrentModelIndex () const
 
QFont getFont0 () const
 
QFont getFont1 () const
 
QFont getFont2 () const
 
QFont getFont3 () const
 
QFont getFont4 () const
 
QFont getFont5 () const
 
QFont getFont6 () const
 
QFont getFont7 () const
 
QFont getFont8 () const
 
QFont getFont9 () const
 
QColor getForegroundColor () const
 
QString getLemmaFromLink (const QString &url)
 
CSwordKeygetMouseClickedKey () const
 
int getNumModules () const
 
double getPixelsPerMM () const
 
QString getRawText (int row, int column)
 
QString getSelectedText () const
 
QVariant getTextModel ()
 
bool hasSelectedText () const noexcept
 
Q_INVOKABLE int indexToVerse (int index)
 
bool isBibleOrCommentary ()
 
Q_INVOKABLE bool moduleIsWritable (int column)
 
Q_INVOKABLE void openEditor (int row, int column)
 
Q_INVOKABLE QString rawText (int row, int column)
 
void scrollToSwordKey (CSwordKey *key)
 
std::optional< Selection > const & selection () const noexcept
 
Q_INVOKABLE void setBibleKey (const QString &link)
 
void setContextMenuColumn (int index)
 
void setContextMenuIndex (int index)
 
void setFilterOptions (FilterOptions filterOptions)
 
void setHighlightWords (const QString &words, bool caseSensitivy)
 
Q_INVOKABLE void setHoveredLink (QString const &link)
 
void setMagReferenceByUrl (const QString &url)
 
void setModules (const QStringList &modules)
 
Q_INVOKABLE void setRawText (int row, int column, const QString &text)
 
Q_INVOKABLE void setSelection (int column, int startIndex, int endIndex, QString const &selectedText)
 
void settingsChanged ()
 
BtModuleTextModeltextModel ()
 
BtModuleTextModel const * textModel () const
 
 ~BtQmlInterface () override
 

Static Public Member Functions

static void copyVerseRange (CSwordVerseKey const &key1, CSwordVerseKey const &key2)
 

Static Public Attributes

static int typeId
 

Protected Member Functions

void timerEvent (QTimerEvent *event) final override
 

Properties

QML_SINGLETONQColor backgroundColor
 
QColor backgroundHighlightColor
 
int backgroundHighlightColorIndex
 
int contextMenuColumn
 
int contextMenuIndex
 
int currentModelIndex
 
QFont font0
 
QFont font1
 
QFont font2
 
QFont font3
 
QFont font4
 
QFont font5
 
QFont font6
 
QFont font7
 
QFont font8
 
QFont font9
 
QColor foregroundColor
 
int numModules
 
double pixelsPerMM
 
QVariant textModel
 

Private Member Functions

QFont font (int column) const
 
void getFontsFromSettings ()
 
QString getReferenceFromUrl (const QString &url)
 

Private Attributes

QString m_activeLink
 
int m_backgroundHighlightColorIndex = -1
 
int m_contextMenuColumn
 
int m_contextMenuIndex
 
std::optional< FindStatem_findState
 
bool m_firstHref = false
 
QList< QFont > m_fonts
 
int m_linkTimerId = 0
 
QStringList m_moduleNames
 
BtModuleTextModel *const m_moduleTextModel
 
std::optional< Selectionm_selection
 
CSwordKeym_swordKey = nullptr
 
BtTextFilter m_textFilter
 
QString m_timeoutUrl
 

Detailed Description

/brief This class provides communications between QML and c++.

It is instantiated by usage within the QML files. It provides properties and functions written in c++ and usable by QML.

Definition at line 37 of file btqmlinterface.h.

Constructor & Destructor Documentation

◆ BtQmlInterface()

BtQmlInterface::BtQmlInterface ( QObject parent = nullptr)

◆ ~BtQmlInterface()

BtQmlInterface::~BtQmlInterface ( )
overridedefault

Member Function Documentation

◆ activeLink()

QString const& BtQmlInterface::activeLink ( ) const
inlinenoexcept

Definition at line 91 of file btqmlinterface.h.

References m_activeLink.

Referenced by BtModelViewReadDisplay::contextMenuEvent().

◆ backgroundColorChanged

void BtQmlInterface::backgroundColorChanged ( )
signal

Referenced by changeColorTheme().

◆ backgroundHighlightColorChanged

void BtQmlInterface::backgroundHighlightColorChanged ( )
signal

Referenced by changeColorTheme().

◆ backgroundHighlightColorIndexChanged

void BtQmlInterface::backgroundHighlightColorIndexChanged ( )
signal

Referenced by scrollToSwordKey().

◆ cancelMagTimer()

void BtQmlInterface::cancelMagTimer ( )

Definition at line 259 of file btqmlinterface.cpp.

References m_linkTimerId.

Referenced by BtQuickWidget::event(), setMagReferenceByUrl(), and timerEvent().

◆ changeColorTheme()

void BtQmlInterface::changeColorTheme ( )

◆ changeReference()

void BtQmlInterface::changeReference ( int  i)

◆ clearSelection()

void BtQmlInterface::clearSelection ( )
noexcept

Definition at line 139 of file btqmlinterface.cpp.

References m_selection.

◆ contextMenuColumnChanged

void BtQmlInterface::contextMenuColumnChanged ( )
signal

Referenced by setContextMenuColumn().

◆ contextMenuIndexChanged

void BtQmlInterface::contextMenuIndexChanged ( )
signal

Referenced by setContextMenuIndex().

◆ copyRange()

void BtQmlInterface::copyRange ( int  index1,
int  index2 
) const

◆ copyVerseRange()

void BtQmlInterface::copyVerseRange ( CSwordVerseKey const &  key1,
CSwordVerseKey const &  key2 
)
static

◆ currentModelIndexChanged

void BtQmlInterface::currentModelIndexChanged ( )
signal

Referenced by scrollToSwordKey().

◆ dragHandler()

void BtQmlInterface::dragHandler ( int  index)

◆ dragOccuring

void BtQmlInterface::dragOccuring ( const QString &  moduleName,
const QString &  keyName 
)
signal

◆ findText()

void BtQmlInterface::findText ( bool  backward)

◆ font()

QFont BtQmlInterface::font ( int  column) const
private

◆ fontChanged

void BtQmlInterface::fontChanged ( )
signal

Referenced by getFontsFromSettings().

◆ foregroundColorChanged

void BtQmlInterface::foregroundColorChanged ( )
signal

Referenced by changeColorTheme().

◆ getBackgroundColor()

QColor BtQmlInterface::getBackgroundColor ( ) const

Definition at line 79 of file btqmlinterface.cpp.

References ColorManager::getBackgroundColor().

◆ getBackgroundHighlightColor()

QColor BtQmlInterface::getBackgroundHighlightColor ( ) const

Definition at line 82 of file btqmlinterface.cpp.

References ColorManager::getBackgroundHighlightColor().

◆ getBackgroundHighlightColorIndex()

int BtQmlInterface::getBackgroundHighlightColorIndex ( ) const

Definition at line 85 of file btqmlinterface.cpp.

References m_backgroundHighlightColorIndex.

◆ getBibleUrlFromLink()

QString BtQmlInterface::getBibleUrlFromLink ( const QString &  url)

Definition at line 203 of file btqmlinterface.cpp.

Referenced by BtModelViewReadDisplay::contextMenuEvent().

◆ getContextMenuColumn()

int BtQmlInterface::getContextMenuColumn ( ) const

Definition at line 70 of file btqmlinterface.cpp.

References m_contextMenuColumn.

◆ getContextMenuIndex()

int BtQmlInterface::getContextMenuIndex ( ) const

Definition at line 61 of file btqmlinterface.cpp.

References m_contextMenuIndex.

◆ getCurrentModelIndex()

int BtQmlInterface::getCurrentModelIndex ( ) const

◆ getFont0()

QFont BtQmlInterface::getFont0 ( ) const

Definition at line 358 of file btqmlinterface.cpp.

References font().

◆ getFont1()

QFont BtQmlInterface::getFont1 ( ) const

Definition at line 359 of file btqmlinterface.cpp.

References font().

◆ getFont2()

QFont BtQmlInterface::getFont2 ( ) const

Definition at line 360 of file btqmlinterface.cpp.

References font().

◆ getFont3()

QFont BtQmlInterface::getFont3 ( ) const

Definition at line 361 of file btqmlinterface.cpp.

References font().

◆ getFont4()

QFont BtQmlInterface::getFont4 ( ) const

Definition at line 362 of file btqmlinterface.cpp.

References font().

◆ getFont5()

QFont BtQmlInterface::getFont5 ( ) const

Definition at line 363 of file btqmlinterface.cpp.

References font().

◆ getFont6()

QFont BtQmlInterface::getFont6 ( ) const

Definition at line 364 of file btqmlinterface.cpp.

References font().

◆ getFont7()

QFont BtQmlInterface::getFont7 ( ) const

Definition at line 365 of file btqmlinterface.cpp.

References font().

◆ getFont8()

QFont BtQmlInterface::getFont8 ( ) const

Definition at line 366 of file btqmlinterface.cpp.

References font().

◆ getFont9()

QFont BtQmlInterface::getFont9 ( ) const

Definition at line 367 of file btqmlinterface.cpp.

References font().

◆ getFontsFromSettings()

void BtQmlInterface::getFontsFromSettings ( )
private

◆ getForegroundColor()

QColor BtQmlInterface::getForegroundColor ( ) const

Definition at line 89 of file btqmlinterface.cpp.

References ColorManager::getForegroundColor().

◆ getLemmaFromLink()

QString BtQmlInterface::getLemmaFromLink ( const QString &  url)

Definition at line 195 of file btqmlinterface.cpp.

Referenced by BtModelViewReadDisplay::contextMenuEvent().

◆ getMouseClickedKey()

CSwordKey * BtQmlInterface::getMouseClickedKey ( ) const

◆ getNumModules()

int BtQmlInterface::getNumModules ( ) const

Definition at line 117 of file btqmlinterface.cpp.

References m_moduleNames.

◆ getPixelsPerMM()

double BtQmlInterface::getPixelsPerMM ( ) const

Definition at line 121 of file btqmlinterface.cpp.

◆ getRawText()

QString BtQmlInterface::getRawText ( int  row,
int  column 
)

◆ getReferenceFromUrl()

QString BtQmlInterface::getReferenceFromUrl ( const QString &  url)
private

Definition at line 211 of file btqmlinterface.cpp.

Referenced by timerEvent().

◆ getSelectedText()

QString BtQmlInterface::getSelectedText ( ) const

Definition at line 144 of file btqmlinterface.cpp.

References m_selection.

◆ getTextModel()

QVariant BtQmlInterface::getTextModel ( )

Definition at line 369 of file btqmlinterface.cpp.

References m_moduleTextModel.

◆ hasSelectedText()

bool BtQmlInterface::hasSelectedText ( ) const
noexcept

Definition at line 141 of file btqmlinterface.cpp.

References m_selection.

Referenced by CDisplayWindow::hasSelectedText().

◆ indexToVerse()

int BtQmlInterface::indexToVerse ( int  index)

Definition at line 184 of file btqmlinterface.cpp.

References BtModuleTextModel::indexToVerse(), and m_moduleTextModel.

◆ isBibleOrCommentary()

bool BtQmlInterface::isBibleOrCommentary ( )

◆ moduleIsWritable()

bool BtQmlInterface::moduleIsWritable ( int  column)

◆ numModulesChanged

void BtQmlInterface::numModulesChanged ( )
signal

Referenced by setModules().

◆ openEditor()

void BtQmlInterface::openEditor ( int  row,
int  column 
)

◆ pixelsPerMMChanged

void BtQmlInterface::pixelsPerMMChanged ( )
signal

◆ positionItemOnScreen

void BtQmlInterface::positionItemOnScreen ( int  index)
signal

Referenced by findText().

◆ rawText()

QString BtQmlInterface::rawText ( int  row,
int  column 
)

Definition at line 248 of file btqmlinterface.cpp.

References BtModuleTextModel::data(), m_moduleTextModel, and ModuleEntry::Text0Role.

Referenced by getRawText().

◆ scrollToSwordKey()

void BtQmlInterface::scrollToSwordKey ( CSwordKey key)

◆ selection()

std::optional<Selection> const& BtQmlInterface::selection ( ) const
inlinenoexcept

Definition at line 127 of file btqmlinterface.h.

References m_selection.

◆ setBibleKey()

void BtQmlInterface::setBibleKey ( const QString &  link)

Definition at line 299 of file btqmlinterface.cpp.

References setBibleReference().

◆ setBibleReference

void BtQmlInterface::setBibleReference ( const QString &  reference)
signal

◆ setContextMenuColumn()

void BtQmlInterface::setContextMenuColumn ( int  index)

Definition at line 74 of file btqmlinterface.cpp.

References contextMenuColumnChanged(), and m_contextMenuColumn.

◆ setContextMenuIndex()

void BtQmlInterface::setContextMenuIndex ( int  index)

Definition at line 65 of file btqmlinterface.cpp.

References contextMenuIndexChanged(), and m_contextMenuIndex.

◆ setFilterOptions()

void BtQmlInterface::setFilterOptions ( FilterOptions  filterOptions)

◆ setHighlightWords()

void BtQmlInterface::setHighlightWords ( const QString &  words,
bool  caseSensitivy 
)

◆ setHoveredLink()

void BtQmlInterface::setHoveredLink ( QString const &  link)

Definition at line 188 of file btqmlinterface.cpp.

References m_activeLink, and setMagReferenceByUrl().

◆ setMagReferenceByUrl()

void BtQmlInterface::setMagReferenceByUrl ( const QString &  url)

Definition at line 264 of file btqmlinterface.cpp.

References cancelMagTimer(), m_linkTimerId, and m_timeoutUrl.

Referenced by setHoveredLink().

◆ setModules()

void BtQmlInterface::setModules ( const QStringList &  modules)

◆ setRawText()

void BtQmlInterface::setRawText ( int  row,
int  column,
const QString &  text 
)

Definition at line 253 of file btqmlinterface.cpp.

References m_moduleTextModel, BtModuleTextModel::setData(), and ModuleEntry::Text0Role.

Referenced by openEditor().

◆ setSelection()

void BtQmlInterface::setSelection ( int  column,
int  startIndex,
int  endIndex,
QString const &  selectedText 
)

Definition at line 127 of file btqmlinterface.cpp.

References BT_ASSERT, and m_selection.

◆ settingsChanged()

void BtQmlInterface::settingsChanged ( )

◆ textChanged

void BtQmlInterface::textChanged ( )
signal

Referenced by settingsChanged().

◆ textModel() [1/2]

BtModuleTextModel* BtQmlInterface::textModel ( )

◆ textModel() [2/2]

BtModuleTextModel const * BtQmlInterface::textModel ( ) const

Definition at line 379 of file btqmlinterface.cpp.

References m_moduleTextModel.

◆ textModelChanged

void BtQmlInterface::textModelChanged ( )
signal

◆ timerEvent()

void BtQmlInterface::timerEvent ( QTimerEvent *  event)
finaloverrideprotected

◆ updateReference

void BtQmlInterface::updateReference ( const QString &  reference)
signal

Member Data Documentation

◆ m_activeLink

QString BtQmlInterface::m_activeLink
private

Definition at line 187 of file btqmlinterface.h.

Referenced by activeLink(), dragHandler(), and setHoveredLink().

◆ m_backgroundHighlightColorIndex

int BtQmlInterface::m_backgroundHighlightColorIndex = -1
private

Definition at line 181 of file btqmlinterface.h.

Referenced by getBackgroundHighlightColorIndex(), and scrollToSwordKey().

◆ m_contextMenuColumn

int BtQmlInterface::m_contextMenuColumn
private

◆ m_contextMenuIndex

int BtQmlInterface::m_contextMenuIndex
private

Definition at line 185 of file btqmlinterface.h.

Referenced by getContextMenuIndex(), getMouseClickedKey(), and setContextMenuIndex().

◆ m_findState

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

Definition at line 188 of file btqmlinterface.h.

Referenced by findText(), and setHighlightWords().

◆ m_firstHref

bool BtQmlInterface::m_firstHref = false
private

Definition at line 175 of file btqmlinterface.h.

◆ m_fonts

QList<QFont> BtQmlInterface::m_fonts
private

Definition at line 180 of file btqmlinterface.h.

Referenced by font(), getFontsFromSettings(), and openEditor().

◆ m_linkTimerId

int BtQmlInterface::m_linkTimerId = 0
private

Definition at line 176 of file btqmlinterface.h.

Referenced by cancelMagTimer(), setMagReferenceByUrl(), and timerEvent().

◆ m_moduleNames

QStringList BtQmlInterface::m_moduleNames
private

◆ m_moduleTextModel

BtModuleTextModel* const BtQmlInterface::m_moduleTextModel
private

◆ m_selection

std::optional<Selection> BtQmlInterface::m_selection
private

◆ m_swordKey

CSwordKey* BtQmlInterface::m_swordKey = nullptr
private

◆ m_textFilter

BtTextFilter BtQmlInterface::m_textFilter
private

Definition at line 183 of file btqmlinterface.h.

Referenced by BtQmlInterface().

◆ m_timeoutUrl

QString BtQmlInterface::m_timeoutUrl
private

Definition at line 184 of file btqmlinterface.h.

Referenced by setMagReferenceByUrl(), and timerEvent().

◆ typeId

int BtQmlInterface::typeId
static

Definition at line 171 of file btqmlinterface.h.

Referenced by anonymous_namespace{main.cpp}::registerMetaTypes().

Property Documentation

◆ backgroundColor

QML_SINGLETONQColor BtQmlInterface::backgroundColor
read

Definition at line 41 of file btqmlinterface.h.

◆ backgroundHighlightColor

QColor BtQmlInterface::backgroundHighlightColor
read

Definition at line 41 of file btqmlinterface.h.

◆ backgroundHighlightColorIndex

int BtQmlInterface::backgroundHighlightColorIndex
read

Definition at line 41 of file btqmlinterface.h.

◆ contextMenuColumn

int BtQmlInterface::contextMenuColumn
readwrite

Definition at line 41 of file btqmlinterface.h.

◆ contextMenuIndex

int BtQmlInterface::contextMenuIndex
readwrite

Definition at line 41 of file btqmlinterface.h.

◆ currentModelIndex

int BtQmlInterface::currentModelIndex
read

Definition at line 41 of file btqmlinterface.h.

◆ font0

QFont BtQmlInterface::font0
read

Definition at line 41 of file btqmlinterface.h.

◆ font1

QFont BtQmlInterface::font1
read

Definition at line 41 of file btqmlinterface.h.

◆ font2

QFont BtQmlInterface::font2
read

Definition at line 41 of file btqmlinterface.h.

◆ font3

QFont BtQmlInterface::font3
read

Definition at line 41 of file btqmlinterface.h.

◆ font4

QFont BtQmlInterface::font4
read

Definition at line 41 of file btqmlinterface.h.

◆ font5

QFont BtQmlInterface::font5
read

Definition at line 41 of file btqmlinterface.h.

◆ font6

QFont BtQmlInterface::font6
read

Definition at line 41 of file btqmlinterface.h.

◆ font7

QFont BtQmlInterface::font7
read

Definition at line 41 of file btqmlinterface.h.

◆ font8

QFont BtQmlInterface::font8
read

Definition at line 41 of file btqmlinterface.h.

◆ font9

QFont BtQmlInterface::font9
read

Definition at line 41 of file btqmlinterface.h.

◆ foregroundColor

QColor BtQmlInterface::foregroundColor
read

Definition at line 41 of file btqmlinterface.h.

◆ numModules

int BtQmlInterface::numModules
read

Definition at line 41 of file btqmlinterface.h.

◆ pixelsPerMM

double BtQmlInterface::pixelsPerMM
read

Definition at line 41 of file btqmlinterface.h.

◆ textModel

BtModuleTextModel * BtQmlInterface::textModel
read

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