15#include <QAbstractItemModel>
17#include <initializer_list>
23#include <QPersistentModelIndex>
27#include "../drivers/btconstmoduleset.h"
28#include "../drivers/btmoduleset.h"
87 {
return lhs.list() ==
rhs.list(); }
116 int rowCount(QModelIndex
const &
parent = QModelIndex())
const override;
121 QModelIndex
const &
parent = QModelIndex())
123 QModelIndex
parent(QModelIndex
const &
index)
const override;
127 Qt::ItemFlags
flags(QModelIndex
const &
index)
const override;
130 int role = Qt::DisplayRole)
const override;
155 bool emitSignal =
true);
QDataStream & operator>>(QDataStream &is, BtBookshelfTreeModel::Grouping &o)
QDataStream & operator<<(QDataStream &os, BtBookshelfTreeModel::Grouping const &o)
friend QDataStream & operator>>(QDataStream &is, BtBookshelfTreeModel::Grouping &o)
static Grouping const LANG_CAT
auto const & list() const noexcept
static Grouping const DEFAULT
friend bool operator==(Grouping const &lhs, Grouping const &rhs)
static Grouping const CAT
static Grouping const CAT_LANG
void saveTo(BtConfigCore &config, QString const &key) const
Grouping(Grouping const ©)=default
Grouping & operator=(Grouping const ©)=default
Grouping(std::initializer_list< Group > values)
Grouping(Grouping &©)=default
static Grouping const LANG
Grouping & operator=(Grouping &©)=default
static Grouping const NONE
bool loadFrom(BtConfigCore const &config, QString const &key)
QVariant data(QModelIndex const &index, int role=Qt::DisplayRole) const override
CheckedBehavior m_defaultChecked
QModelIndex index(int row, int column, QModelIndex const &parent=QModelIndex()) const override
std::unique_ptr< BookshelfModel::Item > m_rootItem
void groupingOrderChanged(BtBookshelfTreeModel::Grouping newGrouping)
void removeModule(CSwordModuleInfo &module)
BtModuleSet m_checkedModulesCache
void setDefaultChecked(CheckedBehavior const b)
QModelIndex parent(QModelIndex const &index) const override
std::shared_ptr< QAbstractItemModel > m_sourceModel
BookshelfModel::Item & getItem(QModelIndex const &index) const
BtModuleSet const & checkedModules() const
QModelIndex getIndex(BookshelfModel::Item const &item)
void setCheckable(bool checkable)
void setCheckedModules(BtConstModuleSet const &modules)
void setGroupingOrder(BtBookshelfTreeModel::Grouping const &groupingOrder, bool emitSignal=true)
CSwordModuleInfo * module(QModelIndex const &index) const
bool setData(QModelIndex const &index, QVariant const &value, int role) override
QMap< CSwordModuleInfo *, QPersistentModelIndex > SourceIndexMap
QList< CSwordModuleInfo * > modules() const
int columnCount(QModelIndex const &parent=QModelIndex()) const override
~BtBookshelfTreeModel() override
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
SourceIndexMap m_sourceIndexMap
CheckedBehavior defaultChecked() const
void resetParentCheckStates(QModelIndex parentIndex, bool inReset)
QModelIndex getGroup(CSwordModuleInfo const &module, QModelIndex const parentIndex, bool &beginInsert)
Qt::ItemFlags flags(QModelIndex const &index) const override
Grouping const & groupingOrder() const
bool hasChildren(QModelIndex const &parent=QModelIndex()) const override
std::shared_ptr< QAbstractItemModel > sourceModel() const noexcept
void setSourceModel(std::shared_ptr< QAbstractItemModel > sourceModel)
int rowCount(QModelIndex const &parent=QModelIndex()) const override
void moduleDataChanged(QModelIndex const &topLeft, QModelIndex const &bottomRight)
QMap< CSwordModuleInfo *, BookshelfModel::ModuleItem * > ModuleItemMap
void addModule(CSwordModuleInfo &module, bool checked, bool inReset)
void moduleRemoved(QModelIndex const &parent, int start, int end)
void moduleInserted(QModelIndex const &parent, int start, int end)
void moduleChecked(CSwordModuleInfo *module, bool checked)