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 #define BUILD_TEXT_TO_SPEECH_CAPTURE , &speakSelectedTextAction
297 #define BUILD_TEXT_TO_SPEECH_ACTION \
298 speakSelectedTextAction.setEnabled(newSelection.has_value());
299 #else
300 #define BUILD_TEXT_TO_SPEECH_CAPTURE
301 #define BUILD_TEXT_TO_SPEECH_ACTION
302 #endif
305 this,
306 [&copySelectedTextAction BUILD_TEXT_TO_SPEECH_CAPTURE](
307 std::optional<BtQmlInterface::Selection> const & newSelection)
308 {
309 copySelectedTextAction.setEnabled(newSelection.has_value());
310 BUILD_TEXT_TO_SPEECH_ACTION
311 });
312 #undef BUILD_TEXT_TO_SPEECH_CAPTURE
313 #undef BUILD_TEXT_TO_SPEECH_ACTION
314 initAddAction(QStringLiteral("copyByReferences"),
317 initAddAction(QStringLiteral("findText"),
318 btMainWindow(),
320 initAddAction(DWG::backInHistory::actionName,
321 m_history,
323 initAddAction(DWG::forwardInHistory::actionName,
324 m_history,
329 addAction(m_actions.backInHistory);
333 addAction(m_actions.forwardInHistory);
335 &m_actionCollection->action(QStringLiteral("findText"));
339 [this]{
340 QString searchText;
341 for (auto const & strongNumber
342 : m_displayWidget->nodeInfo().split(
343 '|',
344 Qt::SkipEmptyParts))
345 searchText.append(
346 QStringLiteral("strong:%1 ")
347 .arg(strongNumber));
349 searchText);
350 });
352 [this](QString const & nodeInfo)
353 { m_actions.findStrongs->setEnabled(!nodeInfo.isNull()); });
355 &initAddAction(QStringLiteral("copyReferenceOnly"),
358 m_actions.copy.entry = &initAddAction(QStringLiteral("copyEntryWithText"),
362 &m_actionCollection->action(QStringLiteral("copySelectedText"));
364 &m_actionCollection->action(QStringLiteral("copyByReferences"));
367 QStringLiteral("saveEntryAsPlain"),
368 [this]{
369 CExportManager mgr(true,
370 tr("Saving"),
373 mgr.saveKey(m_swordKey.get(),
375 true,
376 constModules());
377 });
380 QStringLiteral("saveHtml"),
381 [this]{
382 CExportManager mgr(true,
383 tr("Saving"),
386 mgr.saveKey(m_swordKey.get(),
388 true,
389 constModules());
390 });
392 &initAddAction(QStringLiteral("printReferenceOnly"),
393 this,
395 addAction(m_actions.print.reference);
396 m_actions.print.entry = &initAddAction(QStringLiteral("printEntryWithText"),
397 this,
400 this,
401 [this](QString const & newActiveAnchor) {
402 bool const hasActiveAnchor = !newActiveAnchor.isEmpty();
403 m_actions.copy.reference->setEnabled(hasActiveAnchor);
404 m_actions.print.reference->setEnabled(hasActiveAnchor);
405 });
406 #ifdef BUILD_TEXT_TO_SPEECH
407 m_actions.speakSelectedText =
408 &m_actionCollection->action(QStringLiteral("speakSelectedText"));
409 #endif
410
412 QStringLiteral("Displaywindow shortcuts"));
413}
414
416
419
421 return dynamic_cast<BibleTime*>(m_mdi->parent()->parent());
422}
423
425 // Clear main window toolbars, except for works toolbar
426 btMainWindow()->navToolBar()->clear();
427 btMainWindow()->toolsToolBar()->clear();
428}
429
434
436 if (m_modules.isEmpty()) {
437 setWindowTitle(tr("<NO WORKS>"));
438 } else {
439 setWindowTitle(QStringLiteral("%1 (%2)")
440 .arg(m_swordKey->key(),
441 m_moduleNames.join(QStringLiteral(" | "))));
442 }
443}
444
445/** Store the settings of this window in the given CProfileWindow object. */
447 QWidget const * const w = getProfileWindow(parentWidget());
448 BT_ASSERT(w);
449
450 /**
451 \note We don't use saveGeometry/restoreGeometry for MDI subwindows,
452 because they give slightly incorrect results with some window
453 managers. Might be related to Qt bug QTBUG-7634.
454 */
455 const QRect rect(w->x(), w->y(), w->width(), w->height());
456 conf.setValue<QRect>(QStringLiteral("windowRect"), rect);
457 conf.setValue<bool>(QStringLiteral("staysOnTop"),
458 w->windowFlags() & Qt::WindowStaysOnTopHint);
459 conf.setValue<bool>(QStringLiteral("staysOnBottom"),
460 w->windowFlags() & Qt::WindowStaysOnBottomHint);
461 conf.setValue(QStringLiteral("maximized"), w->isMaximized());
462
463 bool const hasFocus =
464 (w == dynamic_cast<CDisplayWindow *>(mdi()->activeSubWindow()));
465 conf.setValue(QStringLiteral("hasFocus"), hasFocus);
466
467 // Save current key:
468 conf.setValue(QStringLiteral("key"), m_swordKey->normalizedKey());
469
470 // Save list of modules:
471 conf.setValue(QStringLiteral("modules"), m_moduleNames);
472
473 // Default for "not a write window":
474 conf.setValue(QStringLiteral("writeWindowType"), int(0));
475}
476
478 setUpdatesEnabled(false);
479
480 QWidget * const w = getProfileWindow(parentWidget());
481 BT_ASSERT(w);
482
483 /**
484 \note We don't use restoreGeometry/saveGeometry for MDI subwindows,
485 because they give slightly incorrect results with some window
486 managers. Might be related to Qt bug QTBUG-7634.
487 */
488 const QRect rect = conf.value<QRect>(QStringLiteral("windowRect"));
489 w->resize(rect.width(), rect.height());
490 w->move(rect.x(), rect.y());
491 if (conf.value<bool>(QStringLiteral("staysOnTop"), false))
492 w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnTopHint);
493 if (conf.value<bool>(QStringLiteral("staysOnBottom"), false))
494 w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnBottomHint);
495 if (conf.value<bool>(QStringLiteral("maximized")))
496 w->showMaximized();
497
498 setUpdatesEnabled(true);
499}
500
503
507 [this](bool const backEnabled, bool const fwEnabled) {
510
511 m_actions.backInHistory->setEnabled(backEnabled);
512 m_actions.forwardInHistory->setEnabled(fwEnabled);
513 });
514
515 //connect the history actions to the right slots
516 BT_CONNECT(m_actions.backInHistory->popupMenu(), &QMenu::aboutToShow,
517 this, // Needed
518 [this]{
519 QMenu * menu = m_actions.backInHistory->popupMenu();
520 menu->clear();
521 for (auto * const actionPtr
522 : m_history->getBackList())
523 menu->addAction(actionPtr);
524 });
525 BT_CONNECT(m_actions.backInHistory->popupMenu(), &QMenu::triggered,
527 BT_CONNECT(m_actions.forwardInHistory->popupMenu(), &QMenu::aboutToShow,
528 this, // Needed
529 [this]{
530 QMenu* menu = m_actions.forwardInHistory->popupMenu();
531 menu->clear();
532 for (auto * const actionPtr
533 : m_history->getFwList())
534 menu->addAction(actionPtr);
535 });
536 BT_CONNECT(m_actions.forwardInHistory->popupMenu(), &QMenu::triggered,
538}
539
541 //Navigation toolbar
543 m_mainToolBar->addAction(m_actions.backInHistory); //1st button
544 m_mainToolBar->addAction(m_actions.forwardInHistory); //2nd button
545 m_mainToolBar->addWidget(m_keyChooser);
546
547 //Tools toolbar
548 m_buttonsToolBar->addAction(
551
552 auto * const button = new BtDisplaySettingsButton(m_buttonsToolBar);
554 m_buttonsToolBar->addWidget(button);
555}
556
558 auto * const popupMenu = new QMenu(this);
559 popupMenu->addAction(m_actions.findText);
560 popupMenu->addAction(m_actions.findStrongs);
561 popupMenu->addSeparator();
562
563 m_actions.copyMenu = new QMenu(tr("Copy..."), popupMenu);
566 m_actions.copyMenu->addSeparator();
569 popupMenu->addMenu(m_actions.copyMenu);
570
572 tr("Save..."),
573 popupMenu
574 );
577
578 popupMenu->addMenu(m_actions.saveMenu);
579
581 tr("Print..."),
582 popupMenu
583 );
586 popupMenu->addMenu(m_actions.printMenu);
587
588 #ifdef BUILD_TEXT_TO_SPEECH
589 popupMenu->addAction((m_actions.speakSelectedText));
590 #endif
591
592 return addDebugActions(popupMenu);
593}
594
596 if (btApp->debugMode()) {
597 auto * const debugAction =
598 new QAction(tr("DEBUG: Show raw text"), this);
599 debugAction->setProperty("bibletime_show_raw_text", true);
600 menu->addSeparator();
601 menu->addAction(debugAction);
602 }
603 return menu;
604}
605
607 // Navigation toolbar
608 QString keyReference = m_swordKey->key();
609 auto const constMods = constModules();
610 auto * const keyChooser =
612 m_swordKey.get(),
613 btMainWindow()->navToolBar());
618 keyChooser->key()->setKey(keyReference);
621 btMainWindow()->navToolBar()->addWidget(keyChooser);
626
627 // Works toolbar
629
630 // Tools toolbar
631 btMainWindow()->toolsToolBar()->addAction(
634 auto * const button = new BtDisplaySettingsButton(m_buttonsToolBar);
636 btMainWindow()->toolsToolBar()->addWidget(button);
637}
638
641
644
645/** Refresh the settings of this window. */
647 // Since all the CSwordModuleInfo pointers are invalidated, we need to
648 // rebuild m_modules based on m_moduleNames, and remove all missing modules:
649 BT_ASSERT(!m_moduleNames.empty()); // This should otherwise be close()-d
650 m_modules.clear();
651 {
652 auto const & backend = CSwordBackend::instance();
653 auto it = m_moduleNames.begin();
654 do {
655 if (auto * const module = backend.findModuleByName(*it)) {
656 m_modules.append(module);
657 ++it;
658 } else {
659 it = m_moduleNames.erase(it);
660 }
661 } while (it != m_moduleNames.end());
662 }
663 BT_ASSERT(m_moduleNames.size() == m_modules.size());
664
665 if (m_modules.isEmpty()) {
666 close();
667 } else {
669
670 if (auto * const kc = m_keyChooser)
671 kc->setModules(constModules(), false);
672
673 lookup();
674
676 QStringLiteral("Displaywindow shortcuts"));
678 }
679
681
682 m_actionCollection->readShortcuts(QStringLiteral("Lexicon shortcuts"));
683}
684
686 BT_ASSERT(index <= m_modules.size());
687 m_modules.insert(index, module);
688 m_moduleNames.insert(index, module->name());
689 if (index == 0)
690 setWindowIcon(module->moduleIcon());
692 lookup();
695}
696
698 BT_ASSERT(index < m_modules.size());
699 m_modules.replace(index, newModule);
700 m_moduleNames.replace(index, newModule->name());
701 if (index == 0)
702 setWindowIcon(newModule->moduleIcon());
704 lookup();
707}
708
710 BT_ASSERT(index >= 0);
711 BT_ASSERT(index < m_modules.size());
712 m_modules.removeAt(index);
713 m_moduleNames.removeAt(index);
714 if (m_modules.empty())
715 close();
716 if (index == 0)
717 setWindowIcon(m_modules.first()->moduleIcon());
719 lookup();
722}
723
724void CDisplayWindow::setBibleReference(const QString& reference) {
726 lookupKey(reference);
727 return;
728 }
729 auto * const bibleModule =
731 QStringLiteral("standardBible"));
732 if (bibleModule) {
733 BibleTime *mainWindow = btMainWindow();
734 BT_ASSERT(mainWindow);
735 mainWindow->createReadDisplayWindow(bibleModule, reference);
736 return;
737 }
738 message::showInformation(this, tr("Choose Standard Bible"),
739 tr("Please choose a Bible in the Settings > "
740 "Configure dialog."));
741}
742
744 // this would only set the stringlist again
745 //if (moduleChooserBar()) { //necessary for write windows
746 //setModules( m_moduleChooserBar->getModuleList() );
747 //}
748 if (m_modules.isEmpty()) {
749 close();
750 }
751 else {
752 auto const constMods = constModules();
753 Q_EMIT sigModulesChanged(constMods);
754 m_swordKey->setModule(constMods.first());
755 m_keyChooser->setModules(constMods);
756 }
757}
758
760 BT_ASSERT(newKey);
761
762 if (!m_isInitialized || !newKey || m_modules.empty() || !m_modules.first())
763 return;
764
765 if (m_swordKey.get() != newKey)
766 m_swordKey->setKey(newKey->key());
767
771
773}
774
775/** Initialize the window. Call this method from the outside, because calling
776 this in the constructor is not possible! */
778 initActions();
779 initToolbars();
780
781 auto const & conf = btConfig();
782 if (!conf.session().value<bool>(
783 QStringLiteral("GUI/showToolbarsInEachWindow"),
784 true))
785 {
786 m_mainToolBar->setHidden(true);
787 m_buttonsToolBar->setHidden(true);
789 m_moduleChooserBar->setHidden(true);
790 }
794
796
797 m_filterOptions = conf.getFilterOptions();
798 m_displayOptions = conf.getDisplayOptions();
802
803 m_isInitialized = true;
804 return true;
805}
806
807/** Sets the display settings button. */
835
836/** Lookup the current key. Used to refresh the display. */
838
839void CDisplayWindow::lookupKey( const QString& keyName ) {
840 /* This function is called for example after a bookmark was dropped on this
841 window. */
842 BT_ASSERT(m_modules.first());
843
844 if (!m_isInitialized) {
845 return;
846 }
847
848 auto * const m =
850 m_modules.first()->name());
851 if (!m) {
852 return; /// \todo check if this is correct behavior
853 }
854
855 /// \todo check for containsRef compat
856 if (m && m_modules.contains(m)) {
857 m_swordKey->setKey(keyName);
858 // the key chooser does send an update signal
860 Q_EMIT sigKeyChanged(m_swordKey.get());
861 }
862 else { // given module not displayed in this window
863 // If the module is displayed in another display window we assume a
864 // wrong drop. Create a new window for the given module:
865 BibleTime * mainWindow = btMainWindow();
866 BT_ASSERT(mainWindow);
867 mainWindow->createReadDisplayWindow(m, keyName);
868 }
869}
870
873
876
#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
#define BUILD_TEXT_TO_SPEECH_CAPTURE
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:236
void toggledTextWindowNavigator(bool newState)
static BibleTime * instance() noexcept
Definition bibletime.h:223
BtModuleChooserBar * worksToolBar() const noexcept
Definition bibletime.h:232
void toggledTextWindowModuleChooser(bool newState)
QToolBar * navToolBar() const noexcept
Definition bibletime.h:229
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:497
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