BibleTime
btsearchmodulechooserdialog.cpp
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-2025 by the BibleTime developers.
8* The BibleTime source code is licensed under the GNU General Public License
9* version 2.0.
10*
11**********/
12
14
15#include <QAction>
16#include <QToolButton>
17#include "../../backend/bookshelfmodel/btbookshelftreemodel.h"
18#include "../../backend/config/btconfig.h"
19#include "../../backend/drivers/btconstmoduleset.h"
20#include "../../backend/managers/cswordbackend.h"
21#include "../../util/btconnect.h"
22#include "../../util/tool.h"
23#include "../btbookshelfwidget.h"
24#include "../btmodulechooserdialog.h"
25
26
27namespace {
29 QStringLiteral("GUI/SearchDialog/ModuleChooserDialog/grouping"));
30}
31
33 Qt::WindowFlags flags)
34 : BtModuleChooserDialog(parent, flags)
35{
36 // Initialize the tree model:
37 auto * const treeModel =
38 new BtBookshelfTreeModel(btConfig(), groupingOrderKey, this);
39 treeModel->setCheckable(true);
41 [](BtBookshelfTreeModel::Grouping const & grouping)
42 { grouping.saveTo(btConfig(), groupingOrderKey); });
43
44 // Initialize the bookshelf widget:
45 bookshelfWidget()->showHideAction()->setVisible(false);
47 bookshelfWidget()->setTreeModel(treeModel);
49
51}
52
56
59
61 setWindowTitle(tr("Works to Search in"));
63 tr("Select the works which should be searched."));
64}
BtConfig & btConfig()
This is a shortchand for BtConfig::getInstance().
Definition btconfig.h:305
#define BT_CONNECT(...)
Definition btconnect.h:20
void saveTo(BtConfigCore &config, QString const &key) const
void groupingOrderChanged(BtBookshelfTreeModel::Grouping newGrouping)
BtModuleSet const & checkedModules() const
void setCheckedModules(BtConstModuleSet const &modules)
BtBookshelfTreeModel * treeModel() const
QToolButton * showHideButton() const
QAction * showHideAction() const
void setTreeModel(BtBookshelfTreeModel *model)
void setSourceModel(std::shared_ptr< QAbstractItemModel > model)
BtBookshelfWidget * bookshelfWidget() const
void setCheckedModules(BtConstModuleSet const &modules)
BtSearchModuleChooserDialog(QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
static CSwordBackend & instance() noexcept
auto const groupingOrderKey(QStringLiteral("GUI/SearchDialog/ModuleChooserDialog/grouping"))
void initExplanationLabel(QLabel *const label, const QString &heading, const QString &text)
Initializes a QLabel to explain difficult things of dialogs.
Definition tool.cpp:116