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-2021 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"
36 #include "bttoolbarpopupaction.h"
37 #include "btmodulechooserbar.h"
39 #include "bttextwindowheader.h"
40 
41 
42 namespace {
43 
45  for (; w; w = w->parentWidget())
46  if (QMdiSubWindow * const sw = qobject_cast<QMdiSubWindow *>(w))
47  return sw;
48  return nullptr;
49 }
50 
51 } // anonymous namespace
52 
53 
55  CMDIArea * const parent)
56  : QMainWindow(parent)
57  , m_actionCollection(new BtActionCollection(this))
58  , m_mdi(parent)
59  , m_modules(modules)
60  , m_swordKey((static_cast<void>(BT_ASSERT(!modules.empty())),
61  m_modules.first()->createKey()))
62  , m_history(new BTHistory(this))
63 {
64  m_moduleNames.reserve(m_modules.size());
65  for (auto const module : m_modules)
66  m_moduleNames.append(module->name());
67 
69  setMinimumSize(100, 100);
70  setFocusPolicy(Qt::ClickFocus);
71 
72  // Cannot delete on close. QMdiSubWindow and this window work
73  // as pairs. They must be deleted in a specific order.
74  // QMdiSubWindow handles this procedure.
75  //setAttribute(Qt::WA_DeleteOnClose);
76 
77  // Connect this to the backend module list changes
79  this, &CDisplayWindow::reload);
80 
81  setWindowIcon(m_modules.first()->moduleIcon());
83 }
84 
86 
88 { return CSwordModuleInfo::Lexicon; }
89 
91  return dynamic_cast<BibleTime*>(m_mdi->parent()->parent());
92 }
93 
95  // Clear main window toolbars, except for works toolbar
96  btMainWindow()->navToolBar()->clear();
97  btMainWindow()->toolsToolBar()->clear();
98 }
99 
103 }
104 
106  if (m_modules.isEmpty()) {
107  setWindowTitle(tr("<NO WORKS>"));
108  } else {
109  setWindowTitle(QStringLiteral("%1 (%2)")
110  .arg(m_swordKey->key(),
111  m_moduleNames.join(QStringLiteral(" | "))));
112  }
113 }
114 
115 /** Store the settings of this window in the given CProfileWindow object. */
117  QWidget const * const w = getProfileWindow(parentWidget());
118  BT_ASSERT(w);
119 
120  /**
121  \note We don't use saveGeometry/restoreGeometry for MDI subwindows,
122  because they give slightly incorrect results with some window
123  managers. Might be related to Qt bug QTBUG-7634.
124  */
125  const QRect rect(w->x(), w->y(), w->width(), w->height());
126  conf.setValue<QRect>(QStringLiteral("windowRect"), rect);
127  conf.setValue<bool>(QStringLiteral("staysOnTop"),
128  w->windowFlags() & Qt::WindowStaysOnTopHint);
129  conf.setValue<bool>(QStringLiteral("staysOnBottom"),
130  w->windowFlags() & Qt::WindowStaysOnBottomHint);
131  conf.setValue(QStringLiteral("maximized"), w->isMaximized());
132 
133  bool const hasFocus =
134  (w == dynamic_cast<CDisplayWindow *>(mdi()->activeSubWindow()));
135  conf.setValue(QStringLiteral("hasFocus"), hasFocus);
136 
137  // Save current key:
138  conf.setValue(QStringLiteral("key"), m_swordKey->normalizedKey());
139 
140  // Save list of modules:
141  conf.setValue(QStringLiteral("modules"), m_moduleNames);
142 
143  // Default for "not a write window":
144  conf.setValue(QStringLiteral("writeWindowType"), int(0));
145 }
146 
148  setUpdatesEnabled(false);
149 
150  QWidget * const w = getProfileWindow(parentWidget());
151  BT_ASSERT(w);
152 
153  /**
154  \note We don't use restoreGeometry/saveGeometry for MDI subwindows,
155  because they give slightly incorrect results with some window
156  managers. Might be related to Qt bug QTBUG-7634.
157  */
158  const QRect rect = conf.value<QRect>(QStringLiteral("windowRect"));
159  w->resize(rect.width(), rect.height());
160  w->move(rect.x(), rect.y());
161  if (conf.value<bool>(QStringLiteral("staysOnTop"), false))
162  w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnTopHint);
163  if (conf.value<bool>(QStringLiteral("staysOnBottom"), false))
164  w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnBottomHint);
165  if (conf.value<bool>(QStringLiteral("maximized")))
166  w->showMaximized();
167 
168  setUpdatesEnabled(true);
169 }
170 
172  auto * actn = new QAction(QIcon(), tr("Copy"), a);
173  actn->setShortcut(QKeySequence::Copy);
174  a->addAction(QStringLiteral("copySelectedText"), actn);
175 
176  actn = new QAction(QIcon(), tr("Copy by references..."), a);
177  actn->setShortcut(Qt::CTRL | Qt::Key_R);
178  a->addAction(QStringLiteral("copyByReferences"), actn);
179 
180  actn = new QAction(QIcon(), tr("Find..."), a);
181  actn->setShortcut(QKeySequence::Find);
182  a->addAction(QStringLiteral("findText"), actn);
183 
184  actn = new QAction(QIcon(), tr("Change location"), a);
185  actn->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_L));
186  a->addAction(QStringLiteral("openLocation"), actn);
187 
188  actn = new QAction(QIcon(), tr("Page down"), a);
189  actn->setShortcut(QKeySequence(Qt::Key_PageDown));
190  a->addAction(QStringLiteral("pageDown"), actn);
191 
192  actn = new QAction(QIcon(), tr("Page up"), a);
193  actn->setShortcut(QKeySequence(Qt::Key_PageUp));
194  a->addAction(QStringLiteral("pageUp"), actn);
195 
196  actn = new QAction(CResMgr::displaywindows::general::search::icon(),
197  tr("Search with works of this window"), a);
200 
202  CResMgr::displaywindows::general::backInHistory::icon(),
203  tr("Back in history"),
204  a
205  );
208  action);
209 
210  action = new BtToolBarPopupAction(
211  CResMgr::displaywindows::general::forwardInHistory::icon(),
212  tr("Forward in history"),
213  a
214  );
215  action->setShortcut(
218  action);
219 
220  actn = new QAction(tr("Copy reference only"), a);
221  a->addAction(QStringLiteral("copyReferenceOnly"), actn);
222 
223  actn = new QAction(tr("Save entry as HTML"), a);
224  a->addAction(QStringLiteral("saveHtml"), actn);
225 
226  actn = new QAction(tr("Print reference only"), a);
227  a->addAction(QStringLiteral("printReferenceOnly"), actn);
228 
229  actn = new QAction(tr("Entry with text"), a);
230  a->addAction(QStringLiteral("copyEntryWithText"), actn);
231 
232  actn = new QAction(tr("Entry as plain text"), a);
233  a->addAction(QStringLiteral("saveEntryAsPlain"), actn);
234 
235  actn = new QAction(tr("Entry with text"), a);
236  a->addAction(QStringLiteral("printEntryWithText"), actn);
237 
238  actn = new QAction(tr("Strong's Search"), a);
241  actn);
242 }
243 
246 
247  namespace DWG = CResMgr::displaywindows::general;
249  [this]
252  QStringLiteral("openLocation"),
253  [this]{
254  if (btConfig().session().value<bool>(
255  QStringLiteral("GUI/showToolbarsInEachWindow"),
256  true))
257  {
258  m_keyChooser->setFocus();
259  } else if (auto * const kc = btMainWindow()->keyChooser()) {
260  kc->setFocus();
261  }
262  });
263  initAddAction(QStringLiteral("pageDown"),
266  initAddAction(QStringLiteral("pageUp"),
269 
270  initAddAction(QStringLiteral("copySelectedText"),
273  initAddAction(QStringLiteral("copyByReferences"),
276  initAddAction(QStringLiteral("findText"),
277  btMainWindow(),
280  m_history,
281  &BTHistory::back);
283  m_history,
284  &BTHistory::fw);
285 
286  auto * const ac = m_actionCollection;
288  &ac->actionAs<BtToolBarPopupAction>(
290  addAction(m_actions.backInHistory);
291 
293  &ac->actionAs<BtToolBarPopupAction>(
295  addAction(m_actions.forwardInHistory);
296 
297  m_actions.findText = &ac->action(QStringLiteral("findText"));
298 
300  &initAddAction(
302  [this]{
303  QString searchText;
304  for (auto const & strongNumber
306  '|',
307  Qt::SkipEmptyParts))
308  searchText.append(
309  QStringLiteral("strong:%1 ")
310  .arg(strongNumber));
312  searchText);
313  });
314 
316  &initAddAction(QStringLiteral("copyReferenceOnly"),
319 
320  m_actions.copy.entry = &initAddAction(QStringLiteral("copyEntryWithText"),
323 
325  &ac->action(QStringLiteral("copySelectedText"));
326 
328  &ac->action(QStringLiteral("copyByReferences"));
329 
331  &initAddAction(
332  QStringLiteral("saveEntryAsPlain"),
333  [this]{
334  CExportManager mgr(true,
335  tr("Saving"),
336  filterOptions(),
337  displayOptions());
338  mgr.saveKey(m_swordKey.get(),
340  true,
341  constModules());
342  });
343 
345  &initAddAction(
346  QStringLiteral("saveHtml"),
347  [this]{
348  CExportManager mgr(true,
349  tr("Saving"),
350  filterOptions(),
351  displayOptions());
352  mgr.saveKey(m_swordKey.get(),
354  true,
355  constModules());
356  });
357 
359  &initAddAction(QStringLiteral("printReferenceOnly"),
360  this,
362  addAction(m_actions.print.reference);
363 
364  m_actions.print.entry = &initAddAction(QStringLiteral("printEntryWithText"),
365  this,
367 
368  // init with the user defined settings
370  QStringLiteral("Displaywindow shortcuts"));
371 }
372 
375 
379  [this](bool const backEnabled, bool const fwEnabled) {
382 
383  m_actions.backInHistory->setEnabled(backEnabled);
384  m_actions.forwardInHistory->setEnabled(fwEnabled);
385  });
386 
387  //connect the history actions to the right slots
388  BT_CONNECT(m_actions.backInHistory->popupMenu(), &QMenu::aboutToShow,
389  this, // Needed
390  [this]{
391  QMenu * menu = m_actions.backInHistory->popupMenu();
392  menu->clear();
393  for (auto * const actionPtr
394  : m_history->getBackList())
395  menu->addAction(actionPtr);
396  });
397  BT_CONNECT(m_actions.backInHistory->popupMenu(), &QMenu::triggered,
399  BT_CONNECT(m_actions.forwardInHistory->popupMenu(), &QMenu::aboutToShow,
400  this, // Needed
401  [this]{
402  QMenu* menu = m_actions.forwardInHistory->popupMenu();
403  menu->clear();
404  for (auto * const actionPtr
405  : m_history->getFwList())
406  menu->addAction(actionPtr);
407  });
408  BT_CONNECT(m_actions.forwardInHistory->popupMenu(), &QMenu::triggered,
410 }
411 
413  // Create display widget for this window
414  auto readDisplay = new BtModelViewReadDisplay(this, this);
415  setDisplayWidget(readDisplay);
416  setCentralWidget(m_displayWidget);
417  readDisplay->setModules(m_moduleNames);
418 
419  // Add the Navigation toolbar
420  addToolBar(mainToolBar());
421 
422  // Create keychooser
424  m_swordKey.get(),
425  mainToolBar()));
426 
428 
429  // Add the Tools toolbar
430  addToolBar(buttonsToolBar());
431 
432  // Create the Text Header toolbar
433  addToolBarBreak();
434  m_headerBar = new QToolBar(this);
435  m_headerBar->setMovable(false);
436  m_headerBar->setWindowTitle(tr("Text area header"));
437  m_headerBar->setVisible(
438  btConfig().session().value<bool>(
439  QStringLiteral("GUI/showTextWindowHeaders"),
440  true));
442  m_headerBar, &QToolBar::setVisible);
443 
444  addToolBar(m_headerBar);
445 }
446 
448  //Navigation toolbar
450  mainToolBar()->addAction(m_actions.backInHistory); //1st button
451  mainToolBar()->addAction(m_actions.forwardInHistory); //2nd button
452  mainToolBar()->addWidget(m_keyChooser);
453 
454  //Tools toolbar
455  buttonsToolBar()->addAction(
458 
459  auto * const button = new BtDisplaySettingsButton(buttonsToolBar());
460  setDisplaySettingsButton(button);
461  buttonsToolBar()->addWidget(button);
462 
463  // Text Header toolbar
464  auto * const h =
465  new BtTextWindowHeader(m_modules.first()->type(),
466  m_modules,
467  this);
476  m_headerBar->addWidget(h);
477 }
478 
480  auto * const popupMenu = new QMenu(this);
481  BT_CONNECT(popupMenu, &QMenu::aboutToShow,
482  [this] {
483  // enable the action depending on the supported module
484  // features
485  m_actions.findStrongs->setEnabled(
486  !m_displayWidget->getCurrentNodeInfo().isNull());
487 
488  bool const hasActiveAnchor =
490  m_actions.copy.reference->setEnabled(hasActiveAnchor);
491 
492  m_actions.print.reference->setEnabled(hasActiveAnchor);
493 
495  });
496  popupMenu->setTitle(tr("Lexicon window"));
497  popupMenu->setIcon(m_modules.first()->moduleIcon());
498  popupMenu->addAction(m_actions.findText);
499  popupMenu->addAction(m_actions.findStrongs);
500  popupMenu->addSeparator();
501 
502  m_actions.copyMenu = new QMenu(tr("Copy..."), popupMenu);
505  m_actions.copyMenu->addSeparator();
507  m_actions.copyMenu->addAction(m_actions.copy.entry);
508  popupMenu->addMenu(m_actions.copyMenu);
509 
510  m_actions.saveMenu = new QMenu(
511  tr("Save..."),
512  popupMenu
513  );
516 
517  popupMenu->addMenu(m_actions.saveMenu);
518 
519  m_actions.printMenu = new QMenu(
520  tr("Print..."),
521  popupMenu
522  );
525  popupMenu->addMenu(m_actions.printMenu);
526  return popupMenu;
527 }
528 
530  // Navigation toolbar
531  QString keyReference = m_swordKey->key();
532  auto const constMods = constModules();
533  auto * const keyChooser =
534  CKeyChooser::createInstance(constMods,
535  m_swordKey.get(),
536  btMainWindow()->navToolBar());
541  keyChooser->key()->setKey(keyReference);
544  btMainWindow()->navToolBar()->addWidget(keyChooser);
549 
550  // Works toolbar
552 
553  // Tools toolbar
554  btMainWindow()->toolsToolBar()->addAction(
557  auto * const button = new BtDisplaySettingsButton(buttonsToolBar());
558  setDisplaySettingsButton(button);
559  btMainWindow()->toolsToolBar()->addWidget(button);
560 }
561 
564 
567 
570 
571 /** Refresh the settings of this window. */
573  // Since all the CSwordModuleInfo pointers are invalidated, we need to
574  // rebuild m_modules based on m_moduleNames, and remove all missing modules:
575  BT_ASSERT(!m_moduleNames.empty()); // This should otherwise be close()-d
576  m_modules.clear();
577  {
578  auto const & backend = CSwordBackend::instance();
579  auto it = m_moduleNames.begin();
580  do {
581  if (auto * const module = backend.findModuleByName(*it)) {
582  m_modules.append(module);
583  ++it;
584  } else {
585  it = m_moduleNames.erase(it);
586  }
587  } while (it != m_moduleNames.end());
588  }
589  BT_ASSERT(m_moduleNames.size() == m_modules.size());
590 
591  if (m_modules.isEmpty()) {
592  close();
593  } else {
595 
596  if (auto * const kc = m_keyChooser)
597  kc->setModules(constModules(), false);
598 
599  lookup();
600 
602  QStringLiteral("Displaywindow shortcuts"));
604  QStringLiteral("Readwindow shortcuts"));
606  }
607 
609 
610  m_actionCollection->readShortcuts(QStringLiteral("Lexicon shortcuts"));
611 }
612 
614  BT_ASSERT(index <= m_modules.size());
615  m_modules.insert(index, module);
616  m_moduleNames.insert(index, module->name());
617  if (index == 0)
618  setWindowIcon(module->moduleIcon());
620  lookup();
621  modulesChanged();
623 }
624 
626  BT_ASSERT(index < m_modules.size());
627  m_modules.replace(index, newModule);
628  m_moduleNames.replace(index, newModule->name());
629  if (index == 0)
630  setWindowIcon(newModule->moduleIcon());
632  lookup();
633  modulesChanged();
635 }
636 
638  BT_ASSERT(index >= 0);
639  BT_ASSERT(index < m_modules.size());
640  m_modules.removeAt(index);
641  m_moduleNames.removeAt(index);
642  if (m_modules.empty())
643  close();
644  if (index == 0)
645  setWindowIcon(m_modules.first()->moduleIcon());
647  lookup();
648  modulesChanged();
650 }
651 
652 void CDisplayWindow::setBibleReference(const QString& reference) {
654  lookupKey(reference);
655  return;
656  }
657  auto * const bibleModule =
659  QStringLiteral("standardBible"));
660  if (bibleModule) {
661  BibleTime *mainWindow = btMainWindow();
662  BT_ASSERT(mainWindow);
663  mainWindow->createReadDisplayWindow(bibleModule, reference);
664  return;
665  }
666  message::showInformation(this, tr("Choose Standard Bible"),
667  tr("Please choose a Bible in the Settings > "
668  "Configure dialog."));
669 }
670 
671 /** Sets the keychooser widget for this display window. */
673  m_keyChooser = ck;
678 }
679 
681  // this would only set the stringlist again
682  //if (moduleChooserBar()) { //necessary for write windows
683  //setModules( m_moduleChooserBar->getModuleList() );
684  //}
685  if (m_modules.isEmpty()) {
686  close();
687  }
688  else {
689  auto const constMods = constModules();
690  Q_EMIT sigModulesChanged(constMods);
691  m_swordKey->setModule(constMods.first());
692  m_keyChooser->setModules(constMods);
693  }
694 }
695 
697  BT_ASSERT(newKey);
698 
699  if (!m_isInitialized || !newKey || m_modules.empty() || !m_modules.first())
700  return;
701 
702  if (m_swordKey.get() != newKey)
703  m_swordKey->setKey(newKey->key());
704 
707  m_displayWidget->scrollToKey(newKey);
709 
711 }
712 
716  m_moduleChooserBar->setWindowTitle(tr("Work chooser buttons"));
717  m_moduleChooserBar->setLayoutDirection(Qt::LeftToRight);
718  m_moduleChooserBar->setVisible(
719  btConfig().session().value<bool>(
720  QStringLiteral(
721  "GUI/showTextWindowModuleSelectorButtons"),
722  true));
724 
726  m_moduleChooserBar, &BtModuleChooserBar::setVisible);
727 
728  addToolBar(m_moduleChooserBar);
729 }
730 
731 /** Initialize the window. Call this method from the outside, because calling
732  this in the constructor is not possible! */
734  initView();
736  initActions();
737  initToolbars();
738 
739  auto const & conf = btConfig();
740  if (!conf.session().value<bool>(
741  QStringLiteral("GUI/showToolbarsInEachWindow"),
742  true))
743  {
744  if (m_mainToolBar)
745  m_mainToolBar->setHidden(true);
746  if (m_buttonsToolBar)
747  m_buttonsToolBar->setHidden(true);
748  if (m_moduleChooserBar)
749  m_moduleChooserBar->setHidden(true);
750  }
753  initConnections();
754 
756 
757  m_filterOptions = conf.getFilterOptions();
758  m_displayOptions = conf.getDisplayOptions();
762 
763  m_isInitialized = true;
764  return true;
765 }
766 
767 static void prepareToolBar(QToolBar* bar, const QString& title, bool visible) {
768  bar->setAllowedAreas(Qt::TopToolBarArea);
769  bar->setFloatable(false);
770  bar->setWindowTitle(title);
771  bar->setVisible(visible);
772 }
773 
775  if (!m_mainToolBar) {
776  m_mainToolBar = new QToolBar(this);
778  tr("Navigation"),
779  btConfig().session().value<bool>(
780  QStringLiteral("GUI/showTextWindowNavigator"),
781  true));
783  m_mainToolBar, &QToolBar::setVisible);
784  }
785  return m_mainToolBar;
786 }
787 
789  if (!m_buttonsToolBar) {
790  m_buttonsToolBar = new QToolBar(this);
792  tr("Tool"),
793  btConfig().session().value<bool>(
794  QStringLiteral("GUI/showTextWindowToolButtons"),
795  true));
797  m_buttonsToolBar, &QToolBar::setVisible);
798  }
799  return m_buttonsToolBar;
800 }
801 
802 /** Sets the display settings button. */
810 
813  button->setModules(constModules());
814 
816  this, // Needed
817  [this](FilterOptions const & filterOptions) {
820  });
822  this, // Needed
823  [this](DisplayOptions const & displayOptions) {
827  });
829  this, &CDisplayWindow::lookup);
830 }
831 
832 /** Lookup the current key. Used to refresh the display. */
834 
835 void CDisplayWindow::lookupKey( const QString& keyName ) {
836  /* This function is called for example after a bookmark was dropped on this
837  window. */
838  BT_ASSERT(m_modules.first());
839 
840  if (!m_isInitialized) {
841  return;
842  }
843 
844  auto * const m =
846  m_modules.first()->name());
847  if (!m) {
848  return; /// \todo check if this is correct behavior
849  }
850 
851  /// \todo check for containsRef compat
852  if (m && m_modules.contains(m)) {
853  m_swordKey->setKey(keyName);
854  // the key chooser does send an update signal
856  Q_EMIT sigKeyChanged(m_swordKey.get());
857  }
858  else { // given module not displayed in this window
859  // If the module is displayed in another display window we assume a
860  // wrong drop. Create a new window for the given module:
861  BibleTime * mainWindow = btMainWindow();
862  BT_ASSERT(mainWindow);
863  mainWindow->createReadDisplayWindow(m, keyName);
864  }
865 }
866 
867 /** Sets the display widget used by this display window. */
869  // Lets be orwellianly paranoid here:
870  BT_ASSERT(newDisplay);
871 
872  m_displayWidget = newDisplay;
873 
875  [newDisplay]{ newDisplay->qmlInterface()->changeColorTheme(); });
876 }
877 
880 
#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
Definition: btmodulelist.h:20
static void prepareToolBar(QToolBar *bar, const QString &title, bool visible)
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)
QToolBar * toolsToolBar() const noexcept
Definition: bibletime.h:156
void clearMdiToolBars()
QToolBar * navToolBar() const noexcept
Definition: bibletime.h:149
void openFindWidget()
Definition: bibletime.cpp:335
BtModuleChooserBar * worksToolBar() const noexcept
Definition: bibletime.h:152
void toggledTextWindowToolButtons(bool newState)
void toggledTextWindowHeader(bool newState)
void openSearchDialog(BtConstModuleList modules, QString const &searchText={})
Definition: bibletime.cpp:327
void colorThemeChanged()
void toggledTextWindowNavigator(bool newState)
void toggledTextWindowModuleChooser(bool newState)
static BibleTime * instance() noexcept
Definition: bibletime.h:143
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.
Definition: bibletime.cpp:145
void readShortcuts(QString const &group)
Read shortcuts from config.
void addAction(QString const &name, QAction *const action)
QAction & action(QString const &name) const
T value(QString const &key, T const &defaultValue=T()) const
Returns the settings value for the given global key.
Definition: btconfigcore.h:50
void setValue(QString const &key, T const &value)
Sets a value for a key.
Definition: btconfigcore.h:73
CSwordModuleInfo * getDefaultSwordModuleByType(const QString &moduleType)
Returns default sword module info class for a given module type.
Definition: btconfig.cpp:503
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)
BtQmlInterface * qmlInterface() const noexcept
BtQuickWidget * quickWidget() const noexcept
void copySelectedText()
Copies the currently selected text.
void scrollToKey(CSwordKey *key)
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 copyByReferences()
Copies the given text specified by asking user for first and last references.
void printAnchorWithText(DisplayOptions const &displayOptions, FilterOptions const &filterOptions)
void setDisplayOptions(const DisplayOptions &displayOptions)
void setFilterOptions(FilterOptions filterOptions)
void associateWithWindow(CDisplayWindow *window)
bool hasSelectedText() const noexcept
CSwordKey * getMouseClickedKey()
void moduleAdded(int index, CSwordModuleInfo *module)
void moduleReplaced(int index, CSwordModuleInfo *newModule)
void setModules(BtModuleList newModules)
void moduleRemoved(int index)
The base class for all display windows of BibleTime.
void addModuleChooserBar()
virtual void modulesChanged()
FilterOptions m_filterOptions
void sigKeyChanged(CSwordKey *key)
void setDisplayWidget(BtModelViewReadDisplay *newDisplay)
DisplayOptions const & displayOptions() const
void sigDisplayOptionsChanged(const DisplayOptions &displayOptions)
void printAnchorWithText()
BTHistory *const m_history
virtual void reload()
QAction & initAddAction(Args &&... args)
BtModuleList m_modules
struct CDisplayWindow::ActionsStruct m_actions
void setDisplaySettingsButton(BtDisplaySettingsButton *button)
CKeyChooser * keyChooser() const
virtual void initConnections()
virtual void storeProfileSettings(BtConfigCore &windowConf) const
Stores the settings of this window to configuration.
QStringList m_moduleNames
CDisplayWindow(BtModuleList const &modules, CMDIArea *const parent)
void sigFilterOptionsChanged(const FilterOptions &filterOptions)
virtual void initActions()
void sigModulesChanged(const BtConstModuleList &modules)
FilterOptions const & filterOptions() const
virtual CSwordModuleInfo::ModuleType moduleType() const
std::unique_ptr< CSwordKey > const m_swordKey
virtual void setupMainWindowToolBars()
DisplayOptions m_displayOptions
CMDIArea * mdi() const
void clearMainWindowToolBars()
CKeyChooser * m_keyChooser
virtual void lookupSwordKey(CSwordKey *)
CMDIArea *const m_mdi
void lookupKey(QString const &key)
void setKeyChooser(CKeyChooser *ck)
bool m_isInitialized
Whether init() has been called.
BtConstModuleList constModules() const
BibleTime * btMainWindow()
virtual void initView()
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.
void sigModuleListChanged(BtModuleList newList)
~CDisplayWindow() override
BtModuleChooserBar * m_moduleChooserBar
void slotRemoveModule(int index)
QToolBar * mainToolBar()
BtModelViewReadDisplay * m_displayWidget
virtual QMenu * newDisplayWidgetPopupMenu()
QToolBar * m_mainToolBar
void slotReplaceModule(int index, CSwordModuleInfo *newModule)
static void insertKeyboardActions(BtActionCollection *const a)
QToolBar * m_headerBar
CSwordKey * getMouseClickedKey() const
void setBibleReference(const QString &reference)
virtual void copyDisplayedText()
QToolBar * buttonsToolBar()
BtActionCollection *const m_actionCollection
QAction & initAction(Name &&name, Args &&... args)
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)
Definition: ckeychooser.cpp:56
void keyChanged(CSwordKey *newKey)
virtual void updateKey(CSwordKey *key)=0
static CKeyChooser * createInstance(const BtConstModuleList &modules, CSwordKey *key, QWidget *parent)
Definition: ckeychooser.cpp:26
virtual void setKey(CSwordKey *key)=0
virtual CSwordKey * key()=0
CSwordModuleInfo * findModuleByName(const QString &name) const
Searches for a module with the given name.
static CSwordBackend & instance() noexcept
Definition: cswordbackend.h:98
void sigSwordSetupChanged()
virtual bool setKey(const QString &key)=0
virtual QString key() const =0
QIcon moduleIcon() const
QString const & name() const
std::unique_ptr< CSwordBackend > backend(sword::InstallSource const &is)
QMessageBox::StandardButton showInformation(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
struct CDisplayWindow::ActionsStruct::@7 print
BtToolBarPopupAction * forwardInHistory
BtToolBarPopupAction * backInHistory
struct CDisplayWindow::ActionsStruct::@6 save
struct CDisplayWindow::ActionsStruct::@5 copy