15 #include <QAbstractItemModel>
19 #include "../backend/bookshelfmodel/btbookshelffiltermodel.h"
20 #include "../backend/bookshelfmodel/btbookshelfmodel.h"
21 #include "../backend/bookshelfmodel/btbookshelftreemodel.h"
22 #include "../backend/config/btconfigcore.h"
23 #include "../backend/managers/cswordbackend.h"
24 #include "../util/btconnect.h"
25 #include "../util/cresmgr.h"
30 QString groupingConfigKey,
33 , m_treeModel(nullptr)
34 , m_postFilterModel(nullptr)
35 , m_groupingMenu(nullptr)
36 , m_groupingConfigGroup(std::move(groupingConfigGroup))
37 , m_groupingConfigKey(std::move(groupingConfigKey))
48 [
this](QModelIndex
const & index) {
49 static constexpr
auto const MPR =
53 model()->data(index, MPR).value<void *>()))
59 std::shared_ptr<QAbstractItemModel> model)
66 m_groupingMenu->setStatusTip(tr(
"Sets the grouping order for the items in "
87 QString groupingConfigKey,
92 std::move(groupingConfigKey));
96 setIcon(CResMgr::mainWindow::icon_openAction());
99 auto slotModelChanged =
107 BT_CONNECT(filterModel, &BtBookshelfFilterModel::layoutChanged,
109 BT_CONNECT(filterModel, &BtBookshelfFilterModel::modelReset,
111 BT_CONNECT(filterModel, &BtBookshelfFilterModel::rowsInserted,
113 BT_CONNECT(filterModel, &BtBookshelfFilterModel::rowsRemoved,
114 std::move(slotModelChanged));
122 setText(tr(
"&Open work"));
void saveTo(BtConfigCore &config, QString const &key) const
void setGroupingOrder(const BtBookshelfTreeModel::Grouping &groupingOrder, bool emitSignal=true)
void setSourceModel(std::shared_ptr< QAbstractItemModel > sourceModel)
void triggered(CSwordModuleInfo *module)
BtOpenWorkActionMenu * m_menu
BtOpenWorkAction(BtConfigCore groupingConfigGroup, QString groupingConfigKey, QObject *parent=nullptr)
~BtOpenWorkAction() override
static CSwordBackend & instance() noexcept