BibleTime
cbookkeychooser.h
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#pragma once
14
15#include "ckeychooser.h"
16
17#include <QObject>
18#include <QString>
19#include <QList>
20#include "../../backend/drivers/btmodulelist.h"
21
22
25class CSwordKey;
26class CSwordTreeKey;
27class QHBoxLayout;
28class QWidget;
29
30class CBookKeyChooser final : public CKeyChooser {
31
32 Q_OBJECT
33
34public:
35
36 CBookKeyChooser(BtConstModuleList const & modules,
37 CSwordKey * key = nullptr,
38 QWidget * parent = nullptr);
39
40 void refreshContent() final override;
41
42 void setModules(BtConstModuleList const & modules,
43 bool refresh = false) final override;
44 CSwordKey * key() final override;
45
46 void setKey(CSwordKey * key) final override;
47
48 /** \brief Sets a new key to this keychooser. */
49 void setKey(CSwordKey * key, bool const emitSignal);
50
51public Q_SLOTS:
52
53 /** \brief Updates the keychoosers for the given key but emit no signal. */
54 void updateKey(CSwordKey * key) final override;
55
56protected: // methods:
57
58 /**
59 Fills the combo given by depth with the items from the key having depth
60 "depth". The parent sibling is given by key.
61 */
62 void setupCombo(QString const & key,
63 int const depth,
64 int const currentItem);
65
66private: // methods:
67
68 void adjustFont();
69
70private Q_SLOTS:
71
72 /** \brief A keychooser changed. Update and emit a signal if necessary. */
73 void keyChooserChanged(int);
74
75private: // fields:
76
77 QList<CKeyChooserWidget *> m_chooserWidgets;
78 QList<CSwordBookModuleInfo const *> m_modules;
80 QHBoxLayout * m_layout;
81
82}; /* class CBookKeyChooser */
QList< CSwordModuleInfo const * > BtConstModuleList
void refreshContent() final override
void setupCombo(QString const &key, int const depth, int const currentItem)
CSwordKey * key() final override
QList< CKeyChooserWidget * > m_chooserWidgets
void keyChooserChanged(int)
A keychooser changed. Update and emit a signal if necessary.
CSwordTreeKey * m_key
void setModules(BtConstModuleList const &modules, bool refresh=false) final override
void setKey(CSwordKey *key) final override
QList< CSwordBookModuleInfo const * > m_modules
QHBoxLayout * m_layout
void updateKey(CSwordKey *key) final override
Updates the keychoosers for the given key but emit no signal.
Class for generic book support.
CSwordKey implementation for Sword's TreeKey.