BibleTime
ccommentaryreadwindow.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
14
15#include <QAction>
16#include <QIcon>
17#include <QMenu>
18#include <QToolBar>
19#include "../../backend/config/btconfigcore.h"
20#include "../../backend/keys/cswordversekey.h"
21#include "../../backend/managers/cswordbackend.h"
22#include "../../util/cresmgr.h"
23#include "../bibletime.h"
24#include "../keychooser/ckeychooser.h"
25#include "btactioncollection.h"
26
29{
30 QAction* qaction;
31
32 qaction = new QAction(tr("Next book"), this);
34 addAction(QStringLiteral("nextBook"), qaction);
35
36 qaction = new QAction(tr("Previous book"), this);
38 addAction(QStringLiteral("previousBook"), qaction);
39
40 qaction = new QAction(tr("Next chapter"), this);
42 addAction(QStringLiteral("nextChapter"), qaction);
43
44 qaction = new QAction(tr("Previous chapter"), this);
46 addAction(QStringLiteral("previousChapter"), qaction);
47
48 qaction = new QAction(tr("Next verse"), this);
50 addAction(QStringLiteral("nextVerse"), qaction);
51
52 qaction = new QAction(tr("Previous verse"), this);
54 addAction(QStringLiteral("previousVerse"), qaction);
55
56 qaction = new QAction(CResMgr::displaywindows::commentaryWindow::syncWindow::icon(),
57 tr("Synchronize"), this);
58 qaction->setCheckable(true);
60 qaction->setToolTip(tr("Synchronize the displayed entry of this work with the active Bible window"));
62}
63
65 QList<CSwordModuleInfo *> const & modules,
66 QString const & key,
67 CMDIArea * parent)
68 : CDisplayWindow(modules, key, true, new ActionCollection(), parent)
69{ init(); }
70
73
74 initAddAction(QStringLiteral("nextBook"),
75 this,
77 initAddAction(QStringLiteral("previousBook"),
78 this,
80 initAddAction(QStringLiteral("nextChapter"),
81 this,
83 initAddAction(QStringLiteral("previousChapter"),
84 this,
86 initAddAction(QStringLiteral("nextVerse"),
87 this,
89 initAddAction(QStringLiteral("previousVerse"),
90 this,
92
94 m_syncButton = &qaction;
95 addAction(&qaction);
96
97 actionCollection()->readShortcuts(QStringLiteral("Commentary shortcuts"));
98}
99
103 m_syncButton->setChecked(
104 conf.value<bool>(QStringLiteral("syncEnabled"), false));
105}
106
108 const
109{
112 conf.setValue(QStringLiteral("syncEnabled"), m_syncButton->isChecked());
113}
114
119
124
125/** Reimplementation to handle the keychooser refresh. */
128
129 //refresh the book lists
131 CSwordBackend::instance().booknameLanguage().toLatin1());
133
134 actionCollection()->readShortcuts(QStringLiteral("Commentary shortcuts"));
135}
136
137/** rapper around key() to return the right type of key. */
139 CSwordVerseKey * const k =
141 BT_ASSERT(k);
142 return k;
143}
144
145/** Moves to the next book. */
150
151/** Moves one book behind. */
156
157/** Moves to the next book. */
162
163/** Moves one book behind. */
168
169/** Moves to the next book. */
174
175/** Moves one book behind. */
180
182 return m_syncButton->isChecked();
183}
#define BT_ASSERT(...)
Definition btassert.h:17
QToolBar * toolsToolBar() const noexcept
Definition bibletime.h:235
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.
void setValue(QString const &key, T const &value)
Sets a value for a key.
bool syncAllowed() const noexcept override
void setupMainWindowToolBars() override
void storeProfileSettings(BtConfigCore &windowConf) const override
Stores the settings of this window to configuration.
CCommentaryReadWindow(QList< CSwordModuleInfo * > const &modules, QString const &key, CMDIArea *parent)
void applyProfileSettings(BtConfigCore const &windowConf) override
Loads the settings of this window from configuration.
The base class for all display windows of BibleTime.
QToolBar * buttonsToolBar() const noexcept
QAction & initAddAction(Args &&... args)
virtual void reload()
virtual void storeProfileSettings(BtConfigCore &windowConf) const
Stores the settings of this window to configuration.
CKeyChooser * keyChooser() const noexcept
virtual void setupMainWindowToolBars()
CSwordKey * swordKey() const noexcept
BibleTime * btMainWindow()
virtual void initToolbars()
virtual void applyProfileSettings(BtConfigCore const &windowConf)
Loads the settings of this window from configuration.
ActionCollection * actionCollection() const noexcept
BtModuleList const & modules() const noexcept
virtual void setKey(CSwordKey *key)=0
virtual void refreshContent()=0
static CSwordBackend & instance() noexcept
CSwordKey implementation for Sword's VerseKey.
void setLocale(char const *const locale)