BibleTime
src
frontend
btbookshelfwidget.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 <memory>
18
#include <QObject>
19
#include <QString>
20
#include <QStringList>
21
#include <Qt>
22
23
24
class
BtBookshelfFilterModel
;
25
class
BtBookshelfGroupingMenu
;
26
class
BtBookshelfTreeModel
;
27
class
BtBookshelfView
;
28
class
QAbstractItemModel
;
29
class
QAction
;
30
class
QActionGroup;
31
class
QEvent;
32
class
QHBoxLayout;
33
class
QLabel;
34
class
QLineEdit
;
35
class
QMenu
;
36
class
QModelIndex;
37
class
QToolButton
;
38
39
class
BtBookshelfWidget
:
public
QWidget
{
40
Q_OBJECT
41
public
:
42
explicit
BtBookshelfWidget
(
QWidget
*parent =
nullptr
, Qt::WindowFlags flags = Qt::WindowFlags());
43
44
void
setSourceModel
(std::shared_ptr<QAbstractItemModel> model);
45
46
// Getters for models:
47
BtBookshelfTreeModel
*
treeModel
()
const
{
return
m_treeModel
; }
48
BtBookshelfFilterModel
*
postFilterModel
()
const
49
{
return
m_postFilterModel
; }
50
51
// Setters for models:
52
void
setTreeModel
(
BtBookshelfTreeModel
*model);
53
54
// Getters for widgets:
55
QWidget
*
leftCornerWidget
()
const
{
return
m_leftCornerWidget
; }
56
QLabel *
nameFilterLabel
()
const
{
return
m_nameFilterLabel
; }
57
QLineEdit
*
nameFilterEdit
()
const
{
return
m_nameFilterEdit
; }
58
QToolButton
*
groupingButton
()
const
{
return
m_groupingButton
; }
59
QToolButton
*
showHideButton
()
const
{
return
m_showHideButton
; }
60
QWidget
*
rightCornerWidget
()
const
{
return
m_rightCornerWidget
; }
61
BtBookshelfView
*
treeView
()
const
{
return
m_treeView
; }
62
BtBookshelfGroupingMenu
*
groupingMenu
()
const
63
{
return
m_groupingMenu
; }
64
QMenu
*
contextMenu
()
const
{
return
m_contextMenu
; }
65
QMenu
*
itemContextMenu
()
const
{
return
m_itemContextMenu
; }
66
67
// Setters for widgets:
68
void
setLeftCornerWidget
(
QWidget
*w);
69
void
setRightCornerWidget
(
QWidget
*w);
70
71
// Getters for actions:
72
QAction
*
showHideAction
()
const
{
return
m_showHideAction
; }
73
74
// Setters for context menus:
75
void
setContextMenu
(
QMenu
* newMenu) {
m_contextMenu
= newMenu; }
76
void
setItemContextMenu
(
QMenu
* newMenu)
77
{
m_itemContextMenu
= newMenu; }
78
79
bool
eventFilter
(
QObject
*
object
, QEvent *event)
override
;
80
81
void
loadBookshelfState
();
82
void
saveBookshelfState
();
83
84
protected
:
85
void
findExpanded
(
const
QModelIndex& index, QString prefix, QStringList * expandedPaths);
86
void
initActions
();
87
void
initMenus
();
88
void
initWidgets
();
89
void
restoreExpanded
(
const
QModelIndex& index,
const
QStringList& nodeList);
90
void
retranslateUi
();
91
92
private
:
93
// Models:
94
std::shared_ptr<QAbstractItemModel>
m_sourceModel
;
95
BtBookshelfTreeModel
*
m_treeModel
;
96
BtBookshelfFilterModel
*
m_postFilterModel
;
97
98
// Widgets:
99
QHBoxLayout *
m_toolBar
;
100
QWidget
*
m_leftCornerWidget
;
101
QWidget
*
m_rightCornerWidget
;
102
QLabel *
m_nameFilterLabel
;
103
QLineEdit
*
m_nameFilterEdit
;
104
QToolButton
*
m_groupingButton
;
105
QToolButton
*
m_showHideButton
;
106
BtBookshelfView
*
m_treeView
;
107
108
// Popup menus:
109
QMenu
*
m_contextMenu
;
110
BtBookshelfGroupingMenu
*
m_groupingMenu
;
111
QAction
*
m_showHideAction
;
112
QMenu
*
m_itemContextMenu
;
113
QActionGroup *
m_itemActionGroup
;
114
QAction
*
m_itemOpenAction
;
115
QAction
*
m_itemSearchAction
;
116
QMenu
*
m_itemEditMenu
;
117
QAction
*
m_itemEditPlainAction
;
118
QAction
*
m_itemEditHtmlAction
;
119
QAction
*
m_itemUnlockAction
;
120
QAction
*
m_itemAboutAction
;
121
};
BtBookshelfFilterModel
Definition:
btbookshelffiltermodel.h:25
BtBookshelfGroupingMenu
Definition:
btbookshelfgroupingmenu.h:26
BtBookshelfTreeModel
Definition:
btbookshelftreemodel.h:36
BtBookshelfView
Definition:
btbookshelfview.h:28
BtBookshelfWidget
Definition:
btbookshelfwidget.h:39
BtBookshelfWidget::BtBookshelfWidget
BtBookshelfWidget(QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
Definition:
btbookshelfwidget.cpp:41
BtBookshelfWidget::nameFilterLabel
QLabel * nameFilterLabel() const
Definition:
btbookshelfwidget.h:56
BtBookshelfWidget::groupingButton
QToolButton * groupingButton() const
Definition:
btbookshelfwidget.h:58
BtBookshelfWidget::setContextMenu
void setContextMenu(QMenu *newMenu)
Definition:
btbookshelfwidget.h:75
BtBookshelfWidget::leftCornerWidget
QWidget * leftCornerWidget() const
Definition:
btbookshelfwidget.h:55
BtBookshelfWidget::m_itemEditMenu
QMenu * m_itemEditMenu
Definition:
btbookshelfwidget.h:116
BtBookshelfWidget::m_showHideButton
QToolButton * m_showHideButton
Definition:
btbookshelfwidget.h:105
BtBookshelfWidget::treeView
BtBookshelfView * treeView() const
Definition:
btbookshelfwidget.h:61
BtBookshelfWidget::restoreExpanded
void restoreExpanded(const QModelIndex &index, const QStringList &nodeList)
Definition:
btbookshelfwidget.cpp:212
BtBookshelfWidget::m_itemSearchAction
QAction * m_itemSearchAction
Definition:
btbookshelfwidget.h:115
BtBookshelfWidget::m_itemActionGroup
QActionGroup * m_itemActionGroup
Definition:
btbookshelfwidget.h:113
BtBookshelfWidget::setRightCornerWidget
void setRightCornerWidget(QWidget *w)
Definition:
btbookshelfwidget.cpp:104
BtBookshelfWidget::m_itemEditHtmlAction
QAction * m_itemEditHtmlAction
Definition:
btbookshelfwidget.h:118
BtBookshelfWidget::showHideButton
QToolButton * showHideButton() const
Definition:
btbookshelfwidget.h:59
BtBookshelfWidget::m_toolBar
QHBoxLayout * m_toolBar
Definition:
btbookshelfwidget.h:99
BtBookshelfWidget::m_nameFilterEdit
QLineEdit * m_nameFilterEdit
Definition:
btbookshelfwidget.h:103
BtBookshelfWidget::m_rightCornerWidget
QWidget * m_rightCornerWidget
Definition:
btbookshelfwidget.h:101
BtBookshelfWidget::eventFilter
bool eventFilter(QObject *object, QEvent *event) override
Definition:
btbookshelfwidget.cpp:177
BtBookshelfWidget::m_itemContextMenu
QMenu * m_itemContextMenu
Definition:
btbookshelfwidget.h:112
BtBookshelfWidget::setTreeModel
void setTreeModel(BtBookshelfTreeModel *model)
Definition:
btbookshelfwidget.cpp:88
BtBookshelfWidget::treeModel
BtBookshelfTreeModel * treeModel() const
Definition:
btbookshelfwidget.h:47
BtBookshelfWidget::m_nameFilterLabel
QLabel * m_nameFilterLabel
Definition:
btbookshelfwidget.h:102
BtBookshelfWidget::setSourceModel
void setSourceModel(std::shared_ptr< QAbstractItemModel > model)
Definition:
btbookshelfwidget.cpp:78
BtBookshelfWidget::findExpanded
void findExpanded(const QModelIndex &index, QString prefix, QStringList *expandedPaths)
Definition:
btbookshelfwidget.cpp:195
BtBookshelfWidget::initActions
void initActions()
Definition:
btbookshelfwidget.cpp:110
BtBookshelfWidget::m_sourceModel
std::shared_ptr< QAbstractItemModel > m_sourceModel
Definition:
btbookshelfwidget.h:94
BtBookshelfWidget::m_treeModel
BtBookshelfTreeModel * m_treeModel
Definition:
btbookshelfwidget.h:95
BtBookshelfWidget::setLeftCornerWidget
void setLeftCornerWidget(QWidget *w)
Definition:
btbookshelfwidget.cpp:98
BtBookshelfWidget::contextMenu
QMenu * contextMenu() const
Definition:
btbookshelfwidget.h:64
BtBookshelfWidget::rightCornerWidget
QWidget * rightCornerWidget() const
Definition:
btbookshelfwidget.h:60
BtBookshelfWidget::nameFilterEdit
QLineEdit * nameFilterEdit() const
Definition:
btbookshelfwidget.h:57
BtBookshelfWidget::initMenus
void initMenus()
Definition:
btbookshelfwidget.cpp:118
BtBookshelfWidget::initWidgets
void initWidgets()
Definition:
btbookshelfwidget.cpp:137
BtBookshelfWidget::itemContextMenu
QMenu * itemContextMenu() const
Definition:
btbookshelfwidget.h:65
BtBookshelfWidget::m_postFilterModel
BtBookshelfFilterModel * m_postFilterModel
Definition:
btbookshelfwidget.h:96
BtBookshelfWidget::postFilterModel
BtBookshelfFilterModel * postFilterModel() const
Definition:
btbookshelfwidget.h:48
BtBookshelfWidget::m_contextMenu
QMenu * m_contextMenu
Definition:
btbookshelfwidget.h:109
BtBookshelfWidget::groupingMenu
BtBookshelfGroupingMenu * groupingMenu() const
Definition:
btbookshelfwidget.h:62
BtBookshelfWidget::retranslateUi
void retranslateUi()
Definition:
btbookshelfwidget.cpp:169
BtBookshelfWidget::m_itemUnlockAction
QAction * m_itemUnlockAction
Definition:
btbookshelfwidget.h:119
BtBookshelfWidget::m_itemOpenAction
QAction * m_itemOpenAction
Definition:
btbookshelfwidget.h:114
BtBookshelfWidget::m_groupingMenu
BtBookshelfGroupingMenu * m_groupingMenu
Definition:
btbookshelfwidget.h:110
BtBookshelfWidget::m_leftCornerWidget
QWidget * m_leftCornerWidget
Definition:
btbookshelfwidget.h:100
BtBookshelfWidget::showHideAction
QAction * showHideAction() const
Definition:
btbookshelfwidget.h:72
BtBookshelfWidget::saveBookshelfState
void saveBookshelfState()
Definition:
btbookshelfwidget.cpp:241
BtBookshelfWidget::loadBookshelfState
void loadBookshelfState()
Definition:
btbookshelfwidget.cpp:230
BtBookshelfWidget::m_itemEditPlainAction
QAction * m_itemEditPlainAction
Definition:
btbookshelfwidget.h:117
BtBookshelfWidget::m_itemAboutAction
QAction * m_itemAboutAction
Definition:
btbookshelfwidget.h:120
BtBookshelfWidget::m_treeView
BtBookshelfView * m_treeView
Definition:
btbookshelfwidget.h:106
BtBookshelfWidget::setItemContextMenu
void setItemContextMenu(QMenu *newMenu)
Definition:
btbookshelfwidget.h:76
BtBookshelfWidget::m_groupingButton
QToolButton * m_groupingButton
Definition:
btbookshelfwidget.h:104
BtBookshelfWidget::m_showHideAction
QAction * m_showHideAction
Definition:
btbookshelfwidget.h:111
QAbstractItemModel
QAction
QLineEdit
QMenu
QObject
QToolButton
QWidget
Generated by
1.9.1