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
135 QString const & key,
136 bool const addTextHeaderToolbar,
138 CMDIArea * const parent)
139 : QMainWindow(parent)
141 , m_mdi(parent)
143 , m_swordKey((static_cast<void>(BT_ASSERT(!modules.empty())),
144 m_modules.first()->createKey()))
145 , m_history(new BTHistory(this))
146{
147 m_actionCollection->setParent(this);
148
149 m_moduleNames.reserve(m_modules.size());
150 for (auto const module : m_modules)
151 m_moduleNames.append(module->name());
152
154 if (!key.isEmpty())
155 m_swordKey->setKey(key);
156 setMinimumSize(100, 100);
157 setFocusPolicy(Qt::ClickFocus);
158
159 // Cannot delete on close. QMdiSubWindow and this window work
160 // as pairs. They must be deleted in a specific order.
161 // QMdiSubWindow handles this procedure.
162 //setAttribute(Qt::WA_DeleteOnClose);
163
164 // Connect this to the backend module list changes
167
168 setWindowIcon(m_modules.first()->moduleIcon());
170
171 // Create display widget for this window
172 m_displayWidget = new BtModelViewReadDisplay(this, this);
173 setCentralWidget(m_displayWidget);
175
176 // Create the Navigation toolbar:
177 m_mainToolBar = new QToolBar(this);
178 prepareToolBar(m_mainToolBar,
179 tr("Navigation"),
180 btConfig().session().value<bool>(
181 QStringLiteral("GUI/showTextWindowNavigator"),
182 true));
184 m_mainToolBar, &QToolBar::setVisible);
185 addToolBar(m_mainToolBar);
186
187 // Create keychooser
189 m_swordKey.get(),
195
196 // Create module chooser bar:
198 m_moduleChooserBar->setWindowTitle(tr("Work chooser buttons"));
199 m_moduleChooserBar->setLayoutDirection(Qt::LeftToRight);
200 m_moduleChooserBar->setVisible(
201 btConfig().session().value<bool>(
202 QStringLiteral(
203 "GUI/showTextWindowModuleSelectorButtons"),
204 true));
207 m_moduleChooserBar, &BtModuleChooserBar::setVisible);
208 addToolBar(m_moduleChooserBar);
209
210 // Create the Tools toolbar:
211 m_buttonsToolBar = new QToolBar(this);
212 prepareToolBar(m_buttonsToolBar,
213 tr("Tool"),
214 btConfig().session().value<bool>(
215 QStringLiteral("GUI/showTextWindowToolButtons"),
216 true));
218 m_buttonsToolBar, &QToolBar::setVisible);
219 addToolBar(m_buttonsToolBar);
220
221 if (addTextHeaderToolbar) {
222 addToolBarBreak();
223
224 auto * const headerBar = new QToolBar(this);
225 headerBar->setMovable(false);
226 headerBar->setWindowTitle(tr("Text area header"));
227 headerBar->setVisible(
228 btConfig().session().value<bool>(
229 QStringLiteral("GUI/showTextWindowHeaders"),
230 true));
232 headerBar, &QToolBar::setVisible);
233
234 auto * const headerWidget =
235 new BtTextWindowHeader(m_modules.first()->type(),
236 m_modules,
237 headerBar);
239 headerWidget, &BtTextWindowHeader::setModules);
246 headerBar->addWidget(headerWidget);
247
248 addToolBar(headerBar);
249 }
250
251 // Initialize actions:
252 namespace DWG = CResMgr::displaywindows::general;
253 initAddAction(DWG::search::actionName,
254 [this]
257 QStringLiteral("openLocation"),
258 [this]{
259 if (btConfig().session().value<bool>(
260 QStringLiteral("GUI/showToolbarsInEachWindow"),
261 true))
262 {
263 m_keyChooser->setFocus();
264 } else if (auto * const kc = btMainWindow()->keyChooser()) {
265 kc->setFocus();
266 }
267 });
268 initAddAction(QStringLiteral("pageDown"),
271 initAddAction(QStringLiteral("pageUp"),
274 auto & copySelectedTextAction =
275 initAddAction(QStringLiteral("copySelectedText"),
280 this,
281 [&copySelectedTextAction](
282 std::optional<BtQmlInterface::Selection> const & newSelection)
283 {
284 copySelectedTextAction.setEnabled(newSelection.has_value());
285 });
286 initAddAction(QStringLiteral("copyByReferences"),
289 initAddAction(QStringLiteral("findText"),
290 btMainWindow(),
292 initAddAction(DWG::backInHistory::actionName,
293 m_history,
295 initAddAction(DWG::forwardInHistory::actionName,
296 m_history,
301 addAction(m_actions.backInHistory);
305 addAction(m_actions.forwardInHistory);
307 &m_actionCollection->action(QStringLiteral("findText"));
311 [this]{
312 QString searchText;
313 for (auto const & strongNumber
314 : m_displayWidget->nodeInfo().split(
315 '|',
316 Qt::SkipEmptyParts))
317 searchText.append(
318 QStringLiteral("strong:%1 ")
319 .arg(strongNumber));
321 searchText);
322 });
324 [this](QString const & nodeInfo)
325 { m_actions.findStrongs->setEnabled(!nodeInfo.isNull()); });
327 &initAddAction(QStringLiteral("copyReferenceOnly"),
330 m_actions.copy.entry = &initAddAction(QStringLiteral("copyEntryWithText"),
334 &m_actionCollection->action(QStringLiteral("copySelectedText"));
336 &m_actionCollection->action(QStringLiteral("copyByReferences"));
339 QStringLiteral("saveEntryAsPlain"),
340 [this]{
341 CExportManager mgr(true,
342 tr("Saving"),
345 mgr.saveKey(m_swordKey.get(),
347 true,
348 constModules());
349 });
352 QStringLiteral("saveHtml"),
353 [this]{
354 CExportManager mgr(true,
355 tr("Saving"),
358 mgr.saveKey(m_swordKey.get(),
360 true,
361 constModules());
362 });
364 &initAddAction(QStringLiteral("printReferenceOnly"),
365 this,
367 addAction(m_actions.print.reference);
368 m_actions.print.entry = &initAddAction(QStringLiteral("printEntryWithText"),
369 this,
372 this,
373 [this](QString const & newActiveAnchor) {
374 bool const hasActiveAnchor = !newActiveAnchor.isEmpty();
375 m_actions.copy.reference->setEnabled(hasActiveAnchor);
376 m_actions.print.reference->setEnabled(hasActiveAnchor);
377 });
379 QStringLiteral("Displaywindow shortcuts"));
380}
381
383
386
388 return dynamic_cast<BibleTime*>(m_mdi->parent()->parent());
389}
390
392 // Clear main window toolbars, except for works toolbar
393 btMainWindow()->navToolBar()->clear();
394 btMainWindow()->toolsToolBar()->clear();
395}
396
401
403 if (m_modules.isEmpty()) {
404 setWindowTitle(tr("<NO WORKS>"));
405 } else {
406 setWindowTitle(QStringLiteral("%1 (%2)")
407 .arg(m_swordKey->key(),
408 m_moduleNames.join(QStringLiteral(" | "))));
409 }
410}
411
412/** Store the settings of this window in the given CProfileWindow object. */
414 QWidget const * const w = getProfileWindow(parentWidget());
415 BT_ASSERT(w);
416
417 /**
418 \note We don't use saveGeometry/restoreGeometry for MDI subwindows,
419 because they give slightly incorrect results with some window
420 managers. Might be related to Qt bug QTBUG-7634.
421 */
422 const QRect rect(w->x(), w->y(), w->width(), w->height());
423 conf.setValue<QRect>(QStringLiteral("windowRect"), rect);
424 conf.setValue<bool>(QStringLiteral("staysOnTop"),
425 w->windowFlags() & Qt::WindowStaysOnTopHint);
426 conf.setValue<bool>(QStringLiteral("staysOnBottom"),
427 w->windowFlags() & Qt::WindowStaysOnBottomHint);
428 conf.setValue(QStringLiteral("maximized"), w->isMaximized());
429
430 bool const hasFocus =
431 (w == dynamic_cast<CDisplayWindow *>(mdi()->activeSubWindow()));
432 conf.setValue(QStringLiteral("hasFocus"), hasFocus);
433
434 // Save current key:
435 conf.setValue(QStringLiteral("key"), m_swordKey->normalizedKey());
436
437 // Save list of modules:
438 conf.setValue(QStringLiteral("modules"), m_moduleNames);
439
440 // Default for "not a write window":
441 conf.setValue(QStringLiteral("writeWindowType"), int(0));
442}
443
445 setUpdatesEnabled(false);
446
447 QWidget * const w = getProfileWindow(parentWidget());
448 BT_ASSERT(w);
449
450 /**
451 \note We don't use restoreGeometry/saveGeometry 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 = conf.value<QRect>(QStringLiteral("windowRect"));
456 w->resize(rect.width(), rect.height());
457 w->move(rect.x(), rect.y());
458 if (conf.value<bool>(QStringLiteral("staysOnTop"), false))
459 w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnTopHint);
460 if (conf.value<bool>(QStringLiteral("staysOnBottom"), false))
461 w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnBottomHint);
462 if (conf.value<bool>(QStringLiteral("maximized")))
463 w->showMaximized();
464
465 setUpdatesEnabled(true);
466}
467
470
474 [this](bool const backEnabled, bool const fwEnabled) {
477
478 m_actions.backInHistory->setEnabled(backEnabled);
479 m_actions.forwardInHistory->setEnabled(fwEnabled);
480 });
481
482 //connect the history actions to the right slots
483 BT_CONNECT(m_actions.backInHistory->popupMenu(), &QMenu::aboutToShow,
484 this, // Needed
485 [this]{
486 QMenu * menu = m_actions.backInHistory->popupMenu();
487 menu->clear();
488 for (auto * const actionPtr
489 : m_history->getBackList())
490 menu->addAction(actionPtr);
491 });
492 BT_CONNECT(m_actions.backInHistory->popupMenu(), &QMenu::triggered,
494 BT_CONNECT(m_actions.forwardInHistory->popupMenu(), &QMenu::aboutToShow,
495 this, // Needed
496 [this]{
497 QMenu* menu = m_actions.forwardInHistory->popupMenu();
498 menu->clear();
499 for (auto * const actionPtr
500 : m_history->getFwList())
501 menu->addAction(actionPtr);
502 });
503 BT_CONNECT(m_actions.forwardInHistory->popupMenu(), &QMenu::triggered,
505}
506
508 //Navigation toolbar
510 m_mainToolBar->addAction(m_actions.backInHistory); //1st button
511 m_mainToolBar->addAction(m_actions.forwardInHistory); //2nd button
512 m_mainToolBar->addWidget(m_keyChooser);
513
514 //Tools toolbar
515 m_buttonsToolBar->addAction(
518
519 auto * const button = new BtDisplaySettingsButton(m_buttonsToolBar);
521 m_buttonsToolBar->addWidget(button);
522}
523
525 auto * const popupMenu = new QMenu(this);
526 popupMenu->addAction(m_actions.findText);
527 popupMenu->addAction(m_actions.findStrongs);
528 popupMenu->addSeparator();
529
530 m_actions.copyMenu = new QMenu(tr("Copy..."), popupMenu);
533 m_actions.copyMenu->addSeparator();
536 popupMenu->addMenu(m_actions.copyMenu);
537
539 tr("Save..."),
540 popupMenu
541 );
544
545 popupMenu->addMenu(m_actions.saveMenu);
546
548 tr("Print..."),
549 popupMenu
550 );
553 popupMenu->addMenu(m_actions.printMenu);
554 return popupMenu;
555}
556
558 // Navigation toolbar
559 QString keyReference = m_swordKey->key();
560 auto const constMods = constModules();
561 auto * const keyChooser =
563 m_swordKey.get(),
564 btMainWindow()->navToolBar());
569 keyChooser->key()->setKey(keyReference);
572 btMainWindow()->navToolBar()->addWidget(keyChooser);
577
578 // Works toolbar
580
581 // Tools toolbar
582 btMainWindow()->toolsToolBar()->addAction(
585 auto * const button = new BtDisplaySettingsButton(m_buttonsToolBar);
587 btMainWindow()->toolsToolBar()->addWidget(button);
588}
589
592
595
596/** Refresh the settings of this window. */
598 // Since all the CSwordModuleInfo pointers are invalidated, we need to
599 // rebuild m_modules based on m_moduleNames, and remove all missing modules:
600 BT_ASSERT(!m_moduleNames.empty()); // This should otherwise be close()-d
601 m_modules.clear();
602 {
603 auto const & backend = CSwordBackend::instance();
604 auto it = m_moduleNames.begin();
605 do {
606 if (auto * const module = backend.findModuleByName(*it)) {
607 m_modules.append(module);
608 ++it;
609 } else {
610 it = m_moduleNames.erase(it);
611 }
612 } while (it != m_moduleNames.end());
613 }
614 BT_ASSERT(m_moduleNames.size() == m_modules.size());
615
616 if (m_modules.isEmpty()) {
617 close();
618 } else {
620
621 if (auto * const kc = m_keyChooser)
622 kc->setModules(constModules(), false);
623
624 lookup();
625
627 QStringLiteral("Displaywindow shortcuts"));
629 }
630
632
633 m_actionCollection->readShortcuts(QStringLiteral("Lexicon shortcuts"));
634}
635
637 BT_ASSERT(index <= m_modules.size());
638 m_modules.insert(index, module);
639 m_moduleNames.insert(index, module->name());
640 if (index == 0)
641 setWindowIcon(module->moduleIcon());
643 lookup();
646}
647
649 BT_ASSERT(index < m_modules.size());
650 m_modules.replace(index, newModule);
651 m_moduleNames.replace(index, newModule->name());
652 if (index == 0)
653 setWindowIcon(newModule->moduleIcon());
655 lookup();
658}
659
661 BT_ASSERT(index >= 0);
662 BT_ASSERT(index < m_modules.size());
663 m_modules.removeAt(index);
664 m_moduleNames.removeAt(index);
665 if (m_modules.empty())
666 close();
667 if (index == 0)
668 setWindowIcon(m_modules.first()->moduleIcon());
670 lookup();
673}
674
675void CDisplayWindow::setBibleReference(const QString& reference) {
677 lookupKey(reference);
678 return;
679 }
680 auto * const bibleModule =
682 QStringLiteral("standardBible"));
683 if (bibleModule) {
684 BibleTime *mainWindow = btMainWindow();
685 BT_ASSERT(mainWindow);
686 mainWindow->createReadDisplayWindow(bibleModule, reference);
687 return;
688 }
689 message::showInformation(this, tr("Choose Standard Bible"),
690 tr("Please choose a Bible in the Settings > "
691 "Configure dialog."));
692}
693
695 // this would only set the stringlist again
696 //if (moduleChooserBar()) { //necessary for write windows
697 //setModules( m_moduleChooserBar->getModuleList() );
698 //}
699 if (m_modules.isEmpty()) {
700 close();
701 }
702 else {
703 auto const constMods = constModules();
704 Q_EMIT sigModulesChanged(constMods);
705 m_swordKey->setModule(constMods.first());
706 m_keyChooser->setModules(constMods);
707 }
708}
709
711 BT_ASSERT(newKey);
712
713 if (!m_isInitialized || !newKey || m_modules.empty() || !m_modules.first())
714 return;
715
716 if (m_swordKey.get() != newKey)
717 m_swordKey->setKey(newKey->key());
718
722
724}
725
726/** Initialize the window. Call this method from the outside, because calling
727 this in the constructor is not possible! */
729 initActions();
730 initToolbars();
731
732 auto const & conf = btConfig();
733 if (!conf.session().value<bool>(
734 QStringLiteral("GUI/showToolbarsInEachWindow"),
735 true))
736 {
737 m_mainToolBar->setHidden(true);
738 m_buttonsToolBar->setHidden(true);
740 m_moduleChooserBar->setHidden(true);
741 }
745
747
748 m_filterOptions = conf.getFilterOptions();
749 m_displayOptions = conf.getDisplayOptions();
753
754 m_isInitialized = true;
755 return true;
756}
757
758/** Sets the display settings button. */
786
787/** Lookup the current key. Used to refresh the display. */
789
790void CDisplayWindow::lookupKey( const QString& keyName ) {
791 /* This function is called for example after a bookmark was dropped on this
792 window. */
793 BT_ASSERT(m_modules.first());
794
795 if (!m_isInitialized) {
796 return;
797 }
798
799 auto * const m =
801 m_modules.first()->name());
802 if (!m) {
803 return; /// \todo check if this is correct behavior
804 }
805
806 /// \todo check for containsRef compat
807 if (m && m_modules.contains(m)) {
808 m_swordKey->setKey(keyName);
809 // the key chooser does send an update signal
811 Q_EMIT sigKeyChanged(m_swordKey.get());
812 }
813 else { // given module not displayed in this window
814 // If the module is displayed in another display window we assume a
815 // wrong drop. Create a new window for the given module:
816 BibleTime * mainWindow = btMainWindow();
817 BT_ASSERT(mainWindow);
818 mainWindow->createReadDisplayWindow(m, keyName);
819 }
820}
821
824
827
#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:235
void toggledTextWindowNavigator(bool newState)
static BibleTime * instance() noexcept
Definition bibletime.h:222
BtModuleChooserBar * worksToolBar() const noexcept
Definition bibletime.h:231
void toggledTextWindowModuleChooser(bool newState)
QToolBar * navToolBar() const noexcept
Definition bibletime.h:228
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:494
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)
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
QIcon moduleIcon() const
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