BibleTime
cbooktreechooser.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-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 #pragma once
14 
15 #include "ckeychooser.h"
16 
17 #include <QList>
18 #include <QObject>
19 #include <QString>
20 #include "../../backend/drivers/btmodulelist.h"
21 #include "../../backend/keys/cswordtreekey.h"
22 
23 
25 class CSwordKey;
26 class QTreeWidget;
27 class QTreeWidgetItem;
28 class QWidget;
29 
30 class CBookTreeChooser final : public CKeyChooser {
31 
32  Q_OBJECT
33 
34 public: // methods:
35 
36  CBookTreeChooser(BtConstModuleList const & modules,
37  CSwordKey * key = nullptr,
38  QWidget * parent = nullptr);
39 
40  void refreshContent() final override;
41  void setModules(BtConstModuleList const & modules,
42  bool refresh = true) final override;
43 
44  CSwordKey * key() final override { return m_key; }
45  void setKey(CSwordKey * key) final override;
46 
47 public Q_SLOTS:
48 
49  void updateKey(CSwordKey *) final override;
50  void doShow();
51 
52 private: // methods:
53 
54  /** \brief Creates the first level of the tree structure. */
55  void setupTree();
56  void addKeyChildren(CSwordTreeKey * key, QTreeWidgetItem * item);
57  void adjustFont();
58 
59 private Q_SLOTS:
60 
61  void itemActivated(QTreeWidgetItem * item);
62 
63 private: // fields:
64 
68 
69 }; /* class CBookTreeChooser */
QList< CSwordModuleInfo const * > BtConstModuleList
Definition: btmodulelist.h:21
QList< CSwordBookModuleInfo const * > m_modules
CSwordTreeKey * m_key
void updateKey(CSwordKey *) final override
void setKey(CSwordKey *key) final override
QTreeWidget * m_treeView
void addKeyChildren(CSwordTreeKey *key, QTreeWidgetItem *item)
void setupTree()
Creates the first level of the tree structure.
CSwordKey * key() final override
CBookTreeChooser(BtConstModuleList const &modules, CSwordKey *key=nullptr, QWidget *parent=nullptr)
void setModules(BtConstModuleList const &modules, bool refresh=true) final override
void itemActivated(QTreeWidgetItem *item)
void refreshContent() final override
Class for generic book support.
CSwordKey implementation for Sword's TreeKey.
Definition: cswordtreekey.h:43