BibleTime
|
#include <btbookshelftreemodel.h>
Classes | |
class | Grouping |
Public Types | |
enum | CheckedBehavior { CHECKED , UNCHECKED , MODULE_HIDDEN , MODULE_INDEXED } |
enum | Group { GROUP_CATEGORY = 0 , GROUP_LANGUAGE = 1 , GROUP_INDEXING } |
enum | ModuleRole { CheckStateRole = BtBookshelfModel::UserRole , UserRole = BtBookshelfModel::UserRole + 100 } |
Public Slots | |
void | setCheckable (bool checkable) |
void | setCheckedModules (BtConstModuleSet const &modules) |
void | setDefaultChecked (CheckedBehavior b) |
void | setGroupingOrder (const BtBookshelfTreeModel::Grouping &groupingOrder, bool emitSignal=true) |
void | setSourceModel (std::shared_ptr< QAbstractItemModel > sourceModel) |
Signals | |
void | groupingOrderChanged (BtBookshelfTreeModel::Grouping newGrouping) |
void | moduleChecked (CSwordModuleInfo *module, bool checked) |
Public Member Functions | |
BtBookshelfTreeModel (BtConfigCore const &config, QString const &configKey, QObject *parent=nullptr) | |
BtBookshelfTreeModel (const Grouping &grouping, QObject *parent=nullptr) | |
BtBookshelfTreeModel (QObject *parent=nullptr) | |
bool | checkable () const |
BtModuleSet const & | checkedModules () const |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
QVariant | data (CSwordModuleInfo &module, int role=Qt::DisplayRole) const |
CheckedBehavior | defaultChecked () const |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
Grouping const & | groupingOrder () const |
bool | hasChildren (const QModelIndex &parent=QModelIndex()) const override |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
CSwordModuleInfo * | module (QModelIndex const &index) const |
QList< CSwordModuleInfo * > | modules () const |
QModelIndex | parent (const QModelIndex &index) const override |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
std::shared_ptr< QAbstractItemModel > | sourceModel () const noexcept |
~BtBookshelfTreeModel () override | |
Protected Slots | |
void | moduleDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight) |
void | moduleInserted (const QModelIndex &parent, int start, int end) |
void | moduleRemoved (const QModelIndex &parent, int start, int end) |
Protected Member Functions | |
void | resetData () |
Private Types | |
using | ModuleItemMap = QMap< CSwordModuleInfo *, BookshelfModel::ModuleItem * > |
using | SourceIndexMap = QMap< CSwordModuleInfo *, QPersistentModelIndex > |
Private Member Functions | |
void | addModule (CSwordModuleInfo &module, bool checked) |
void | addModule (CSwordModuleInfo &module, QModelIndex parentIndex, Grouping &intermediateGrouping, bool checked) |
template<class T > | |
QModelIndex | getGroup (CSwordModuleInfo &module, QModelIndex parentIndex) |
QModelIndex | getIndex (const BookshelfModel::Item &item) |
BookshelfModel::Item & | getItem (const QModelIndex &index) const |
void | removeModule (CSwordModuleInfo &module) |
void | resetParentCheckStates (QModelIndex parentIndex) |
Private Attributes | |
bool | m_checkable |
BtModuleSet | m_checkedModulesCache |
CheckedBehavior | m_defaultChecked |
Grouping | m_groupingOrder |
ModuleItemMap | m_modules |
std::unique_ptr< BookshelfModel::Item > | m_rootItem |
SourceIndexMap | m_sourceIndexMap |
std::shared_ptr< QAbstractItemModel > | m_sourceModel |
Definition at line 36 of file btbookshelftreemodel.h.
|
private |
Definition at line 43 of file btbookshelftreemodel.h.
|
private |
Definition at line 44 of file btbookshelftreemodel.h.
Definition at line 59 of file btbookshelftreemodel.h.
Enumerator | |
---|---|
GROUP_CATEGORY | |
GROUP_LANGUAGE | |
GROUP_INDEXING |
Definition at line 53 of file btbookshelftreemodel.h.
Enumerator | |
---|---|
CheckStateRole | |
UserRole |
Definition at line 48 of file btbookshelftreemodel.h.
BtBookshelfTreeModel::BtBookshelfTreeModel | ( | QObject * | parent = nullptr | ) |
Definition at line 54 of file btbookshelftreemodel.cpp.
BtBookshelfTreeModel::BtBookshelfTreeModel | ( | BtConfigCore const & | config, |
QString const & | configKey, | ||
QObject * | parent = nullptr |
||
) |
Definition at line 60 of file btbookshelftreemodel.cpp.
BtBookshelfTreeModel::BtBookshelfTreeModel | ( | const Grouping & | grouping, |
QObject * | parent = nullptr |
||
) |
Definition at line 69 of file btbookshelftreemodel.cpp.
|
overridedefault |
|
private |
Definition at line 369 of file btbookshelftreemodel.cpp.
References m_groupingOrder, m_modules, and module().
Referenced by addModule(), moduleInserted(), setGroupingOrder(), and setSourceModel().
|
private |
Definition at line 387 of file btbookshelftreemodel.cpp.
References addModule(), getItem(), GROUP_CATEGORY, GROUP_INDEXING, GROUP_LANGUAGE, BookshelfModel::Item::indexFor(), BookshelfModel::Item::insertChild(), m_checkedModulesCache, m_modules, module(), resetParentCheckStates(), and BookshelfModel::Item::setCheckState().
|
inline |
Definition at line 134 of file btbookshelftreemodel.h.
References m_checkable.
Referenced by setCheckable().
|
inline |
Definition at line 137 of file btbookshelftreemodel.h.
References m_checkedModulesCache.
Referenced by BtBookshelfWorksPage::checkedModules(), and BtSearchModuleChooserDialog::checkedModules().
|
override |
Definition at line 83 of file btbookshelftreemodel.cpp.
References parent().
Referenced by resetData().
|
override |
Definition at line 121 of file btbookshelftreemodel.cpp.
References BT_ASSERT, BookshelfModel::Item::checkState(), CheckStateRole, BookshelfModel::Item::data(), index(), m_checkable, BtBookshelfModel::ModuleHiddenRole, BookshelfModel::ModuleItem::moduleInfo(), BtBookshelfModel::ModulePointerRole, and BookshelfModel::Item::type().
Referenced by BookshelfModel::ModuleItem::data(), BtInstallPageModel::data(), module(), moduleDataChanged(), moduleInserted(), and moduleRemoved().
QVariant BtBookshelfTreeModel::data | ( | CSwordModuleInfo & | module, |
int | role = Qt::DisplayRole |
||
) | const |
Definition at line 158 of file btbookshelftreemodel.cpp.
References BT_ASSERT, m_sourceIndexMap, m_sourceModel, and module().
|
inline |
Definition at line 135 of file btbookshelftreemodel.h.
References m_defaultChecked.
|
override |
Definition at line 220 of file btbookshelftreemodel.cpp.
References index(), m_checkable, and BookshelfModel::Item::type().
|
inlineprivate |
Definition at line 180 of file btbookshelftreemodel.h.
References BookshelfModel::Item::getGroupItem(), getItem(), index(), BookshelfModel::Item::indexFor(), BookshelfModel::Item::insertChild(), module(), and T.
|
private |
Definition at line 470 of file btbookshelftreemodel.cpp.
References BookshelfModel::Item::childIndex(), index(), and BookshelfModel::Item::parent().
Referenced by moduleDataChanged(), removeModule(), and setCheckedModules().
|
private |
Definition at line 461 of file btbookshelftreemodel.cpp.
References BT_ASSERT, index(), m_rootItem, and UNLIKELY.
Referenced by addModule(), getGroup(), hasChildren(), index(), and rowCount().
|
inline |
Definition at line 133 of file btbookshelftreemodel.h.
References m_groupingOrder.
Referenced by BtBookshelfDockWidget::groupingOrder(), and setGroupingOrder().
|
signal |
|
override |
Definition at line 89 of file btbookshelftreemodel.cpp.
References BookshelfModel::Item::children(), getItem(), and parent().
|
override |
Definition at line 237 of file btbookshelftreemodel.cpp.
References m_sourceModel.
|
override |
Definition at line 93 of file btbookshelftreemodel.cpp.
References BookshelfModel::Item::children(), getItem(), and parent().
Referenced by data(), BtInstallPageModel::data(), anonymous_namespace{btmodulechoosermenu.cpp}::SortModel::filterAcceptsRowNoHiddenCheck(), flags(), getGroup(), getIndex(), getItem(), module(), parent(), removeModule(), resetData(), and setData().
|
inline |
Definition at line 125 of file btbookshelftreemodel.h.
References data(), index(), and BtBookshelfModel::ModulePointerRole.
Referenced by addModule(), data(), BtInstallPageModel::data(), getGroup(), moduleDataChanged(), moduleInserted(), moduleRemoved(), removeModule(), setGroupingOrder(), and setSourceModel().
|
signal |
Referenced by BtBookshelfWorksPage::BtBookshelfWorksPage(), and setData().
|
protectedslot |
Definition at line 530 of file btbookshelftreemodel.cpp.
References BT_ASSERT, data(), getIndex(), m_modules, m_sourceModel, module(), and BtBookshelfModel::ModulePointerRole.
Referenced by setSourceModel().
|
protectedslot |
Definition at line 559 of file btbookshelftreemodel.cpp.
References addModule(), BT_ASSERT, CHECKED, data(), m_defaultChecked, m_sourceIndexMap, m_sourceModel, module(), MODULE_HIDDEN, MODULE_INDEXED, BtBookshelfModel::ModuleHasIndexRole, BtBookshelfModel::ModuleHiddenRole, BtBookshelfModel::ModulePointerRole, parent(), and UNCHECKED.
Referenced by setSourceModel().
|
protectedslot |
Definition at line 587 of file btbookshelftreemodel.cpp.
References BT_ASSERT, data(), m_sourceIndexMap, m_sourceModel, module(), BtBookshelfModel::ModulePointerRole, parent(), and removeModule().
Referenced by setSourceModel().
|
inline |
Definition at line 136 of file btbookshelftreemodel.h.
References m_modules.
Referenced by setCheckedModules().
|
override |
Definition at line 106 of file btbookshelftreemodel.cpp.
References BT_ASSERT, BookshelfModel::Item::childIndex(), index(), m_rootItem, and BookshelfModel::Item::parent().
Referenced by columnCount(), BtInstallPageModel::columnCount(), hasChildren(), index(), moduleInserted(), moduleRemoved(), resetData(), and rowCount().
|
private |
Definition at line 431 of file btbookshelftreemodel.cpp.
References BT_ASSERT, BookshelfModel::Item::childIndex(), BookshelfModel::Item::children(), getIndex(), index(), m_checkedModulesCache, m_modules, m_rootItem, module(), BookshelfModel::Item::parent(), and resetParentCheckStates().
Referenced by moduleRemoved().
|
protected |
Definition at line 354 of file btbookshelftreemodel.cpp.
References columnCount(), index(), parent(), and rowCount().
Referenced by setCheckable().
|
private |
Definition at line 487 of file btbookshelftreemodel.cpp.
References BT_ASSERT, BookshelfModel::Item::checkState(), BookshelfModel::Item::children(), and BookshelfModel::Item::setCheckState().
Referenced by addModule(), removeModule(), and setData().
|
override |
Definition at line 79 of file btbookshelftreemodel.cpp.
References BookshelfModel::Item::children(), getItem(), and parent().
Referenced by resetData().
|
slot |
Definition at line 333 of file btbookshelftreemodel.cpp.
References checkable(), m_checkable, m_sourceModel, and resetData().
Referenced by BtInstallPageModel::BtInstallPageModel(), and BtSearchModuleChooserDialog::BtSearchModuleChooserDialog().
|
slot |
Definition at line 344 of file btbookshelftreemodel.cpp.
References getIndex(), m_modules, modules(), and setData().
Referenced by BtSearchModuleChooserDialog::setCheckedModules().
|
override |
Definition at line 163 of file btbookshelftreemodel.cpp.
References BT_ASSERT, BookshelfModel::Item::checkState(), BookshelfModel::Item::children(), index(), m_checkedModulesCache, moduleChecked(), BookshelfModel::ModuleItem::moduleInfo(), resetParentCheckStates(), BookshelfModel::Item::setCheckState(), BookshelfModel::Item::type(), and UNLIKELY.
Referenced by setCheckedModules().
|
inlineslot |
Definition at line 147 of file btbookshelftreemodel.h.
References m_defaultChecked.
Referenced by BtBookshelfWorksPage::BtBookshelfWorksPage(), and BtInstallPageModel::BtInstallPageModel().
|
slot |
Definition at line 302 of file btbookshelftreemodel.cpp.
References addModule(), BtModuleSet::contains(), groupingOrder(), groupingOrderChanged(), m_checkedModulesCache, m_groupingOrder, m_modules, m_rootItem, m_sourceIndexMap, m_sourceModel, module(), and BtBookshelfModel::ModulePointerRole.
Referenced by BtBookshelfWidget::initMenus(), BtOpenWorkActionMenu::postBuildMenu(), and BtBookshelfWorksPage::slotGroupingActionTriggered().
|
slot |
Definition at line 247 of file btbookshelftreemodel.cpp.
References addModule(), BT_CONNECT, CHECKED, m_checkedModulesCache, m_defaultChecked, m_modules, m_rootItem, m_sourceIndexMap, m_sourceModel, module(), MODULE_HIDDEN, MODULE_INDEXED, moduleDataChanged(), BtBookshelfModel::ModuleHasIndexRole, BtBookshelfModel::ModuleHiddenRole, moduleInserted(), BtBookshelfModel::ModulePointerRole, moduleRemoved(), and sourceModel().
Referenced by BtBookshelfWorksPage::BtBookshelfWorksPage(), BtBookshelfWidget::setSourceModel(), BtOpenWorkActionMenu::setSourceModel(), and BtBookshelfWidget::setTreeModel().
|
inlinenoexcept |
Definition at line 130 of file btbookshelftreemodel.h.
References m_sourceModel.
Referenced by setSourceModel(), and BtOpenWorkActionMenu::sourceModel().
|
private |
Definition at line 205 of file btbookshelftreemodel.h.
Referenced by checkable(), data(), flags(), and setCheckable().
|
private |
Definition at line 207 of file btbookshelftreemodel.h.
Referenced by addModule(), checkedModules(), removeModule(), setData(), setGroupingOrder(), and setSourceModel().
|
private |
Definition at line 204 of file btbookshelftreemodel.h.
Referenced by defaultChecked(), moduleInserted(), setDefaultChecked(), and setSourceModel().
|
private |
Definition at line 203 of file btbookshelftreemodel.h.
Referenced by addModule(), groupingOrder(), and setGroupingOrder().
|
private |
Definition at line 201 of file btbookshelftreemodel.h.
Referenced by addModule(), moduleDataChanged(), modules(), removeModule(), setCheckedModules(), setGroupingOrder(), and setSourceModel().
|
private |
Definition at line 200 of file btbookshelftreemodel.h.
Referenced by getItem(), parent(), removeModule(), setGroupingOrder(), and setSourceModel().
|
private |
Definition at line 202 of file btbookshelftreemodel.h.
Referenced by data(), moduleInserted(), moduleRemoved(), setGroupingOrder(), and setSourceModel().
|
private |
Definition at line 199 of file btbookshelftreemodel.h.
Referenced by data(), headerData(), moduleDataChanged(), moduleInserted(), moduleRemoved(), setCheckable(), setGroupingOrder(), setSourceModel(), and sourceModel().