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 void 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 } // anonymous namespace
59 
60 
62  bool const addTextHeaderToolbar,
63  CMDIArea * const parent)
64  : QMainWindow(parent)
65  , m_actionCollection(new BtActionCollection(this))
66  , m_mdi(parent)
67  , m_modules(modules)
68  , m_swordKey((static_cast<void>(BT_ASSERT(!modules.empty())),
69  m_modules.first()->createKey()))
70  , m_history(new BTHistory(this))
71 {
72  m_moduleNames.reserve(m_modules.size());
73  for (auto const module : m_modules)
74  m_moduleNames.append(module->name());
75 
77  setMinimumSize(100, 100);
78  setFocusPolicy(Qt::ClickFocus);
79 
80  // Cannot delete on close. QMdiSubWindow and this window work
81  // as pairs. They must be deleted in a specific order.
82  // QMdiSubWindow handles this procedure.
83  //setAttribute(Qt::WA_DeleteOnClose);
84 
85  // Connect this to the backend module list changes
87  this, &CDisplayWindow::reload);
88 
89  setWindowIcon(m_modules.first()->moduleIcon());
91 
92  // Create display widget for this window
93  m_displayWidget = new BtModelViewReadDisplay(this, this);
94  setCentralWidget(m_displayWidget);
96 
97  // Create the Navigation toolbar:
98  m_mainToolBar = new QToolBar(this);
100  tr("Navigation"),
101  btConfig().session().value<bool>(
102  QStringLiteral("GUI/showTextWindowNavigator"),
103  true));
105  m_mainToolBar, &QToolBar::setVisible);
106  addToolBar(m_mainToolBar);
107 
108  // Create keychooser
110  m_swordKey.get(),
111  m_mainToolBar));
112 
113  // Create module chooser bar:
115  m_moduleChooserBar->setWindowTitle(tr("Work chooser buttons"));
116  m_moduleChooserBar->setLayoutDirection(Qt::LeftToRight);
117  m_moduleChooserBar->setVisible(
118  btConfig().session().value<bool>(
119  QStringLiteral(
120  "GUI/showTextWindowModuleSelectorButtons"),
121  true));
124  m_moduleChooserBar, &BtModuleChooserBar::setVisible);
125  addToolBar(m_moduleChooserBar);
126 
127  // Create the Tools toolbar:
128  m_buttonsToolBar = new QToolBar(this);
130  tr("Tool"),
131  btConfig().session().value<bool>(
132  QStringLiteral("GUI/showTextWindowToolButtons"),
133  true));
135  m_buttonsToolBar, &QToolBar::setVisible);
136  addToolBar(m_buttonsToolBar);
137 
138  if (addTextHeaderToolbar) {
139  // Create the Text Header toolbar
140  addToolBarBreak();
141  m_headerBar = new QToolBar(this);
142  m_headerBar->setMovable(false);
143  m_headerBar->setWindowTitle(tr("Text area header"));
144  m_headerBar->setVisible(
145  btConfig().session().value<bool>(
146  QStringLiteral("GUI/showTextWindowHeaders"),
147  true));
149  m_headerBar, &QToolBar::setVisible);
150  addToolBar(m_headerBar);
151  }
152 }
153 
155 
157 { return CSwordModuleInfo::Lexicon; }
158 
160  return dynamic_cast<BibleTime*>(m_mdi->parent()->parent());
161 }
162 
164  // Clear main window toolbars, except for works toolbar
165  btMainWindow()->navToolBar()->clear();
166  btMainWindow()->toolsToolBar()->clear();
167 }
168 
172 }
173 
175  if (m_modules.isEmpty()) {
176  setWindowTitle(tr("<NO WORKS>"));
177  } else {
178  setWindowTitle(QStringLiteral("%1 (%2)")
179  .arg(m_swordKey->key(),
180  m_moduleNames.join(QStringLiteral(" | "))));
181  }
182 }
183 
184 /** Store the settings of this window in the given CProfileWindow object. */
186  QWidget const * const w = getProfileWindow(parentWidget());
187  BT_ASSERT(w);
188 
189  /**
190  \note We don't use saveGeometry/restoreGeometry for MDI subwindows,
191  because they give slightly incorrect results with some window
192  managers. Might be related to Qt bug QTBUG-7634.
193  */
194  const QRect rect(w->x(), w->y(), w->width(), w->height());
195  conf.setValue<QRect>(QStringLiteral("windowRect"), rect);
196  conf.setValue<bool>(QStringLiteral("staysOnTop"),
197  w->windowFlags() & Qt::WindowStaysOnTopHint);
198  conf.setValue<bool>(QStringLiteral("staysOnBottom"),
199  w->windowFlags() & Qt::WindowStaysOnBottomHint);
200  conf.setValue(QStringLiteral("maximized"), w->isMaximized());
201 
202  bool const hasFocus =
203  (w == dynamic_cast<CDisplayWindow *>(mdi()->activeSubWindow()));
204  conf.setValue(QStringLiteral("hasFocus"), hasFocus);
205 
206  // Save current key:
207  conf.setValue(QStringLiteral("key"), m_swordKey->normalizedKey());
208 
209  // Save list of modules:
210  conf.setValue(QStringLiteral("modules"), m_moduleNames);
211 
212  // Default for "not a write window":
213  conf.setValue(QStringLiteral("writeWindowType"), int(0));
214 }
215 
217  setUpdatesEnabled(false);
218 
219  QWidget * const w = getProfileWindow(parentWidget());
220  BT_ASSERT(w);
221 
222  /**
223  \note We don't use restoreGeometry/saveGeometry for MDI subwindows,
224  because they give slightly incorrect results with some window
225  managers. Might be related to Qt bug QTBUG-7634.
226  */
227  const QRect rect = conf.value<QRect>(QStringLiteral("windowRect"));
228  w->resize(rect.width(), rect.height());
229  w->move(rect.x(), rect.y());
230  if (conf.value<bool>(QStringLiteral("staysOnTop"), false))
231  w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnTopHint);
232  if (conf.value<bool>(QStringLiteral("staysOnBottom"), false))
233  w->setWindowFlags(w->windowFlags() | Qt::WindowStaysOnBottomHint);
234  if (conf.value<bool>(QStringLiteral("maximized")))
235  w->showMaximized();
236 
237  setUpdatesEnabled(true);
238 }
239 
241  auto * actn = new QAction(QIcon(), tr("Copy"), a);
242  actn->setShortcut(QKeySequence::Copy);
243  a->addAction(QStringLiteral("copySelectedText"), actn);
244 
245  actn = new QAction(QIcon(), tr("Copy by references..."), a);
246  actn->setShortcut(Qt::CTRL | Qt::Key_R);
247  a->addAction(QStringLiteral("copyByReferences"), actn);
248 
249  actn = new QAction(QIcon(), tr("Find..."), a);
250  actn->setShortcut(QKeySequence::Find);
251  a->addAction(QStringLiteral("findText"), actn);
252 
253  actn = new QAction(QIcon(), tr("Change location"), a);
254  actn->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_L));
255  a->addAction(QStringLiteral("openLocation"), actn);
256 
257  actn = new QAction(QIcon(), tr("Page down"), a);
258  actn->setShortcut(QKeySequence(Qt::Key_PageDown));
259  a->addAction(QStringLiteral("pageDown"), actn);
260 
261  actn = new QAction(QIcon(), tr("Page up"), a);
262  actn->setShortcut(QKeySequence(Qt::Key_PageUp));
263  a->addAction(QStringLiteral("pageUp"), actn);
264 
265  actn = new QAction(CResMgr::displaywindows::general::search::icon(),
266  tr("Search with works of this window"), a);
269 
271  CResMgr::displaywindows::general::backInHistory::icon(),
272  tr("Back in history"),
273  a
274  );
277  action);
278 
279  action = new BtToolBarPopupAction(
280  CResMgr::displaywindows::general::forwardInHistory::icon(),
281  tr("Forward in history"),
282  a
283  );
284  action->setShortcut(
287  action);
288 
289  actn = new QAction(tr("Copy reference only"), a);
290  a->addAction(QStringLiteral("copyReferenceOnly"), actn);
291 
292  actn = new QAction(tr("Save entry as HTML"), a);
293  a->addAction(QStringLiteral("saveHtml"), actn);
294 
295  actn = new QAction(tr("Print reference only"), a);
296  a->addAction(QStringLiteral("printReferenceOnly"), actn);
297 
298  actn = new QAction(tr("Entry with text"), a);
299  a->addAction(QStringLiteral("copyEntryWithText"), actn);
300 
301  actn = new QAction(tr("Entry as plain text"), a);
302  a->addAction(QStringLiteral("saveEntryAsPlain"), actn);
303 
304  actn = new QAction(tr("Entry with text"), a);
305  a->addAction(QStringLiteral("printEntryWithText"), actn);
306 
307  actn = new QAction(tr("Strong's Search"), a);
310  actn);
311 }
312 
315 
316  namespace DWG = CResMgr::displaywindows::general;
318  [this]
321  QStringLiteral("openLocation"),
322  [this]{
323  if (btConfig().session().value<bool>(
324  QStringLiteral("GUI/showToolbarsInEachWindow"),
325  true))
326  {
327  m_keyChooser->setFocus();
328  } else if (auto * const kc = btMainWindow()->keyChooser()) {
329  kc->setFocus();
330  }
331  });
332  initAddAction(QStringLiteral("pageDown"),
335  initAddAction(QStringLiteral("pageUp"),
338 
339  initAddAction(QStringLiteral("copySelectedText"),
342  initAddAction(QStringLiteral("copyByReferences"),
345  initAddAction(QStringLiteral("findText"),
346  btMainWindow(),
349  m_history,
350  &BTHistory::back);
352  m_history,
353  &BTHistory::fw);
354 
355  auto * const ac = m_actionCollection;
357  &ac->actionAs<BtToolBarPopupAction>(
359  addAction(m_actions.backInHistory);
360 
362  &ac->actionAs<BtToolBarPopupAction>(
364  addAction(m_actions.forwardInHistory);
365 
366  m_actions.findText = &ac->action(QStringLiteral("findText"));
367 
369  &initAddAction(
371  [this]{
372  QString searchText;
373  for (auto const & strongNumber
375  '|',
376  Qt::SkipEmptyParts))
377  searchText.append(
378  QStringLiteral("strong:%1 ")
379  .arg(strongNumber));
381  searchText);
382  });
383 
385  &initAddAction(QStringLiteral("copyReferenceOnly"),
388 
389  m_actions.copy.entry = &initAddAction(QStringLiteral("copyEntryWithText"),
392 
394  &ac->action(QStringLiteral("copySelectedText"));
395 
397  &ac->action(QStringLiteral("copyByReferences"));
398 
400  &initAddAction(
401  QStringLiteral("saveEntryAsPlain"),
402  [this]{
403  CExportManager mgr(true,
404  tr("Saving"),
405  filterOptions(),
406  displayOptions());
407  mgr.saveKey(m_swordKey.get(),
409  true,
410  constModules());
411  });
412 
414  &initAddAction(
415  QStringLiteral("saveHtml"),
416  [this]{
417  CExportManager mgr(true,
418  tr("Saving"),
419  filterOptions(),
420  displayOptions());
421  mgr.saveKey(m_swordKey.get(),
423  true,
424  constModules());
425  });
426 
428  &initAddAction(QStringLiteral("printReferenceOnly"),
429  this,
431  addAction(m_actions.print.reference);
432 
433  m_actions.print.entry = &initAddAction(QStringLiteral("printEntryWithText"),
434  this,
436 
437  // init with the user defined settings
439  QStringLiteral("Displaywindow shortcuts"));
440 }
441 
444 
448  [this](bool const backEnabled, bool const fwEnabled) {
451 
452  m_actions.backInHistory->setEnabled(backEnabled);
453  m_actions.forwardInHistory->setEnabled(fwEnabled);
454  });
455 
456  //connect the history actions to the right slots
457  BT_CONNECT(m_actions.backInHistory->popupMenu(), &QMenu::aboutToShow,
458  this, // Needed
459  [this]{
460  QMenu * menu = m_actions.backInHistory->popupMenu();
461  menu->clear();
462  for (auto * const actionPtr
463  : m_history->getBackList())
464  menu->addAction(actionPtr);
465  });
466  BT_CONNECT(m_actions.backInHistory->popupMenu(), &QMenu::triggered,
468  BT_CONNECT(m_actions.forwardInHistory->popupMenu(), &QMenu::aboutToShow,
469  this, // Needed
470  [this]{
471  QMenu* menu = m_actions.forwardInHistory->popupMenu();
472  menu->clear();
473  for (auto * const actionPtr
474  : m_history->getFwList())
475  menu->addAction(actionPtr);
476  });
477  BT_CONNECT(m_actions.forwardInHistory->popupMenu(), &QMenu::triggered,
479 }
480 
482  //Navigation toolbar
484  m_mainToolBar->addAction(m_actions.backInHistory); //1st button
485  m_mainToolBar->addAction(m_actions.forwardInHistory); //2nd button
486  m_mainToolBar->addWidget(m_keyChooser);
487 
488  //Tools toolbar
489  m_buttonsToolBar->addAction(
492 
493  auto * const button = new BtDisplaySettingsButton(m_buttonsToolBar);
494  setDisplaySettingsButton(button);
495  m_buttonsToolBar->addWidget(button);
496 
497  // Text Header toolbar
498  auto * const h =
499  new BtTextWindowHeader(m_modules.first()->type(),
500  m_modules,
501  this);
510  m_headerBar->addWidget(h);
511 }
512 
514  auto * const popupMenu = new QMenu(this);
515  BT_CONNECT(popupMenu, &QMenu::aboutToShow,
516  [this] {
517  // enable the action depending on the supported module
518  // features
519  m_actions.findStrongs->setEnabled(
520  !m_displayWidget->getCurrentNodeInfo().isNull());
521 
522  bool const hasActiveAnchor =
524  m_actions.copy.reference->setEnabled(hasActiveAnchor);
525 
526  m_actions.print.reference->setEnabled(hasActiveAnchor);
527 
529  });
530  popupMenu->setTitle(tr("Lexicon window"));
531  popupMenu->setIcon(m_modules.first()->moduleIcon());
532  popupMenu->addAction(m_actions.findText);
533  popupMenu->addAction(m_actions.findStrongs);
534  popupMenu->addSeparator();
535 
536  m_actions.copyMenu = new QMenu(tr("Copy..."), popupMenu);
539  m_actions.copyMenu->addSeparator();
541  m_actions.copyMenu->addAction(m_actions.copy.entry);
542  popupMenu->addMenu(m_actions.copyMenu);
543 
544  m_actions.saveMenu = new QMenu(
545  tr("Save..."),
546  popupMenu
547  );
550 
551  popupMenu->addMenu(m_actions.saveMenu);
552 
553  m_actions.printMenu = new QMenu(
554  tr("Print..."),
555  popupMenu
556  );
559  popupMenu->addMenu(m_actions.printMenu);
560  return popupMenu;
561 }
562 
564  // Navigation toolbar
565  QString keyReference = m_swordKey->key();
566  auto const constMods = constModules();
567  auto * const keyChooser =
568  CKeyChooser::createInstance(constMods,
569  m_swordKey.get(),
570  btMainWindow()->navToolBar());
575  keyChooser->key()->setKey(keyReference);
578  btMainWindow()->navToolBar()->addWidget(keyChooser);
583 
584  // Works toolbar
586 
587  // Tools toolbar
588  btMainWindow()->toolsToolBar()->addAction(
591  auto * const button = new BtDisplaySettingsButton(m_buttonsToolBar);
592  setDisplaySettingsButton(button);
593  btMainWindow()->toolsToolBar()->addWidget(button);
594 }
595 
598 
601 
604 
605 /** Refresh the settings of this window. */
607  // Since all the CSwordModuleInfo pointers are invalidated, we need to
608  // rebuild m_modules based on m_moduleNames, and remove all missing modules:
609  BT_ASSERT(!m_moduleNames.empty()); // This should otherwise be close()-d
610  m_modules.clear();
611  {
612  auto const & backend = CSwordBackend::instance();
613  auto it = m_moduleNames.begin();
614  do {
615  if (auto * const module = backend.findModuleByName(*it)) {
616  m_modules.append(module);
617  ++it;
618  } else {
619  it = m_moduleNames.erase(it);
620  }
621  } while (it != m_moduleNames.end());
622  }
623  BT_ASSERT(m_moduleNames.size() == m_modules.size());
624 
625  if (m_modules.isEmpty()) {
626  close();
627  } else {
629 
630  if (auto * const kc = m_keyChooser)
631  kc->setModules(constModules(), false);
632 
633  lookup();
634 
636  QStringLiteral("Displaywindow shortcuts"));
638  QStringLiteral("Readwindow shortcuts"));
640  }
641 
643 
644  m_actionCollection->readShortcuts(QStringLiteral("Lexicon shortcuts"));
645 }
646 
648  BT_ASSERT(index <= m_modules.size());
649  m_modules.insert(index, module);
650  m_moduleNames.insert(index, module->name());
651  if (index == 0)
652  setWindowIcon(module->moduleIcon());
654  lookup();
655  modulesChanged();
657 }
658 
660  BT_ASSERT(index < m_modules.size());
661  m_modules.replace(index, newModule);
662  m_moduleNames.replace(index, newModule->name());
663  if (index == 0)
664  setWindowIcon(newModule->moduleIcon());
666  lookup();
667  modulesChanged();
669 }
670 
672  BT_ASSERT(index >= 0);
673  BT_ASSERT(index < m_modules.size());
674  m_modules.removeAt(index);
675  m_moduleNames.removeAt(index);
676  if (m_modules.empty())
677  close();
678  if (index == 0)
679  setWindowIcon(m_modules.first()->moduleIcon());
681  lookup();
682  modulesChanged();
684 }
685 
686 void CDisplayWindow::setBibleReference(const QString& reference) {
688  lookupKey(reference);
689  return;
690  }
691  auto * const bibleModule =
693  QStringLiteral("standardBible"));
694  if (bibleModule) {
695  BibleTime *mainWindow = btMainWindow();
696  BT_ASSERT(mainWindow);
697  mainWindow->createReadDisplayWindow(bibleModule, reference);
698  return;
699  }
700  message::showInformation(this, tr("Choose Standard Bible"),
701  tr("Please choose a Bible in the Settings > "
702  "Configure dialog."));
703 }
704 
705 /** Sets the keychooser widget for this display window. */
707  m_keyChooser = ck;
712 }
713 
715  // this would only set the stringlist again
716  //if (moduleChooserBar()) { //necessary for write windows
717  //setModules( m_moduleChooserBar->getModuleList() );
718  //}
719  if (m_modules.isEmpty()) {
720  close();
721  }
722  else {
723  auto const constMods = constModules();
724  Q_EMIT sigModulesChanged(constMods);
725  m_swordKey->setModule(constMods.first());
726  m_keyChooser->setModules(constMods);
727  }
728 }
729 
731  BT_ASSERT(newKey);
732 
733  if (!m_isInitialized || !newKey || m_modules.empty() || !m_modules.first())
734  return;
735 
736  if (m_swordKey.get() != newKey)
737  m_swordKey->setKey(newKey->key());
738 
741  m_displayWidget->scrollToKey(newKey);
743 
745 }
746 
747 /** Initialize the window. Call this method from the outside, because calling
748  this in the constructor is not possible! */
750  initActions();
751  initToolbars();
752 
753  auto const & conf = btConfig();
754  if (!conf.session().value<bool>(
755  QStringLiteral("GUI/showToolbarsInEachWindow"),
756  true))
757  {
758  m_mainToolBar->setHidden(true);
759  m_buttonsToolBar->setHidden(true);
760  if (m_moduleChooserBar)
761  m_moduleChooserBar->setHidden(true);
762  }
765  initConnections();
766 
768 
769  m_filterOptions = conf.getFilterOptions();
770  m_displayOptions = conf.getDisplayOptions();
774 
775  m_isInitialized = true;
776  return true;
777 }
778 
779 /** Sets the display settings button. */
787 
790  button->setModules(constModules());
791 
793  this, // Needed
794  [this](FilterOptions const & filterOptions) {
797  });
799  this, // Needed
800  [this](DisplayOptions const & displayOptions) {
804  });
806  this, &CDisplayWindow::lookup);
807 }
808 
809 /** Lookup the current key. Used to refresh the display. */
811 
812 void CDisplayWindow::lookupKey( const QString& keyName ) {
813  /* This function is called for example after a bookmark was dropped on this
814  window. */
815  BT_ASSERT(m_modules.first());
816 
817  if (!m_isInitialized) {
818  return;
819  }
820 
821  auto * const m =
823  m_modules.first()->name());
824  if (!m) {
825  return; /// \todo check if this is correct behavior
826  }
827 
828  /// \todo check for containsRef compat
829  if (m && m_modules.contains(m)) {
830  m_swordKey->setKey(keyName);
831  // the key chooser does send an update signal
833  Q_EMIT sigKeyChanged(m_swordKey.get());
834  }
835  else { // given module not displayed in this window
836  // If the module is displayed in another display window we assume a
837  // wrong drop. Create a new window for the given module:
838  BibleTime * mainWindow = btMainWindow();
839  BT_ASSERT(mainWindow);
840  mainWindow->createReadDisplayWindow(m, keyName);
841  }
842 }
843 
846 
#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
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 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.
virtual void modulesChanged()
FilterOptions m_filterOptions
void sigKeyChanged(CSwordKey *key)
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
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()
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.
CDisplayWindow(BtModuleList const &modules, bool const addTextHeaderToolbar, CMDIArea *const parent)
void sigModuleListChanged(BtModuleList newList)
~CDisplayWindow() override
BtModuleChooserBar * m_moduleChooserBar
void slotRemoveModule(int index)
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()
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)
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::@7 print
BtToolBarPopupAction * forwardInHistory
BtToolBarPopupAction * backInHistory
struct CDisplayWindow::ActionsStruct::@6 save
struct CDisplayWindow::ActionsStruct::@5 copy