BibleTime
cdisplaywindow.cpp
Go to the documentation of this file.
1/*********
2*
3* In the name of the Father, and of the Son, and of the Holy Spirit.
4*
5* This file is part of BibleTime's source code, https://bibletime.info/
6*
7* Copyright 1999-2025 by the BibleTime developers.
8* The BibleTime source code is licensed under the GNU General Public License
9* version 2.0.
10*
11**********/
12
13#include "cdisplaywindow.h"
14
15#include <QClipboard>
16#include <QCloseEvent>
17#include <QDebug>
18#include <QFileDialog>
19#include <QMdiSubWindow>
20#include <QMenu>
21#include <QStringList>
22#include <QWidget>
23#include "../../backend/config/btconfig.h"
24#include "../../backend/keys/cswordkey.h"
25#include "../../backend/managers/cswordbackend.h"
26#include "../../util/cresmgr.h"
27#include "../bibletime.h"
28#include "../cexportmanager.h"
29#include "../cmdiarea.h"
30#include "../display/btmodelviewreaddisplay.h"
31#include "../display/modelview/btqmlinterface.h"
32#include "../display/modelview/btquickwidget.h"
33#include "../keychooser/ckeychooser.h"
34#include "../keychooser/bthistory.h"
35#include "../messagedialog.h"
37#include "btmodulechooserbar.h"
39#include "bttextwindowheader.h"
40
41
42namespace {
43
45 for (; w; w = w->parentWidget())
46 if (QMdiSubWindow * const sw = qobject_cast<QMdiSubWindow *>(w))
47 return sw;
48 return nullptr;
49}
50
51void prepareToolBar(QToolBar* bar, const QString& title, bool visible) {
52 bar->setAllowedAreas(Qt::TopToolBarArea);
53 bar->setFloatable(false);
54 bar->setWindowTitle(title);
55 bar->setVisible(visible);
56}
57
58
59} // anonymous namespace
60
62 : BtActionCollection(parent)
63{
64 auto * actn = new QAction(QIcon(), tr("Copy"), this);
65 actn->setShortcut(QKeySequence::Copy);
66 addAction(QStringLiteral("copySelectedText"), actn);
67
68 actn = new QAction(QIcon(), tr("Copy by references..."), this);
69 actn->setShortcut(Qt::CTRL | Qt::Key_R);
70 addAction(QStringLiteral("copyByReferences"), actn);
71
72 actn = new QAction(QIcon(), tr("Find..."), this);
73 actn->setShortcut(QKeySequence::Find);
74 addAction(QStringLiteral("findText"), actn);
75
76 actn = new QAction(QIcon(), tr("Change location"), this);
77 actn->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_L));
78 addAction(QStringLiteral("openLocation"), actn);
79
80 actn = new QAction(QIcon(), tr("Page down"), this);
81 actn->setShortcut(QKeySequence(Qt::Key_PageDown));
82 addAction(QStringLiteral("pageDown"), actn);
83
84 actn = new QAction(QIcon(), tr("Page up"), this);
85 actn->setShortcut(QKeySequence(Qt::Key_PageUp));
86 addAction(QStringLiteral("pageUp"), actn);
87
88 actn = new QAction(CResMgr::displaywindows::general::search::icon(),
89 tr("Search with works of this window"),
90 this);
93
95 CResMgr::displaywindows::general::backInHistory::icon(),
96 tr("Back in history"),
97 this);
100 action);
101
103 CResMgr::displaywindows::general::forwardInHistory::icon(),
104 tr("Forward in history"),
105 this);
106 action->setShortcut(
109 action);
110
111 actn = new QAction(tr("Copy reference only"), this);
112 addAction(QStringLiteral("copyReferenceOnly"), actn);
113
114 actn = new QAction(tr("Save entry as HTML"), this);
115 addAction(QStringLiteral("saveHtml"), actn);
116
117 actn = new QAction(tr("Print reference only"), this);
118 addAction(QStringLiteral("printReferenceOnly"), actn);
119
120 actn = new QAction(tr("Entry with text"), this);
121 addAction(QStringLiteral("copyEntryWithText"), actn);
122
123 actn = new QAction(tr("Entry as plain text"), this);
124 addAction(QStringLiteral("saveEntryAsPlain"), actn);
125
126 actn = new QAction(tr("Entry with text"), this);
127 addAction(QStringLiteral("printEntryWithText"), actn);
128
129 actn = new QAction(tr("Strong's Search"), this);
132
133 #ifdef BUILD_TEXT_TO_SPEECH
134 actn = new QAction(tr("Speak selected text"), this);
135 addAction("speakSelectedText", actn);
136 #endif
137}
138
140 QString const & key,
141 bool const addTextHeaderToolbar,
143 CMDIArea * const parent)
144 : QMainWindow(parent)
146 , m_mdi(parent)
148 , m_swordKey((static_cast<void>(BT_ASSERT(!modules.empty())),
149 m_modules.first()->createKey()))
150 , m_history(new BTHistory(this))
151{
152 m_actionCollection->setParent(this);
153
154 m_moduleNames.reserve(m_modules.size());
155 for (auto const module : m_modules)
156 m_moduleNames.append(module->name());
157
159 if (!key.isEmpty())
160 m_swordKey->setKey(key);
161 setMinimumSize(100, 100);
162 setFocusPolicy(Qt::ClickFocus);
163
164 // Cannot delete on close. QMdiSubWindow and this window work
165 // as pairs. They must be deleted in a specific order.
166 // QMdiSubWindow handles this procedure.
167 //setAttribute(Qt::WA_DeleteOnClose);
168
169 // Connect this to the backend module list changes
172
173 setWindowIcon(m_modules.first()->moduleIcon());
175
176 // Create display widget for this window
177 m_displayWidget = new BtModelViewReadDisplay(this, this);
178 setCentralWidget(m_displayWidget);
180
181 // Create the Navigation toolbar:
182 m_mainToolBar = new QToolBar(this);
183 prepareToolBar(m_mainToolBar,
184 tr("Navigation"),
185 btConfig().session().value<bool>(
186 QStringLiteral("GUI/showTextWindowNavigator"),
187 true));
189 m_mainToolBar, &QToolBar::setVisible);
190 addToolBar(m_mainToolBar);
191
192 // Create keychooser
194 m_swordKey.get(),
200
201 // Create module chooser bar:
203 m_moduleChooserBar->setWindowTitle(tr("Work chooser buttons"));
204 m_moduleChooserBar->setLayoutDirection(Qt::LeftToRight);
205 m_moduleChooserBar->setVisible(
206 btConfig().session().value<bool>(
207 QStringLiteral(
208 "GUI/showTextWindowModuleSelectorButtons"),
209 true));
212 m_moduleChooserBar, &BtModuleChooserBar::setVisible);
213 addToolBar(m_moduleChooserBar);
214
215 // Create the Tools toolbar:
216 m_buttonsToolBar = new QToolBar(this);
217 prepareToolBar(m_buttonsToolBar,
218 tr("Tool"),
219 btConfig().session().value<bool>(
220 QStringLiteral("GUI/showTextWindowToolButtons"),
221 true));
223 m_buttonsToolBar, &QToolBar::setVisible);
224 addToolBar(m_buttonsToolBar);
225
226 if (addTextHeaderToolbar) {
227 addToolBarBreak();
228
229 auto * const headerBar = new QToolBar(this);
230 headerBar->setMovable(false);
231 headerBar->setWindowTitle(tr("Text area header"));
232 headerBar->setVisible(
233 btConfig().session().value<bool>(
234 QStringLiteral("GUI/showTextWindowHeaders"),
235 true));
237 headerBar, &QToolBar::setVisible);
238
239 auto * const headerWidget =
240 new BtTextWindowHeader(m_modules.first()->type(),
241 m_modules,
242 headerBar);
244 headerWidget, &BtTextWindowHeader::setModules);
251 headerBar->addWidget(headerWidget);
252
253 addToolBar(headerBar);
254 }
255
256 // Initialize actions:
257 namespace DWG = CResMgr::displaywindows::general;
258 initAddAction(DWG::search::actionName,
259 [this]
262 QStringLiteral("openLocation"),
263 [this]{
264 if (btConfig().session().value<bool>(
265 QStringLiteral("GUI/showToolbarsInEachWindow"),
266 true))
267 {
268 m_keyChooser->setFocus();
269 } else if (auto * const kc = btMainWindow()->keyChooser()) {
270 kc->setFocus();
271 }
272 });
273 initAddAction(QStringLiteral("pageDown"),
276 initAddAction(QStringLiteral("pageUp"),
279 auto & copySelectedTextAction =
280 initAddAction(QStringLiteral("copySelectedText"),
283 auto hasSelection = m_displayWidget->qmlInterface()->selection().has_value();
284 copySelectedTextAction.setEnabled(hasSelection);
285 #ifdef BUILD_TEXT_TO_SPEECH
286 auto & speakSelectedTextAction =
287 initAddAction(QStringLiteral("speakSelectedText"),
289 &BtModelViewReadDisplay::speakSelectedText);
290 speakSelectedTextAction.setEnabled(hasSelection);
291 #endif
294 this,
295 [&copySelectedTextAction
296 #ifdef BUILD_TEXT_TO_SPEECH
297 , &speakSelectedTextAction
298 #endif
299 ](
300 std::optional<BtQmlInterface::Selection> const & newSelection)
301 {
302 copySelectedTextAction.setEnabled(newSelection.has_value());
303 #ifdef BUILD_TEXT_TO_SPEECH
304 speakSelectedTextAction.setEnabled(newSelection.has_value());
305 #endif
306 });
307 initAddAction(QStringLiteral("copyByReferences"),
310 initAddAction(QStringLiteral("findText"),
311 btMainWindow(),
313 initAddAction(DWG::backInHistory::actionName,
314 m_history,
316 initAddAction(DWG::forwardInHistory::actionName,
317 m_history,
322 addAction(m_actions.backInHistory);
326 addAction(m_actions.forwardInHistory);
328 &m_actionCollection->action(QStringLiteral("findText"));
332 [this]{
333 QString searchText;
334 for (auto const & strongNumber
335 : m_displayWidget->nodeInfo().split(
336 '|',
337 Qt::SkipEmptyParts))
338 searchText.append(
339 QStringLiteral("strong:%1 ")
340 .arg(strongNumber));
342 searchText);
343 });
345 [this](QString const & nodeInfo)
346 { m_actions.findStrongs->setEnabled(!nodeInfo.isNull()); });
348 &initAddAction(QStringLiteral("copyReferenceOnly"),
351 m_actions.copy.entry = &initAddAction(QStringLiteral("copyEntryWithText"),
355 &m_actionCollection->action(QStringLiteral("copySelectedText"));
357 &m_actionCollection->action(QStringLiteral("copyByReferences"));
360 QStringLiteral("saveEntryAsPlain"),
361 [this]{
362 CExportManager mgr(true,
363 tr("Saving"),
366 mgr.saveKey(m_swordKey.get(),
368 true,
369 constModules());
370 });
373 QStringLiteral("saveHtml"),
374 [this]{
375 CExportManager mgr(true,
376 tr("Saving"),
379 mgr.saveKey(m_swordKey.get(),
381 true,
382 constModules());
383 });
385 &initAddAction(QStringLiteral("printReferenceOnly"),
386 this,
388 addAction(m_actions.print.reference);
389 m_actions.print.entry = &initAddAction(QStringLiteral("printEntryWithText"),
390 this,
393 this,
394 [this](QString const & newActiveAnchor) {
395 bool const hasActiveAnchor = !newActiveAnchor.isEmpty();
396 m_actions.copy.reference->setEnabled(hasActiveAnchor);
397 m_actions.print.reference->setEnabled(hasActiveAnchor);
398 });
399 #ifdef BUILD_TEXT_TO_SPEECH
400 m_actions.speakSelectedText =
401 &m_actionCollection->action(QStringLiteral("speakSelectedText"));
402 #endif
403
405 QStringLiteral("Displaywindow shortcuts"));
406}
407
409
412
414 return dynamic_cast<BibleTime*>(m_mdi->parent()->parent());
415}
416
418 // Clear main window toolbars, except for works toolbar
419 btMainWindow()->navToolBar()->clear();
420 btMainWindow()->toolsToolBar()->clear();
421}
422
427
429 if (m_modules.isEmpty()) {
430 setWindowTitle(tr("<NO WORKS>"));
431 } else {
432 setWindowTitle(QStringLiteral("%1 (%2)")
433 .arg(m_swordKey->key(),
434 m_moduleNames.join(QStringLiteral(" | "))));
435 }
436}
437
438/** Store the settings of this window in the given CProfileWindow object. */
440 QWidget const * const w = getProfileWindow(parentWidget());
441 BT_ASSERT(w);
442
443 /**
444 \note We don't use saveGeometry/restoreGeometry for MDI subwindows,
445 because they give slightly incorrect results with some window
446 managers. Might be related to Qt bug QTBUG-7634.
447 */
448 const QRect rect(w->x(), w->y(), w->width(), w->height());
449 conf.setValue<QRect>(QStringLiteral("windowRect"), rect);
450 conf.setValue<bool>(QStringLiteral("staysOnTop"),
451 w->windowFlags() & Qt::WindowStaysOnTopHint);
452 conf.setValue<bool>(QStringLiteral("staysOnBottom"),
453 w->windowFlags() & Qt::WindowStaysOnBottomHint);
454 conf.setValue(QStringLiteral("maximized"), w->isMaximized());
455
456 bool const hasFocus =
457 (w == dynamic_cast<CDisplayWindow *>(mdi()->activeSubWindow()));
458 conf.setValue(QStringLiteral("hasFocus"), hasFocus);
459
460 // Save current key:
461 conf.setValue(QStringLiteral("key"), m_swordKey->normalizedKey());
462
463 // Save list of modules:
464 conf.setValue(QStringLiteral("modules"), m_moduleNames);
465
466 // Default for "not a write window":
467 conf.setValue(QStringLiteral("writeWindowType"), int(0));
468}
469
471 setUpdatesEnabled(false);
472
473 QWidget * const w = getProfileWindow(parentWidget());
474 BT_ASSERT(w);
475
476 /**
477 \note We don't use restoreGeometry/saveGeometry for MDI subwindows,
478 because they give slightly incorrect results with some window
479 managers. Might be related to Qt bug QTBUG-7634.
480 */
481 const QRect rect = conf.value<QRect>(QStringLiteral("windowRect"));
482 w->resize(rect.width(), rect.height());
483 w->move(rect.x(), rect.y());
484 if (conf.value<bool>(QStringLiteral("staysOnTop"), false))
485 w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnTopHint);
486 if (conf.value<bool>(QStringLiteral("staysOnBottom"), false))
487 w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnBottomHint);
488 if (conf.value<bool>(QStringLiteral("maximized")))
489 w->showMaximized();
490
491 setUpdatesEnabled(true);
492}
493
496
500 [this](bool const backEnabled, bool const fwEnabled) {
503
504 m_actions.backInHistory->setEnabled(backEnabled);
505 m_actions.forwardInHistory->setEnabled(fwEnabled);
506 });
507
508 //connect the history actions to the right slots
509 BT_CONNECT(m_actions.backInHistory->popupMenu(), &QMenu::aboutToShow,
510 this, // Needed
511 [this]{
512 QMenu * menu = m_actions.backInHistory->popupMenu();
513 menu->clear();
514 for (auto * const actionPtr
515 : m_history->getBackList())
516 menu->addAction(actionPtr);
517 });
518 BT_CONNECT(m_actions.backInHistory->popupMenu(), &QMenu::triggered,
520 BT_CONNECT(m_actions.forwardInHistory->popupMenu(), &QMenu::aboutToShow,
521 this, // Needed
522 [this]{
523 QMenu* menu = m_actions.forwardInHistory->popupMenu();
524 menu->clear();
525 for (auto * const actionPtr
526 : m_history->getFwList())
527 menu->addAction(actionPtr);
528 });
529 BT_CONNECT(m_actions.forwardInHistory->popupMenu(), &QMenu::triggered,
531}
532
534 //Navigation toolbar
536 m_mainToolBar->addAction(m_actions.backInHistory); //1st button
537 m_mainToolBar->addAction(m_actions.forwardInHistory); //2nd button
538 m_mainToolBar->addWidget(m_keyChooser);
539
540 //Tools toolbar
541 m_buttonsToolBar->addAction(
544
545 auto * const button = new BtDisplaySettingsButton(m_buttonsToolBar);
547 m_buttonsToolBar->addWidget(button);
548}
549
551 auto * const popupMenu = new QMenu(this);
552 popupMenu->addAction(m_actions.findText);
553 popupMenu->addAction(m_actions.findStrongs);
554 popupMenu->addSeparator();
555
556 m_actions.copyMenu = new QMenu(tr("Copy..."), popupMenu);
559 m_actions.copyMenu->addSeparator();
562 popupMenu->addMenu(m_actions.copyMenu);
563
565 tr("Save..."),
566 popupMenu
567 );
570
571 popupMenu->addMenu(m_actions.saveMenu);
572
574 tr("Print..."),
575 popupMenu
576 );
579 popupMenu->addMenu(m_actions.printMenu);
580
581 #ifdef BUILD_TEXT_TO_SPEECH
582 popupMenu->addAction((m_actions.speakSelectedText));
583 #endif
584
585 return popupMenu;
586}
587
589 // Navigation toolbar
590 QString keyReference = m_swordKey->key();
591 auto const constMods = constModules();
592 auto * const keyChooser =
594 m_swordKey.get(),
595 btMainWindow()->navToolBar());
600 keyChooser->key()->setKey(keyReference);
603 btMainWindow()->navToolBar()->addWidget(keyChooser);
608
609 // Works toolbar
611
612 // Tools toolbar
613 btMainWindow()->toolsToolBar()->addAction(
616 auto * const button = new BtDisplaySettingsButton(m_buttonsToolBar);
618 btMainWindow()->toolsToolBar()->addWidget(button);
619}
620
623
626
627/** Refresh the settings of this window. */
629 // Since all the CSwordModuleInfo pointers are invalidated, we need to
630 // rebuild m_modules based on m_moduleNames, and remove all missing modules:
631 BT_ASSERT(!m_moduleNames.empty()); // This should otherwise be close()-d
632 m_modules.clear();
633 {
634 auto const & backend = CSwordBackend::instance();
635 auto it = m_moduleNames.begin();
636 do {
637 if (auto * const module = backend.findModuleByName(*it)) {
638 m_modules.append(module);
639 ++it;
640 } else {
641 it = m_moduleNames.erase(it);
642 }
643 } while (it != m_moduleNames.end());
644 }
645 BT_ASSERT(m_moduleNames.size() == m_modules.size());
646
647 if (m_modules.isEmpty()) {
648 close();
649 } else {
651
652 if (auto * const kc = m_keyChooser)
653 kc->setModules(constModules(), false);
654
655 lookup();
656
658 QStringLiteral("Displaywindow shortcuts"));
660 }
661
663
664 m_actionCollection->readShortcuts(QStringLiteral("Lexicon shortcuts"));
665}
666
668 BT_ASSERT(index <= m_modules.size());
669 m_modules.insert(index, module);
670 m_moduleNames.insert(index, module->name());
671 if (index == 0)
672 setWindowIcon(module->moduleIcon());
674 lookup();
677}
678
680 BT_ASSERT(index < m_modules.size());
681 m_modules.replace(index, newModule);
682 m_moduleNames.replace(index, newModule->name());
683 if (index == 0)
684 setWindowIcon(newModule->moduleIcon());
686 lookup();
689}
690
692 BT_ASSERT(index >= 0);
693 BT_ASSERT(index < m_modules.size());
694 m_modules.removeAt(index);
695 m_moduleNames.removeAt(index);
696 if (m_modules.empty())
697 close();
698 if (index == 0)
699 setWindowIcon(m_modules.first()->moduleIcon());
701 lookup();
704}
705
706void CDisplayWindow::setBibleReference(const QString& reference) {
708 lookupKey(reference);
709 return;
710 }
711 auto * const bibleModule =
713 QStringLiteral("standardBible"));
714 if (bibleModule) {
715 BibleTime *mainWindow = btMainWindow();
716 BT_ASSERT(mainWindow);
717 mainWindow->createReadDisplayWindow(bibleModule, reference);
718 return;
719 }
720 message::showInformation(this, tr("Choose Standard Bible"),
721 tr("Please choose a Bible in the Settings > "
722 "Configure dialog."));
723}
724
726 // this would only set the stringlist again
727 //if (moduleChooserBar()) { //necessary for write windows
728 //setModules( m_moduleChooserBar->getModuleList() );
729 //}
730 if (m_modules.isEmpty()) {
731 close();
732 }
733 else {
734 auto const constMods = constModules();
735 Q_EMIT sigModulesChanged(constMods);
736 m_swordKey->setModule(constMods.first());
737 m_keyChooser->setModules(constMods);
738 }
739}
740
742 BT_ASSERT(newKey);
743
744 if (!m_isInitialized || !newKey || m_modules.empty() || !m_modules.first())
745 return;
746
747 if (m_swordKey.get() != newKey)
748 m_swordKey->setKey(newKey->key());
749
753
755}
756
757/** Initialize the window. Call this method from the outside, because calling
758 this in the constructor is not possible! */
760 initActions();
761 initToolbars();
762
763 auto const & conf = btConfig();
764 if (!conf.session().value<bool>(
765 QStringLiteral("GUI/showToolbarsInEachWindow"),
766 true))
767 {
768 m_mainToolBar->setHidden(true);
769 m_buttonsToolBar->setHidden(true);
771 m_moduleChooserBar->setHidden(true);
772 }
776
778
779 m_filterOptions = conf.getFilterOptions();
780 m_displayOptions = conf.getDisplayOptions();
784
785 m_isInitialized = true;
786 return true;
787}
788
789/** Sets the display settings button. */
817
818/** Lookup the current key. Used to refresh the display. */
820
821void CDisplayWindow::lookupKey( const QString& keyName ) {
822 /* This function is called for example after a bookmark was dropped on this
823 window. */
824 BT_ASSERT(m_modules.first());
825
826 if (!m_isInitialized) {
827 return;
828 }
829
830 auto * const m =
832 m_modules.first()->name());
833 if (!m) {
834 return; /// \todo check if this is correct behavior
835 }
836
837 /// \todo check for containsRef compat
838 if (m && m_modules.contains(m)) {
839 m_swordKey->setKey(keyName);
840 // the key chooser does send an update signal
842 Q_EMIT sigKeyChanged(m_swordKey.get());
843 }
844 else { // given module not displayed in this window
845 // If the module is displayed in another display window we assume a
846 // wrong drop. Create a new window for the given module:
847 BibleTime * mainWindow = btMainWindow();
848 BT_ASSERT(mainWindow);
849 mainWindow->createReadDisplayWindow(m, keyName);
850 }
851}
852
855
858
#define BT_ASSERT(...)
Definition btassert.h:17
BtConfig & btConfig()
This is a shortchand for BtConfig::getInstance().
Definition btconfig.h:305
#define BT_CONNECT(...)
Definition btconnect.h:20
QList< CSwordModuleInfo * > BtModuleList
void move(QAction *)
Definition bthistory.cpp:45
void historyMoved(QString newKey)
void fw()
Definition bthistory.cpp:67
void back()
Definition bthistory.cpp:60
void add(CSwordKey *newKey)
Definition bthistory.cpp:29
void historyChanged(bool backEnabled, bool fwEnabled)
void clearMdiToolBars()
void openFindWidget()
void toggledTextWindowToolButtons(bool newState)
void toggledTextWindowHeader(bool newState)
void openSearchDialog(BtConstModuleList modules, QString const &searchText={})
QToolBar * toolsToolBar() const noexcept
Definition bibletime.h:238
void toggledTextWindowNavigator(bool newState)
static BibleTime * instance() noexcept
Definition bibletime.h:225
BtModuleChooserBar * worksToolBar() const noexcept
Definition bibletime.h:234
void toggledTextWindowModuleChooser(bool newState)
QToolBar * navToolBar() const noexcept
Definition bibletime.h:231
void autoScrollStop()
CDisplayWindow * createReadDisplayWindow(QList< CSwordModuleInfo * > modules, QString const &key)
Creates a new presenter in the MDI area according to the type of the module.
void readShortcuts(QString const &group)
Read shortcuts from config.
void addAction(QString const &name, QAction *const action)
QAction & action(QString const &name) const
T & actionAs(QString const &name) const
T value(QString const &key, T const &defaultValue=T()) const
Returns the settings value for the given global key.
void setValue(QString const &key, T const &value)
Sets a value for a key.
CSwordModuleInfo * getDefaultSwordModuleByType(const QString &moduleType)
Returns default sword module info class for a given module type.
Definition btconfig.cpp:493
void sigDisplayOptionsChanged(DisplayOptions displayOptions)
void setFilterOptions(FilterOptions const &moduleSettings)
void sigFilterOptionsChanged(FilterOptions filterOptions)
void setDisplayOptions(DisplayOptions const &displaySettings)
void setDisplayOptionsNoRepopulate(DisplayOptions const &displaySettings)
void setFilterOptionsNoRepopulate(FilterOptions const &moduleSettings)
void setModules(const BtConstModuleList &modules)
void printAll(DisplayOptions const &displayOptions, FilterOptions const &filterOptions)
void printAnchorOnly(DisplayOptions const &displayOptions, FilterOptions const &filterOptions)
void copySelectedText()
Copies the currently selected text.
void setModules(QStringList const &modules)
void installPopup(QMenu *const popup)
Installs the popup which should be opened when the right mouse button was pressed.
void activeAnchorChanged(QString newActiveAnchor)
void copyByReferences()
Copies the given text specified by asking user for first and last references.
BtQuickWidget * quickWidget() const noexcept
void setOptions(DisplayOptions const &displayOptions, FilterOptions const &filterOptions)
BtQmlInterface * qmlInterface() const noexcept
void printAnchorWithText(DisplayOptions const &displayOptions, FilterOptions const &filterOptions)
void nodeInfoChanged(QString newNodeInfo)
void associateWithWindow(CDisplayWindow *window)
void selectionChanged(std::optional< Selection > newSelection)
std::optional< Selection > const & selection() const noexcept
CSwordKey * getMouseClickedKey()
void moduleAdded(int index, CSwordModuleInfo *module)
void moduleReplaced(int index, CSwordModuleInfo *newModule)
void setModules(BtModuleList newModules)
void moduleRemoved(int index)
ActionCollection(QObject *parent=nullptr)
The base class for all display windows of BibleTime.
virtual void modulesChanged()
FilterOptions m_filterOptions
QAction & initAddAction(Args &&... args)
void sigKeyChanged(CSwordKey *key)
void sigDisplayOptionsChanged(const DisplayOptions &displayOptions)
BTHistory *const m_history
virtual void reload()
BtModuleList m_modules
struct CDisplayWindow::ActionsStruct m_actions
void setDisplaySettingsButton(BtDisplaySettingsButton *button)
virtual void initConnections()
virtual void storeProfileSettings(BtConfigCore &windowConf) const
Stores the settings of this window to configuration.
FilterOptions const & filterOptions() const noexcept
CKeyChooser * keyChooser() const noexcept
QStringList m_moduleNames
ActionCollection *const m_actionCollection
void sigFilterOptionsChanged(const FilterOptions &filterOptions)
void sigModulesChanged(const BtConstModuleList &modules)
virtual CSwordModuleInfo::ModuleType moduleType() const
std::unique_ptr< CSwordKey > const m_swordKey
virtual void setupMainWindowToolBars()
DisplayOptions m_displayOptions
void clearMainWindowToolBars()
CKeyChooser * m_keyChooser
virtual void lookupSwordKey(CSwordKey *)
CMDIArea *const m_mdi
void lookupKey(QString const &key)
DisplayOptions const & displayOptions() const noexcept
bool m_isInitialized
Whether init() has been called.
BtConstModuleList constModules() const
BibleTime * btMainWindow()
void slotAddModule(int index, CSwordModuleInfo *module)
QToolBar * m_buttonsToolBar
virtual void initToolbars()
virtual void applyProfileSettings(BtConfigCore const &windowConf)
Loads the settings of this window from configuration.
virtual void initActions()=0
void sigModuleListChanged(BtModuleList newList)
~CDisplayWindow() override
BtModuleChooserBar * m_moduleChooserBar
void slotRemoveModule(int index)
ActionCollection * actionCollection() const noexcept
BtModelViewReadDisplay * m_displayWidget
CMDIArea * mdi() const
BtModuleList const & modules() const noexcept
virtual QMenu * newDisplayWidgetPopupMenu()
QToolBar * m_mainToolBar
void slotReplaceModule(int index, CSwordModuleInfo *newModule)
CSwordKey * getMouseClickedKey() const
void setBibleReference(const QString &reference)
virtual void copyDisplayedText()
CDisplayWindow(BtModuleList const &modules, QString const &key, bool const addTextHeaderToolbar, ActionCollection *actionCollection, CMDIArea *const parent)
bool saveKey(CSwordKey const *const key, Format const format, bool const addText, const BtConstModuleList &modules)
bool copyKey(CSwordKey const *const key, Format const format, bool const addText)
virtual void setModules(const BtConstModuleList &modules, bool refresh=true)=0
void handleHistoryMoved(QString const &newKey)
void keyChanged(CSwordKey *newKey)
virtual void updateKey(CSwordKey *key)=0
static CKeyChooser * createInstance(const BtConstModuleList &modules, CSwordKey *key, QWidget *parent)
virtual void setKey(CSwordKey *key)=0
virtual CSwordKey * key()=0
CSwordModuleInfo * findModuleByName(const QString &name) const
Searches for a module with the given name.
void sigSwordSetupChanged()
static CSwordBackend & instance() noexcept
virtual bool setKey(const QString &key)=0
virtual QString key() const =0
QString const & name() const
void prepareToolBar(QToolBar *bar, const QString &title, bool visible)
QMessageBox::StandardButton showInformation(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
struct CDisplayWindow::ActionsStruct::@14 save
struct CDisplayWindow::ActionsStruct::@13 copy
struct CDisplayWindow::ActionsStruct::@15 print
BtToolBarPopupAction * forwardInHistory
BtToolBarPopupAction * backInHistory