BibleTime
|
#include <btqmlinterface.h>
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) |
CSwordKey * | getMouseClickedKey () 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 () |
BtModuleTextModel * | textModel () |
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< FindState > | m_findState |
bool | m_firstHref = false |
QList< QFont > | m_fonts |
int | m_linkTimerId = 0 |
QStringList | m_moduleNames |
BtModuleTextModel *const | m_moduleTextModel |
std::optional< Selection > | m_selection |
CSwordKey * | m_swordKey = nullptr |
BtTextFilter | m_textFilter |
QString | m_timeoutUrl |
/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.
BtQmlInterface::BtQmlInterface | ( | QObject * | parent = nullptr | ) |
Definition at line 40 of file btqmlinterface.cpp.
References m_moduleTextModel, m_textFilter, and BtModuleTextModel::setTextFilter().
|
overridedefault |
|
inlinenoexcept |
Definition at line 91 of file btqmlinterface.h.
References m_activeLink.
Referenced by BtModelViewReadDisplay::contextMenuEvent().
|
signal |
Referenced by changeColorTheme().
|
signal |
Referenced by changeColorTheme().
|
signal |
Referenced by scrollToSwordKey().
void BtQmlInterface::cancelMagTimer | ( | ) |
Definition at line 259 of file btqmlinterface.cpp.
References m_linkTimerId.
Referenced by BtQuickWidget::event(), setMagReferenceByUrl(), and timerEvent().
void BtQmlInterface::changeColorTheme | ( | ) |
Definition at line 392 of file btqmlinterface.cpp.
References backgroundColorChanged(), backgroundHighlightColorChanged(), and foregroundColorChanged().
Referenced by BtModelViewReadDisplay::BtModelViewReadDisplay(), and settingsChanged().
void BtQmlInterface::changeReference | ( | int | i | ) |
Definition at line 325 of file btqmlinterface.cpp.
References BtModuleTextModel::indexToKeyName(), m_moduleTextModel, and updateReference().
|
noexcept |
Definition at line 139 of file btqmlinterface.cpp.
References m_selection.
|
signal |
Referenced by setContextMenuColumn().
|
signal |
Referenced by setContextMenuIndex().
void BtQmlInterface::copyRange | ( | int | index1, |
int | index2 | ||
) | const |
Definition at line 398 of file btqmlinterface.cpp.
References CSwordKey::copy(), BtModuleTextModel::indexToKeyName(), m_moduleTextModel, and m_swordKey.
|
static |
Definition at line 412 of file btqmlinterface.cpp.
References BT_ASSERT, FilterOptions::footnotes, FilterOptions::greekAccents, FilterOptions::headings, FilterOptions::hebrewCantillation, FilterOptions::hebrewPoints, FilterOptions::lemmas, DisplayOptions::lineBreaks, CSwordKey::module(), FilterOptions::morphSegmentation, FilterOptions::morphTags, FilterOptions::redLetterWords, Rendering::CTextRendering::renderKeyRange(), FilterOptions::scriptureReferences, Rendering::CTextRendering::setDisplayOptions(), Rendering::CTextRendering::setFilterOptions(), FilterOptions::strongNumbers, FilterOptions::textualVariants, and DisplayOptions::verseNumbers.
|
signal |
Referenced by scrollToSwordKey().
void BtQmlInterface::dragHandler | ( | int | index | ) |
Definition at line 330 of file btqmlinterface.cpp.
References dragOccuring(), BtModuleTextModel::indexToKeyName(), m_activeLink, m_moduleNames, and m_moduleTextModel.
|
signal |
Referenced by BtModelViewReadDisplay::BtModelViewReadDisplay(), and dragHandler().
void BtQmlInterface::findText | ( | bool | backward | ) |
Definition at line 466 of file btqmlinterface.cpp.
References BtModuleTextModel::data(), getCurrentModelIndex(), m_findState, m_moduleTextModel, positionItemOnScreen(), BtModuleTextModel::rowCount(), BtModuleTextModel::setFindState(), and ModuleEntry::Text1Role.
Referenced by BtModelViewReadDisplay::findText().
|
private |
Definition at line 352 of file btqmlinterface.cpp.
References m_fonts.
Referenced by getFont0(), getFont1(), getFont2(), getFont3(), getFont4(), getFont5(), getFont6(), getFont7(), getFont8(), and getFont9().
|
signal |
Referenced by getFontsFromSettings().
|
signal |
Referenced by changeColorTheme().
QColor BtQmlInterface::getBackgroundColor | ( | ) | const |
Definition at line 79 of file btqmlinterface.cpp.
References ColorManager::getBackgroundColor().
QColor BtQmlInterface::getBackgroundHighlightColor | ( | ) | const |
Definition at line 82 of file btqmlinterface.cpp.
References ColorManager::getBackgroundHighlightColor().
int BtQmlInterface::getBackgroundHighlightColorIndex | ( | ) | const |
Definition at line 85 of file btqmlinterface.cpp.
References m_backgroundHighlightColorIndex.
QString BtQmlInterface::getBibleUrlFromLink | ( | const QString & | url | ) |
Definition at line 203 of file btqmlinterface.cpp.
Referenced by BtModelViewReadDisplay::contextMenuEvent().
int BtQmlInterface::getContextMenuColumn | ( | ) | const |
Definition at line 70 of file btqmlinterface.cpp.
References m_contextMenuColumn.
int BtQmlInterface::getContextMenuIndex | ( | ) | const |
Definition at line 61 of file btqmlinterface.cpp.
References m_contextMenuIndex.
int BtQmlInterface::getCurrentModelIndex | ( | ) | const |
Definition at line 92 of file btqmlinterface.cpp.
References CSwordModuleInfo::Bible, CSwordModuleInfo::Commentary, CSwordModuleInfo::GenericBook, CSwordKey::key(), CSwordModuleInfo::Lexicon, m_moduleTextModel, m_swordKey, CSwordKey::module(), CSwordTreeKey::offset(), CSwordTreeKey::positionToRoot(), CSwordTreeKey::setKey(), CSwordModuleInfo::type(), and BtModuleTextModel::verseKeyToIndex().
Referenced by findText().
QFont BtQmlInterface::getFont0 | ( | ) | const |
Definition at line 358 of file btqmlinterface.cpp.
References font().
QFont BtQmlInterface::getFont1 | ( | ) | const |
Definition at line 359 of file btqmlinterface.cpp.
References font().
QFont BtQmlInterface::getFont2 | ( | ) | const |
Definition at line 360 of file btqmlinterface.cpp.
References font().
QFont BtQmlInterface::getFont3 | ( | ) | const |
Definition at line 361 of file btqmlinterface.cpp.
References font().
QFont BtQmlInterface::getFont4 | ( | ) | const |
Definition at line 362 of file btqmlinterface.cpp.
References font().
QFont BtQmlInterface::getFont5 | ( | ) | const |
Definition at line 363 of file btqmlinterface.cpp.
References font().
QFont BtQmlInterface::getFont6 | ( | ) | const |
Definition at line 364 of file btqmlinterface.cpp.
References font().
QFont BtQmlInterface::getFont7 | ( | ) | const |
Definition at line 365 of file btqmlinterface.cpp.
References font().
QFont BtQmlInterface::getFont8 | ( | ) | const |
Definition at line 366 of file btqmlinterface.cpp.
References font().
QFont BtQmlInterface::getFont9 | ( | ) | const |
Definition at line 367 of file btqmlinterface.cpp.
References font().
|
private |
Definition at line 278 of file btqmlinterface.cpp.
References btConfig(), fontChanged(), BtConfig::getFontForLanguage(), CSwordBackend::instance(), m_fonts, and m_moduleNames.
Referenced by setModules(), and settingsChanged().
QColor BtQmlInterface::getForegroundColor | ( | ) | const |
Definition at line 89 of file btqmlinterface.cpp.
References ColorManager::getForegroundColor().
QString BtQmlInterface::getLemmaFromLink | ( | const QString & | url | ) |
Definition at line 195 of file btqmlinterface.cpp.
Referenced by BtModelViewReadDisplay::contextMenuEvent().
CSwordKey * BtQmlInterface::getMouseClickedKey | ( | ) | const |
Definition at line 348 of file btqmlinterface.cpp.
References BtModuleTextModel::indexToKey(), m_contextMenuColumn, m_contextMenuIndex, and m_moduleTextModel.
Referenced by BtQuickWidget::getMouseClickedKey().
int BtQmlInterface::getNumModules | ( | ) | const |
Definition at line 117 of file btqmlinterface.cpp.
References m_moduleNames.
double BtQmlInterface::getPixelsPerMM | ( | ) | const |
Definition at line 121 of file btqmlinterface.cpp.
QString BtQmlInterface::getRawText | ( | int | row, |
int | column | ||
) |
Definition at line 147 of file btqmlinterface.cpp.
References BT_ASSERT, CSwordBackend::findModuleByName(), BtModuleTextModel::indexToVerseKey(), CSwordBackend::instance(), CSwordVerseKey::key(), m_moduleNames, m_moduleTextModel, CSwordKey::rawText(), rawText(), and CSwordVerseKey::setKey().
Referenced by openEditor().
|
private |
Definition at line 211 of file btqmlinterface.cpp.
Referenced by timerEvent().
QString BtQmlInterface::getSelectedText | ( | ) | const |
Definition at line 144 of file btqmlinterface.cpp.
References m_selection.
QVariant BtQmlInterface::getTextModel | ( | ) |
Definition at line 369 of file btqmlinterface.cpp.
References m_moduleTextModel.
|
noexcept |
Definition at line 141 of file btqmlinterface.cpp.
References m_selection.
Referenced by CDisplayWindow::hasSelectedText().
int BtQmlInterface::indexToVerse | ( | int | index | ) |
Definition at line 184 of file btqmlinterface.cpp.
References BtModuleTextModel::indexToVerse(), and m_moduleTextModel.
bool BtQmlInterface::isBibleOrCommentary | ( | ) |
Definition at line 47 of file btqmlinterface.cpp.
References CSwordModuleInfo::Bible, CSwordModuleInfo::Commentary, m_swordKey, CSwordKey::module(), and CSwordModuleInfo::type().
Referenced by BtQuickWidget::dragEnterEvent().
bool BtQmlInterface::moduleIsWritable | ( | int | column | ) |
Definition at line 382 of file btqmlinterface.cpp.
References BT_ASSERT, CSwordBackend::findModuleByName(), CSwordBackend::instance(), and m_moduleNames.
|
signal |
Referenced by setModules().
void BtQmlInterface::openEditor | ( | int | row, |
int | column | ||
) |
Definition at line 175 of file btqmlinterface.cpp.
References getRawText(), BtModuleTextModel::indexToKeyName(), m_fonts, m_moduleTextModel, BtEditTextWizard::setFont(), setRawText(), BtEditTextWizard::setText(), BtEditTextWizard::setTitle(), and BtEditTextWizard::text().
|
signal |
|
signal |
Referenced by findText().
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().
void BtQmlInterface::scrollToSwordKey | ( | CSwordKey * | key | ) |
Definition at line 306 of file btqmlinterface.cpp.
References backgroundHighlightColorIndexChanged(), currentModelIndexChanged(), BtModuleTextModel::firstEntryIndex(), BtModuleTextModel::keyToIndex(), m_backgroundHighlightColorIndex, m_moduleTextModel, and m_swordKey.
Referenced by BtModelViewReadDisplay::scrollToKey().
|
inlinenoexcept |
Definition at line 127 of file btqmlinterface.h.
References m_selection.
void BtQmlInterface::setBibleKey | ( | const QString & | link | ) |
Definition at line 299 of file btqmlinterface.cpp.
References setBibleReference().
|
signal |
Referenced by BtModelViewReadDisplay::BtModelViewReadDisplay(), and setBibleKey().
void BtQmlInterface::setContextMenuColumn | ( | int | index | ) |
Definition at line 74 of file btqmlinterface.cpp.
References contextMenuColumnChanged(), and m_contextMenuColumn.
void BtQmlInterface::setContextMenuIndex | ( | int | index | ) |
Definition at line 65 of file btqmlinterface.cpp.
References contextMenuIndexChanged(), and m_contextMenuIndex.
void BtQmlInterface::setFilterOptions | ( | FilterOptions | filterOptions | ) |
Definition at line 57 of file btqmlinterface.cpp.
References m_moduleTextModel, and BtModuleTextModel::setFilterOptions().
Referenced by BtModelViewReadDisplay::setFilterOptions().
void BtQmlInterface::setHighlightWords | ( | const QString & | words, |
bool | caseSensitivy | ||
) |
Definition at line 444 of file btqmlinterface.cpp.
References m_findState, m_moduleTextModel, BtModuleTextModel::setFindState(), and BtModuleTextModel::setHighlightWords().
Referenced by BtModelViewReadDisplay::highlightText().
void BtQmlInterface::setHoveredLink | ( | QString const & | link | ) |
Definition at line 188 of file btqmlinterface.cpp.
References m_activeLink, and 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().
void BtQmlInterface::setModules | ( | const QStringList & | modules | ) |
Definition at line 318 of file btqmlinterface.cpp.
References getFontsFromSettings(), m_moduleNames, m_moduleTextModel, numModulesChanged(), and BtModuleTextModel::setModules().
Referenced by BtModelViewReadDisplay::setModules().
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().
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.
void BtQmlInterface::settingsChanged | ( | ) |
Definition at line 272 of file btqmlinterface.cpp.
References changeColorTheme(), getFontsFromSettings(), and textChanged().
Referenced by BtModelViewReadDisplay::settingsChanged().
|
signal |
Referenced by settingsChanged().
BtModuleTextModel* BtQmlInterface::textModel | ( | ) |
BtModuleTextModel const * BtQmlInterface::textModel | ( | ) | const |
Definition at line 379 of file btqmlinterface.cpp.
References m_moduleTextModel.
|
signal |
|
finaloverrideprotected |
Definition at line 452 of file btqmlinterface.cpp.
References BT_ASSERT, cancelMagTimer(), Rendering::detectInfo(), getReferenceFromUrl(), BibleTime::infoDisplay(), BibleTime::instance(), m_linkTimerId, m_timeoutUrl, and InfoDisplay::CInfoDisplay::setInfo().
|
signal |
Referenced by BtModelViewReadDisplay::BtModelViewReadDisplay(), and changeReference().
|
private |
Definition at line 187 of file btqmlinterface.h.
Referenced by activeLink(), dragHandler(), and setHoveredLink().
|
private |
Definition at line 181 of file btqmlinterface.h.
Referenced by getBackgroundHighlightColorIndex(), and scrollToSwordKey().
|
private |
Definition at line 186 of file btqmlinterface.h.
Referenced by getContextMenuColumn(), getMouseClickedKey(), and setContextMenuColumn().
|
private |
Definition at line 185 of file btqmlinterface.h.
Referenced by getContextMenuIndex(), getMouseClickedKey(), and setContextMenuIndex().
|
private |
Definition at line 188 of file btqmlinterface.h.
Referenced by findText(), and setHighlightWords().
|
private |
Definition at line 175 of file btqmlinterface.h.
|
private |
Definition at line 180 of file btqmlinterface.h.
Referenced by font(), getFontsFromSettings(), and openEditor().
|
private |
Definition at line 176 of file btqmlinterface.h.
Referenced by cancelMagTimer(), setMagReferenceByUrl(), and timerEvent().
|
private |
Definition at line 182 of file btqmlinterface.h.
Referenced by dragHandler(), getFontsFromSettings(), getNumModules(), getRawText(), moduleIsWritable(), and setModules().
|
private |
Definition at line 177 of file btqmlinterface.h.
Referenced by BtQmlInterface(), changeReference(), copyRange(), dragHandler(), findText(), getCurrentModelIndex(), getMouseClickedKey(), getRawText(), getTextModel(), indexToVerse(), openEditor(), rawText(), scrollToSwordKey(), setFilterOptions(), setHighlightWords(), setModules(), setRawText(), and textModel().
|
private |
Definition at line 189 of file btqmlinterface.h.
Referenced by clearSelection(), getSelectedText(), hasSelectedText(), selection(), and setSelection().
|
private |
Definition at line 178 of file btqmlinterface.h.
Referenced by copyRange(), getCurrentModelIndex(), isBibleOrCommentary(), and scrollToSwordKey().
|
private |
Definition at line 183 of file btqmlinterface.h.
Referenced by BtQmlInterface().
|
private |
Definition at line 184 of file btqmlinterface.h.
Referenced by setMagReferenceByUrl(), and timerEvent().
|
static |
Definition at line 171 of file btqmlinterface.h.
Referenced by anonymous_namespace{main.cpp}::registerMetaTypes().
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
readwrite |
Definition at line 41 of file btqmlinterface.h.
|
readwrite |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
|
read |
Definition at line 41 of file btqmlinterface.h.
Referenced by BtModelViewReadDisplay::reloadModules(), and BtModelViewReadDisplay::setDisplayOptions().