19 #include <QFileDialog>
20 #include <QGuiApplication>
21 #include <QHBoxLayout>
28 #include "../../backend/keys/cswordkey.h"
29 #include "../../backend/drivers/cswordbiblemoduleinfo.h"
30 #include "../../backend/managers/cswordbackend.h"
31 #include "../../backend/managers/referencemanager.h"
32 #include "../../util/btassert.h"
33 #include "../../util/btconnect.h"
34 #include "../../util/tool.h"
35 #include "../bibletime.h"
36 #include "../btcopybyreferencesdialog.h"
37 #include "../BtMimeData.h"
38 #include "../cexportmanager.h"
39 #include "../displaywindow/cdisplaywindow.h"
40 #include "../keychooser/ckeychooser.h"
49 , m_parentWindow(displayWindow)
51 , m_qmlInterface(m_quickWidget->qmlInterface())
52 , m_scrollBar(new QScrollBar(this))
54 auto *
const layout =
new QHBoxLayout(
this);
55 layout->setContentsMargins(0, 0, 0, 0);
57 m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
60 [
this](QString
const & reference) {
62 key->setKey(reference);
78 [
this](QString
const & reference) {
85 [
this](
const QString& moduleName,
const QString& keyName) {
86 auto & drag = *
new QDrag(
this);
88 std::make_unique<BTMimeData>(
91 if (
auto *
const module =
95 module->moduleIcon().pixmap(
97 std::unique_ptr<CSwordKey> key(module->createKey());
100 mimedata->setText(key->strippedText());
102 drag.setMimeData(mimedata.release());
103 drag.exec(Qt::CopyAction, Qt::CopyAction);
118 int speed = 25 * (1 + std::abs(value/30));
135 { QGuiApplication::clipboard()->setText(
text(part)); }
143 m_popup->exec(event->globalPos());
147 { QGuiApplication::clipboard()->setText(
qmlInterface()->getSelectedText()); }
154 if (dlg.exec() != QDialog::Accepted)
157 auto const & result = dlg.
result();
159 auto const & module = *result.module;
163 qml.copyVerseRange(
static_cast<CSwordVerseKey const &
>(*result.key1),
166 qml.copyRange(result.index1, result.index2);
171 auto const filename =
172 QFileDialog::getSaveFileName(
174 QObject::tr(
"Save document ..."),
176 QObject::tr(
"Text files") +
" (*.txt);;"
177 + QObject::tr(
"All files") +
" (*)");
178 if (!filename.isEmpty())
205 const CSBiMI *bible =
dynamic_cast<const CSBiMI*
>(module);
210 mgr.
printKey(module, startKey.
key(), stopKey.
key(), displayOptions, filterOptions);
213 mgr.
printKey(module, key->
key(), key->
key(), displayOptions, filterOptions);
227 mgr.
printKey(module, startKey.
key(), stopKey.
key(), displayOptions, filterOptions);
264 text = QStringLiteral(
"%1\n(%2, %3)")
270 if (
auto const decodedLink =
272 return decodedLink->key;
277 auto const decodedLink(
279 if (decodedLink && decodedLink->module) {
280 std::unique_ptr<CSwordKey> key(decodedLink->module->createKey());
281 key->setKey(decodedLink->key);
282 return key->strippedText();
288 auto const decodedLink(
290 if (decodedLink && decodedLink->module) {
291 std::unique_ptr<CSwordKey> key(decodedLink->module->createKey());
292 key->setKey(decodedLink->key);
297 return QStringLiteral(
"%1\n(%2, %3)")
298 .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)
BtQmlInterface * qmlInterface() const noexcept
void findText(bool const backward)
void highlightText(const QString &text, bool caseSensitive)
void copySelectedText()
Copies the currently selected text.
void scrollToKey(CSwordKey *key)
void setLemma(const QString &lemma)
void setModules(QStringList const &modules)
QString text(TextPart const part=Document)
void copyAsPlainText(TextPart const part)
bool hasActiveAnchor() const
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()
BtQuickWidget *const m_quickWidget
void updateReferenceText()
BtQmlInterface *const m_qmlInterface
QScrollBar *const m_scrollBar
BtModelViewReadDisplay(CDisplayWindow *displayWindow, QWidget *parent=nullptr)
void setDisplayOptions(const DisplayOptions &displayOptions)
void print(TextPart const, DisplayOptions const &displayOptions, FilterOptions const &filterOptions)
void contextMenuEvent(QContextMenuEvent *event) final override
void setFilterOptions(FilterOptions filterOptions)
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 updateReference(const QString &reference)
void setModules(const QStringList &modules)
void setHighlightWords(const QString &words, bool caseSensitivy)
void setFilterOptions(FilterOptions filterOptions)
QString const & activeLink() const noexcept
void findText(bool backward)
QString getLemmaFromLink(const QString &url)
The base class for all display windows of BibleTime.
DisplayOptions const & displayOptions() const
CKeyChooser * keyChooser() const
FilterOptions const & filterOptions() const
void lookupKey(QString const &key)
void setBibleReference(const QString &reference)
bool printKey(CSwordKey const *const key, DisplayOptions const &displayOptions, FilterOptions const &filterOptions)
bool printByHyperlink(QString const &hyperlink, DisplayOptions const &displayOptions, FilterOptions const &filterOptions)
Prints a key using the hyperlink created by CReferenceManager.
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)