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-2026 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 "../bibletimeapp.h"
29#include "../cexportmanager.h"
30#include "../cmdiarea.h"
31#include "../display/btmodelviewreaddisplay.h"
32#include "../display/modelview/btqmlinterface.h"
33#include "../display/modelview/btquickwidget.h"
34#include "../keychooser/ckeychooser.h"
35#include "../keychooser/bthistory.h"
36#include "../messagedialog.h"
38#include "btmodulechooserbar.h"
40#include "bttextwindowheader.h"
41
42
43namespace {
44
46 for (; w; w = w->parentWidget())
47 if (QMdiSubWindow * const sw = qobject_cast<QMdiSubWindow *>(w))
48 return sw;
49 return nullptr;
50}
51
52void prepareToolBar(QToolBar* bar, const QString& title, bool visible) {
53 bar->setAllowedAreas(Qt::TopToolBarArea);
54 bar->setFloatable(false);
55 bar->setWindowTitle(title);
56 bar->setVisible(visible);
57}
58
59
60} // anonymous namespace
61
63 : BtActionCollection(parent)
64{
65 auto * actn = new QAction(QIcon(), tr("Copy"), this);
66 actn->setShortcut(QKeySequence::Copy);
67 addAction(QStringLiteral("copySelectedText"), actn);
68
69 actn = new QAction(QIcon(), tr("Copy by references..."), this);
70 actn->setShortcut(Qt::CTRL | Qt::Key_R);
71 addAction(QStringLiteral("copyByReferences"), actn);
72
73 actn = new QAction(QIcon(), tr("Find..."), this);
74 actn->setShortcut(QKeySequence::Find);
75 addAction(QStringLiteral("findText"), actn);
76
77 actn = new QAction(QIcon(), tr("Change location"), this);
78 actn->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_L));
79 addAction(QStringLiteral("openLocation"), actn);
80
81 actn = new QAction(QIcon(), tr("Page down"), this);
82 actn->setShortcut(QKeySequence(Qt::Key_PageDown));
83 addAction(QStringLiteral("pageDown"), actn);
84
85 actn = new QAction(QIcon(), tr("Page up"), this);
86 actn->setShortcut(QKeySequence(Qt::Key_PageUp));
87 addAction(QStringLiteral("pageUp"), actn);
88
89 actn = new QAction(CResMgr::displaywindows::general::search::icon(),
90 tr("Search with works of this window"),
91 this);
94
96 CResMgr::displaywindows::general::backInHistory::icon(),
97 tr("Back in history"),
98 this);
99 action->setEnabled(false);
102 action);
103
105 CResMgr::displaywindows::general::forwardInHistory::icon(),
106 tr("Forward in history"),
107 this);
108 action->setEnabled(false);
109 action->setShortcut(
112 action);
113
114 actn = new QAction(tr("Copy reference only"), this);
115 addAction(QStringLiteral("copyReferenceOnly"), actn);
116
117 actn = new QAction(tr("Save entry as HTML"), this);
118 addAction(QStringLiteral("saveHtml"), actn);
119
120 actn = new QAction(tr("Print reference only"), this);
121 addAction(QStringLiteral("printReferenceOnly"), actn);
122
123 actn = new QAction(tr("Entry with text"), this);
124 addAction(QStringLiteral("copyEntryWithText"), actn);
125
126 actn = new QAction(tr("Entry as plain text"), this);
127 addAction(QStringLiteral("saveEntryAsPlain"), actn);
128
129 actn = new QAction(tr("Entry with text"), this);
130 addAction(QStringLiteral("printEntryWithText"), actn);
131
132 actn = new QAction(tr("Strong's Search"), this);
135
136 #ifdef BUILD_TEXT_TO_SPEECH
137 actn = new QAction(tr("Speak selected text"), this);
138 addAction("speakSelectedText", actn);
139 #endif
140}
141
143 QString const & key,
144 bool const addTextHeaderToolbar,
146 CMDIArea * const parent)
147 : QMainWindow(parent)
149 , m_mdi(parent)
151 , m_swordKey((static_cast<void>(BT_ASSERT(!modules.empty())),
152 m_modules.first()->createKey()))
153 , m_history(new BTHistory(this))
154{
155 m_actionCollection->setParent(this);
156
157 m_moduleNames.reserve(m_modules.size());
158 for (auto const module : m_modules)
159 m_moduleNames.append(module->name());
160
162 if (!key.isEmpty())
163 m_swordKey->setKey(key);
164 m_history->add(m_swordKey.get());
165
166 setMinimumSize(100, 100);
167 setFocusPolicy(Qt::ClickFocus);
168
169 // Cannot delete on close. QMdiSubWindow and this window work
170 // as pairs. They must be deleted in a specific order.
171 // QMdiSubWindow handles this procedure.
172 //setAttribute(Qt::WA_DeleteOnClose);
173
174 // Connect this to the backend module list changes
177
178 setWindowIcon(m_modules.first()->moduleIcon());
180
181 // Create display widget for this window
182 m_displayWidget = new BtModelViewReadDisplay(this, this);
183 setCentralWidget(m_displayWidget);
185
186 // Create the Navigation toolbar:
187 m_mainToolBar = new QToolBar(this);
188 prepareToolBar(m_mainToolBar,
189 tr("Navigation"),
190 btConfig().session().value<bool>(
191 QStringLiteral("GUI/showTextWindowNavigator"),
192 true));
194 m_mainToolBar, &QToolBar::setVisible);
195 addToolBar(m_mainToolBar);
196
197 // Create keychooser
199 m_swordKey.get(),
205
206 // Create module chooser bar:
208 m_moduleChooserBar->setWindowTitle(tr("Work chooser buttons"));
209 m_moduleChooserBar->setLayoutDirection(Qt::LeftToRight);
210 m_moduleChooserBar->setVisible(
211 btConfig().session().value<bool>(
212 QStringLiteral(
213 "GUI/showTextWindowModuleSelectorButtons"),
214 true));
217 m_moduleChooserBar, &BtModuleChooserBar::setVisible);
218 addToolBar(m_moduleChooserBar);
219
220 // Create the Tools toolbar:
221 m_buttonsToolBar = new QToolBar(this);
222 prepareToolBar(m_buttonsToolBar,
223 tr("Tool"),
224 btConfig().session().value<bool>(
225 QStringLiteral("GUI/showTextWindowToolButtons"),
226 true));
228 m_buttonsToolBar, &QToolBar::setVisible);
229 addToolBar(m_buttonsToolBar);
230
231 if (addTextHeaderToolbar) {
232 addToolBarBreak();
233
234 auto * const headerBar = new QToolBar(this);
235 headerBar->setMovable(false);
236 headerBar->setWindowTitle(tr("Text area header"));
237 headerBar->setVisible(
238 btConfig().session().value<bool>(
239 QStringLiteral("GUI/showTextWindowHeaders"),
240 true));
242 headerBar, &QToolBar::setVisible);
243
244 auto * const headerWidget =
245 new BtTextWindowHeader(m_modules.first()->type(),
246 m_modules,
247 headerBar);
249 headerWidget, &BtTextWindowHeader::setModules);
256 headerBar->addWidget(headerWidget);
257
258 addToolBar(headerBar);
259 }
260
261 // Initialize actions:
262 namespace DWG = CResMgr::displaywindows::general;
263 initAddAction(DWG::search::actionName,
264 [this]
267 QStringLiteral("openLocation"),
268 [this]{
269 if (btConfig().session().value<bool>(
270 QStringLiteral("GUI/showToolbarsInEachWindow"),
271 true))
272 {
273 m_keyChooser->setFocus();
274 } else if (auto * const kc = btMainWindow()->keyChooser()) {
275 kc->setFocus();
276 }
277 });
278 initAddAction(QStringLiteral("pageDown"),
281 initAddAction(QStringLiteral("pageUp"),
284 auto & copySelectedTextAction =
285 initAddAction(QStringLiteral("copySelectedText"),
288 auto hasSelection = m_displayWidget->qmlInterface()->selection().has_value();
289 copySelectedTextAction.setEnabled(hasSelection);
290 #ifdef BUILD_TEXT_TO_SPEECH
291 auto & speakSelectedTextAction =
292 initAddAction(QStringLiteral("speakSelectedText"),
294 &BtModelViewReadDisplay::speakSelectedText);
295 speakSelectedTextAction.setEnabled(hasSelection);
296 #endif
299 this,
300 [&copySelectedTextAction
301 #ifdef BUILD_TEXT_TO_SPEECH
302 , &speakSelectedTextAction
303 #endif
304 ](
305 std::optional<BtQmlInterface::Selection> const & newSelection)
306 {
307 copySelectedTextAction.setEnabled(newSelection.has_value());
308 #ifdef BUILD_TEXT_TO_SPEECH
309 speakSelectedTextAction.setEnabled(newSelection.has_value());
310 #endif
311 });
312 initAddAction(QStringLiteral("copyByReferences"),
315 initAddAction(QStringLiteral("findText"),
316 btMainWindow(),
318 initAddAction(DWG::backInHistory::actionName,
319 m_history,
321 initAddAction(DWG::forwardInHistory::actionName,
322 m_history,
327 addAction(m_actions.backInHistory);
331 addAction(m_actions.forwardInHistory);
333 &m_actionCollection->action(QStringLiteral("findText"));
337 [this]{
338 QString searchText;
339 for (auto const & strongNumber
340 : m_displayWidget->nodeInfo().split(
341 '|',
342 Qt::SkipEmptyParts))
343 searchText.append(
344 QStringLiteral("strong:%1 ")
345 .arg(strongNumber));
347 searchText);
348 });
350 [this](QString const & nodeInfo)
351 { m_actions.findStrongs->setEnabled(!nodeInfo.isNull()); });
353 &initAddAction(QStringLiteral("copyReferenceOnly"),
356 m_actions.copy.entry = &initAddAction(QStringLiteral("copyEntryWithText"),
360 &m_actionCollection->action(QStringLiteral("copySelectedText"));
362 &m_actionCollection->action(QStringLiteral("copyByReferences"));
365 QStringLiteral("saveEntryAsPlain"),
366 [this]{
367 CExportManager mgr(true,
368 tr("Saving"),
371 mgr.saveKey(m_swordKey.get(),
373 true,
374 constModules());
375 });
378 QStringLiteral("saveHtml"),
379 [this]{
380 CExportManager mgr(true,
381 tr("Saving"),
384 mgr.saveKey(m_swordKey.get(),
386 true,
387 constModules());
388 });
390 &initAddAction(QStringLiteral("printReferenceOnly"),
391 this,
393 addAction(m_actions.print.reference);
394 m_actions.print.entry = &initAddAction(QStringLiteral("printEntryWithText"),
395 this,
398 this,
399 [this](QString const & newActiveAnchor) {
400 bool const hasActiveAnchor = !newActiveAnchor.isEmpty();
401 m_actions.copy.reference->setEnabled(hasActiveAnchor);
402 m_actions.print.reference->setEnabled(hasActiveAnchor);
403 });
404 #ifdef BUILD_TEXT_TO_SPEECH
405 m_actions.speakSelectedText =
406 &m_actionCollection->action(QStringLiteral("speakSelectedText"));
407 #endif
408
410 QStringLiteral("Displaywindow shortcuts"));
411}
412
414
417
419 return dynamic_cast<BibleTime*>(m_mdi->parent()->parent());
420}
421
423 // Clear main window toolbars, except for works toolbar
424 btMainWindow()->navToolBar()->clear();
425 btMainWindow()->toolsToolBar()->clear();
426}
427
432
434 if (m_modules.isEmpty()) {
435 setWindowTitle(tr("<NO WORKS>"));
436 } else {
437 setWindowTitle(QStringLiteral("%1 (%2)")
438 .arg(m_swordKey->key(),
439 m_moduleNames.join(QStringLiteral(" | "))));
440 }
441}
442
443/** Store the settings of this window in the given CProfileWindow object. */
445 QWidget const * const w = getProfileWindow(parentWidget());
446 BT_ASSERT(w);
447
448 /**
449 \note We don't use saveGeometry/restoreGeometry for MDI subwindows,
450 because they give slightly incorrect results with some window
451 managers. Might be related to Qt bug QTBUG-7634.
452 */
453 const QRect rect(w->x(), w->y(), w->width(), w->height());
454 conf.setValue<QRect>(QStringLiteral("windowRect"), rect);
455 conf.setValue<bool>(QStringLiteral("staysOnTop"),
456 w->windowFlags() & Qt::WindowStaysOnTopHint);
457 conf.setValue<bool>(QStringLiteral("staysOnBottom"),
458 w->windowFlags() & Qt::WindowStaysOnBottomHint);
459 conf.setValue(QStringLiteral("maximized"), w->isMaximized());
460
461 bool const hasFocus =
462 (w == dynamic_cast<CDisplayWindow *>(mdi()->activeSubWindow()));
463 conf.setValue(QStringLiteral("hasFocus"), hasFocus);
464
465 // Save current key:
466 conf.setValue(QStringLiteral("key"), m_swordKey->normalizedKey());
467
468 // Save list of modules:
469 conf.setValue(QStringLiteral("modules"), m_moduleNames);
470
471 // Default for "not a write window":
472 conf.setValue(QStringLiteral("writeWindowType"), int(0));
473}
474
476 setUpdatesEnabled(false);
477
478 QWidget * const w = getProfileWindow(parentWidget());
479 BT_ASSERT(w);
480
481 /**
482 \note We don't use restoreGeometry/saveGeometry for MDI subwindows,
483 because they give slightly incorrect results with some window
484 managers. Might be related to Qt bug QTBUG-7634.
485 */
486 const QRect rect = conf.value<QRect>(QStringLiteral("windowRect"));
487 w->resize(rect.width(), rect.height());
488 w->move(rect.x(), rect.y());
489 if (conf.value<bool>(QStringLiteral("staysOnTop"), false))
490 w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnTopHint);
491 if (conf.value<bool>(QStringLiteral("staysOnBottom"), false))
492 w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnBottomHint);
493 if (conf.value<bool>(QStringLiteral("maximized")))
494 w->showMaximized();
495
496 setUpdatesEnabled(true);
497}
498
501
505 [this](bool const backEnabled, bool const fwEnabled) {
508
509 m_actions.backInHistory->setEnabled(backEnabled);
510 m_actions.forwardInHistory->setEnabled(fwEnabled);
511 });
512
513 //connect the history actions to the right slots
514 BT_CONNECT(m_actions.backInHistory->popupMenu(), &QMenu::aboutToShow,
515 this, // Needed
516 [this]{
517 QMenu * menu = m_actions.backInHistory->popupMenu();
518 menu->clear();
519 for (auto * const actionPtr
520 : m_history->getBackList())
521 menu->addAction(actionPtr);
522 });
523 BT_CONNECT(m_actions.backInHistory->popupMenu(), &QMenu::triggered,
525 BT_CONNECT(m_actions.forwardInHistory->popupMenu(), &QMenu::aboutToShow,
526 this, // Needed
527 [this]{
528 QMenu* menu = m_actions.forwardInHistory->popupMenu();
529 menu->clear();
530 for (auto * const actionPtr
531 : m_history->getFwList())
532 menu->addAction(actionPtr);
533 });
534 BT_CONNECT(m_actions.forwardInHistory->popupMenu(), &QMenu::triggered,
536}
537
539 //Navigation toolbar
541 m_mainToolBar->addAction(m_actions.backInHistory); //1st button
542 m_mainToolBar->addAction(m_actions.forwardInHistory); //2nd button
543 m_mainToolBar->addWidget(m_keyChooser);
544
545 //Tools toolbar
546 m_buttonsToolBar->addAction(
549
550 auto * const button = new BtDisplaySettingsButton(m_buttonsToolBar);
552 m_buttonsToolBar->addWidget(button);
553}
554
556 auto * const popupMenu = new QMenu(this);
557 popupMenu->addAction(m_actions.findText);
558 popupMenu->addAction(m_actions.findStrongs);
559 popupMenu->addSeparator();
560
561 m_actions.copyMenu = new QMenu(tr("Copy..."), popupMenu);
564 m_actions.copyMenu->addSeparator();
567 popupMenu->addMenu(m_actions.copyMenu);
568
570 tr("Save..."),
571 popupMenu
572 );
575
576 popupMenu->addMenu(m_actions.saveMenu);
577
579 tr("Print..."),
580 popupMenu
581 );
584 popupMenu->addMenu(m_actions.printMenu);
585
586 #ifdef BUILD_TEXT_TO_SPEECH
587 popupMenu->addAction((m_actions.speakSelectedText));
588 #endif
589
590 return addDebugActions(popupMenu);
591}
592
594 if (btApp->debugMode()) {
595 auto * const debugAction =
596 new QAction(tr("DEBUG: Show raw text"), this);
597 debugAction->setProperty("bibletime_show_raw_text", true);
598 menu->addSeparator();
599 menu->addAction(debugAction);
600 }
601 return menu;
602}
603
605 // Navigation toolbar
606 QString keyReference = m_swordKey->key();
607 auto const constMods = constModules();
608 auto * const keyChooser =
610 m_swordKey.get(),
611 btMainWindow()->navToolBar());
616 keyChooser->key()->setKey(keyReference);
619 btMainWindow()->navToolBar()->addWidget(keyChooser);
624
625 // Works toolbar
627
628 // Tools toolbar
629 btMainWindow()->toolsToolBar()->addAction(
632 auto * const button = new BtDisplaySettingsButton(m_buttonsToolBar);
634 btMainWindow()->toolsToolBar()->addWidget(button);
635}
636
639
642
643/** Refresh the settings of this window. */
645 // Since all the CSwordModuleInfo pointers are invalidated, we need to
646 // rebuild m_modules based on m_moduleNames, and remove all missing modules:
647 BT_ASSERT(!m_moduleNames.empty()); // This should otherwise be close()-d
648 m_modules.clear();
649 {
650 auto const & backend = CSwordBackend::instance();
651 auto it = m_moduleNames.begin();
652 do {
653 if (auto * const module = backend.findModuleByName(*it)) {
654 m_modules.append(module);
655 ++it;
656 } else {
657 it = m_moduleNames.erase(it);
658 }
659 } while (it != m_moduleNames.end());
660 }
661 BT_ASSERT(m_moduleNames.size() == m_modules.size());
662
663 if (m_modules.isEmpty()) {
664 close();
665 } else {
667
668 if (auto * const kc = m_keyChooser)
669 kc->setModules(constModules(), false);
670
671 lookup();
672
674 QStringLiteral("Displaywindow shortcuts"));
676 }
677
679
680 m_actionCollection->readShortcuts(QStringLiteral("Lexicon shortcuts"));
681}
682
684 BT_ASSERT(index <= m_modules.size());
685 m_modules.insert(index, module);
686 m_moduleNames.insert(index, module->name());
687 if (index == 0)
688 setWindowIcon(module->moduleIcon());
690 lookup();
693}
694
696 BT_ASSERT(index < m_modules.size());
697 m_modules.replace(index, newModule);
698 m_moduleNames.replace(index, newModule->name());
699 if (index == 0)
700 setWindowIcon(newModule->moduleIcon());
702 lookup();
705}
706
708 BT_ASSERT(index >= 0);
709 BT_ASSERT(index < m_modules.size());
710 m_modules.removeAt(index);
711 m_moduleNames.removeAt(index);
712 if (m_modules.empty())
713 close();
714 if (index == 0)
715 setWindowIcon(m_modules.first()->moduleIcon());
717 lookup();
720}
721
722void CDisplayWindow::setBibleReference(const QString& reference) {
724 lookupKey(reference);
725 return;
726 }
727 auto * const bibleModule =
729 QStringLiteral("standardBible"));
730 if (bibleModule) {
731 BibleTime *mainWindow = btMainWindow();
732 BT_ASSERT(mainWindow);
733 mainWindow->createReadDisplayWindow(bibleModule, reference);
734 return;
735 }
736 message::showInformation(this, tr("Choose Standard Bible"),
737 tr("Please choose a Bible in the Settings > "
738 "Configure dialog."));
739}
740
742 // this would only set the stringlist again
743 //if (moduleChooserBar()) { //necessary for write windows
744 //setModules( m_moduleChooserBar->getModuleList() );
745 //}
746 if (m_modules.isEmpty()) {
747 close();
748 }
749 else {
750 auto const constMods = constModules();
751 Q_EMIT sigModulesChanged(constMods);
752 m_swordKey->setModule(constMods.first());
753 m_keyChooser->setModules(constMods);
754 }
755}
756
758 BT_ASSERT(newKey);
759
760 if (!m_isInitialized || !newKey || m_modules.empty() || !m_modules.first())
761 return;
762
763 if (m_swordKey.get() != newKey)
764 m_swordKey->setKey(newKey->key());
765
769
771}
772
773/** Initialize the window. Call this method from the outside, because calling
774 this in the constructor is not possible! */
776 initActions();
777 initToolbars();
778
779 auto const & conf = btConfig();
780 if (!conf.session().value<bool>(
781 QStringLiteral("GUI/showToolbarsInEachWindow"),
782 true))
783 {
784 m_mainToolBar->setHidden(true);
785 m_buttonsToolBar->setHidden(true);
787 m_moduleChooserBar->setHidden(true);
788 }
792
794
795 m_filterOptions = conf.getFilterOptions();
796 m_displayOptions = conf.getDisplayOptions();
800
801 m_isInitialized = true;
802 return true;
803}
804
805/** Sets the display settings button. */
833
834/** Lookup the current key. Used to refresh the display. */
836
837void CDisplayWindow::lookupKey( const QString& keyName ) {
838 /* This function is called for example after a bookmark was dropped on this
839 window. */
840 BT_ASSERT(m_modules.first());
841
842 if (!m_isInitialized) {
843 return;
844 }
845
846 auto * const m =
848 m_modules.first()->name());
849 if (!m) {
850 return; /// \todo check if this is correct behavior
851 }
852
853 /// \todo check for containsRef compat
854 if (m && m_modules.contains(m)) {
855 m_swordKey->setKey(keyName);
856 // the key chooser does send an update signal
858 Q_EMIT sigKeyChanged(m_swordKey.get());
859 }
860 else { // given module not displayed in this window
861 // If the module is displayed in another display window we assume a
862 // wrong drop. Create a new window for the given module:
863 BibleTime * mainWindow = btMainWindow();
864 BT_ASSERT(mainWindow);
865 mainWindow->createReadDisplayWindow(m, keyName);
866 }
867}
868
871
874
#define btApp
#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:239
void toggledTextWindowNavigator(bool newState)
static BibleTime * instance() noexcept
Definition bibletime.h:226
BtModuleChooserBar * worksToolBar() const noexcept
Definition bibletime.h:235
void toggledTextWindowModuleChooser(bool newState)
QToolBar * navToolBar() const noexcept
Definition bibletime.h:232
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
QMenu * addDebugActions(QMenu *menu)
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