BibleTime
ckeychooser.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 <QWidget>
16 
17 #include "../../backend/drivers/btmodulelist.h"
18 
19 
20 class CSwordKey;
21 class QAction;
22 
23 /**
24  * The base class for the KeyChooser.
25  * Do not use directly, create a KeyChooser with
26  * @ref #createInstance , this will create the proper one
27  * of the classes that inherit from @ref CKeyChooser
28  */
29 class CKeyChooser: public QWidget {
30 
31  Q_OBJECT
32 
33 public: // methods:
34 
35  /**
36  * Creates a proper Instance, either
37  * @ref CLexiconKeyChooser or
38  * @ref CBibleKeyChooser
39  * @param info the @ref CModuleInfo to be represented by the KeyChooser
40  * @param key if not NULL, the @ref CKey the KeyChooser should be set to
41  * @param parent the parent of the widget to create
42  */
43  static CKeyChooser * createInstance(const BtConstModuleList & modules,
44  CSwordKey * key,
45  QWidget * parent);
46 
47  /**
48  Sets the CKey
49  \param key the key which the widget should be set to.
50  */
51  virtual void setKey(CSwordKey * key) = 0;
52 
53  /**
54  \returns the current CKey.
55  */
56  virtual CSwordKey * key() = 0;
57 
58  /**
59  Sets the module of this keychooser and refreshes the comboboxes
60  */
61  virtual void setModules(const BtConstModuleList & modules,
62  bool refresh = true) = 0;
63 
64  /**
65  Refreshes the content of the different key chooser parts.
66  */
67  virtual void refreshContent() = 0;
68 
69 public Q_SLOTS:
70 
71  /**
72  Updates the CKey.
73  \param key the key which the widget should be set to.
74  */
75  virtual void updateKey(CSwordKey * key) = 0;
76 
77  void handleHistoryMoved(QString const & newKey);
78 
79 Q_SIGNALS:
80 
81  /**
82  * is emitted if the @ref CKey was changed by the user
83  */
84  void keyChanged(CSwordKey * newKey);
85 
86 protected: // methods:
87 
88  CKeyChooser(QWidget * parent = nullptr);
89 
90 };
QList< CSwordModuleInfo const * > BtConstModuleList
Definition: btmodulelist.h:21
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
CKeyChooser(QWidget *parent=nullptr)
Definition: ckeychooser.cpp:24
virtual CSwordKey * key()=0
virtual void refreshContent()=0