diff options
Diffstat (limited to 'src/frontend/searchdialog/btsearchmodulechooserdialog.cpp')
-rw-r--r-- | src/frontend/searchdialog/btsearchmodulechooserdialog.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/frontend/searchdialog/btsearchmodulechooserdialog.cpp b/src/frontend/searchdialog/btsearchmodulechooserdialog.cpp new file mode 100644 index 0000000..1d5f556 --- /dev/null +++ b/src/frontend/searchdialog/btsearchmodulechooserdialog.cpp @@ -0,0 +1,58 @@ +/********* +* +* In the name of the Father, and of the Son, and of the Holy Spirit. +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2011 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License +* version 2.0. +* +**********/ + +#include "frontend/searchdialog/btsearchmodulechooserdialog.h" + +#include <QAction> +#include <QToolButton> +#include "backend/bookshelfmodel/btbookshelftreemodel.h" +#include "backend/managers/cswordbackend.h" +#include "util/tool.h" + + +namespace { +const QString groupingOrderKey("GUI/SearchDialog/ModuleChooserDialog/grouping"); +} + +BtSearchModuleChooserDialog::BtSearchModuleChooserDialog(QWidget *parent, + Qt::WindowFlags flags) + : BtModuleChooserDialog(parent, flags) +{ + // Initialize the tree model: + BtBookshelfTreeModel::Grouping grouping(groupingOrderKey); + BtBookshelfTreeModel *treeModel = new BtBookshelfTreeModel(grouping, this); + treeModel->setCheckable(true); + connect(treeModel, SIGNAL(groupingOrderChanged(BtBookshelfTreeModel::Grouping)), + this, SLOT(slotGroupingOrderChanged(const BtBookshelfTreeModel::Grouping&))); + + // Initialize the bookshelf widget: + bookshelfWidget()->showHideAction()->setVisible(false); + bookshelfWidget()->showHideButton()->hide(); + bookshelfWidget()->setTreeModel(treeModel); + bookshelfWidget()->setSourceModel(CSwordBackend::instance()->model()); + + retranslateUi(); +} + +BtSearchModuleChooserDialog::~BtSearchModuleChooserDialog() { + // Intentionally empty +} + +void BtSearchModuleChooserDialog::retranslateUi() { + setWindowTitle(tr("Works to Search in")); + util::tool::initExplanationLabel(label(), QString::null, + tr("Select the works which should be searched.")); +} + +void BtSearchModuleChooserDialog::slotGroupingOrderChanged(const BtBookshelfTreeModel::Grouping &g) { + g.saveTo(groupingOrderKey); +} |