20#include <QGuiApplication>
26#ifdef BUILD_TEXT_TO_SPEECH
27#include <QTextToSpeech>
32#include "../../backend/keys/cswordkey.h"
33#include "../../backend/drivers/cswordbiblemoduleinfo.h"
34#include "../../backend/managers/cswordbackend.h"
35#include "../../backend/managers/referencemanager.h"
36#include "../../util/btassert.h"
37#include "../../util/btconnect.h"
38#include "../../util/tool.h"
39#include "../bibletime.h"
40#include "../btcopybyreferencesdialog.h"
41#include "../BtMimeData.h"
42#include "../cexportmanager.h"
43#include "../displaywindow/cdisplaywindow.h"
44#include "../keychooser/ckeychooser.h"
53 , m_parentWindow(displayWindow)
55 , m_qmlInterface(m_quickWidget->qmlInterface())
56 , m_scrollBar(new QScrollBar(this))
58 auto *
const layout =
new QHBoxLayout(
this);
59 layout->setContentsMargins(0, 0, 0, 0);
61 m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
64 [
this](QString
const & reference) {
66 key->setKey(reference);
82 [
this](QString
const & reference) {
89 [
this](
const QString& moduleName,
const QString& keyName) {
90 auto & drag = *
new QDrag(
this);
92 std::make_unique<BTMimeData>(
95 if (
auto *
const module =
99 module->moduleIcon().pixmap(
101 std::unique_ptr<CSwordKey> key(module->createKey());
102 key->setKey(keyName);
104 mimedata->setText(key->strippedText());
106 drag.setMimeData(mimedata.release());
107 drag.exec(Qt::CopyAction, Qt::CopyAction);
114 [
this](QString
const & newLink) {
133 int speed = 25 * (1 + std::abs(value/30));
150{ QGuiApplication::clipboard()->setText(
text(part)); }
154 m_popup->exec(event->globalPos());
158{ QGuiApplication::clipboard()->setText(
qmlInterface()->getSelectedText()); }
165 if (dlg.exec() != QDialog::Accepted)
168 auto const & result = dlg.
result();
170 auto const &
module = *result.module;
174 qml.copyVerseRange(
static_cast<CSwordVerseKey const &
>(*result.key1),
177 qml.copyRange(result.index1, result.index2);
182 auto const filename =
183 QFileDialog::getSaveFileName(
185 QObject::tr(
"Save document ..."),
187 QObject::tr(
"Text files") +
" (*.txt);;"
188 + QObject::tr(
"All files") +
" (*)");
189 if (!filename.isEmpty())
216 const CSBiMI *bible =
dynamic_cast<const CSBiMI*
>(module);
221 mgr.printKey(module, startKey.
key(), stopKey.
key(), displayOptions, filterOptions);
224 mgr.printKey(module, key->key(), key->key(), displayOptions, filterOptions);
238 mgr.printKey(module, startKey.
key(), stopKey.
key(), displayOptions, filterOptions);
245 mgr.printByHyperlink(
m_activeAnchor, displayOptions, filterOptions);
254#ifdef BUILD_TEXT_TO_SPEECH
255void BtModelViewReadDisplay::speakSelectedText() {
281 text = QStringLiteral(
"%1\n(%2, %3)")
287 if (
auto const decodedLink =
289 return decodedLink->key;
294 auto const decodedLink(
296 if (decodedLink && decodedLink->module) {
297 std::unique_ptr<CSwordKey> key(decodedLink->module->createKey());
298 key->setKey(decodedLink->key);
299 return key->strippedText();
305 auto const decodedLink(
307 if (decodedLink && decodedLink->module) {
308 std::unique_ptr<CSwordKey> key(decodedLink->module->createKey());
309 key->setKey(decodedLink->key);
314 return QStringLiteral(
"%1\n(%2, %3)")
315 .arg(key->strippedText(), key->key(), key->module()->name());
QList< BookmarkItem > ItemList
static BibleTime * instance() noexcept
Result const & result() const noexcept
CDisplayWindow * m_parentWindow
void slotSliderMoved(int value)
void findText(bool const backward)
void highlightText(const QString &text, bool caseSensitive)
void copySelectedText()
Copies the currently selected text.
void scrollToKey(CSwordKey *key)
void setModules(QStringList const &modules)
void setNodeInfo(QString const &newNodeInfo)
QString text(TextPart const part=Document)
void activeAnchorChanged(QString newActiveAnchor)
void copyAsPlainText(TextPart const part)
void copyByReferences()
Copies the given text specified by asking user for first and last references.
void save(TextPart const part)
Saves the given text with the specified format into the applications clipboard.
void slotSliderReleased()
void setOptions(DisplayOptions const &displayOptions, FilterOptions const &filterOptions)
BtQmlInterface * qmlInterface() const noexcept
BtQuickWidget *const m_quickWidget
void updateReferenceText()
BtQmlInterface *const m_qmlInterface
void nodeInfoChanged(QString newNodeInfo)
QScrollBar *const m_scrollBar
BtModelViewReadDisplay(CDisplayWindow *displayWindow, QWidget *parent=nullptr)
void print(TextPart const, DisplayOptions const &displayOptions, FilterOptions const &filterOptions)
void contextMenuEvent(QContextMenuEvent *event) final override
void setBibleReference(const QString &reference)
~BtModelViewReadDisplay() override
void scrollToSwordKey(CSwordKey *key)
QString getBibleUrlFromLink(const QString &url)
void dragOccuring(const QString &moduleName, const QString &keyName)
void setBibleReference(const QString &reference)
void activeLinkChanged(QString newActiveLink)
std::optional< Selection > const & selection() const noexcept
void updateReference(const QString &reference)
void setModules(const QStringList &modules)
void setHighlightWords(const QString &words, bool caseSensitivy)
void findText(bool backward)
QString getLemmaFromLink(const QString &url)
The base class for all display windows of BibleTime.
QToolBar * mainToolBar() const noexcept
FilterOptions const & filterOptions() const noexcept
CKeyChooser * keyChooser() const noexcept
void lookupKey(QString const &key)
DisplayOptions const & displayOptions() const noexcept
CSwordKey * swordKey() const noexcept
void setBibleReference(const QString &reference)
static CSwordBackend & instance() noexcept
void setFilterOptions(const FilterOptions &options)
Implementation for Sword Bibles.
CSwordModuleInfo const * module() const
virtual bool setKey(const QString &key)=0
virtual QString key() const =0
QString const & name() const
CSwordKey implementation for Sword's TreeKey.
QString key() const final override
CSwordKey implementation for Sword's VerseKey.
QString key() const final override
std::optional< DecodedHyperlink > decodeHyperlink(QString const &hyperlink)