20#include <QGuiApplication>
29#include "../../backend/keys/cswordkey.h"
30#include "../../backend/drivers/cswordbiblemoduleinfo.h"
31#include "../../backend/managers/cswordbackend.h"
32#include "../../backend/managers/referencemanager.h"
33#include "../../util/btassert.h"
34#include "../../util/btconnect.h"
35#include "../../util/tool.h"
36#include "../bibletime.h"
37#include "../btcopybyreferencesdialog.h"
38#include "../BtMimeData.h"
39#include "../cexportmanager.h"
40#include "../displaywindow/cdisplaywindow.h"
41#include "../keychooser/ckeychooser.h"
50 , m_parentWindow(displayWindow)
52 , m_qmlInterface(m_quickWidget->qmlInterface())
53 , m_scrollBar(new QScrollBar(this))
55 auto *
const layout =
new QHBoxLayout(
this);
56 layout->setContentsMargins(0, 0, 0, 0);
58 m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
61 [
this](QString
const & reference) {
63 key->setKey(reference);
79 [
this](QString
const & reference) {
86 [
this](
const QString& moduleName,
const QString& keyName) {
87 auto & drag = *
new QDrag(
this);
89 std::make_unique<BTMimeData>(
92 if (
auto *
const module =
96 module->moduleIcon().pixmap(
98 std::unique_ptr<CSwordKey> key(module->createKey());
101 mimedata->setText(key->strippedText());
103 drag.setMimeData(mimedata.release());
104 drag.exec(Qt::CopyAction, Qt::CopyAction);
111 [
this](QString
const & newLink) {
130 int speed = 25 * (1 + std::abs(value/30));
147{ QGuiApplication::clipboard()->setText(
text(part)); }
151 m_popup->exec(event->globalPos());
155{ QGuiApplication::clipboard()->setText(
qmlInterface()->getSelectedText()); }
162 if (dlg.exec() != QDialog::Accepted)
165 auto const & result = dlg.
result();
167 auto const &
module = *result.module;
171 qml.copyVerseRange(
static_cast<CSwordVerseKey const &
>(*result.key1),
174 qml.copyRange(result.index1, result.index2);
179 auto const filename =
180 QFileDialog::getSaveFileName(
182 QObject::tr(
"Save document ..."),
184 QObject::tr(
"Text files") +
" (*.txt);;"
185 + QObject::tr(
"All files") +
" (*)");
186 if (!filename.isEmpty())
213 const CSBiMI *bible =
dynamic_cast<const CSBiMI*
>(module);
218 mgr.printKey(module, startKey.
key(), stopKey.
key(), displayOptions, filterOptions);
221 mgr.printKey(module, key->key(), key->key(), displayOptions, filterOptions);
235 mgr.printKey(module, startKey.
key(), stopKey.
key(), displayOptions, filterOptions);
242 mgr.printByHyperlink(
m_activeAnchor, displayOptions, filterOptions);
271 text = QStringLiteral(
"%1\n(%2, %3)")
277 if (
auto const decodedLink =
279 return decodedLink->key;
284 auto const decodedLink(
286 if (decodedLink && decodedLink->module) {
287 std::unique_ptr<CSwordKey> key(decodedLink->module->createKey());
288 key->setKey(decodedLink->key);
289 return key->strippedText();
295 auto const decodedLink(
297 if (decodedLink && decodedLink->module) {
298 std::unique_ptr<CSwordKey> key(decodedLink->module->createKey());
299 key->setKey(decodedLink->key);
304 return QStringLiteral(
"%1\n(%2, %3)")
305 .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)
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)