BibleTime
src
frontend
displaywindow
btmodulechoosermenu.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 "../btmenuview.h"
16
17
#include <QFlags>
18
#include <QObject>
19
#include <QString>
20
#include "../../backend/drivers/cswordmoduleinfo.h"
21
#include "../../backend/drivers/btmodulelist.h"
22
23
24
class
QAction
;
25
class
QActionGroup;
26
class
QMenu
;
27
class
QModelIndex;
28
class
QWidget
;
29
30
class
BtModuleChooserMenu
final:
public
BtMenuView
{
31
32
Q_OBJECT
33
34
public
:
// types:
35
36
enum
Flag
{
37
DisableNonBiblesOnFirstButton
,
38
DisableSelectedModule
,
39
AddNoneButton
40
};
41
Q_DECLARE_FLAGS(Flags,
Flag
)
42
43
public
:
// methods:
44
45
BtModuleChooserMenu
(QString
const
& title,
46
CSwordModuleInfo::ModuleType
moduleType
,
47
Flags flags,
48
QWidget
* parent =
nullptr
);
49
50
void
update
(
BtModuleList
newModulesToUse,
51
CSwordModuleInfo
* newSelectedModule,
52
int
newButtonIndexIndex,
53
int
newLeftLikeModules);
54
55
CSwordModuleInfo::ModuleType
moduleType
() const noexcept
56
{
return
m_moduleType
; }
57
58
CSwordModuleInfo
*
selectedModule
() const noexcept
59
{
return
m_selectedModule
; }
60
61
void
setSelectedModule
(
CSwordModuleInfo
*
const
newSelectedModule) noexcept;
62
63
int
buttonIndex
() const noexcept {
return
m_buttonIndex
; }
64
65
Q_SIGNALS:
66
67
void
sigModuleChosen
(
CSwordModuleInfo
* module);
68
69
private
:
// methods:
70
71
void
preBuildMenu
(QActionGroup * actionGroup)
final
override
;
72
73
QAction
*
newAction
(
QMenu
* parentMenu,
74
QModelIndex
const
& itemIndex)
final
override
;
75
76
public
:
// fields:
77
78
CSwordModuleInfo::ModuleType
const
m_moduleType
;
79
void
*
const
m_sortedModel
;
80
Flags
const
m_flags
;
81
BtModuleList
m_newModulesToUse
;
82
CSwordModuleInfo
*
m_selectedModule
=
nullptr
;
83
int
m_buttonIndex
;
84
int
m_leftLikeModules
;
85
86
};
87
88
Q_DECLARE_OPERATORS_FOR_FLAGS(BtModuleChooserMenu::Flags)
BtModuleList
QList< CSwordModuleInfo * > BtModuleList
Definition:
btmodulelist.h:20
BtMenuView
Definition:
btmenuview.h:47
BtModuleChooserMenu
Definition:
btmodulechoosermenu.h:30
BtModuleChooserMenu::m_sortedModel
void *const m_sortedModel
Definition:
btmodulechoosermenu.h:79
BtModuleChooserMenu::newAction
QAction * newAction(QMenu *parentMenu, QModelIndex const &itemIndex) final override
Definition:
btmodulechoosermenu.cpp:148
BtModuleChooserMenu::update
void update(BtModuleList newModulesToUse, CSwordModuleInfo *newSelectedModule, int newButtonIndexIndex, int newLeftLikeModules)
Definition:
btmodulechoosermenu.cpp:182
BtModuleChooserMenu::preBuildMenu
void preBuildMenu(QActionGroup *actionGroup) final override
Definition:
btmodulechoosermenu.cpp:127
BtModuleChooserMenu::sigModuleChosen
void sigModuleChosen(CSwordModuleInfo *module)
BtModuleChooserMenu::m_flags
Flags const m_flags
Definition:
btmodulechoosermenu.h:80
BtModuleChooserMenu::m_leftLikeModules
int m_leftLikeModules
Definition:
btmodulechoosermenu.h:84
BtModuleChooserMenu::Flag
Flag
Definition:
btmodulechoosermenu.h:36
BtModuleChooserMenu::AddNoneButton
@ AddNoneButton
Definition:
btmodulechoosermenu.h:39
BtModuleChooserMenu::DisableSelectedModule
@ DisableSelectedModule
Definition:
btmodulechoosermenu.h:38
BtModuleChooserMenu::DisableNonBiblesOnFirstButton
@ DisableNonBiblesOnFirstButton
Definition:
btmodulechoosermenu.h:37
BtModuleChooserMenu::m_buttonIndex
int m_buttonIndex
Definition:
btmodulechoosermenu.h:83
BtModuleChooserMenu::m_selectedModule
CSwordModuleInfo * m_selectedModule
Definition:
btmodulechoosermenu.h:82
BtModuleChooserMenu::BtModuleChooserMenu
BtModuleChooserMenu(QString const &title, CSwordModuleInfo::ModuleType moduleType, Flags flags, QWidget *parent=nullptr)
Definition:
btmodulechoosermenu.cpp:102
BtModuleChooserMenu::m_newModulesToUse
BtModuleList m_newModulesToUse
Definition:
btmodulechoosermenu.h:81
BtModuleChooserMenu::selectedModule
CSwordModuleInfo * selectedModule() const noexcept
Definition:
btmodulechoosermenu.h:58
BtModuleChooserMenu::setSelectedModule
void setSelectedModule(CSwordModuleInfo *const newSelectedModule) noexcept
Definition:
btmodulechoosermenu.cpp:194
BtModuleChooserMenu::m_moduleType
CSwordModuleInfo::ModuleType const m_moduleType
Definition:
btmodulechoosermenu.h:78
BtModuleChooserMenu::moduleType
CSwordModuleInfo::ModuleType moduleType() const noexcept
Definition:
btmodulechoosermenu.h:55
BtModuleChooserMenu::buttonIndex
int buttonIndex() const noexcept
Definition:
btmodulechoosermenu.h:63
CSwordModuleInfo
Definition:
cswordmoduleinfo.h:49
CSwordModuleInfo::ModuleType
ModuleType
Definition:
cswordmoduleinfo.h:87
QAction
QMenu
QWidget
Generated by
1.9.1