16 #include <QApplication>
18 #include "../backend/drivers/cswordmoduleinfo.h"
19 #include "../util/btassert.h"
20 #include "../util/btconnect.h"
21 #include "../util/btdebugonly.h"
27 if (modules.empty())
return true;
37 numModules * 100, nullptr),
38 m_currentModuleIndex(0)
40 setWindowTitle(tr(
"Creating indices"));
49 for (
auto *
const m : modules) {
56 indexedModules.append(m);
58 std::array<QMetaObject::Connection, 3u> connections{
59 BT_CONNECT(
this, &BtModuleIndexDialog::canceled,
60 m , [m]{ m->cancelIndexing(); }),
65 qApp->processEvents();
69 [
this](
int percentage) {
71 qApp->processEvents();
75 setLabelText(tr(
"Creating index for work: %1").arg(m->name()));
83 }
catch (std::exception
const & e) {
86 msg = tr(
"<UNKNOWN EXCEPTION>");
90 tr(
"Indexing aborted"),
91 tr(
"An internal error occurred while building "
92 "the index:<br/><br/>%1").arg(msg));
98 for (
auto & connection : connections) {
103 if (wasCanceled()) success =
false;
110 for (
auto *
const m : indexedModules)
#define BT_DEBUG_ONLY(...)
BtModuleIndexDialog(int numModules)
bool indexAllModulesPrivate(QList< CSwordModuleInfo * > const &modules)
static bool indexAllModules(QList< CSwordModuleInfo * > const &modules)
void indexingProgress(int)
QStringList r(content.left(bodyIndex))
QMessageBox::StandardButton showWarning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)