16 #include <QApplication>
18 #include <QHBoxLayout>
19 #include <QStringList>
21 #include <QTreeWidgetItemIterator>
22 #include <QTreeWidget>
23 #include <QTreeWidgetItem>
24 #include "../../backend/config/btconfig.h"
25 #include "../../backend/drivers/btmodulelist.h"
26 #include "../../backend/drivers/cswordbookmoduleinfo.h"
27 #include "../../backend/drivers/cswordmoduleinfo.h"
28 #include "../../backend/keys/cswordkey.h"
29 #include "../../backend/keys/cswordtreekey.h"
30 #include "../../util/btconnect.h"
43 if (!modules.count()) {
51 QHBoxLayout* layout =
new QHBoxLayout(
this);
52 layout->setSpacing(0);
53 layout->setContentsMargins(0, 0, 0, 0);
67 if (
m_key != newKey ) {
73 QTreeWidgetItem* matching_item =
m_treeView->topLevelItem(0);
77 if ((*it)->text(1) ==
key) {
78 matching_item = (*it);
95 for (
auto const *
const m : modules) {
96 const CSBMI *book =
dynamic_cast<const CSBMI*
>(m);
97 if (book !=
nullptr) {
149 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
152 QApplication::restoreOverrideCursor();
172 if (
key->hasChildren()) {
173 key->positionToFirstChild();
176 columns <<
key->getLocalNameUnicode() <<
key->
key();
178 i->setData(0, Qt::ToolTipRole,
key->getLocalNameUnicode());
179 auto const offset =
key->offset();
181 key->setOffset(offset);
183 while (
key->positionToNextSibling());
BtConfig & btConfig()
This is a shortchand for BtConfig::getInstance().
QList< CSwordModuleInfo const * > BtConstModuleList
QList< CSwordBookModuleInfo const * > m_modules
void updateKey(CSwordKey *) final override
void setKey(CSwordKey *key) final override
void showEvent(QShowEvent *const showEvent) override
void addKeyChildren(CSwordTreeKey *key, QTreeWidgetItem *item)
void setupTree()
Creates the first level of the tree structure.
CSwordKey * key() final override
CBookTreeChooser(BtConstModuleList const &modules, CSwordKey *key=nullptr, QWidget *parent=nullptr)
void setModules(BtConstModuleList const &modules, bool refresh=true) final override
void itemActivated(QTreeWidgetItem *item)
void refreshContent() final override
void keyChanged(CSwordKey *newKey)
Class for generic book support.
virtual QString key() const =0
CSwordKey implementation for Sword's TreeKey.
QString key() const final override
bool setKey(const QString &key) final override
void setOffset(Offset value)