BibleTime
bttextwindowheaderwidget.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 <QObject>
18 #include <QString>
19 #include <QStringList>
20 #include "../../backend/drivers/cswordmoduleinfo.h"
21 #include "../../backend/drivers/btmodulelist.h"
22 
23 
25 class QAction;
26 class QLabel;
27 class QToolButton;
28 
29 /**
30 * A widget for choosing a module in a window. Consists of a label and a button.
31 * When user selects a module,
32 * button sends a signal. This widget needs to get a message back after a window
33 * module list has been changed. Only then it will be updated.
34 * See BtTextWindowHeader.
35 */
37  Q_OBJECT
38 
39  public:
40 
41  /**
42  * A new empty widget. updateMenu() is needed to update the label, menu items etc.
43  */
45  QWidget * parent = nullptr);
46 
47  public:
48  /**
49  * Called after the window module list has changed. Updates the module name and
50  * the existing menu items but doesn't add or remove them if the menu exists.
51  * If the menu doesn't exist, creates it first and then updates it.
52  */
53  void updateWidget(BtModuleList newModulesToUse,
54  CSwordModuleInfo * module,
55  int newIndex,
56  int leftLikeModules);
57 
58  Q_SIGNALS:
59  /** User selected a module from menu to replace an existing module.*/
60  void sigModuleReplace(int index, CSwordModuleInfo * newModule);
61  /** User selected a module from menu to add. */
62  void sigModuleAdd(int index, CSwordModuleInfo * module);
63  /** User selected a module from menu to be removed. */
64  void sigModuleRemove ( int index );
65 
66  private:
67 
68  int m_id;
72  QLabel* m_iconLabel;
73  QLabel* m_label;
75 };
QList< CSwordModuleInfo * > BtModuleList
Definition: btmodulelist.h:20
void updateWidget(BtModuleList newModulesToUse, CSwordModuleInfo *module, int newIndex, int leftLikeModules)
BtTextWindowHeaderWidget(CSwordModuleInfo::ModuleType mtype, QWidget *parent=nullptr)
void sigModuleReplace(int index, CSwordModuleInfo *newModule)
void sigModuleAdd(int index, CSwordModuleInfo *module)
BtModuleChooserMenu * m_replaceMenu
void sigModuleRemove(int index)
BtModuleChooserMenu * m_addMenu