BibleTime
|
#include <btbookshelftreemodel.h>
Classes | |
class | Grouping |
Public Types | |
enum | CheckedBehavior { CHECKED , UNCHECKED , MODULE_HIDDEN , MODULE_INDEXED } |
enum | Group : int { 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 const b) |
void | setGroupingOrder (BtBookshelfTreeModel::Grouping const &groupingOrder, bool emitSignal=true) |
void | setSourceModel (std::shared_ptr< QAbstractItemModel > sourceModel) |
Signals | |
void | groupingOrderChanged (BtBookshelfTreeModel::Grouping newGrouping) |
void | moduleChecked (CSwordModuleInfo *module, bool checked) |
Protected Slots | |
void | moduleDataChanged (QModelIndex const &topLeft, QModelIndex const &bottomRight) |
void | moduleInserted (QModelIndex const &parent, int start, int end) |
void | moduleRemoved (QModelIndex const &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, bool inReset) |
template<class T > | |
QModelIndex | getGroup (CSwordModuleInfo const &module, QModelIndex const parentIndex, bool &beginInsert) |
QModelIndex | getIndex (BookshelfModel::Item const &item) |
BookshelfModel::Item & | getItem (QModelIndex const &index) const |
void | removeModule (CSwordModuleInfo &module) |
void | resetParentCheckStates (QModelIndex parentIndex, bool inReset) |
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 37 of file btbookshelftreemodel.h.
|
private |
Definition at line 44 of file btbookshelftreemodel.h.
|
private |
Definition at line 45 of file btbookshelftreemodel.h.
Definition at line 60 of file btbookshelftreemodel.h.
Enumerator | |
---|---|
GROUP_CATEGORY | |
GROUP_LANGUAGE | |
GROUP_INDEXING |
Definition at line 54 of file btbookshelftreemodel.h.
Enumerator | |
---|---|
CheckStateRole | |
UserRole |
Definition at line 49 of file btbookshelftreemodel.h.
Definition at line 68 of file btbookshelftreemodel.cpp.
BtBookshelfTreeModel::BtBookshelfTreeModel | ( | BtConfigCore const & | config, |
QString const & | configKey, | ||
QObject *const | parent = nullptr |
||
) |
Definition at line 74 of file btbookshelftreemodel.cpp.
References BtBookshelfTreeModel::Grouping::DEFAULT, and BtBookshelfTreeModel::Grouping::loadFrom().
BtBookshelfTreeModel::BtBookshelfTreeModel | ( | Grouping const & | grouping, |
QObject * | parent = nullptr |
||
) |
Definition at line 89 of file btbookshelftreemodel.cpp.
|
overridedefault |
|
private |
Definition at line 392 of file btbookshelftreemodel.cpp.
References getGroup(), getItem(), GROUP_CATEGORY, GROUP_INDEXING, GROUP_LANGUAGE, BtBookshelfTreeModel::Grouping::list(), m_checkedModulesCache, m_groupingOrder, m_modules, module(), and resetParentCheckStates().
Referenced by moduleInserted(), setGroupingOrder(), and setSourceModel().
|
inline |
Definition at line 144 of file btbookshelftreemodel.h.
References m_checkable.
Referenced by setCheckable().
|
inline |
Definition at line 147 of file btbookshelftreemodel.h.
References m_checkedModulesCache.
Referenced by BtBookshelfWorksPage::checkedModules(), and BtSearchModuleChooserDialog::checkedModules().
|
override |
Definition at line 103 of file btbookshelftreemodel.cpp.
References parent().
Referenced by resetData().
QVariant BtBookshelfTreeModel::data | ( | CSwordModuleInfo & | module, |
int | role = Qt::DisplayRole |
||
) | const |
Definition at line 180 of file btbookshelftreemodel.cpp.
References BT_ASSERT, m_sourceIndexMap, m_sourceModel, and module().
|
override |
Definition at line 142 of file btbookshelftreemodel.cpp.
References BT_ASSERT, BookshelfModel::Item::checkState(), CheckStateRole, BookshelfModel::Item::data(), data(), index(), BookshelfModel::Item::ITEM_MODULE, m_checkable, BtBookshelfModel::ModuleHiddenRole, BookshelfModel::ModuleItem::moduleInfo(), BtBookshelfModel::ModulePointerRole, and BookshelfModel::Item::type().
Referenced by BookshelfModel::ModuleItem::data(), BtInstallPageModel::data(), data(), module(), moduleDataChanged(), moduleInserted(), and moduleRemoved().
|
inline |
Definition at line 145 of file btbookshelftreemodel.h.
References m_defaultChecked.
|
override |
Definition at line 243 of file btbookshelftreemodel.cpp.
References index(), BookshelfModel::Item::ITEM_MODULE, m_checkable, and BookshelfModel::Item::type().
|
inlineprivate |
Definition at line 186 of file btbookshelftreemodel.h.
References getGroup(), getItem(), index(), module(), and T.
Referenced by addModule(), BtInstallPageModel::columnCount(), BtInstallPageModel::data(), getGroup(), getIndex(), BtInstallPageModel::headerData(), moduleDataChanged(), moduleInserted(), moduleRemoved(), removeModule(), resetParentCheckStates(), and setDefaultChecked().
|
private |
Definition at line 483 of file btbookshelftreemodel.cpp.
References BookshelfModel::Item::childIndex(), getGroup(), and index().
Referenced by moduleDataChanged(), removeModule(), and setCheckedModules().
Definition at line 474 of file btbookshelftreemodel.cpp.
References BT_ASSERT, index(), m_rootItem, and UNLIKELY.
Referenced by addModule(), getGroup(), hasChildren(), index(), and rowCount().
Definition at line 143 of file btbookshelftreemodel.h.
References m_groupingOrder.
Referenced by BtBookshelfDockWidget::groupingOrder(), BtOpenWorkActionMenu::postBuildMenu(), setGroupingOrder(), and BtBookshelfWidget::setTreeModel().
|
signal |
|
override |
Definition at line 109 of file btbookshelftreemodel.cpp.
References BookshelfModel::Item::children(), getItem(), and parent().
|
override |
Definition at line 260 of file btbookshelftreemodel.cpp.
References m_sourceModel.
|
override |
Definition at line 113 of file btbookshelftreemodel.cpp.
References BookshelfModel::Item::children(), getItem(), and parent().
Referenced by BtInstallPageModel::data(), data(), anonymous_namespace{btmodulechoosermenu.cpp}::SortModel::filterAcceptsRowNoHiddenCheck(), flags(), getGroup(), getIndex(), getItem(), module(), parent(), removeModule(), resetData(), and setData().
|
inline |
Definition at line 135 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 547 of file btbookshelftreemodel.cpp.
References BT_ASSERT, data(), getGroup(), getIndex(), m_modules, m_sourceModel, module(), and BtBookshelfModel::ModulePointerRole.
Referenced by setSourceModel().
|
protectedslot |
Definition at line 576 of file btbookshelftreemodel.cpp.
References addModule(), BT_ASSERT, CHECKED, data(), getGroup(), 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 604 of file btbookshelftreemodel.cpp.
References BT_ASSERT, data(), getGroup(), m_sourceIndexMap, m_sourceModel, module(), BtBookshelfModel::ModulePointerRole, parent(), and removeModule().
Referenced by setSourceModel().
|
inline |
Definition at line 146 of file btbookshelftreemodel.h.
References m_modules.
Referenced by setCheckedModules().
|
override |
Definition at line 126 of file btbookshelftreemodel.cpp.
References BT_ASSERT, BookshelfModel::Item::childIndex(), index(), m_rootItem, and BookshelfModel::Item::parent().
Referenced by BtInstallPageModel::columnCount(), columnCount(), hasChildren(), index(), moduleInserted(), moduleRemoved(), resetData(), and rowCount().
|
private |
Definition at line 444 of file btbookshelftreemodel.cpp.
References BT_ASSERT, getGroup(), getIndex(), index(), m_checkedModulesCache, m_modules, m_rootItem, module(), and resetParentCheckStates().
Referenced by moduleRemoved().
|
protected |
Definition at line 377 of file btbookshelftreemodel.cpp.
References columnCount(), index(), parent(), and rowCount().
Referenced by setCheckable().
|
private |
Definition at line 500 of file btbookshelftreemodel.cpp.
References BT_ASSERT, BookshelfModel::Item::checkState(), and getGroup().
Referenced by addModule(), removeModule(), and setData().
|
override |
Definition at line 99 of file btbookshelftreemodel.cpp.
References BookshelfModel::Item::children(), getItem(), and parent().
Referenced by resetData().
|
slot |
Definition at line 356 of file btbookshelftreemodel.cpp.
References checkable(), m_checkable, m_sourceModel, and resetData().
Referenced by BtInstallPageModel::BtInstallPageModel().
|
slot |
Definition at line 367 of file btbookshelftreemodel.cpp.
References getIndex(), m_modules, modules(), and setData().
Referenced by BtSearchModuleChooserDialog::setCheckedModules().
|
override |
Definition at line 185 of file btbookshelftreemodel.cpp.
References BT_ASSERT, BookshelfModel::Item::checkState(), BookshelfModel::Item::children(), index(), BookshelfModel::Item::ITEM_MODULE, m_checkedModulesCache, moduleChecked(), BookshelfModel::ModuleItem::moduleInfo(), resetParentCheckStates(), BookshelfModel::Item::setCheckState(), BookshelfModel::Item::type(), and UNLIKELY.
Referenced by setCheckedModules().
|
inlineslot |
Definition at line 157 of file btbookshelftreemodel.h.
References getGroup(), and m_defaultChecked.
Referenced by BtBookshelfWorksPage::BtBookshelfWorksPage(), and BtInstallPageModel::BtInstallPageModel().
|
slot |
Definition at line 325 of file btbookshelftreemodel.cpp.
References addModule(), BtModuleSet::contains(), groupingOrder(), groupingOrderChanged(), m_checkedModulesCache, m_groupingOrder, m_modules, m_rootItem, m_sourceIndexMap, m_sourceModel, and module().
Referenced by BtBookshelfWidget::initMenus(), BtOpenWorkActionMenu::postBuildMenu(), and BtBookshelfWorksPage::slotGroupingActionTriggered().
|
slot |
Definition at line 270 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(), moduleRemoved(), and sourceModel().
Referenced by BtBookshelfWorksPage::BtBookshelfWorksPage(), BtBookshelfWidget::setSourceModel(), BtOpenWorkActionMenu::setSourceModel(), and BtBookshelfWidget::setTreeModel().
|
inlinenoexcept |
Definition at line 140 of file btbookshelftreemodel.h.
References m_sourceModel.
Referenced by setSourceModel(), and BtOpenWorkActionMenu::sourceModel().
|
private |
Definition at line 214 of file btbookshelftreemodel.h.
Referenced by checkable(), data(), flags(), and setCheckable().
|
private |
Definition at line 216 of file btbookshelftreemodel.h.
Referenced by addModule(), checkedModules(), removeModule(), setData(), setGroupingOrder(), and setSourceModel().
|
private |
Definition at line 213 of file btbookshelftreemodel.h.
Referenced by defaultChecked(), moduleInserted(), setDefaultChecked(), and setSourceModel().
|
private |
Definition at line 212 of file btbookshelftreemodel.h.
Referenced by addModule(), groupingOrder(), and setGroupingOrder().
|
private |
Definition at line 210 of file btbookshelftreemodel.h.
Referenced by addModule(), moduleDataChanged(), modules(), removeModule(), setCheckedModules(), setGroupingOrder(), and setSourceModel().
|
private |
Definition at line 209 of file btbookshelftreemodel.h.
Referenced by getItem(), parent(), removeModule(), setGroupingOrder(), and setSourceModel().
|
private |
Definition at line 211 of file btbookshelftreemodel.h.
Referenced by data(), moduleInserted(), moduleRemoved(), setGroupingOrder(), and setSourceModel().
|
private |
Definition at line 208 of file btbookshelftreemodel.h.
Referenced by data(), headerData(), moduleDataChanged(), moduleInserted(), moduleRemoved(), setCheckable(), setGroupingOrder(), setSourceModel(), and sourceModel().