BibleTime
btopenworkaction.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 <memory>
18 #include <QAction>
19 #include <QObject>
20 #include <QString>
21 #include "../backend/bookshelfmodel/btbookshelftreemodel.h"
22 #include "../backend/config/btconfigcore.h"
23 
24 
27 class CSwordModuleInfo;
28 class QAbstractItemModel;
29 class QActionGroup;
30 class QWidget;
31 
33  Q_OBJECT
34  public:
35  BtOpenWorkActionMenu(BtConfigCore groupingConfigGroup,
36  QString groupingConfigKey,
37  QWidget * parent = nullptr);
38 
39  void setSourceModel(std::shared_ptr<QAbstractItemModel> model);
40 
41  std::shared_ptr<QAbstractItemModel> sourceModel() const
42  { return m_treeModel->sourceModel(); }
43 
45 
47  { return m_postFilterModel; }
48 
49  Q_SIGNALS:
50  void triggered(CSwordModuleInfo *module);
51 
52  private:
53  void retranslateUi();
54 
55  void postBuildMenu(QActionGroup * actions) override;
56 
57  private:
58  // Models:
61 
62  // Grouping menu:
65  QString const m_groupingConfigKey;
66 };
67 
68 class BtOpenWorkAction: public QAction {
69  Q_OBJECT
70  public:
71  explicit BtOpenWorkAction(BtConfigCore groupingConfigGroup,
72  QString groupingConfigKey,
73  QObject * parent = nullptr);
74  ~BtOpenWorkAction() override;
75 
76  Q_SIGNALS:
77  void triggered(CSwordModuleInfo *module);
78 
79  protected:
80  void retranslateUi();
81 
82  private:
84 };
std::shared_ptr< QAbstractItemModel > sourceModel() const noexcept
QAbstractItemModel * model() const
Definition: btmenuview.h:66
QString const m_groupingConfigKey
std::shared_ptr< QAbstractItemModel > sourceModel() const
void setSourceModel(std::shared_ptr< QAbstractItemModel > model)
void triggered(CSwordModuleInfo *module)
BtBookshelfGroupingMenu * m_groupingMenu
BtBookshelfTreeModel * treeModel() const
BtConfigCore m_groupingConfigGroup
BtBookshelfFilterModel * m_postFilterModel
BtOpenWorkActionMenu(BtConfigCore groupingConfigGroup, QString groupingConfigKey, QWidget *parent=nullptr)
void postBuildMenu(QActionGroup *actions) override
BtBookshelfTreeModel * m_treeModel
BtBookshelfFilterModel * postFilterModel() const
void triggered(CSwordModuleInfo *module)
BtOpenWorkActionMenu * m_menu
BtOpenWorkAction(BtConfigCore groupingConfigGroup, QString groupingConfigKey, QObject *parent=nullptr)
~BtOpenWorkAction() override