16 #include <QHBoxLayout>
19 #include <QPushButton>
20 #include <QSizePolicy>
21 #include <QSpacerItem>
22 #include <QStringList>
23 #include <QTreeWidget>
24 #include <QTreeWidgetItem>
25 #include <QVBoxLayout>
26 #include "../../backend/config/btconfig.h"
27 #include "../../backend/drivers/cswordmoduleinfo.h"
28 #include "../../backend/managers/cswordbackend.h"
29 #include "../../util/btconnect.h"
30 #include "../../util/cresmgr.h"
31 #include "../../util/tool.h"
32 #include "../btmoduleindexdialog.h"
38 setWindowIcon(CResMgr::searchdialog::icon());
40 auto vboxLayout =
new QVBoxLayout(
this);
41 auto hboxLayout =
new QHBoxLayout();
50 new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);
51 hboxLayout->addItem(spacerItem);
54 m_deleteButton->setIcon(CResMgr::bookshelfmgr::indexpage::icon_delete());
58 m_createButton->setIcon(CResMgr::bookshelfmgr::indexpage::icon_create());
65 vboxLayout->addLayout(hboxLayout);
75 "settings/behaviour/autoDeleteOrphanedIndices"),
84 this, &BtIndexDialog::close);
102 | Qt::ItemIsAutoTristate);
109 | Qt::ItemIsAutoTristate);
113 if (modulePtr->hasIndex()) {
115 item->setText(0, modulePtr->name());
116 item->setText(1, tr(
"%1 KiB").arg(modulePtr->indexSize() / 1024));
117 item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
118 item->setCheckState(0, Qt::Unchecked);
121 item->setText(0, modulePtr->name());
122 item->setText(1, tr(
"0 KiB"));
123 item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
124 item->setCheckState(0, Qt::Checked);
130 setWindowTitle(tr(
"Manage Search Indexes"));
133 tr(
"If selected, those indexes which have no corresponding "
134 "work will be deleted when BibleTime starts"));
136 tr(
"Automatically delete orphaned indexes when BibleTime "
144 m_createButton->setToolTip(tr(
"Create new indexes for the selected works"));
147 m_moduleList->setHeaderLabels(QStringList(tr(
"Work")) << tr(
"Index size"));
154 QStringLiteral(
"settings/behaviour/autoDeleteOrphanedIndices"),
155 newState == Qt::Checked);
165 if (
auto * module =
backend.findModuleByName(
167 moduleList.append(module);
171 if (!moduleList.isEmpty()) {
179 bool indicesDeleted =
false;
184 if (
auto * module =
backend.findModuleByName(
187 module->deleteIndex();
188 indicesDeleted =
true;
BtConfig & btConfig()
This is a shortchand for BtConfig::getInstance().
void setValue(QString const &key, T const &value)
Sets a value for a key.
QCheckBox * m_autoDeleteOrphanedIndicesBox
QPushButton * m_closeButton
QPushButton * m_createButton
QTreeWidget * m_moduleList
void slotSwordSetupChanged()
void autoDeleteOrphanedIndicesChanged(int newState)
void populateModuleList()
QPushButton * m_deleteButton
QTreeWidgetItem * m_modsWithoutIndices
QTreeWidgetItem * m_modsWithIndices
BtIndexDialog(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
static bool indexAllModules(QList< CSwordModuleInfo * > const &modules)
static CSwordBackend & instance() noexcept
void sigSwordSetupChanged()
std::unique_ptr< CSwordBackend > backend(sword::InstallSource const &is)