BibleTime
src
frontend
displaywindow
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
24
class
BtModuleChooserMenu
;
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
*/
36
class
BtTextWindowHeaderWidget
:
public
QWidget
{
37
Q_OBJECT
38
39
public
:
40
41
/**
42
* A new empty widget. updateMenu() is needed to update the label, menu items etc.
43
*/
44
BtTextWindowHeaderWidget
(
CSwordModuleInfo::ModuleType
mtype,
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
;
69
QAction
*
m_removeAction
;
70
BtModuleChooserMenu
*
m_replaceMenu
;
71
BtModuleChooserMenu
*
m_addMenu
;
72
QLabel*
m_iconLabel
;
73
QLabel*
m_label
;
74
QToolButton
*
m_button
;
75
};
BtModuleList
QList< CSwordModuleInfo * > BtModuleList
Definition:
btmodulelist.h:20
BtModuleChooserMenu
Definition:
btmodulechoosermenu.h:30
BtTextWindowHeaderWidget
Definition:
bttextwindowheaderwidget.h:36
BtTextWindowHeaderWidget::m_iconLabel
QLabel * m_iconLabel
Definition:
bttextwindowheaderwidget.h:72
BtTextWindowHeaderWidget::m_label
QLabel * m_label
Definition:
bttextwindowheaderwidget.h:73
BtTextWindowHeaderWidget::updateWidget
void updateWidget(BtModuleList newModulesToUse, CSwordModuleInfo *module, int newIndex, int leftLikeModules)
Definition:
bttextwindowheaderwidget.cpp:106
BtTextWindowHeaderWidget::BtTextWindowHeaderWidget
BtTextWindowHeaderWidget(CSwordModuleInfo::ModuleType mtype, QWidget *parent=nullptr)
Definition:
bttextwindowheaderwidget.cpp:31
BtTextWindowHeaderWidget::sigModuleReplace
void sigModuleReplace(int index, CSwordModuleInfo *newModule)
BtTextWindowHeaderWidget::sigModuleAdd
void sigModuleAdd(int index, CSwordModuleInfo *module)
BtTextWindowHeaderWidget::m_id
int m_id
Definition:
bttextwindowheaderwidget.h:68
BtTextWindowHeaderWidget::m_replaceMenu
BtModuleChooserMenu * m_replaceMenu
Definition:
bttextwindowheaderwidget.h:70
BtTextWindowHeaderWidget::m_removeAction
QAction * m_removeAction
Definition:
bttextwindowheaderwidget.h:69
BtTextWindowHeaderWidget::m_button
QToolButton * m_button
Definition:
bttextwindowheaderwidget.h:74
BtTextWindowHeaderWidget::sigModuleRemove
void sigModuleRemove(int index)
BtTextWindowHeaderWidget::m_addMenu
BtModuleChooserMenu * m_addMenu
Definition:
bttextwindowheaderwidget.h:71
CSwordModuleInfo
Definition:
cswordmoduleinfo.h:49
CSwordModuleInfo::ModuleType
ModuleType
Definition:
cswordmoduleinfo.h:87
QAction
QToolButton
QWidget
Generated by
1.9.1